| GET | /v1/OrderHeaders/Open |
|---|
<?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 Address implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ID=0,
/** @var int */
public int $AddressTypeID=0,
/** @var string|null */
public ?string $AddressContact=null,
/** @var string|null */
public ?string $AttentionTo=null,
/** @var string|null */
public ?string $AddressLine1=null,
/** @var string|null */
public ?string $AddressLine2=null,
/** @var string|null */
public ?string $AddressLine3=null,
/** @var string|null */
public ?string $AddressCity=null,
/** @var string|null */
public ?string $AddressState=null,
/** @var string|null */
public ?string $AddressZip=null,
/** @var string|null */
public ?string $AddressCountry=null,
/** @var string|null */
public ?string $PhoneNumber=null,
/** @var string|null */
public ?string $FaxNumber=null,
/** @var string */
public string $UID='',
/** @var string|null */
public ?string $Name=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ID'])) $this->ID = $o['ID'];
if (isset($o['AddressTypeID'])) $this->AddressTypeID = $o['AddressTypeID'];
if (isset($o['AddressContact'])) $this->AddressContact = $o['AddressContact'];
if (isset($o['AttentionTo'])) $this->AttentionTo = $o['AttentionTo'];
if (isset($o['AddressLine1'])) $this->AddressLine1 = $o['AddressLine1'];
if (isset($o['AddressLine2'])) $this->AddressLine2 = $o['AddressLine2'];
if (isset($o['AddressLine3'])) $this->AddressLine3 = $o['AddressLine3'];
if (isset($o['AddressCity'])) $this->AddressCity = $o['AddressCity'];
if (isset($o['AddressState'])) $this->AddressState = $o['AddressState'];
if (isset($o['AddressZip'])) $this->AddressZip = $o['AddressZip'];
if (isset($o['AddressCountry'])) $this->AddressCountry = $o['AddressCountry'];
if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
if (isset($o['FaxNumber'])) $this->FaxNumber = $o['FaxNumber'];
if (isset($o['UID'])) $this->UID = $o['UID'];
if (isset($o['Name'])) $this->Name = $o['Name'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ID)) $o['ID'] = $this->ID;
if (isset($this->AddressTypeID)) $o['AddressTypeID'] = $this->AddressTypeID;
if (isset($this->AddressContact)) $o['AddressContact'] = $this->AddressContact;
if (isset($this->AttentionTo)) $o['AttentionTo'] = $this->AttentionTo;
if (isset($this->AddressLine1)) $o['AddressLine1'] = $this->AddressLine1;
if (isset($this->AddressLine2)) $o['AddressLine2'] = $this->AddressLine2;
if (isset($this->AddressLine3)) $o['AddressLine3'] = $this->AddressLine3;
if (isset($this->AddressCity)) $o['AddressCity'] = $this->AddressCity;
if (isset($this->AddressState)) $o['AddressState'] = $this->AddressState;
if (isset($this->AddressZip)) $o['AddressZip'] = $this->AddressZip;
if (isset($this->AddressCountry)) $o['AddressCountry'] = $this->AddressCountry;
if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
if (isset($this->FaxNumber)) $o['FaxNumber'] = $this->FaxNumber;
if (isset($this->UID)) $o['UID'] = $this->UID;
if (isset($this->Name)) $o['Name'] = $this->Name;
return empty($o) ? new class(){} : $o;
}
}
class OrderHeader implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ID=0,
/** @var int */
public int $AgentID=0,
/** @var int */
public int $CustomerID=0,
/** @var string|null */
public ?string $AgentName=null,
/** @var string|null */
public ?string $CustomerName=null,
/** @var DateTime */
public DateTime $OrderDate=new DateTime(),
/** @var int */
public int $OrderStatus=0,
/** @var string|null */
public ?string $OrderStatusText=null,
/** @var int */
public int $TotalQuantityUnits=0,
/** @var float */
public float $TotalOrderCost=0.0,
/** @var float */
public float $TotalProductCost=0.0,
/** @var float */
public float $TotalOrderTax=0.0,
/** @var float */
public float $TotalShippingCost=0.0,
/** @var int */
public int $BillingAddressID=0,
/** @var int */
public int $ShippingAddressID=0,
/** @var float */
public float $CustomerPaidAmount=0.0,
/** @var string|null */
public ?string $Notes=null,
/** @var string */
public string $UID='',
/** @var bool|null */
public ?bool $Recalculate=null,
/** @var string|null */
public ?string $PublicOrderID=null,
/** @var string|null */
public ?string $Address=null,
/** @var Address|null */
public ?Address $ShippingAddress=null,
/** @var Address|null */
public ?Address $BillingAddress=null,
/** @var bool|null */
public ?bool $isMultiShip=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ID'])) $this->ID = $o['ID'];
if (isset($o['AgentID'])) $this->AgentID = $o['AgentID'];
if (isset($o['CustomerID'])) $this->CustomerID = $o['CustomerID'];
if (isset($o['AgentName'])) $this->AgentName = $o['AgentName'];
if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
if (isset($o['OrderDate'])) $this->OrderDate = JsonConverters::from('DateTime', $o['OrderDate']);
if (isset($o['OrderStatus'])) $this->OrderStatus = $o['OrderStatus'];
if (isset($o['OrderStatusText'])) $this->OrderStatusText = $o['OrderStatusText'];
if (isset($o['TotalQuantityUnits'])) $this->TotalQuantityUnits = $o['TotalQuantityUnits'];
if (isset($o['TotalOrderCost'])) $this->TotalOrderCost = $o['TotalOrderCost'];
if (isset($o['TotalProductCost'])) $this->TotalProductCost = $o['TotalProductCost'];
if (isset($o['TotalOrderTax'])) $this->TotalOrderTax = $o['TotalOrderTax'];
if (isset($o['TotalShippingCost'])) $this->TotalShippingCost = $o['TotalShippingCost'];
if (isset($o['BillingAddressID'])) $this->BillingAddressID = $o['BillingAddressID'];
if (isset($o['ShippingAddressID'])) $this->ShippingAddressID = $o['ShippingAddressID'];
if (isset($o['CustomerPaidAmount'])) $this->CustomerPaidAmount = $o['CustomerPaidAmount'];
if (isset($o['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['UID'])) $this->UID = $o['UID'];
if (isset($o['Recalculate'])) $this->Recalculate = $o['Recalculate'];
if (isset($o['PublicOrderID'])) $this->PublicOrderID = $o['PublicOrderID'];
if (isset($o['Address'])) $this->Address = $o['Address'];
if (isset($o['ShippingAddress'])) $this->ShippingAddress = JsonConverters::from('Address', $o['ShippingAddress']);
if (isset($o['BillingAddress'])) $this->BillingAddress = JsonConverters::from('Address', $o['BillingAddress']);
if (isset($o['isMultiShip'])) $this->isMultiShip = $o['isMultiShip'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ID)) $o['ID'] = $this->ID;
if (isset($this->AgentID)) $o['AgentID'] = $this->AgentID;
if (isset($this->CustomerID)) $o['CustomerID'] = $this->CustomerID;
if (isset($this->AgentName)) $o['AgentName'] = $this->AgentName;
if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
if (isset($this->OrderDate)) $o['OrderDate'] = JsonConverters::to('DateTime', $this->OrderDate);
if (isset($this->OrderStatus)) $o['OrderStatus'] = $this->OrderStatus;
if (isset($this->OrderStatusText)) $o['OrderStatusText'] = $this->OrderStatusText;
if (isset($this->TotalQuantityUnits)) $o['TotalQuantityUnits'] = $this->TotalQuantityUnits;
if (isset($this->TotalOrderCost)) $o['TotalOrderCost'] = $this->TotalOrderCost;
if (isset($this->TotalProductCost)) $o['TotalProductCost'] = $this->TotalProductCost;
if (isset($this->TotalOrderTax)) $o['TotalOrderTax'] = $this->TotalOrderTax;
if (isset($this->TotalShippingCost)) $o['TotalShippingCost'] = $this->TotalShippingCost;
if (isset($this->BillingAddressID)) $o['BillingAddressID'] = $this->BillingAddressID;
if (isset($this->ShippingAddressID)) $o['ShippingAddressID'] = $this->ShippingAddressID;
if (isset($this->CustomerPaidAmount)) $o['CustomerPaidAmount'] = $this->CustomerPaidAmount;
if (isset($this->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->UID)) $o['UID'] = $this->UID;
if (isset($this->Recalculate)) $o['Recalculate'] = $this->Recalculate;
if (isset($this->PublicOrderID)) $o['PublicOrderID'] = $this->PublicOrderID;
if (isset($this->Address)) $o['Address'] = $this->Address;
if (isset($this->ShippingAddress)) $o['ShippingAddress'] = JsonConverters::to('Address', $this->ShippingAddress);
if (isset($this->BillingAddress)) $o['BillingAddress'] = JsonConverters::to('Address', $this->BillingAddress);
if (isset($this->isMultiShip)) $o['isMultiShip'] = $this->isMultiShip;
return empty($o) ? new class(){} : $o;
}
}
class OrderHeadersResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<OrderHeader>|null */
public ?array $OrderHeaders=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['OrderHeaders'])) $this->OrderHeaders = JsonConverters::fromArray('OrderHeader', $o['OrderHeaders']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->OrderHeaders)) $o['OrderHeaders'] = JsonConverters::toArray('OrderHeader', $this->OrderHeaders);
return empty($o) ? new class(){} : $o;
}
}
class OpenOrderRequest implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
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.
GET /v1/OrderHeaders/Open HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
OrderHeaders:
[
{
ID: 0,
AgentID: 0,
CustomerID: 0,
AgentName: String,
CustomerName: String,
OrderDate: 0001-01-01,
OrderStatus: 0,
OrderStatusText: String,
TotalQuantityUnits: 0,
TotalOrderCost: 0,
TotalProductCost: 0,
TotalOrderTax: 0,
TotalShippingCost: 0,
BillingAddressID: 0,
ShippingAddressID: 0,
CustomerPaidAmount: 0,
Notes: String,
UID: 00000000000000000000000000000000,
Recalculate: False,
PublicOrderID: String,
Address: String,
ShippingAddress:
{
ID: 0,
AddressTypeID: 0,
AddressContact: String,
AttentionTo: String,
AddressLine1: String,
AddressLine2: String,
AddressLine3: String,
AddressCity: String,
AddressState: String,
AddressZip: String,
AddressCountry: String,
PhoneNumber: String,
FaxNumber: String,
UID: 00000000000000000000000000000000,
Name: String
},
BillingAddress:
{
ID: 0,
AddressTypeID: 0,
AddressContact: String,
AttentionTo: String,
AddressLine1: String,
AddressLine2: String,
AddressLine3: String,
AddressCity: String,
AddressState: String,
AddressZip: String,
AddressCountry: String,
PhoneNumber: String,
FaxNumber: String,
UID: 00000000000000000000000000000000,
Name: String
},
isMultiShip: False
}
]
}