| POST,OPTIONS | /v1/dispatch/quote/{Token}/answer |
|---|
<?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 DispatchQuoteView implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $CustomerName=null,
/** @var string|null */
public ?string $Cargo=null,
/** @var int */
public int $Units=0,
/** @var string|null */
public ?string $FromLoc=null,
/** @var string|null */
public ?string $ToLoc=null,
/** @var int|null */
public ?int $Miles=null,
/** @var string|null */
public ?string $WindowText=null,
/** @var bool|null */
public ?bool $IsUrgent=null,
/** @var int|null */
public ?int $LoadsNeeded=null,
/** @var int|null */
public ?int $UnitsPerTruck=null,
/** @var float|null */
public ?float $RatePerLoad=null,
/** @var float */
public float $UrgencyPct=0.0,
/** @var float|null */
public ?float $QuoteTotal=null,
/** @var int */
public int $QuoteVersion=0,
/** @var string|null */
public ?string $Status=null,
/** @var DateTime|null */
public ?DateTime $QuotedUtc=null,
/** @var DateTime|null */
public ?DateTime $ExpiresUtc=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
if (isset($o['Cargo'])) $this->Cargo = $o['Cargo'];
if (isset($o['Units'])) $this->Units = $o['Units'];
if (isset($o['FromLoc'])) $this->FromLoc = $o['FromLoc'];
if (isset($o['ToLoc'])) $this->ToLoc = $o['ToLoc'];
if (isset($o['Miles'])) $this->Miles = $o['Miles'];
if (isset($o['WindowText'])) $this->WindowText = $o['WindowText'];
if (isset($o['IsUrgent'])) $this->IsUrgent = $o['IsUrgent'];
if (isset($o['LoadsNeeded'])) $this->LoadsNeeded = $o['LoadsNeeded'];
if (isset($o['UnitsPerTruck'])) $this->UnitsPerTruck = $o['UnitsPerTruck'];
if (isset($o['RatePerLoad'])) $this->RatePerLoad = $o['RatePerLoad'];
if (isset($o['UrgencyPct'])) $this->UrgencyPct = $o['UrgencyPct'];
if (isset($o['QuoteTotal'])) $this->QuoteTotal = $o['QuoteTotal'];
if (isset($o['QuoteVersion'])) $this->QuoteVersion = $o['QuoteVersion'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['QuotedUtc'])) $this->QuotedUtc = JsonConverters::from('DateTime', $o['QuotedUtc']);
if (isset($o['ExpiresUtc'])) $this->ExpiresUtc = JsonConverters::from('DateTime', $o['ExpiresUtc']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
if (isset($this->Cargo)) $o['Cargo'] = $this->Cargo;
if (isset($this->Units)) $o['Units'] = $this->Units;
if (isset($this->FromLoc)) $o['FromLoc'] = $this->FromLoc;
if (isset($this->ToLoc)) $o['ToLoc'] = $this->ToLoc;
if (isset($this->Miles)) $o['Miles'] = $this->Miles;
if (isset($this->WindowText)) $o['WindowText'] = $this->WindowText;
if (isset($this->IsUrgent)) $o['IsUrgent'] = $this->IsUrgent;
if (isset($this->LoadsNeeded)) $o['LoadsNeeded'] = $this->LoadsNeeded;
if (isset($this->UnitsPerTruck)) $o['UnitsPerTruck'] = $this->UnitsPerTruck;
if (isset($this->RatePerLoad)) $o['RatePerLoad'] = $this->RatePerLoad;
if (isset($this->UrgencyPct)) $o['UrgencyPct'] = $this->UrgencyPct;
if (isset($this->QuoteTotal)) $o['QuoteTotal'] = $this->QuoteTotal;
if (isset($this->QuoteVersion)) $o['QuoteVersion'] = $this->QuoteVersion;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->QuotedUtc)) $o['QuotedUtc'] = JsonConverters::to('DateTime', $this->QuotedUtc);
if (isset($this->ExpiresUtc)) $o['ExpiresUtc'] = JsonConverters::to('DateTime', $this->ExpiresUtc);
return empty($o) ? new class(){} : $o;
}
}
class DispatchQuoteResponse implements JsonSerializable
{
public function __construct(
/** @var DispatchQuoteView|null */
public ?DispatchQuoteView $Quote=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Quote'])) $this->Quote = JsonConverters::from('DispatchQuoteView', $o['Quote']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Quote)) $o['Quote'] = JsonConverters::to('DispatchQuoteView', $this->Quote);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class DispatchQuoteAnswerRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Token=null,
/** @var bool|null */
public ?bool $Accept=null,
/** @var string|null */
public ?string $Reason=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Token'])) $this->Token = $o['Token'];
if (isset($o['Accept'])) $this->Accept = $o['Accept'];
if (isset($o['Reason'])) $this->Reason = $o['Reason'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Token)) $o['Token'] = $this->Token;
if (isset($this->Accept)) $o['Accept'] = $this->Accept;
if (isset($this->Reason)) $o['Reason'] = $this->Reason;
return empty($o) ? new class(){} : $o;
}
}
PHP DispatchQuoteAnswerRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/dispatch/quote/{Token}/answer HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<DispatchQuoteAnswerRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Accept>false</Accept>
<Reason>String</Reason>
<Token>String</Token>
</DispatchQuoteAnswerRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<DispatchQuoteResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
<Quote>
<Cargo>String</Cargo>
<Code>String</Code>
<CustomerName>String</CustomerName>
<ExpiresUtc>0001-01-01T00:00:00</ExpiresUtc>
<FromLoc>String</FromLoc>
<IsUrgent>false</IsUrgent>
<LoadsNeeded>0</LoadsNeeded>
<Miles>0</Miles>
<QuoteTotal>0</QuoteTotal>
<QuoteVersion>0</QuoteVersion>
<QuotedUtc>0001-01-01T00:00:00</QuotedUtc>
<RatePerLoad>0</RatePerLoad>
<Status>String</Status>
<ToLoc>String</ToLoc>
<Units>0</Units>
<UnitsPerTruck>0</UnitsPerTruck>
<UrgencyPct>0</UrgencyPct>
<WindowText>String</WindowText>
</Quote>
<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>
</DispatchQuoteResponse>