Trendsic Platform Service

<back to all web services

CoveragePtoDecideRequest

Requires Authentication
The following routes are available for this service:
POST/v1/coverage/pto/{WorkerTimeOffID}/decide
<?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 CoveragePtoCheck implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $Ok=null,
        /** @var string|null */
        public ?string $Text=null
    ) {
    }

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

class CoveragePlannedItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $WorkerTimeOffID=0,
        /** @var int */
        public int $ContactId=0,
        /** @var string|null */
        public ?string $WorkerName=null,
        /** @var string|null */
        public ?string $Initials=null,
        /** @var string|null */
        public ?string $Dates=null,
        /** @var string|null */
        public ?string $Reason=null,
        /** @var string|null */
        public ?string $Stage=null,
        /** @var string|null */
        public ?string $StageLabel=null,
        /** @var bool|null */
        public ?bool $NeedBook=null,
        /** @var int|null */
        public ?int $CoverageGapId=null,
        /** @var array<CoveragePtoCheck>|null */
        public ?array $Checks=null,
        /** @var string|null */
        public ?string $DenyReason=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['WorkerTimeOffID'])) $this->WorkerTimeOffID = $o['WorkerTimeOffID'];
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['WorkerName'])) $this->WorkerName = $o['WorkerName'];
        if (isset($o['Initials'])) $this->Initials = $o['Initials'];
        if (isset($o['Dates'])) $this->Dates = $o['Dates'];
        if (isset($o['Reason'])) $this->Reason = $o['Reason'];
        if (isset($o['Stage'])) $this->Stage = $o['Stage'];
        if (isset($o['StageLabel'])) $this->StageLabel = $o['StageLabel'];
        if (isset($o['NeedBook'])) $this->NeedBook = $o['NeedBook'];
        if (isset($o['CoverageGapId'])) $this->CoverageGapId = $o['CoverageGapId'];
        if (isset($o['Checks'])) $this->Checks = JsonConverters::fromArray('CoveragePtoCheck', $o['Checks']);
        if (isset($o['DenyReason'])) $this->DenyReason = $o['DenyReason'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->WorkerTimeOffID)) $o['WorkerTimeOffID'] = $this->WorkerTimeOffID;
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->WorkerName)) $o['WorkerName'] = $this->WorkerName;
        if (isset($this->Initials)) $o['Initials'] = $this->Initials;
        if (isset($this->Dates)) $o['Dates'] = $this->Dates;
        if (isset($this->Reason)) $o['Reason'] = $this->Reason;
        if (isset($this->Stage)) $o['Stage'] = $this->Stage;
        if (isset($this->StageLabel)) $o['StageLabel'] = $this->StageLabel;
        if (isset($this->NeedBook)) $o['NeedBook'] = $this->NeedBook;
        if (isset($this->CoverageGapId)) $o['CoverageGapId'] = $this->CoverageGapId;
        if (isset($this->Checks)) $o['Checks'] = JsonConverters::toArray('CoveragePtoCheck', $this->Checks);
        if (isset($this->DenyReason)) $o['DenyReason'] = $this->DenyReason;
        return empty($o) ? new class(){} : $o;
    }
}

class CoveragePlannedResponse implements JsonSerializable
{
    public function __construct(
        /** @var array<CoveragePlannedItem>|null */
        public ?array $Items=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class CoveragePtoDecideRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $WorkerTimeOffID=0,
        /** @var bool|null */
        public ?bool $Approve=null,
        /** @var string|null */
        public ?string $DenyReason=null
    ) {
    }

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

PHP CoveragePtoDecideRequest DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /v1/coverage/pto/{WorkerTimeOffID}/decide HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"WorkerTimeOffID":0,"Approve":false,"DenyReason":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Items":[{"WorkerTimeOffID":0,"ContactId":0,"WorkerName":"String","Initials":"String","Dates":"String","Reason":"String","Stage":"String","StageLabel":"String","NeedBook":false,"CoverageGapId":0,"Checks":[{"Ok":false,"Text":"String"}],"DenyReason":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}