Server

<back to all web services

PostDirektkosten

Direktkosten
Requires Authentication
The following routes are available for this service:
POST/api/v1/direktkosten
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class PostDirektkostenResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null,
        /** @var string|null */
        public ?string $checksumMD5=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
        if (isset($o['checksumMD5'])) $this->checksumMD5 = $o['checksumMD5'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        if (isset($this->checksumMD5)) $o['checksumMD5'] = $this->checksumMD5;
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class BillingInformation implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var string|null */
        public ?string $guid=null,

        // @DataMember
        /** @var DateTime */
        public DateTime $from=new DateTime(),

        // @DataMember
        /** @var DateTime */
        public DateTime $to=new DateTime(),

        // @DataMember
        /** @var bool|null */
        public ?bool $isCompleted=null,

        // @DataMember
        /** @var bool|null */
        public ?bool $hasNebenkosten=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['guid'])) $this->guid = $o['guid'];
        if (isset($o['from'])) $this->from = JsonConverters::from('DateTime', $o['from']);
        if (isset($o['to'])) $this->to = JsonConverters::from('DateTime', $o['to']);
        if (isset($o['isCompleted'])) $this->isCompleted = $o['isCompleted'];
        if (isset($o['hasNebenkosten'])) $this->hasNebenkosten = $o['hasNebenkosten'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->guid)) $o['guid'] = $this->guid;
        if (isset($this->from)) $o['from'] = JsonConverters::to('DateTime', $this->from);
        if (isset($this->to)) $o['to'] = JsonConverters::to('DateTime', $this->to);
        if (isset($this->isCompleted)) $o['isCompleted'] = $this->isCompleted;
        if (isset($this->hasNebenkosten)) $o['hasNebenkosten'] = $this->hasNebenkosten;
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class Direktkosten implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var string */
        public string $guid='',

        // @DataMember
        /** @var string|null */
        public ?string $label=null,

        // @DataMember
        /** @var DateTime */
        public DateTime $date=new DateTime(),

        // @DataMember
        /** @var float */
        public float $brutto=0.0,

        // @DataMember
        /** @var float */
        public float $salesTax=0.0,

        // @DataMember
        /** @var float */
        public float $quantity=0.0,

        // @DataMember
        /** @var string|null */
        public ?string $type=null,

        // @DataMember
        /** @var bool|null */
        public ?bool $isDeleted=null,

        // @DataMember
        /** @var bool|null */
        public ?bool $isCreatedByApp=null,

        // @DataMember
        /** @var string */
        public string $nutzerGuid='',

        // @DataMember
        /** @var BillingInformation|null */
        public ?BillingInformation $billingInformation=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['guid'])) $this->guid = $o['guid'];
        if (isset($o['label'])) $this->label = $o['label'];
        if (isset($o['date'])) $this->date = JsonConverters::from('DateTime', $o['date']);
        if (isset($o['brutto'])) $this->brutto = $o['brutto'];
        if (isset($o['salesTax'])) $this->salesTax = $o['salesTax'];
        if (isset($o['quantity'])) $this->quantity = $o['quantity'];
        if (isset($o['type'])) $this->type = $o['type'];
        if (isset($o['isDeleted'])) $this->isDeleted = $o['isDeleted'];
        if (isset($o['isCreatedByApp'])) $this->isCreatedByApp = $o['isCreatedByApp'];
        if (isset($o['nutzerGuid'])) $this->nutzerGuid = $o['nutzerGuid'];
        if (isset($o['billingInformation'])) $this->billingInformation = JsonConverters::from('BillingInformation', $o['billingInformation']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->guid)) $o['guid'] = $this->guid;
        if (isset($this->label)) $o['label'] = $this->label;
        if (isset($this->date)) $o['date'] = JsonConverters::to('DateTime', $this->date);
        if (isset($this->brutto)) $o['brutto'] = $this->brutto;
        if (isset($this->salesTax)) $o['salesTax'] = $this->salesTax;
        if (isset($this->quantity)) $o['quantity'] = $this->quantity;
        if (isset($this->type)) $o['type'] = $this->type;
        if (isset($this->isDeleted)) $o['isDeleted'] = $this->isDeleted;
        if (isset($this->isCreatedByApp)) $o['isCreatedByApp'] = $this->isCreatedByApp;
        if (isset($this->nutzerGuid)) $o['nutzerGuid'] = $this->nutzerGuid;
        if (isset($this->billingInformation)) $o['billingInformation'] = JsonConverters::to('BillingInformation', $this->billingInformation);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class RelatedTo implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var string */
        public string $guid=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['guid'])) $this->guid = $o['guid'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->guid)) $o['guid'] = $this->guid;
        return empty($o) ? new class(){} : $o;
    }
}

