Trendsic Platform Service

<back to all web services

ServiceAgreementRequest

Requires Authentication
The following routes are available for this service:
GET,OPTIONS/v1/project/{ProjectID}/agreements
GET,POST,PUT,DELETE,OPTIONS/v1/serviceagreement
GET,DELETE,OPTIONS/v1/serviceagreement/{AgreementID}
<?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 ServiceAgreement implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AgreementID=0,
        /** @var string */
        public string $AgreementUID='',
        /** @var string */
        public string $TenantId='',
        /** @var string */
        public string $BranchId='',
        /** @var string|null */
        public ?string $BranchName=null,
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $ProjectName=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var string|null */
        public ?string $PricingShape=null,
        /** @var float|null */
        public ?float $MonthlyAmount=null,
        /** @var float|null */
        public ?float $PerVisitAmount=null,
        /** @var string|null */
        public ?string $SkipPolicy=null,
        /** @var int|null */
        public ?int $SeasonStartMonth=null,
        /** @var int|null */
        public ?int $SeasonStartDay=null,
        /** @var int|null */
        public ?int $SeasonEndMonth=null,
        /** @var int|null */
        public ?int $SeasonEndDay=null,
        /** @var string|null */
        public ?string $RecurrenceFrequency=null,
        /** @var string|null */
        public ?string $RecurrenceBy=null,
        /** @var string|null */
        public ?string $RecurrenceByValue=null,
        /** @var DateTime|null */
        public ?DateTime $EffectiveStartDate=null,
        /** @var DateTime|null */
        public ?DateTime $EndDate=null,
        /** @var int|null */
        public ?int $PreferredCrewID=null,
        /** @var string|null */
        public ?string $PreferredCrewName=null,
        /** @var string|null */
        public ?string $ExternalRef=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var string|null */
        public ?string $UpdatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $UpdatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $NextVisitDate=null,
        /** @var int */
        public int $VisitsThisPeriod=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AgreementID'])) $this->AgreementID = $o['AgreementID'];
        if (isset($o['AgreementUID'])) $this->AgreementUID = $o['AgreementUID'];
        if (isset($o['TenantId'])) $this->TenantId = $o['TenantId'];
        if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
        if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['ProjectName'])) $this->ProjectName = $o['ProjectName'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['PricingShape'])) $this->PricingShape = $o['PricingShape'];
        if (isset($o['MonthlyAmount'])) $this->MonthlyAmount = $o['MonthlyAmount'];
        if (isset($o['PerVisitAmount'])) $this->PerVisitAmount = $o['PerVisitAmount'];
        if (isset($o['SkipPolicy'])) $this->SkipPolicy = $o['SkipPolicy'];
        if (isset($o['SeasonStartMonth'])) $this->SeasonStartMonth = $o['SeasonStartMonth'];
        if (isset($o['SeasonStartDay'])) $this->SeasonStartDay = $o['SeasonStartDay'];
        if (isset($o['SeasonEndMonth'])) $this->SeasonEndMonth = $o['SeasonEndMonth'];
        if (isset($o['SeasonEndDay'])) $this->SeasonEndDay = $o['SeasonEndDay'];
        if (isset($o['RecurrenceFrequency'])) $this->RecurrenceFrequency = $o['RecurrenceFrequency'];
        if (isset($o['RecurrenceBy'])) $this->RecurrenceBy = $o['RecurrenceBy'];
        if (isset($o['RecurrenceByValue'])) $this->RecurrenceByValue = $o['RecurrenceByValue'];
        if (isset($o['EffectiveStartDate'])) $this->EffectiveStartDate = JsonConverters::from('DateTime', $o['EffectiveStartDate']);
        if (isset($o['EndDate'])) $this->EndDate = JsonConverters::from('DateTime', $o['EndDate']);
        if (isset($o['PreferredCrewID'])) $this->PreferredCrewID = $o['PreferredCrewID'];
        if (isset($o['PreferredCrewName'])) $this->PreferredCrewName = $o['PreferredCrewName'];
        if (isset($o['ExternalRef'])) $this->ExternalRef = $o['ExternalRef'];
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
        if (isset($o['UpdatedBy'])) $this->UpdatedBy = $o['UpdatedBy'];
        if (isset($o['UpdatedAt'])) $this->UpdatedAt = JsonConverters::from('DateTime', $o['UpdatedAt']);
        if (isset($o['NextVisitDate'])) $this->NextVisitDate = JsonConverters::from('DateTime', $o['NextVisitDate']);
        if (isset($o['VisitsThisPeriod'])) $this->VisitsThisPeriod = $o['VisitsThisPeriod'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AgreementID)) $o['AgreementID'] = $this->AgreementID;
        if (isset($this->AgreementUID)) $o['AgreementUID'] = $this->AgreementUID;
        if (isset($this->TenantId)) $o['TenantId'] = $this->TenantId;
        if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
        if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->ProjectName)) $o['ProjectName'] = $this->ProjectName;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->PricingShape)) $o['PricingShape'] = $this->PricingShape;
        if (isset($this->MonthlyAmount)) $o['MonthlyAmount'] = $this->MonthlyAmount;
        if (isset($this->PerVisitAmount)) $o['PerVisitAmount'] = $this->PerVisitAmount;
        if (isset($this->SkipPolicy)) $o['SkipPolicy'] = $this->SkipPolicy;
        if (isset($this->SeasonStartMonth)) $o['SeasonStartMonth'] = $this->SeasonStartMonth;
        if (isset($this->SeasonStartDay)) $o['SeasonStartDay'] = $this->SeasonStartDay;
        if (isset($this->SeasonEndMonth)) $o['SeasonEndMonth'] = $this->SeasonEndMonth;
        if (isset($this->SeasonEndDay)) $o['SeasonEndDay'] = $this->SeasonEndDay;
        if (isset($this->RecurrenceFrequency)) $o['RecurrenceFrequency'] = $this->RecurrenceFrequency;
        if (isset($this->RecurrenceBy)) $o['RecurrenceBy'] = $this->RecurrenceBy;
        if (isset($this->RecurrenceByValue)) $o['RecurrenceByValue'] = $this->RecurrenceByValue;
        if (isset($this->EffectiveStartDate)) $o['EffectiveStartDate'] = JsonConverters::to('DateTime', $this->EffectiveStartDate);
        if (isset($this->EndDate)) $o['EndDate'] = JsonConverters::to('DateTime', $this->EndDate);
        if (isset($this->PreferredCrewID)) $o['PreferredCrewID'] = $this->PreferredCrewID;
        if (isset($this->PreferredCrewName)) $o['PreferredCrewName'] = $this->PreferredCrewName;
        if (isset($this->ExternalRef)) $o['ExternalRef'] = $this->ExternalRef;
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
        if (isset($this->UpdatedBy)) $o['UpdatedBy'] = $this->UpdatedBy;
        if (isset($this->UpdatedAt)) $o['UpdatedAt'] = JsonConverters::to('DateTime', $this->UpdatedAt);
        if (isset($this->NextVisitDate)) $o['NextVisitDate'] = JsonConverters::to('DateTime', $this->NextVisitDate);
        if (isset($this->VisitsThisPeriod)) $o['VisitsThisPeriod'] = $this->VisitsThisPeriod;
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class ServiceAgreementRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $AgreementID=0,
        /** @var int */
        public int $ProjectID=0,
        /** @var array<ServiceAgreement>|null */
        public ?array $ServiceAgreement=null
    ) {
    }

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

