| GET | /stock/{brand}/lookup | Get Serial Number and Article lookup from the database |
|---|
<?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 GetStockLookupResponse implements JsonSerializable
{
public function __construct(
/** @description Exists in Stock? */
// @ApiMember(Description="Exists in Stock?", IsRequired=true)
/** @var bool|null */
public ?bool $existsInStock=null,
/** @description Stock Locations / POSes */
// @ApiMember(Description="Stock Locations / POSes", IsRequired=true)
/** @var Pos|null */
public ?Pos $stockLocation=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['existsInStock'])) $this->existsInStock = $o['existsInStock'];
if (isset($o['stockLocation'])) $this->stockLocation = JsonConverters::from('Pos', $o['stockLocation']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->existsInStock)) $o['existsInStock'] = $this->existsInStock;
if (isset($this->stockLocation)) $o['stockLocation'] = JsonConverters::to('Pos', $this->stockLocation);
return empty($o) ? new class(){} : $o;
}
}
class GetStockLookup implements JsonSerializable
{
public function __construct(
/** @description Brand */
// @ApiMember(Description="Brand", IsRequired=true)
/** @var string */
public string $brand='',
/** @description Article Code */
// @ApiMember(Description="Article Code", IsRequired=true)
/** @var string */
public string $articleCode='',
/** @description Serial Number */
// @ApiMember(Description="Serial Number", IsRequired=true)
/** @var string */
public string $serialNumber=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['brand'])) $this->brand = $o['brand'];
if (isset($o['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['serialNumber'])) $this->serialNumber = $o['serialNumber'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->brand)) $o['brand'] = $this->brand;
if (isset($this->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->serialNumber)) $o['serialNumber'] = $this->serialNumber;
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 /stock/{brand}/lookup HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<GetStockLookupResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.Stock.ServiceModel">
<existsInStock>false</existsInStock>
<stockLocation>
<city>String</city>
<country>String</country>
<name>String</name>
<posCode>String</posCode>
<posCodeToBeDisplayed>String</posCodeToBeDisplayed>
<postalCode>String</postalCode>
<state>String</state>
<street>String</street>
</stockLocation>
</GetStockLookupResponse>