| POST | /stock/depotDropoff |
|---|
<?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 ApiServiceRequest implements IServiceRequest, IHasApiKey, IHasDeviceInfo, JsonSerializable
{
public function __construct(
/** @description The API Key required for authentication */
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
/** @var string */
public string $apiKey='',
/** @description Latitude of the user making this request */
// @ApiMember(DataType="double", Description="Latitude of the user making this request")
/** @var float */
public float $latitude=0.0,
/** @description Longitude of the user making this request */
// @ApiMember(DataType="double", Description="Longitude of the user making this request")
/** @var float */
public float $longitude=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['apiKey'])) $this->apiKey = $o['apiKey'];
if (isset($o['latitude'])) $this->latitude = $o['latitude'];
if (isset($o['longitude'])) $this->longitude = $o['longitude'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->apiKey)) $o['apiKey'] = $this->apiKey;
if (isset($this->latitude)) $o['latitude'] = $this->latitude;
if (isset($this->longitude)) $o['longitude'] = $this->longitude;
return empty($o) ? new class(){} : $o;
}
}
class ApiServiceResponse implements IServiceResponse, JsonSerializable
{
public function __construct(
/** @description Information about the response. */
// @ApiMember(Description="Information about the response.", IsRequired=true)
/** @var string */
public string $description='',
/** @description Heading or summary of the response. */
// @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
/** @var string */
public string $heading='',
/** @description Did the intended operation for this response complete successfully? */
// @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
/** @var bool|null */
public ?bool $wasSuccessful=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['description'])) $this->description = $o['description'];
if (isset($o['heading'])) $this->heading = $o['heading'];
if (isset($o['wasSuccessful'])) $this->wasSuccessful = $o['wasSuccessful'];
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->description)) $o['description'] = $this->description;
if (isset($this->heading)) $o['heading'] = $this->heading;
if (isset($this->wasSuccessful)) $o['wasSuccessful'] = $this->wasSuccessful;
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
class AntelSealData implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $sealNumber=null,
/** @var string|null */
public ?string $principalName=null,
/** @var int */
public int $sealId=0,
/** @var string|null */
public ?string $operatorName=null,
/** @var string|null */
public ?string $outletName=null,
/** @var string|null */
public ?string $upliftDate=null,
/** @var bool|null */
public ?bool $sealExists=null,
/** @var bool|null */
public ?bool $isPaused=null,
/** @var bool|null */
public ?bool $pausedAwaitingAuth=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['sealNumber'])) $this->sealNumber = $o['sealNumber'];
if (isset($o['principalName'])) $this->principalName = $o['principalName'];
if (isset($o['sealId'])) $this->sealId = $o['sealId'];
if (isset($o['operatorName'])) $this->operatorName = $o['operatorName'];
if (isset($o['outletName'])) $this->outletName = $o['outletName'];
if (isset($o['upliftDate'])) $this->upliftDate = $o['upliftDate'];
if (isset($o['sealExists'])) $this->sealExists = $o['sealExists'];
if (isset($o['isPaused'])) $this->isPaused = $o['isPaused'];
if (isset($o['pausedAwaitingAuth'])) $this->pausedAwaitingAuth = $o['pausedAwaitingAuth'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->sealNumber)) $o['sealNumber'] = $this->sealNumber;
if (isset($this->principalName)) $o['principalName'] = $this->principalName;
if (isset($this->sealId)) $o['sealId'] = $this->sealId;
if (isset($this->operatorName)) $o['operatorName'] = $this->operatorName;
if (isset($this->outletName)) $o['outletName'] = $this->outletName;
if (isset($this->upliftDate)) $o['upliftDate'] = $this->upliftDate;
if (isset($this->sealExists)) $o['sealExists'] = $this->sealExists;
if (isset($this->isPaused)) $o['isPaused'] = $this->isPaused;
if (isset($this->pausedAwaitingAuth)) $o['pausedAwaitingAuth'] = $this->pausedAwaitingAuth;
return empty($o) ? new class(){} : $o;
}
}
class DepotDropOffResponse extends ApiServiceResponse implements JsonSerializable
{
/**
* @param string $description
* @param string $heading
* @param bool|null $wasSuccessful
* @param ResponseStatus|null $responseStatus
*/
public function __construct(
string $description='',
string $heading='',
?bool $wasSuccessful=null,
?ResponseStatus $responseStatus=null,
/** @var AntelSealData|null */
public ?AntelSealData $sealData=null,
/** @var bool|null */
public ?bool $weightRequired=null,
/** @var bool|null */
public ?bool $atDepot=null,
/** @var bool|null */
public ?bool $skipConfirm=null
) {
parent::__construct($description,$heading,$wasSuccessful,$responseStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['sealData'])) $this->sealData = JsonConverters::from('AntelSealData', $o['sealData']);
if (isset($o['weightRequired'])) $this->weightRequired = $o['weightRequired'];
if (isset($o['atDepot'])) $this->atDepot = $o['atDepot'];
if (isset($o['skipConfirm'])) $this->skipConfirm = $o['skipConfirm'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->sealData)) $o['sealData'] = JsonConverters::to('AntelSealData', $this->sealData);
if (isset($this->weightRequired)) $o['weightRequired'] = $this->weightRequired;
if (isset($this->atDepot)) $o['atDepot'] = $this->atDepot;
if (isset($this->skipConfirm)) $o['skipConfirm'] = $this->skipConfirm;
return empty($o) ? new class(){} : $o;
}
}
class DepotDropOff extends ApiServiceRequest implements JsonSerializable
{
/**
* @param string $apiKey
* @param float $latitude
* @param float $longitude
*/
public function __construct(
string $apiKey='',
float $latitude=0.0,
float $longitude=0.0,
/** @var string|null */
public ?string $sealNumber=null
) {
parent::__construct($apiKey,$latitude,$longitude);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['sealNumber'])) $this->sealNumber = $o['sealNumber'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->sealNumber)) $o['sealNumber'] = $this->sealNumber;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /stock/depotDropoff HTTP/1.1
Host: antel.api.dev.86degrees.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
sealNumber: String,
apiKey: String,
latitude: 0,
longitude: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
sealData:
{
sealNumber: String,
principalName: String,
sealId: 0,
operatorName: String,
outletName: String,
upliftDate: String,
sealExists: False,
isPaused: False,
pausedAwaitingAuth: False
},
weightRequired: False,
atDepot: False,
skipConfirm: False,
description: String,
heading: String,
wasSuccessful: False,
responseStatus:
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
}
}