| GET | /buyin/{brand} | Get list of buyin | Get list of paginated buyin based on the search parameters submitted |
|---|
<?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 BuyIn implements JsonSerializable
{
public function __construct(
/** @description Brand Trigram, e.g. CAR, IWC; compulsory only if articleCode is not provided */
// @ApiMember(Description="Brand Trigram, e.g. CAR, IWC; compulsory only if articleCode is not provided", IsRequired=true)
/** @var string */
public string $brand='',
/** @description Code of BuyIn */
// @ApiMember(Description="Code of BuyIn", IsRequired=true)
/** @var int */
public int $buyInOrderId=0,
/** @description Richemont POS code */
// @ApiMember(Description="Richemont POS code", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Richemont Reference Code of the item */
// @ApiMember(Description="Richemont Reference Code of the item", IsRequired=true)
/** @var string */
public string $articleCode='',
/** @description Serial Number of the item */
// @ApiMember(Description="Serial Number of the item")
/** @var string */
public string $serialNumber='',
/** @description Buy-in order status code */
// @ApiMember(Description="Buy-in order status code")
/** @var string */
public string $buyInStatusId='',
/** @description Buy-in creation date */
// @ApiMember(Description="Buy-in creation date")
/** @var DateTime */
public DateTime $buyInDate=new DateTime(),
/** @description Emails of Sale Representatives */
// @ApiMember(Description="Emails of Sale Representatives")
/** @var array<string>|null */
public ?array $saleRepresentativeEmails=null,
/** @description True is the buy-in’s piece is in stock, False otherwise */
// @ApiMember(Description="True is the buy-in’s piece is in stock, False otherwise")
/** @var bool|null */
public ?bool $isInStock=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['brand'])) $this->brand = $o['brand'];
if (isset($o['buyInOrderId'])) $this->buyInOrderId = $o['buyInOrderId'];
if (isset($o['posCode'])) $this->posCode = $o['posCode'];
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['serialNumber'])) $this->serialNumber = $o['serialNumber'];
if (isset($o['buyInStatusId'])) $this->buyInStatusId = $o['buyInStatusId'];
if (isset($o['buyInDate'])) $this->buyInDate = JsonConverters::from('DateTime', $o['buyInDate']);
if (isset($o['saleRepresentativeEmails'])) $this->saleRepresentativeEmails = JsonConverters::fromArray('string', $o['saleRepresentativeEmails']);
if (isset($o['isInStock'])) $this->isInStock = $o['isInStock'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->brand)) $o['brand'] = $this->brand;
if (isset($this->buyInOrderId)) $o['buyInOrderId'] = $this->buyInOrderId;
if (isset($this->posCode)) $o['posCode'] = $this->posCode;
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->serialNumber)) $o['serialNumber'] = $this->serialNumber;
if (isset($this->buyInStatusId)) $o['buyInStatusId'] = $this->buyInStatusId;
if (isset($this->buyInDate)) $o['buyInDate'] = JsonConverters::to('DateTime', $this->buyInDate);
if (isset($this->saleRepresentativeEmails)) $o['saleRepresentativeEmails'] = JsonConverters::toArray('string', $this->saleRepresentativeEmails);
if (isset($this->isInStock)) $o['isInStock'] = $this->isInStock;
return empty($o) ? new class(){} : $o;
}
}
class GetBuyInPaginatedResponse implements JsonSerializable
{
public function __construct(
/** @description Index of the result set returnedr */
// @ApiMember(Description="Index of the result set returnedr", 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 Total amount of pages / result sets */
// @ApiMember(Description="Total amount of pages / result sets", IsRequired=true)
/** @var int */
public int $totalPages=0,
/** @description Total amount of results */
// @ApiMember(Description="Total amount of results", IsRequired=true)
/** @var int */
public int $totalResults=0,
/** @description List of Sale Details */
// @ApiMember(Description="List of Sale Details", IsRequired=true)
/** @var array<BuyIn>|null */
public ?array $elements=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['page'])) $this->page = $o['page'];
if (isset($o['items'])) $this->items = $o['items'];
if (isset($o['totalPages'])) $this->totalPages = $o['totalPages'];
if (isset($o['totalResults'])) $this->totalResults = $o['totalResults'];
if (isset($o['elements'])) $this->elements = JsonConverters::fromArray('BuyIn', $o['elements']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->page)) $o['page'] = $this->page;
if (isset($this->items)) $o['items'] = $this->items;
if (isset($this->totalPages)) $o['totalPages'] = $this->totalPages;
if (isset($this->totalResults)) $o['totalResults'] = $this->totalResults;
if (isset($this->elements)) $o['elements'] = JsonConverters::toArray('BuyIn', $this->elements);
return empty($o) ? new class(){} : $o;
}
}
class GetBuyInPaginated implements JsonSerializable
{
public function __construct(
/** @description Richemont Brand ID */
// @ApiMember(Description="Richemont Brand ID")
/** @var string */
public string $brand='',
/** @description Richemont POS code */
// @ApiMember(Description="Richemont POS code", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Richemont Reference Code of the item */
// @ApiMember(Description="Richemont Reference Code of the item")
/** @var string */
public string $articleCode='',
/** @description Serial Number of the item */
// @ApiMember(Description="Serial Number of the item")
/** @var string */
public string $serialNumber='',
/** @description Buy-in order status code */
// @ApiMember(Description="Buy-in order status code")
/** @var string */
public string $buyInStatusId='',
/** @description True is the buy-in’s piece is in stock, False otherwise */
// @ApiMember(Description="True is the buy-in’s piece is in stock, False otherwise")
/** @var bool|null */
public ?bool $isInStock=null,
/** @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 Omit precise record count - save on performance */
// @ApiMember(Description="Omit precise record count - save on performance")
/** @var bool|null */
public ?bool $noCount=null,
/** @description Sort Expression, Possible values: 'SaleDetailIdDESC', 'DocumentDate'. */
// @ApiMember(Description="Sort Expression, Possible values: 'SaleDetailIdDESC', 'DocumentDate'.")
/** @var string */
public string $sortBy=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['brand'])) $this->brand = $o['brand'];
if (isset($o['posCode'])) $this->posCode = $o['posCode'];
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['serialNumber'])) $this->serialNumber = $o['serialNumber'];
if (isset($o['buyInStatusId'])) $this->buyInStatusId = $o['buyInStatusId'];
if (isset($o['isInStock'])) $this->isInStock = $o['isInStock'];
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->posCode)) $o['posCode'] = $this->posCode;
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->serialNumber)) $o['serialNumber'] = $this->serialNumber;
if (isset($this->buyInStatusId)) $o['buyInStatusId'] = $this->buyInStatusId;
if (isset($this->isInStock)) $o['isInStock'] = $this->isInStock;
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 .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /buyin/{brand} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <GetBuyInPaginatedResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.CPO.ServiceModel"> <elements i:nil="true" /> <items>0</items> <page>0</page> <totalPages>0</totalPages> <totalResults>0</totalResults> </GetBuyInPaginatedResponse>