Trendsic Platform Service

<back to all web services

CourierBookAvailabilityRequest

The following routes are available for this service:
GET,OPTIONS/v1/book/{Slug}/availability
<?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 LevelOffer implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Code=null,
        /** @var string|null */
        public ?string $Name=null,
        /** @var bool|null */
        public ?bool $Ok=null,
        /** @var string|null */
        public ?string $Why=null,
        /** @var string|null */
        public ?string $Promise=null,
        /** @var float */
        public float $Surcharge=0.0
    ) {
    }

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

class Window implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Id=null,
        /** @var int */
        public int $DayIx=0,
        /** @var int */
        public int $StartMin=0,
        /** @var int */
        public int $EndMin=0,
        /** @var string|null */
        public ?string $Label=null,
        /** @var bool|null */
        public ?bool $Asap=null,
        /** @var array<LevelOffer>|null */
        public ?array $Levels=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['DayIx'])) $this->DayIx = $o['DayIx'];
        if (isset($o['StartMin'])) $this->StartMin = $o['StartMin'];
        if (isset($o['EndMin'])) $this->EndMin = $o['EndMin'];
        if (isset($o['Label'])) $this->Label = $o['Label'];
        if (isset($o['Asap'])) $this->Asap = $o['Asap'];
        if (isset($o['Levels'])) $this->Levels = JsonConverters::fromArray('LevelOffer', $o['Levels']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->DayIx)) $o['DayIx'] = $this->DayIx;
        if (isset($this->StartMin)) $o['StartMin'] = $this->StartMin;
        if (isset($this->EndMin)) $o['EndMin'] = $this->EndMin;
        if (isset($this->Label)) $o['Label'] = $this->Label;
        if (isset($this->Asap)) $o['Asap'] = $this->Asap;
        if (isset($this->Levels)) $o['Levels'] = JsonConverters::toArray('LevelOffer', $this->Levels);
        return empty($o) ? new class(){} : $o;
    }
}

class CourierBookDay implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $DayIx=0,
        /** @var string|null */
        public ?string $Date=null,
        /** @var int */
        public int $Weekday=0,
        /** @var bool|null */
        public ?bool $Closed=null,
        /** @var array<Window>|null */
        public ?array $Windows=null
    ) {
    }

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

class CourierBookAvailabilityResponse implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $InArea=null,
        /** @var array<CourierBookDay>|null */
        public ?array $Days=null,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

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

class CourierBookAvailabilityRequest implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Slug=null,
        /** @var string|null */
        public ?string $Profile=null,
        /** @var string|null */
        public ?string $Zip=null
    ) {
    }

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

PHP CourierBookAvailabilityRequest 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.

GET /v1/book/{Slug}/availability HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CourierBookAvailabilityResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Days>
    <CourierBookDay>
      <Closed>false</Closed>
      <Date>String</Date>
      <DayIx>0</DayIx>
      <Weekday>0</Weekday>
      <Windows>
        <CourierEngine.Window>
          <Asap>false</Asap>
          <DayIx>0</DayIx>
          <EndMin>0</EndMin>
          <Id>String</Id>
          <Label>String</Label>
          <Levels>
            <CourierEngine.LevelOffer>
              <Code>String</Code>
              <Name>String</Name>
              <Ok>false</Ok>
              <Promise>String</Promise>
              <Surcharge>0</Surcharge>
              <Why>String</Why>
            </CourierEngine.LevelOffer>
          </Levels>
          <StartMin>0</StartMin>
        </CourierEngine.Window>
      </Windows>
    </CourierBookDay>
  </Days>
  <InArea>false</InArea>
  <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>
</CourierBookAvailabilityResponse>