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 .xml suffix or ?format=xml

HTTP + XML

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: g-lange-servdesk.eras-online.de 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PostDirektkosten xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eras2Web.Service.Desktop.Server.ServiceModel.Eras2WebExt.Post">
  <BearerToken>String</BearerToken>
  <Direktkosten xmlns:d2p1="http://schemas.datacontract.org/2004/07/Eras2Web.Service.Desktop.Server.ServiceModel.Eras2WebExt.Models">
    <d2p1:BillingInformation>
      <d2p1:From>0001-01-01T00:00:00</d2p1:From>
      <d2p1:Guid>String</d2p1:Guid>
      <d2p1:HasNebenkosten>false</d2p1:HasNebenkosten>
      <d2p1:IsCompleted>false</d2p1:IsCompleted>
      <d2p1:To>0001-01-01T00:00:00</d2p1:To>
    </d2p1:BillingInformation>
    <d2p1:Brutto>0</d2p1:Brutto>
    <d2p1:Date>0001-01-01T00:00:00</d2p1:Date>
    <d2p1:Guid>00000000-0000-0000-0000-000000000000</d2p1:Guid>
    <d2p1:IsCreatedByApp>false</d2p1:IsCreatedByApp>
    <d2p1:IsDeleted>false</d2p1:IsDeleted>
    <d2p1:Label>String</d2p1:Label>
    <d2p1:NutzerGuid>00000000-0000-0000-0000-000000000000</d2p1:NutzerGuid>
    <d2p1:Quantity>0</d2p1:Quantity>
    <d2p1:SalesTax>0</d2p1:SalesTax>
    <d2p1:Type>String</d2p1:Type>
  </Direktkosten>
  <RelatedToBillingInformation xmlns:d2p1="http://schemas.datacontract.org/2004/07/Eras2Web.Service.Desktop.Server.ServiceModel.Eras2WebExt.Models">
    <d2p1:Guid>00000000-0000-0000-0000-000000000000</d2p1:Guid>
  </RelatedToBillingInformation>
  <RelatedToNutzer xmlns:d2p1="http://schemas.datacontract.org/2004/07/Eras2Web.Service.Desktop.Server.ServiceModel.Eras2WebExt.Models">
    <d2p1:Guid>00000000-0000-0000-0000-000000000000</d2p1:Guid>
  </RelatedToNutzer>
  <RelatedToObjekt xmlns:d2p1="http://schemas.datacontract.org/2004/07/Eras2Web.Service.Desktop.Server.ServiceModel.Eras2WebExt.Models">
    <d2p1:Guid>00000000-0000-0000-0000-000000000000</d2p1:Guid>
  </RelatedToObjekt>
</PostDirektkosten>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<PostDirektkostenResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Eras2Web.Service.Desktop.Server.ServiceModel.Eras2WebExt.Post">
  <ChecksumMD5>String</ChecksumMD5>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
</PostDirektkostenResponse>