PHP ServiceAgreementRequest 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/serviceagreement HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"AgreementID":0,"ProjectID":0,"ServiceAgreement":[{"AgreementID":0,"AgreementUID":"00000000000000000000000000000000","TenantId":"00000000000000000000000000000000","BranchId":"00000000000000000000000000000000","BranchName":"String","ProjectID":0,"ProjectName":"String","Name":"String","Status":"String","PricingShape":"String","MonthlyAmount":0,"PerVisitAmount":0,"SkipPolicy":"String","SeasonStartMonth":0,"SeasonStartDay":0,"SeasonEndMonth":0,"SeasonEndDay":0,"RecurrenceFrequency":"String","RecurrenceBy":"String","RecurrenceByValue":"String","EffectiveStartDate":"0001-01-01T00:00:00.0000000","EndDate":"0001-01-01T00:00:00.0000000","PreferredCrewID":0,"PreferredCrewName":"String","ExternalRef":"String","CreatedBy":"String","CreatedAt":"0001-01-01T00:00:00.0000000","UpdatedBy":"String","UpdatedAt":"0001-01-01T00:00:00.0000000","NextVisitDate":"0001-01-01T00:00:00.0000000","VisitsThisPeriod":0}]}
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"}},"ServiceAgreement":[{"AgreementID":0,"AgreementUID":"00000000000000000000000000000000","TenantId":"00000000000000000000000000000000","BranchId":"00000000000000000000000000000000","BranchName":"String","ProjectID":0,"ProjectName":"String","Name":"String","Status":"String","PricingShape":"String","MonthlyAmount":0,"PerVisitAmount":0,"SkipPolicy":"String","SeasonStartMonth":0,"SeasonStartDay":0,"SeasonEndMonth":0,"SeasonEndDay":0,"RecurrenceFrequency":"String","RecurrenceBy":"String","RecurrenceByValue":"String","EffectiveStartDate":"0001-01-01T00:00:00.0000000","EndDate":"0001-01-01T00:00:00.0000000","PreferredCrewID":0,"PreferredCrewName":"String","ExternalRef":"String","CreatedBy":"String","CreatedAt":"0001-01-01T00:00:00.0000000","UpdatedBy":"String","UpdatedAt":"0001-01-01T00:00:00.0000000","NextVisitDate":"0001-01-01T00:00:00.0000000","VisitsThisPeriod":0}]}