| GET | /aggregatedStock/{brand}/{posCode} | Get aggregated stock |
|---|
<?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 ClusterStockItem implements JsonSerializable
{
public function __construct(
/** @description Article Code */
// @ApiMember(Description="Article Code", IsRequired=true)
/** @var string */
public string $articleCode='',
/** @description Asset Quantity */
// @ApiMember(Description="Asset Quantity", IsRequired=true)
/** @var int */
public int $assetQuantity=0,
/** @description Consignment Quantity */
// @ApiMember(Description="Consignment Quantity", IsRequired=true)
/** @var int */
public int $consignmentQuantity=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['assetQuantity'])) $this->assetQuantity = $o['assetQuantity'];
if (isset($o['consignmentQuantity'])) $this->consignmentQuantity = $o['consignmentQuantity'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->assetQuantity)) $o['assetQuantity'] = $this->assetQuantity;
if (isset($this->consignmentQuantity)) $o['consignmentQuantity'] = $this->consignmentQuantity;
return empty($o) ? new class(){} : $o;
}
}
class ClusterStock implements JsonSerializable
{
public function __construct(
/** @description Cluster code */
// @ApiMember(Description="Cluster code", IsRequired=true)
/** @var string */
public string $clusterCode='',
/** @description Stock Items */
// @ApiMember(Description="Stock Items", IsRequired=true)
/** @var array<ClusterStockItem>|null */
public ?array $stockItems=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['clusterCode'])) $this->clusterCode = $o['clusterCode'];
if (isset($o['stockItems'])) $this->stockItems = JsonConverters::fromArray('ClusterStockItem', $o['stockItems']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->clusterCode)) $o['clusterCode'] = $this->clusterCode;
if (isset($this->stockItems)) $o['stockItems'] = JsonConverters::toArray('ClusterStockItem', $this->stockItems);
return empty($o) ? new class(){} : $o;
}
}
class AggregatedStockResponse extends ClusterStock implements JsonSerializable
{
/**
* @param string $clusterCode
* @param array<ClusterStockItem>|null $stockItems
*/
public function __construct(
string $clusterCode='',
?array $stockItems=null
) {
parent::__construct($clusterCode,$stockItems);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
return empty($o) ? new class(){} : $o;
}
}
class GetAggregatedStock implements JsonSerializable
{
public function __construct(
/** @description Brand */
// @ApiMember(Description="Brand", IsRequired=true)
/** @var string */
public string $brand='',
/** @description Authorized POS Code e.g. ES100:102048 */
// @ApiMember(Description="Authorized POS Code e.g. ES100:102048", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Article Codes */
// @ApiMember(Description="Article Codes")
/** @var array<string>|null */
public ?array $articleCodes=null
) {
}
/** @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['articleCodes'])) $this->articleCodes = JsonConverters::fromArray('string', $o['articleCodes']);
}
/** @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->articleCodes)) $o['articleCodes'] = JsonConverters::toArray('string', $this->articleCodes);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /aggregatedStock/{brand}/{posCode} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"clusterCode":"String","stockItems":[{"articleCode":"String","assetQuantity":0,"consignmentQuantity":0}]}