| GET | /stock/{brand}/{posCode}/{articleCode} | Get stock 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 Pos implements JsonSerializable
{
public function __construct(
/** @description Name of the POS */
// @ApiMember(Description="Name of the POS", IsRequired=true)
/** @var string */
public string $name='',
/** @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 Country of the POS */
// @ApiMember(Description="Country of the POS", IsRequired=true)
/** @var string */
public string $country='',
/** @description City of the POS */
// @ApiMember(Description="City of the POS", IsRequired=true)
/** @var string */
public string $city='',
/** @description Postal Code */
// @ApiMember(Description="Postal Code", IsRequired=true)
/** @var string */
public string $postalCode='',
/** @description State */
// @ApiMember(Description="State", IsRequired=true)
/** @var string */
public string $state='',
/** @description Street */
// @ApiMember(Description="Street", IsRequired=true)
/** @var string */
public string $street=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['posCode'])) $this->posCode = $o['posCode'];
if (isset($o['posCodeToBeDisplayed'])) $this->posCodeToBeDisplayed = $o['posCodeToBeDisplayed'];
if (isset($o['country'])) $this->country = $o['country'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['postalCode'])) $this->postalCode = $o['postalCode'];
if (isset($o['state'])) $this->state = $o['state'];
if (isset($o['street'])) $this->street = $o['street'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->posCode)) $o['posCode'] = $this->posCode;
if (isset($this->posCodeToBeDisplayed)) $o['posCodeToBeDisplayed'] = $this->posCodeToBeDisplayed;
if (isset($this->country)) $o['country'] = $this->country;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->postalCode)) $o['postalCode'] = $this->postalCode;
if (isset($this->state)) $o['state'] = $this->state;
if (isset($this->street)) $o['street'] = $this->street;
return empty($o) ? new class(){} : $o;
}
}
class UnitNetAmount implements JsonSerializable
{
public function __construct(
/** @description Currency Iso Code */
// @ApiMember(Description="Currency Iso Code", IsRequired=true)
/** @var string */
public string $currencyIsoCode='',
/** @description Value */
// @ApiMember(Description="Value", IsRequired=true)
/** @var float */
public float $value=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['currencyIsoCode'])) $this->currencyIsoCode = $o['currencyIsoCode'];
if (isset($o['value'])) $this->value = $o['value'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->currencyIsoCode)) $o['currencyIsoCode'] = $this->currencyIsoCode;
if (isset($this->value)) $o['value'] = $this->value;
return empty($o) ? new class(){} : $o;
}
}
class StockPositionItem implements JsonSerializable
{
public function __construct(
/** @description Quantity */
// @ApiMember(Description="Quantity", IsRequired=true)
/** @var int */
public int $quantity=0,
/** @description Serial Number */
// @ApiMember(Description="Serial Number")
/** @var string|null */
public ?string $serialNumber=null,
/** @description Stock Date */
// @ApiMember(Description="Stock Date", IsRequired=true)
/** @var string */
public string $stockDate='',
/** @description Loaded On Date */
// @ApiMember(Description="Loaded On Date", IsRequired=true)
/** @var string */
public string $loadedOnDate='',
/** @description Type e.g. consignment or standard */
// @ApiMember(Description="Type e.g. consignment or standard", IsRequired=true)
/** @var string */
public string $type='',
/** @description Is Consignment Sellable */
// @ApiMember(Description="Is Consignment Sellable ", IsRequired=true)
/** @var bool|null */
public ?bool $isConsignmentSellable=null,
/** @description Sell-In Price. Disclaimer: this data will be arriving empty/null due to DealerCost project still being in test phase. */
// @ApiMember(Description="Sell-In Price. Disclaimer: this data will be arriving empty/null due to DealerCost project still being in test phase.")
/** @var UnitNetAmount|null */
public ?UnitNetAmount $unitNetAmount=null,
/** @description Retail Sales Price */
// @ApiMember(Description="Retail Sales Price")
/** @var UnitNetAmount|null */
public ?UnitNetAmount $retailSalesPrice=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['quantity'])) $this->quantity = $o['quantity'];
if (isset($o['serialNumber'])) $this->serialNumber = $o['serialNumber'];
if (isset($o['stockDate'])) $this->stockDate = $o['stockDate'];
if (isset($o['loadedOnDate'])) $this->loadedOnDate = $o['loadedOnDate'];
if (isset($o['type'])) $this->type = $o['type'];
if (isset($o['isConsignmentSellable'])) $this->isConsignmentSellable = $o['isConsignmentSellable'];
if (isset($o['unitNetAmount'])) $this->unitNetAmount = JsonConverters::from('UnitNetAmount', $o['unitNetAmount']);
if (isset($o['retailSalesPrice'])) $this->retailSalesPrice = JsonConverters::from('UnitNetAmount', $o['retailSalesPrice']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->quantity)) $o['quantity'] = $this->quantity;
if (isset($this->serialNumber)) $o['serialNumber'] = $this->serialNumber;
if (isset($this->stockDate)) $o['stockDate'] = $this->stockDate;
if (isset($this->loadedOnDate)) $o['loadedOnDate'] = $this->loadedOnDate;
if (isset($this->type)) $o['type'] = $this->type;
if (isset($this->isConsignmentSellable)) $o['isConsignmentSellable'] = $this->isConsignmentSellable;
if (isset($this->unitNetAmount)) $o['unitNetAmount'] = JsonConverters::to('UnitNetAmount', $this->unitNetAmount);
if (isset($this->retailSalesPrice)) $o['retailSalesPrice'] = JsonConverters::to('UnitNetAmount', $this->retailSalesPrice);
return empty($o) ? new class(){} : $o;
}
}
class GetStockDetailResponse implements JsonSerializable
{
public function __construct(
/** @description Article code */
// @ApiMember(Description="Article code", IsRequired=true)
/** @var string */
public string $articleCode='',
/** @description Brand */
// @ApiMember(Description="Brand", IsRequired=true)
/** @var string */
public string $brand='',
/** @description Pos Code */
// @ApiMember(Description="Pos Code", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Current Stock Quantity */
// @ApiMember(Description="Current Stock Quantity", IsRequired=true)
/** @var int */
public int $currentStockQuantity=0,
/** @description Shared Stock Location */
// @ApiMember(Description="Shared Stock Location", IsRequired=true)
/** @var Pos|null */
public ?Pos $sharedStockLocation=null,
/** @description Stock Positions */
// @ApiMember(Description="Stock Positions", IsRequired=true)
/** @var array<StockPositionItem>|null */
public ?array $stockPositions=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['brand'])) $this->brand = $o['brand'];
if (isset($o['posCode'])) $this->posCode = $o['posCode'];
if (isset($o['currentStockQuantity'])) $this->currentStockQuantity = $o['currentStockQuantity'];
if (isset($o['sharedStockLocation'])) $this->sharedStockLocation = JsonConverters::from('Pos', $o['sharedStockLocation']);
if (isset($o['stockPositions'])) $this->stockPositions = JsonConverters::fromArray('StockPositionItem', $o['stockPositions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->brand)) $o['brand'] = $this->brand;
if (isset($this->posCode)) $o['posCode'] = $this->posCode;
if (isset($this->currentStockQuantity)) $o['currentStockQuantity'] = $this->currentStockQuantity;
if (isset($this->sharedStockLocation)) $o['sharedStockLocation'] = JsonConverters::to('Pos', $this->sharedStockLocation);
if (isset($this->stockPositions)) $o['stockPositions'] = JsonConverters::toArray('StockPositionItem', $this->stockPositions);
return empty($o) ? new class(){} : $o;
}
}
class GetStockDetail implements 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 string */
public string $posCode='',
/** @description Article Code */
// @ApiMember(Description="Article Code", IsRequired=true)
/** @var string */
public string $articleCode=''
) {
}
/** @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'];
}
/** @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;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /stock/{brand}/{posCode}/{articleCode} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"articleCode":"String","brand":"String","posCode":"String","currentStockQuantity":0,"sharedStockLocation":{"name":"String","posCode":"String","posCodeToBeDisplayed":"String","country":"String","city":"String","postalCode":"String","state":"String","street":"String"},"stockPositions":[{"quantity":0,"serialNumber":"String","stockDate":"String","loadedOnDate":"String","type":"String","isConsignmentSellable":false,"unitNetAmount":{"currencyIsoCode":"String","value":0},"retailSalesPrice":{"currencyIsoCode":"String","value":0}}]}