| 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 .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
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/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"InArea":false,"Days":[{"DayIx":0,"Date":"String","Weekday":0,"Closed":false,"Windows":[{"Id":"String","DayIx":0,"StartMin":0,"EndMin":0,"Label":"String","Asap":false,"Levels":[{"Code":"String","Name":"String","Ok":false,"Why":"String","Promise":"String","Surcharge":0}]}]}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}