Richemont.Booster2.PublicApi

<back to all web services

ExportMovement

Requires Authentication
The following routes are available for this service:
POST/stock/{brand}/movement/exportExport 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;
    }
}

PHP ExportMovement DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

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: application/xml
Content-Type: application/xml
Content-Length: length

<ExportMovement xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.Stock.ServiceModel">
  <brand>String</brand>
  <dateFrom>0001-01-01T00:00:00</dateFrom>
  <dateTo>0001-01-01T00:00:00</dateTo>
  <movementTypeIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </movementTypeIds>
  <posCodes xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>String</d2p1:string>
  </posCodes>
  <searchKey>String</searchKey>
  <sortBy>String</sortBy>
  <downloadRequestId>String</downloadRequestId>
</ExportMovement>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ExportMovementResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.Stock.ServiceModel">
  <asyncTaskId>00000000-0000-0000-0000-000000000000</asyncTaskId>
</ExportMovementResponse>