Richemont.Booster2.PublicApi

<back to all web services

GetTask

Requires Authentication
The following routes are available for this service:
GET/tasksGet tasks of authorized user
<?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 Task implements JsonSerializable
{
    public function __construct(
        /** @description Async task ID */
        // @ApiMember(Description="Async task ID", IsRequired=true)
        /** @var string */
        public string $asyncTaskId='',

        /** @description Type of requested async task, e.g 'stock', 'sellout', 'crm' */
        // @ApiMember(Description="Type of requested async task, e.g 'stock', 'sellout', 'crm'", IsRequired=true)
        /** @var string */
        public string $type='',

        /** @description Async task creation date */
        // @ApiMember(Description="Async task creation date", IsRequired=true)
        /** @var string */
        public string $requestDate='',

        /** @description Status of requested async task, e.g 'REQ', 'INP', 'COM', 'ERR' */
        // @ApiMember(Description="Status of requested async task, e.g 'REQ', 'INP', 'COM', 'ERR'", IsRequired=true)
        /** @var string */
        public string $status='',

        /** @description Percentage of completion */
        // @ApiMember(Description="Percentage of completion", IsRequired=true)
        /** @var int */
        public int $percentage=0,

        /** @description Brand Trigram */
        // @ApiMember(Description="Brand Trigram", IsRequired=true)
        /** @var string */
        public string $brand='',

        /** @description Download url of created files */
        // @ApiMember(Description="Download url of created files")
        /** @var string|null */
        public ?string $downloadUrl=null,

        /** @description Presigned expiring download url */
        // @ApiMember(Description="Presigned expiring download url")
        /** @var string|null */
        public ?string $signedDownloadUrl=null,

        /** @description Total count of operations */
        // @ApiMember(Description="Total count of operations")
        /** @var int|null */
        public ?int $totalResults=null,

        /** @description Count of successful operations */
        // @ApiMember(Description="Count of successful operations")
        /** @var int|null */
        public ?int $totalSucceeded=null,

        /** @description Count of failed operations */
        // @ApiMember(Description="Count of failed operations")
        /** @var int|null */
        public ?int $totalFailed=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['asyncTaskId'])) $this->asyncTaskId = $o['asyncTaskId'];
        if (isset($o['type'])) $this->type = $o['type'];
        if (isset($o['requestDate'])) $this->requestDate = $o['requestDate'];
        if (isset($o['status'])) $this->status = $o['status'];
        if (isset($o['percentage'])) $this->percentage = $o['percentage'];
        if (isset($o['brand'])) $this->brand = $o['brand'];
        if (isset($o['downloadUrl'])) $this->downloadUrl = $o['downloadUrl'];
        if (isset($o['signedDownloadUrl'])) $this->signedDownloadUrl = $o['signedDownloadUrl'];
        if (isset($o['totalResults'])) $this->totalResults = $o['totalResults'];
        if (isset($o['totalSucceeded'])) $this->totalSucceeded = $o['totalSucceeded'];
        if (isset($o['totalFailed'])) $this->totalFailed = $o['totalFailed'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->asyncTaskId)) $o['asyncTaskId'] = $this->asyncTaskId;
        if (isset($this->type)) $o['type'] = $this->type;
        if (isset($this->requestDate)) $o['requestDate'] = $this->requestDate;
        if (isset($this->status)) $o['status'] = $this->status;
        if (isset($this->percentage)) $o['percentage'] = $this->percentage;
        if (isset($this->brand)) $o['brand'] = $this->brand;
        if (isset($this->downloadUrl)) $o['downloadUrl'] = $this->downloadUrl;
        if (isset($this->signedDownloadUrl)) $o['signedDownloadUrl'] = $this->signedDownloadUrl;
        if (isset($this->totalResults)) $o['totalResults'] = $this->totalResults;
        if (isset($this->totalSucceeded)) $o['totalSucceeded'] = $this->totalSucceeded;
        if (isset($this->totalFailed)) $o['totalFailed'] = $this->totalFailed;
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template array of Task
 */
class GetTaskResponse extends \ArrayObject implements JsonSerializable
{
    public function __construct(Task ...$items) {
        parent::__construct($items, \ArrayObject::STD_PROP_LIST);
    }
    
    /** @throws \Exception */
    public function append($value): void {
        if ($value instanceof Task)
            parent::append($value);
        else
            throw new \Exception("Can only append a Task to " . __CLASS__);
    }
    
    /** @throws Exception */
    public function fromMap($o): void {
        foreach ($o as $item) {
            $el = new Task();
            $el->fromMap($item);
            $this->append($el);
        }
    }
    
    /** @throws Exception */
    public function jsonSerialize(): array {
        return parent::getArrayCopy();
    }
}

class GetTask implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetTask 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.

GET /tasks HTTP/1.1 
Host: dev-api-booster.richemont.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ArrayOfTask xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.NightlyProcess.ServiceModel" />