Trendsic Platform Service

<back to all web services

ResourceRateAppendRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/rates/{Uid}
<?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 ResourceRateComponentDto implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Label=null,
        /** @var float */
        public float $Amount=0.0
    ) {
    }

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

class ResourceRateHistoryRow implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $From=null,
        /** @var float */
        public float $Cost=0.0,
        /** @var float */
        public float $Bill=0.0
    ) {
    }

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

class ResourceRateResource implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Meta=null,
        /** @var string|null */
        public ?string $Unit=null,
        /** @var float */
        public float $CostRate=0.0,
        /** @var float */
        public float $BillRate=0.0,
        /** @var string|null */
        public ?string $EffectiveFrom=null,
        /** @var bool|null */
        public ?bool $HasCard=null,
        /** @var array<ResourceRateComponentDto>|null */
        public ?array $Composition=null,
        /** @var float|null */
        public ?float $PrevailingFloor=null,
        /** @var array<ResourceRateHistoryRow>|null */
        public ?array $History=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Meta'])) $this->Meta = $o['Meta'];
        if (isset($o['Unit'])) $this->Unit = $o['Unit'];
        if (isset($o['CostRate'])) $this->CostRate = $o['CostRate'];
        if (isset($o['BillRate'])) $this->BillRate = $o['BillRate'];
        if (isset($o['EffectiveFrom'])) $this->EffectiveFrom = $o['EffectiveFrom'];
        if (isset($o['HasCard'])) $this->HasCard = $o['HasCard'];
        if (isset($o['Composition'])) $this->Composition = JsonConverters::fromArray('ResourceRateComponentDto', $o['Composition']);
        if (isset($o['PrevailingFloor'])) $this->PrevailingFloor = $o['PrevailingFloor'];
        if (isset($o['History'])) $this->History = JsonConverters::fromArray('ResourceRateHistoryRow', $o['History']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Meta)) $o['Meta'] = $this->Meta;
        if (isset($this->Unit)) $o['Unit'] = $this->Unit;
        if (isset($this->CostRate)) $o['CostRate'] = $this->CostRate;
        if (isset($this->BillRate)) $o['BillRate'] = $this->BillRate;
        if (isset($this->EffectiveFrom)) $o['EffectiveFrom'] = $this->EffectiveFrom;
        if (isset($this->HasCard)) $o['HasCard'] = $this->HasCard;
        if (isset($this->Composition)) $o['Composition'] = JsonConverters::toArray('ResourceRateComponentDto', $this->Composition);
        if (isset($this->PrevailingFloor)) $o['PrevailingFloor'] = $this->PrevailingFloor;
        if (isset($this->History)) $o['History'] = JsonConverters::toArray('ResourceRateHistoryRow', $this->History);
        return empty($o) ? new class(){} : $o;
    }
}

class ResourceRateAppendResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var ResourceRateResource|null */
        public ?ResourceRateResource $Resource=null
    ) {
    }

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

class ResourceRateAppendRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Uid='',
        /** @var float */
        public float $CostRate=0.0,
        /** @var float */
        public float $BillRate=0.0,
        /** @var string|null */
        public ?string $EffectiveFrom=null
    ) {
    }

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

PHP ResourceRateAppendRequest DTOs

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

HTTP + OTHER

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

POST /v1/rates/{Uid} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Uid":"00000000000000000000000000000000","CostRate":0,"BillRate":0,"EffectiveFrom":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Resource":{"Id":"00000000000000000000000000000000","Name":"String","Meta":"String","Unit":"String","CostRate":0,"BillRate":0,"EffectiveFrom":"String","HasCard":false,"Composition":[{"Label":"String","Amount":0}],"PrevailingFloor":0,"History":[{"From":"String","Cost":0,"Bill":0}]}}