| POST | /api/v1/nebenkosten |
|---|
<?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 PostNebenkostenResponse 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;
}
}
enum NebenkostenTargetAllocation : string
{
case Null = 'Null';
case AlleNutzer = 'AlleNutzer';
case ZugeordneteNutzer = 'ZugeordneteNutzer';
case ZugeordneteNutzeinheiten = 'ZugeordneteNutzeinheiten';
case ZugeordneteNutzerDiff = 'ZugeordneteNutzerDiff';
case ZugeordneteNutzeinheitenDiff = 'ZugeordneteNutzeinheitenDiff';
}
enum NebenkostenTargetAllocationIn : string
{
case Nebenkosten = 'Nebenkosten';
case Heizkosten = 'Heizkosten';
case Warmwasserkosten = 'Warmwasserkosten';
}
// @DataContract
class NebenkostenNutzeinheit implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var float|null */
public ?float $relativeAmount=null,
// @DataMember
/** @var bool|null */
public ?bool $isDeleted=null,
// @DataMember
/** @var bool|null */
public ?bool $isCreatedByApp=null,
// @DataMember
/** @var string */
public string $nutzeinheitGuid=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['relativeAmount'])) $this->relativeAmount = $o['relativeAmount'];
if (isset($o['isDeleted'])) $this->isDeleted = $o['isDeleted'];
if (isset($o['isCreatedByApp'])) $this->isCreatedByApp = $o['isCreatedByApp'];
if (isset($o['nutzeinheitGuid'])) $this->nutzeinheitGuid = $o['nutzeinheitGuid'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->relativeAmount)) $o['relativeAmount'] = $this->relativeAmount;
if (isset($this->isDeleted)) $o['isDeleted'] = $this->isDeleted;
if (isset($this->isCreatedByApp)) $o['isCreatedByApp'] = $this->isCreatedByApp;
if (isset($this->nutzeinheitGuid)) $o['nutzeinheitGuid'] = $this->nutzeinheitGuid;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class NebenkostenNutzer implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var float|null */
public ?float $relativeAmount=null,
// @DataMember
/** @var bool|null */
public ?bool $isDeleted=null,
// @DataMember
/** @var bool|null */
public ?bool $isCreatedByApp=null,
// @DataMember
/** @var string */
public string $nutzerGuid=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['relativeAmount'])) $this->relativeAmount = $o['relativeAmount'];
if (isset($o['isDeleted'])) $this->isDeleted = $o['isDeleted'];
if (isset($o['isCreatedByApp'])) $this->isCreatedByApp = $o['isCreatedByApp'];
if (isset($o['nutzerGuid'])) $this->nutzerGuid = $o['nutzerGuid'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->relativeAmount)) $o['relativeAmount'] = $this->relativeAmount;
if (isset($this->isDeleted)) $o['isDeleted'] = $this->isDeleted;
if (isset($this->isCreatedByApp)) $o['isCreatedByApp'] = $this->isCreatedByApp;
if (isset($this->nutzerGuid)) $o['nutzerGuid'] = $this->nutzerGuid;
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 Nebenkosten implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var string */
public string $guid='',
// @DataMember
/** @var int */
public int $number=0,
// @DataMember
/** @var DateTime */
public DateTime $from=new DateTime(),
// @DataMember
/** @var DateTime */
public DateTime $to=new DateTime(),
// @DataMember
/** @var NebenkostenTargetAllocation|null */
public ?NebenkostenTargetAllocation $targetAllocation=null,
// @DataMember
/** @var NebenkostenTargetAllocationIn|null */
public ?NebenkostenTargetAllocationIn $targetAllocationIn=null,
// @DataMember
/** @var string|null */
public ?string $nebenkostenKind=null,
/** @description Freitext */
// @DataMember
// @ApiMember(Description="Freitext")
/** @var string|null */
public ?string $kostenart=null,
// @DataMember
/** @var float|null */
public ?float $brutto=null,
// @DataMember
/** @var float|null */
public ?float $bruttoLastYear=null,
// @DataMember
/** @var float|null */
public ?float $salesTax=null,
// @DataMember
/** @var string|null */
public ?string $haushaltsnahediensteLabel=null,
// @DataMember
/** @var float|null */
public ?float $haushaltsnahediensteBrutto=null,
/** @description Freitext */
// @DataMember
// @ApiMember(Description="Freitext")
/** @var string|null */
public ?string $kostenartUnit=null,
// @DataMember
/** @var string|null */
public ?string $reduzierungsartType=null,
// @DataMember
/** @var string|null */
public ?string $comment=null,
// @DataMember
/** @var bool|null */
public ?bool $isDeleted=null,
// @DataMember
/** @var bool|null */
public ?bool $isCreatedByApp=null,
// @DataMember
/** @var array<NebenkostenNutzeinheit>|null */
public ?array $nebenkostenNutzeinheiten=null,
// @DataMember
/** @var array<NebenkostenNutzer>|null */
public ?array $nebenkostenNutzer=null,
// @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['number'])) $this->number = $o['number'];
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['targetAllocation'])) $this->targetAllocation = JsonConverters::from('NebenkostenTargetAllocation', $o['targetAllocation']);
if (isset($o['targetAllocationIn'])) $this->targetAllocationIn = JsonConverters::from('NebenkostenTargetAllocationIn', $o['targetAllocationIn']);
if (isset($o['nebenkostenKind'])) $this->nebenkostenKind = $o['nebenkostenKind'];
if (isset($o['kostenart'])) $this->kostenart = $o['kostenart'];
if (isset($o['brutto'])) $this->brutto = $o['brutto'];
if (isset($o['bruttoLastYear'])) $this->bruttoLastYear = $o['bruttoLastYear'];
if (isset($o['salesTax'])) $this->salesTax = $o['salesTax'];
if (isset($o['haushaltsnahediensteLabel'])) $this->haushaltsnahediensteLabel = $o['haushaltsnahediensteLabel'];
if (isset($o['haushaltsnahediensteBrutto'])) $this->haushaltsnahediensteBrutto = $o['haushaltsnahediensteBrutto'];
if (isset($o['kostenartUnit'])) $this->kostenartUnit = $o['kostenartUnit'];
if (isset($o['reduzierungsartType'])) $this->reduzierungsartType = $o['reduzierungsartType'];
if (isset($o['comment'])) $this->comment = $o['comment'];
if (isset($o['isDeleted'])) $this->isDeleted = $o['isDeleted'];
if (isset($o['isCreatedByApp'])) $this->isCreatedByApp = $o['isCreatedByApp'];
if (isset($o['nebenkostenNutzeinheiten'])) $this->nebenkostenNutzeinheiten = JsonConverters::fromArray('NebenkostenNutzeinheit', $o['nebenkostenNutzeinheiten']);
if (isset($o['nebenkostenNutzer'])) $this->nebenkostenNutzer = JsonConverters::fromArray('NebenkostenNutzer', $o['nebenkostenNutzer']);
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->number)) $o['number'] = $this->number;
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->targetAllocation)) $o['targetAllocation'] = JsonConverters::to('NebenkostenTargetAllocation', $this->targetAllocation);
if (isset($this->targetAllocationIn)) $o['targetAllocationIn'] = JsonConverters::to('NebenkostenTargetAllocationIn', $this->targetAllocationIn);
if (isset($this->nebenkostenKind)) $o['nebenkostenKind'] = $this->nebenkostenKind;
if (isset($this->kostenart)) $o['kostenart'] = $this->kostenart;
if (isset($this->brutto)) $o['brutto'] = $this->brutto;
if (isset($this->bruttoLastYear)) $o['bruttoLastYear'] = $this->bruttoLastYear;
if (isset($this->salesTax)) $o['salesTax'] = $this->salesTax;
if (isset($this->haushaltsnahediensteLabel)) $o['haushaltsnahediensteLabel'] = $this->haushaltsnahediensteLabel;
if (isset($this->haushaltsnahediensteBrutto)) $o['haushaltsnahediensteBrutto'] = $this->haushaltsnahediensteBrutto;
if (isset($this->kostenartUnit)) $o['kostenartUnit'] = $this->kostenartUnit;
if (isset($this->reduzierungsartType)) $o['reduzierungsartType'] = $this->reduzierungsartType;
if (isset($this->comment)) $o['comment'] = $this->comment;
if (isset($this->isDeleted)) $o['isDeleted'] = $this->isDeleted;
if (isset($this->isCreatedByApp)) $o['isCreatedByApp'] = $this->isCreatedByApp;
if (isset($this->nebenkostenNutzeinheiten)) $o['nebenkostenNutzeinheiten'] = JsonConverters::toArray('NebenkostenNutzeinheit', $this->nebenkostenNutzeinheiten);
if (isset($this->nebenkostenNutzer)) $o['nebenkostenNutzer'] = JsonConverters::toArray('NebenkostenNutzer', $this->nebenkostenNutzer);
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 PostNebenkosten implements IHasBearerToken, JsonSerializable
{
public function __construct(
// @ApiMember(IsRequired=true, ParameterType="body")
/** @var Nebenkosten|null */
public ?Nebenkosten $nebenkosten=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 string */
public string $bearerToken=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['nebenkosten'])) $this->nebenkosten = JsonConverters::from('Nebenkosten', $o['nebenkosten']);
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['bearerToken'])) $this->bearerToken = $o['bearerToken'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->nebenkosten)) $o['nebenkosten'] = JsonConverters::to('Nebenkosten', $this->nebenkosten);
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->bearerToken)) $o['bearerToken'] = $this->bearerToken;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/v1/nebenkosten HTTP/1.1
Host: isp-plauen-servdesk.eras-online.de
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
nebenkosten:
{
guid: 00000000000000000000000000000000,
number: 0,
from: 0001-01-01T00:00:00Z,
to: 0001-01-01T00:00:00Z,
targetAllocation: Null,
targetAllocationIn: Nebenkosten,
nebenkostenKind: String,
kostenart: String,
brutto: 0,
bruttoLastYear: 0,
salesTax: 0,
haushaltsnahediensteLabel: String,
haushaltsnahediensteBrutto: 0,
kostenartUnit: String,
reduzierungsartType: String,
comment: String,
isDeleted: False,
isCreatedByApp: False,
nebenkostenNutzeinheiten:
[
{
relativeAmount: 0,
isDeleted: False,
isCreatedByApp: False,
nutzeinheitGuid: 00000000000000000000000000000000
}
],
nebenkostenNutzer:
[
{
relativeAmount: 0,
isDeleted: False,
isCreatedByApp: False,
nutzerGuid: 00000000000000000000000000000000
}
],
billingInformation:
{
guid: String,
from: 0001-01-01T00:00:00Z,
to: 0001-01-01T00:00:00Z,
isCompleted: False,
hasNebenkosten: False
}
},
relatedToObjekt:
{
guid: 00000000000000000000000000000000
},
relatedToBillingInformation:
{
guid: 00000000000000000000000000000000
},
bearerToken: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
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
}