class PostDirektkosten implements IHasBearerToken, JsonSerializable
{
    public function __construct(
        // @ApiMember(IsRequired=true, ParameterType="body")
        /** @var Direktkosten|null */
        public ?Direktkosten $direktkosten=null,

        // @ApiMember(IsRequired=true, ParameterType="body")
        /** @var RelatedTo|null */
        public ?RelatedTo $relatedToObjekt=null,

        // @ApiMember(IsRequired=true, ParameterType="body")
        /** @var RelatedTo|null */
        public ?RelatedTo $relatedToBillingInformation=null,

        // @ApiMember(IsRequired=true, ParameterType="body")
        /** @var RelatedTo|null */
        public ?RelatedTo $relatedToNutzer=null,

        // @ApiMember(IsRequired=true, ParameterType="body")
        /** @var string */
        public string $bearerToken=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['direktkosten'])) $this->direktkosten = JsonConverters::from('Direktkosten', $o['direktkosten']);
        if (isset($o['relatedToObjekt'])) $this->relatedToObjekt = JsonConverters::from('RelatedTo', $o['relatedToObjekt']);
        if (isset($o['relatedToBillingInformation'])) $this->relatedToBillingInformation = JsonConverters::from('RelatedTo', $o['relatedToBillingInformation']);
        if (isset($o['relatedToNutzer'])) $this->relatedToNutzer = JsonConverters::from('RelatedTo', $o['relatedToNutzer']);
        if (isset($o['bearerToken'])) $this->bearerToken = $o['bearerToken'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->direktkosten)) $o['direktkosten'] = JsonConverters::to('Direktkosten', $this->direktkosten);
        if (isset($this->relatedToObjekt)) $o['relatedToObjekt'] = JsonConverters::to('RelatedTo', $this->relatedToObjekt);
        if (isset($this->relatedToBillingInformation)) $o['relatedToBillingInformation'] = JsonConverters::to('RelatedTo', $this->relatedToBillingInformation);
        if (isset($this->relatedToNutzer)) $o['relatedToNutzer'] = JsonConverters::to('RelatedTo', $this->relatedToNutzer);
        if (isset($this->bearerToken)) $o['bearerToken'] = $this->bearerToken;
        return empty($o) ? new class(){} : $o;
    }
}

PHP PostDirektkosten DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/v1/direktkosten HTTP/1.1 
Host: stage-servdesk.eras-online.de 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"direktkosten":{"guid":"00000000000000000000000000000000","label":"String","date":"0001-01-01T00:00:00.0000000Z","brutto":0,"salesTax":0,"quantity":0,"type":"String","isDeleted":false,"isCreatedByApp":false,"nutzerGuid":"00000000000000000000000000000000","billingInformation":{"guid":"String","from":"0001-01-01T00:00:00.0000000Z","to":"0001-01-01T00:00:00.0000000Z","isCompleted":false,"hasNebenkosten":false}},"relatedToObjekt":{"guid":"00000000000000000000000000000000"},"relatedToBillingInformation":{"guid":"00000000000000000000000000000000"},"relatedToNutzer":{"guid":"00000000000000000000000000000000"},"bearerToken":"String"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"checksumMD5":"String"}