| POST | /stock/{brand}/movement/export | Export Stock Movement Data |
|---|
<?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 MovementsRequest 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 array<string>|null */
public ?array $posCodes=null,
/** @description Movement Type Ids */
// @ApiMember(Description="Movement Type Ids")
/** @var array<int>|null */
public ?array $movementTypeIds=null,
/** @description Search Key (Article or SerialNumber) */
// @ApiMember(Description="Search Key (Article or SerialNumber)")
/** @var string|null */
public ?string $searchKey=null,
/** @description In Stock Since date from */
// @ApiMember(Description="In Stock Since date from ")
/** @var DateTime|null */
public ?DateTime $dateFrom=null,
/** @description In Stock Since date to */
// @ApiMember(Description="In Stock Since date to")
/** @var DateTime|null */
public ?DateTime $dateTo=null,
/** @description Sort by date could be: 'DateDESC' or 'DateASC' (default is descending) */
// @ApiMember(Description="Sort by date could be: 'DateDESC' or 'DateASC' (default is descending) ")
/** @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['movementTypeIds'])) $this->movementTypeIds = JsonConverters::fromArray('int', $o['movementTypeIds']);
if (isset($o['searchKey'])) $this->searchKey = $o['searchKey'];
if (isset($o['dateFrom'])) $this->dateFrom = JsonConverters::from('DateTime', $o['dateFrom']);
if (isset($o['dateTo'])) $this->dateTo = JsonConverters::from('DateTime', $o['dateTo']);
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->movementTypeIds)) $o['movementTypeIds'] = JsonConverters::toArray('int', $this->movementTypeIds);
if (isset($this->searchKey)) $o['searchKey'] = $this->searchKey;
if (isset($this->dateFrom)) $o['dateFrom'] = JsonConverters::to('DateTime', $this->dateFrom);
if (isset($this->dateTo)) $o['dateTo'] = JsonConverters::to('DateTime', $this->dateTo);
if (isset($this->sortBy)) $o['sortBy'] = $this->sortBy;
return empty($o) ? new class(){} : $o;
}
}
class ExportMovementResponse implements JsonSerializable
{
public function __construct(
/** @description Unique Identifier of the Export Request created */
// @ApiMember(Description="Unique Identifier of the Export Request created", IsRequired=true)
/** @var string */
public string $asyncTaskId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['asyncTaskId'])) $this->asyncTaskId = $o['asyncTaskId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->asyncTaskId)) $o['asyncTaskId'] = $this->asyncTaskId;
return empty($o) ? new class(){} : $o;
}
}
class ExportMovement extends MovementsRequest implements JsonSerializable
{
/**
* @param string $brand
* @param array<string>|null $posCodes
* @param array<int>|null $movementTypeIds
* @param string|null $searchKey
* @param DateTime|null $dateFrom
* @param DateTime|null $dateTo
* @param string|null $sortBy
*/
public function __construct(
string $brand='',
?array $posCodes=null,
?array $movementTypeIds=null,
?string $searchKey=null,
?DateTime $dateFrom=null,
?DateTime $dateTo=null,
?string $sortBy=null,
/** @description Export Request ID of the API Consumers */
// @ApiMember(Description="Export Request ID of the API Consumers", IsRequired=true)
/** @var string */
public string $downloadRequestId=''
) {
parent::__construct($brand,$posCodes,$movementTypeIds,$searchKey,$dateFrom,$dateTo,$sortBy);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['downloadRequestId'])) $this->downloadRequestId = $o['downloadRequestId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->downloadRequestId)) $o['downloadRequestId'] = $this->downloadRequestId;
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.
POST /stock/{brand}/movement/export HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"downloadRequestId":"String","brand":"String","posCodes":["String"],"movementTypeIds":[0],"searchKey":"String","dateFrom":"\/Date(-62135596800000-0000)\/","dateTo":"\/Date(-62135596800000-0000)\/","sortBy":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"asyncTaskId":"00000000000000000000000000000000"}