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 .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 /v1/serviceagreement HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<ServiceAgreementRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <AgreementID>0</AgreementID>
  <ProjectID>0</ProjectID>
  <ServiceAgreement>
    <ServiceAgreement>
      <AgreementID>0</AgreementID>
      <AgreementUID>00000000-0000-0000-0000-000000000000</AgreementUID>
      <BranchId>00000000-0000-0000-0000-000000000000</BranchId>
      <BranchName>String</BranchName>
      <CreatedAt>0001-01-01T00:00:00</CreatedAt>
      <CreatedBy>String</CreatedBy>
      <EffectiveStartDate>0001-01-01T00:00:00</EffectiveStartDate>
      <EndDate>0001-01-01T00:00:00</EndDate>
      <ExternalRef>String</ExternalRef>
      <MonthlyAmount>0</MonthlyAmount>
      <Name>String</Name>
      <NextVisitDate>0001-01-01T00:00:00</NextVisitDate>
      <PerVisitAmount>0</PerVisitAmount>
      <PreferredCrewID>0</PreferredCrewID>
      <PreferredCrewName>String</PreferredCrewName>
      <PricingShape>String</PricingShape>
      <ProjectID>0</ProjectID>
      <ProjectName>String</ProjectName>
      <RecurrenceBy>String</RecurrenceBy>
      <RecurrenceByValue>String</RecurrenceByValue>
      <RecurrenceFrequency>String</RecurrenceFrequency>
      <SeasonEndDay>0</SeasonEndDay>
      <SeasonEndMonth>0</SeasonEndMonth>
      <SeasonStartDay>0</SeasonStartDay>
      <SeasonStartMonth>0</SeasonStartMonth>
      <SkipPolicy>String</SkipPolicy>
      <Status>String</Status>
      <TenantId>00000000-0000-0000-0000-000000000000</TenantId>
      <UpdatedAt>0001-01-01T00:00:00</UpdatedAt>
      <UpdatedBy>String</UpdatedBy>
      <VisitsThisPeriod>0</VisitsThisPeriod>
    </ServiceAgreement>
  </ServiceAgreement>
</ServiceAgreementRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ServiceAgreementResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <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>
  <ServiceAgreement>
    <ServiceAgreement>
      <AgreementID>0</AgreementID>
      <AgreementUID>00000000-0000-0000-0000-000000000000</AgreementUID>
      <BranchId>00000000-0000-0000-0000-000000000000</BranchId>
      <BranchName>String</BranchName>
      <CreatedAt>0001-01-01T00:00:00</CreatedAt>
      <CreatedBy>String</CreatedBy>
      <EffectiveStartDate>0001-01-01T00:00:00</EffectiveStartDate>
      <EndDate>0001-01-01T00:00:00</EndDate>
      <ExternalRef>String</ExternalRef>
      <MonthlyAmount>0</MonthlyAmount>
      <Name>String</Name>
      <NextVisitDate>0001-01-01T00:00:00</NextVisitDate>
      <PerVisitAmount>0</PerVisitAmount>
      <PreferredCrewID>0</PreferredCrewID>
      <PreferredCrewName>String</PreferredCrewName>
      <PricingShape>String</PricingShape>
      <ProjectID>0</ProjectID>
      <ProjectName>String</ProjectName>
      <RecurrenceBy>String</RecurrenceBy>
      <RecurrenceByValue>String</RecurrenceByValue>
      <RecurrenceFrequency>String</RecurrenceFrequency>
      <SeasonEndDay>0</SeasonEndDay>
      <SeasonEndMonth>0</SeasonEndMonth>
      <SeasonStartDay>0</SeasonStartDay>
      <SeasonStartMonth>0</SeasonStartMonth>
      <SkipPolicy>String</SkipPolicy>
      <Status>String</Status>
      <TenantId>00000000-0000-0000-0000-000000000000</TenantId>
      <UpdatedAt>0001-01-01T00:00:00</UpdatedAt>
      <UpdatedBy>String</UpdatedBy>
      <VisitsThisPeriod>0</VisitsThisPeriod>
    </ServiceAgreement>
  </ServiceAgreement>
</ServiceAgreementResponse>