| POST,PUT,DELETE,OPTIONS | /v1/OrderLines | ||
|---|---|---|---|
| GET | /v1/OrderLines/OrderHeaders/{OrderHeaderUID} |
<?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 OrderLine implements JsonSerializable
{
public function __construct(
/** @var int */
public int $ID=0,
/** @var string */
public string $OrderHeaderID='',
/** @var int */
public int $OrderLineNumber=0,
/** @var int */
public int $ProductID=0,
/** @var string|null */
public ?string $StripeProductId=null,
/** @var int */
public int $ProductCategory=0,
/** @var int */
public int $ProductSubCategory=0,
/** @var int */
public int $Quantity=0,
/** @var float */
public float $TotalOrderLineCost=0.0,
/** @var float */
public float $ProductCost=0.0,
/** @var float */
public float $PerUnitProductCost=0.0,
/** @var float */
public float $OrderLineTax=0.0,
/** @var float */
public float $OrderLineShippingCost=0.0,
/** @var float */
public float $PerUnitShippingCost=0.0,
/** @var int */
public int $OrderLineStatusID=0,
/** @var int */
public int $ShipMethodID=0,
/** @var DateTime */
public DateTime $EstimatedShipDate=new DateTime(),
/** @var DateTime */
public DateTime $EstimatedDeliveryDate=new DateTime(),
/** @var DateTime */
public DateTime $ActualShipDate=new DateTime(),
/** @var DateTime */
public DateTime $ActualDeliveryDate=new DateTime(),
/** @var DateTime */
public DateTime $OrderLineCreatedDate=new DateTime(),
/** @var DateTime */
public DateTime $OrderLineModifiedDate=new DateTime(),
/** @var string */
public string $UID='',
/** @var string|null */
public ?string $ProductName=null,
/** @var int */
public int $AgentId=0,
/** @var string|null */
public ?string $Street=null,
/** @var string|null */
public ?string $City=null,
/** @var string|null */
public ?string $State=null,
/** @var string|null */
public ?string $Zip=null,
/** @var string|null */
public ?string $PhoneNumber=null,
/** @var int */
public int $AddressId=0,
/** @var string|null */
public ?string $ShippingAddress=null,
/** @var string|null */
public ?string $FullName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ID'])) $this->ID = $o['ID'];
if (isset($o['OrderHeaderID'])) $this->OrderHeaderID = $o['OrderHeaderID'];
if (isset($o['OrderLineNumber'])) $this->OrderLineNumber = $o['OrderLineNumber'];
if (isset($o['ProductID'])) $this->ProductID = $o['ProductID'];
if (isset($o['StripeProductId'])) $this->StripeProductId = $o['StripeProductId'];
if (isset($o['ProductCategory'])) $this->ProductCategory = $o['ProductCategory'];
if (isset($o['ProductSubCategory'])) $this->ProductSubCategory = $o['ProductSubCategory'];
if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
if (isset($o['TotalOrderLineCost'])) $this->TotalOrderLineCost = $o['TotalOrderLineCost'];
if (isset($o['ProductCost'])) $this->ProductCost = $o['ProductCost'];
if (isset($o['PerUnitProductCost'])) $this->PerUnitProductCost = $o['PerUnitProductCost'];
if (isset($o['OrderLineTax'])) $this->OrderLineTax = $o['OrderLineTax'];
if (isset($o['OrderLineShippingCost'])) $this->OrderLineShippingCost = $o['OrderLineShippingCost'];
if (isset($o['PerUnitShippingCost'])) $this->PerUnitShippingCost = $o['PerUnitShippingCost'];
if (isset($o['OrderLineStatusID'])) $this->OrderLineStatusID = $o['OrderLineStatusID'];
if (isset($o['ShipMethodID'])) $this->ShipMethodID = $o['ShipMethodID'];
if (isset($o['EstimatedShipDate'])) $this->EstimatedShipDate = JsonConverters::from('DateTime', $o['EstimatedShipDate']);
if (isset($o['EstimatedDeliveryDate'])) $this->EstimatedDeliveryDate = JsonConverters::from('DateTime', $o['EstimatedDeliveryDate']);
if (isset($o['ActualShipDate'])) $this->ActualShipDate = JsonConverters::from('DateTime', $o['ActualShipDate']);
if (isset($o['ActualDeliveryDate'])) $this->ActualDeliveryDate = JsonConverters::from('DateTime', $o['ActualDeliveryDate']);
if (isset($o['OrderLineCreatedDate'])) $this->OrderLineCreatedDate = JsonConverters::from('DateTime', $o['OrderLineCreatedDate']);
if (isset($o['OrderLineModifiedDate'])) $this->OrderLineModifiedDate = JsonConverters::from('DateTime', $o['OrderLineModifiedDate']);
if (isset($o['UID'])) $this->UID = $o['UID'];
if (isset($o['ProductName'])) $this->ProductName = $o['ProductName'];
if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
if (isset($o['Street'])) $this->Street = $o['Street'];
if (isset($o['City'])) $this->City = $o['City'];
if (isset($o['State'])) $this->State = $o['State'];
if (isset($o['Zip'])) $this->Zip = $o['Zip'];
if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
if (isset($o['AddressId'])) $this->AddressId = $o['AddressId'];
if (isset($o['ShippingAddress'])) $this->ShippingAddress = $o['ShippingAddress'];
if (isset($o['FullName'])) $this->FullName = $o['FullName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ID)) $o['ID'] = $this->ID;
if (isset($this->OrderHeaderID)) $o['OrderHeaderID'] = $this->OrderHeaderID;
if (isset($this->OrderLineNumber)) $o['OrderLineNumber'] = $this->OrderLineNumber;
if (isset($this->ProductID)) $o['ProductID'] = $this->ProductID;
if (isset($this->StripeProductId)) $o['StripeProductId'] = $this->StripeProductId;
if (isset($this->ProductCategory)) $o['ProductCategory'] = $this->ProductCategory;
if (isset($this->ProductSubCategory)) $o['ProductSubCategory'] = $this->ProductSubCategory;
if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
if (isset($this->TotalOrderLineCost)) $o['TotalOrderLineCost'] = $this->TotalOrderLineCost;
if (isset($this->ProductCost)) $o['ProductCost'] = $this->ProductCost;
if (isset($this->PerUnitProductCost)) $o['PerUnitProductCost'] = $this->PerUnitProductCost;
if (isset($this->OrderLineTax)) $o['OrderLineTax'] = $this->OrderLineTax;
if (isset($this->OrderLineShippingCost)) $o['OrderLineShippingCost'] = $this->OrderLineShippingCost;
if (isset($this->PerUnitShippingCost)) $o['PerUnitShippingCost'] = $this->PerUnitShippingCost;
if (isset($this->OrderLineStatusID)) $o['OrderLineStatusID'] = $this->OrderLineStatusID;
if (isset($this->ShipMethodID)) $o['ShipMethodID'] = $this->ShipMethodID;
if (isset($this->EstimatedShipDate)) $o['EstimatedShipDate'] = JsonConverters::to('DateTime', $this->EstimatedShipDate);
if (isset($this->EstimatedDeliveryDate)) $o['EstimatedDeliveryDate'] = JsonConverters::to('DateTime', $this->EstimatedDeliveryDate);
if (isset($this->ActualShipDate)) $o['ActualShipDate'] = JsonConverters::to('DateTime', $this->ActualShipDate);
if (isset($this->ActualDeliveryDate)) $o['ActualDeliveryDate'] = JsonConverters::to('DateTime', $this->ActualDeliveryDate);
if (isset($this->OrderLineCreatedDate)) $o['OrderLineCreatedDate'] = JsonConverters::to('DateTime', $this->OrderLineCreatedDate);
if (isset($this->OrderLineModifiedDate)) $o['OrderLineModifiedDate'] = JsonConverters::to('DateTime', $this->OrderLineModifiedDate);
if (isset($this->UID)) $o['UID'] = $this->UID;
if (isset($this->ProductName)) $o['ProductName'] = $this->ProductName;
if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
if (isset($this->Street)) $o['Street'] = $this->Street;
if (isset($this->City)) $o['City'] = $this->City;
if (isset($this->State)) $o['State'] = $this->State;
if (isset($this->Zip)) $o['Zip'] = $this->Zip;
if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
if (isset($this->AddressId)) $o['AddressId'] = $this->AddressId;
if (isset($this->ShippingAddress)) $o['ShippingAddress'] = $this->ShippingAddress;
if (isset($this->FullName)) $o['FullName'] = $this->FullName;
return empty($o) ? new class(){} : $o;
}
}
class OrderLinesResponse implements JsonSerializable
{
public function __construct(
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var array<OrderLine>|null */
public ?array $OrderLines=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['OrderLines'])) $this->OrderLines = JsonConverters::fromArray('OrderLine', $o['OrderLines']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->OrderLines)) $o['OrderLines'] = JsonConverters::toArray('OrderLine', $this->OrderLines);
return empty($o) ? new class(){} : $o;
}
}
class OrderLinesRequest implements JsonSerializable
{
public function __construct(
/** @var string */
public string $OrderHeaderUID='',
/** @var array<OrderLine>|null */
public ?array $OrderLines=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['OrderHeaderUID'])) $this->OrderHeaderUID = $o['OrderHeaderUID'];
if (isset($o['OrderLines'])) $this->OrderLines = JsonConverters::fromArray('OrderLine', $o['OrderLines']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->OrderHeaderUID)) $o['OrderHeaderUID'] = $this->OrderHeaderUID;
if (isset($this->OrderLines)) $o['OrderLines'] = JsonConverters::toArray('OrderLine', $this->OrderLines);
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 /v1/OrderLines HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
OrderHeaderUID: 00000000000000000000000000000000,
OrderLines:
[
{
ID: 0,
OrderHeaderID: 00000000000000000000000000000000,
OrderLineNumber: 0,
ProductID: 0,
StripeProductId: String,
ProductCategory: 0,
ProductSubCategory: 0,
Quantity: 0,
TotalOrderLineCost: 0,
ProductCost: 0,
PerUnitProductCost: 0,
OrderLineTax: 0,
OrderLineShippingCost: 0,
PerUnitShippingCost: 0,
OrderLineStatusID: 0,
ShipMethodID: 0,
EstimatedShipDate: 0001-01-01,
EstimatedDeliveryDate: 0001-01-01,
ActualShipDate: 0001-01-01,
ActualDeliveryDate: 0001-01-01,
OrderLineCreatedDate: 0001-01-01,
OrderLineModifiedDate: 0001-01-01,
UID: 00000000000000000000000000000000,
ProductName: String,
AgentId: 0,
Street: String,
City: String,
State: String,
Zip: String,
PhoneNumber: String,
AddressId: 0,
ShippingAddress: String,
FullName: String
}
]
}
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
}
},
OrderLines:
[
{
ID: 0,
OrderHeaderID: 00000000000000000000000000000000,
OrderLineNumber: 0,
ProductID: 0,
StripeProductId: String,
ProductCategory: 0,
ProductSubCategory: 0,
Quantity: 0,
TotalOrderLineCost: 0,
ProductCost: 0,
PerUnitProductCost: 0,
OrderLineTax: 0,
OrderLineShippingCost: 0,
PerUnitShippingCost: 0,
OrderLineStatusID: 0,
ShipMethodID: 0,
EstimatedShipDate: 0001-01-01,
EstimatedDeliveryDate: 0001-01-01,
ActualShipDate: 0001-01-01,
ActualDeliveryDate: 0001-01-01,
OrderLineCreatedDate: 0001-01-01,
OrderLineModifiedDate: 0001-01-01,
UID: 00000000000000000000000000000000,
ProductName: String,
AgentId: 0,
Street: String,
City: String,
State: String,
Zip: String,
PhoneNumber: String,
AddressId: 0,
ShippingAddress: String,
FullName: String
}
]
}