| GET | /purchaseItem/{brand} | Get a list of purchase details |
|---|
<?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 Amount implements JsonSerializable
{
public function __construct(
/** @description Value */
// @ApiMember(Description="Value", IsRequired=true)
/** @var float */
public float $value=0.0,
/** @description Currency */
// @ApiMember(Description="Currency", IsRequired=true)
/** @var string */
public string $currency=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['value'])) $this->value = $o['value'];
if (isset($o['currency'])) $this->currency = $o['currency'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->value)) $o['value'] = $this->value;
if (isset($this->currency)) $o['currency'] = $this->currency;
return empty($o) ? new class(){} : $o;
}
}
class PurchaseItem implements JsonSerializable
{
public function __construct(
/** @description Pos Code */
// @ApiMember(Description="Pos Code", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Pos Code To Be Displayed */
// @ApiMember(Description="Pos Code To Be Displayed", IsRequired=true)
/** @var string */
public string $posCodeToBeDisplayed='',
/** @description Erp Order Id */
// @ApiMember(Description="Erp Order Id", IsRequired=true)
/** @var int */
public int $erpOrderId=0,
/** @description Line number */
// @ApiMember(Description="Line number", IsRequired=true)
/** @var int */
public int $lineNumber=0,
/** @description Order Date */
// @ApiMember(Description="Order Date", IsRequired=true)
/** @var string */
public string $orderDate='',
/** @description Origin Order Id */
// @ApiMember(Description="Origin Order Id")
/** @var int|null */
public ?int $originOrderId=null,
/** @description Article Code */
// @ApiMember(Description="Article Code", IsRequired=true)
/** @var string */
public string $articleCode='',
/** @description Ordered Quantity */
// @ApiMember(Description="Ordered Quantity", IsRequired=true)
/** @var int */
public int $orderedQuantity=0,
/** @description Open Quantity */
// @ApiMember(Description="Open Quantity", IsRequired=true)
/** @var int */
public int $openQuantity=0,
/** @description Order status */
// @ApiMember(Description="Order status", IsRequired=true)
/** @var string */
public string $status='',
/** @description Net Amount */
// @ApiMember(Description="Net Amount", IsRequired=true)
/** @var Amount|null */
public ?Amount $netAmount=null,
/** @description Customer Reference */
// @ApiMember(Description="Customer Reference", IsRequired=true)
/** @var string */
public string $customerReference='',
/** @description Speaking Article Code */
// @ApiMember(Description="Speaking Article Code", IsRequired=true)
/** @var string */
public string $speakingArticleCode='',
/** @description Expected Delivery Date */
// @ApiMember(Description="Expected Delivery Date", IsRequired=true)
/** @var string */
public string $expectedDeliveryDate='',
/** @description Is Strap Vip Order */
// @ApiMember(Description="Is Strap Vip Order", IsRequired=true)
/** @var bool|null */
public ?bool $isStrapVipOrder=null,
/** @description Order Type */
// @ApiMember(Description="Order Type", IsRequired=true)
/** @var string */
public string $orderType=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['posCode'])) $this->posCode = $o['posCode'];
if (isset($o['posCodeToBeDisplayed'])) $this->posCodeToBeDisplayed = $o['posCodeToBeDisplayed'];
if (isset($o['erpOrderId'])) $this->erpOrderId = $o['erpOrderId'];
if (isset($o['lineNumber'])) $this->lineNumber = $o['lineNumber'];
if (isset($o['orderDate'])) $this->orderDate = $o['orderDate'];
if (isset($o['originOrderId'])) $this->originOrderId = $o['originOrderId'];
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['orderedQuantity'])) $this->orderedQuantity = $o['orderedQuantity'];
if (isset($o['openQuantity'])) $this->openQuantity = $o['openQuantity'];
if (isset($o['status'])) $this->status = $o['status'];
if (isset($o['netAmount'])) $this->netAmount = JsonConverters::from('Amount', $o['netAmount']);
if (isset($o['customerReference'])) $this->customerReference = $o['customerReference'];
if (isset($o['speakingArticleCode'])) $this->speakingArticleCode = $o['speakingArticleCode'];
if (isset($o['expectedDeliveryDate'])) $this->expectedDeliveryDate = $o['expectedDeliveryDate'];
if (isset($o['isStrapVipOrder'])) $this->isStrapVipOrder = $o['isStrapVipOrder'];
if (isset($o['orderType'])) $this->orderType = $o['orderType'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->posCode)) $o['posCode'] = $this->posCode;
if (isset($this->posCodeToBeDisplayed)) $o['posCodeToBeDisplayed'] = $this->posCodeToBeDisplayed;
if (isset($this->erpOrderId)) $o['erpOrderId'] = $this->erpOrderId;
if (isset($this->lineNumber)) $o['lineNumber'] = $this->lineNumber;
if (isset($this->orderDate)) $o['orderDate'] = $this->orderDate;
if (isset($this->originOrderId)) $o['originOrderId'] = $this->originOrderId;
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->orderedQuantity)) $o['orderedQuantity'] = $this->orderedQuantity;
if (isset($this->openQuantity)) $o['openQuantity'] = $this->openQuantity;
if (isset($this->status)) $o['status'] = $this->status;
if (isset($this->netAmount)) $o['netAmount'] = JsonConverters::to('Amount', $this->netAmount);
if (isset($this->customerReference)) $o['customerReference'] = $this->customerReference;
if (isset($this->speakingArticleCode)) $o['speakingArticleCode'] = $this->speakingArticleCode;
if (isset($this->expectedDeliveryDate)) $o['expectedDeliveryDate'] = $this->expectedDeliveryDate;
if (isset($this->isStrapVipOrder)) $o['isStrapVipOrder'] = $this->isStrapVipOrder;
if (isset($this->orderType)) $o['orderType'] = $this->orderType;
return empty($o) ? new class(){} : $o;
}
}
class GetPurchaseItemsResponse implements JsonSerializable
{
public function __construct(
/** @description Total Pages */
// @ApiMember(Description="Total Pages", IsRequired=true)
/** @var int */
public int $totalPages=0,
/** @description Total Results */
// @ApiMember(Description="Total Results", IsRequired=true)
/** @var int */
public int $totalResults=0,
/** @description Index of the result set returned */
// @ApiMember(Description="Index of the result set returned", IsRequired=true)
/** @var int */
public int $page=0,
/** @description Size of the result set returned */
// @ApiMember(Description="Size of the result set returned", IsRequired=true)
/** @var int */
public int $items=0,
/** @description List of purchase items */
// @ApiMember(Description="List of purchase items", IsRequired=true)
/** @var array<PurchaseItem>|null */
public ?array $elements=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['totalPages'])) $this->totalPages = $o['totalPages'];
if (isset($o['totalResults'])) $this->totalResults = $o['totalResults'];
if (isset($o['page'])) $this->page = $o['page'];
if (isset($o['items'])) $this->items = $o['items'];
if (isset($o['elements'])) $this->elements = JsonConverters::fromArray('PurchaseItem', $o['elements']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->totalPages)) $o['totalPages'] = $this->totalPages;
if (isset($this->totalResults)) $o['totalResults'] = $this->totalResults;
if (isset($this->page)) $o['page'] = $this->page;
if (isset($this->items)) $o['items'] = $this->items;
if (isset($this->elements)) $o['elements'] = JsonConverters::toArray('PurchaseItem', $this->elements);
return empty($o) ? new class(){} : $o;
}
}
class GetPurchaseItems implements IPagedRequest, JsonSerializable
{
public function __construct(
/** @description Brand */
// @ApiMember(Description="Brand", IsRequired=true)
/** @var string */
public string $brand='',
/** @description POS Legacy */
// @ApiMember(Description="POS Legacy", IsRequired=true)
/** @var array<string>|null */
public ?array $posCodes=null,
/** @description Article Codes */
// @ApiMember(Description="Article Codes")
/** @var array<string>|null */
public ?array $articleCodes=null,
/** @description ERP Order Codes */
// @ApiMember(Description="ERP Order Codes")
/** @var array<string>|null */
public ?array $erpOrderCodes=null,
/** @description Index of the result set returned */
// @ApiMember(Description="Index of the result set returned")
/** @var int */
public int $page=0,
/** @description Size of the result set returned */
// @ApiMember(Description="Size of the result set returned")
/** @var int */
public int $items=0,
/** @description Omit precise record count - save on performance */
// @ApiMember(Description="Omit precise record count - save on performance")
/** @var bool|null */
public ?bool $noCount=null,
/** @description Sorting expression */
// @ApiMember(Description="Sorting expression")
/** @var string|null */
public ?string $sortBy=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['brand'])) $this->brand = $o['brand'];
if (isset($o['posCodes'])) $this->posCodes = JsonConverters::fromArray('string', $o['posCodes']);
if (isset($o['articleCodes'])) $this->articleCodes = JsonConverters::fromArray('string', $o['articleCodes']);
if (isset($o['erpOrderCodes'])) $this->erpOrderCodes = JsonConverters::fromArray('string', $o['erpOrderCodes']);
if (isset($o['page'])) $this->page = $o['page'];
if (isset($o['items'])) $this->items = $o['items'];
if (isset($o['noCount'])) $this->noCount = $o['noCount'];
if (isset($o['sortBy'])) $this->sortBy = $o['sortBy'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->brand)) $o['brand'] = $this->brand;
if (isset($this->posCodes)) $o['posCodes'] = JsonConverters::toArray('string', $this->posCodes);
if (isset($this->articleCodes)) $o['articleCodes'] = JsonConverters::toArray('string', $this->articleCodes);
if (isset($this->erpOrderCodes)) $o['erpOrderCodes'] = JsonConverters::toArray('string', $this->erpOrderCodes);
if (isset($this->page)) $o['page'] = $this->page;
if (isset($this->items)) $o['items'] = $this->items;
if (isset($this->noCount)) $o['noCount'] = $this->noCount;
if (isset($this->sortBy)) $o['sortBy'] = $this->sortBy;
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 /purchaseItem/{brand} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
totalPages: 0,
totalResults: 0,
page: 0,
items: 0
}