Richemont.Booster2.PublicApi

<back to all web services

GetUserAuth

Requires Authentication
The following routes are available for this service:
GET/user/{userId}/authorizeGet user if exists and is not disabled
<?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 Auth implements JsonSerializable
{
    public function __construct(
        /** @description Brand Trigram */
        // @ApiMember(Description="Brand Trigram", IsRequired=true)
        /** @var string */
        public string $brand='',

        /** @description List of Pos Group - in case of internal user */
        // @ApiMember(Description="List of Pos Group - in case of internal user")
        /** @var array<int>|null */
        public ?array $posGroups=null,

        /** @description Pos Code - in case of external users */
        // @ApiMember(Description="Pos Code - in case of external users")
        /** @var string|null */
        public ?string $posCode=null,

        /** @description List of user roles */
        // @ApiMember(Description="List of user roles", IsRequired=true)
        /** @var array<string>|null */
        public ?array $roles=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['brand'])) $this->brand = $o['brand'];
        if (isset($o['posGroups'])) $this->posGroups = JsonConverters::fromArray('int', $o['posGroups']);
        if (isset($o['posCode'])) $this->posCode = $o['posCode'];
        if (isset($o['roles'])) $this->roles = JsonConverters::fromArray('Guid', $o['roles']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->brand)) $o['brand'] = $this->brand;
        if (isset($this->posGroups)) $o['posGroups'] = JsonConverters::toArray('int', $this->posGroups);
        if (isset($this->posCode)) $o['posCode'] = $this->posCode;
        if (isset($this->roles)) $o['roles'] = JsonConverters::toArray('Guid', $this->roles);
        return empty($o) ? new class(){} : $o;
    }
}

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

class GetUserAuth implements JsonSerializable
{
    public function __construct(
        /** @description User's UserID */
        // @ApiMember(Description="User's UserID", IsRequired=true)
        /** @var string */
        public string $userId=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['userId'])) $this->userId = $o['userId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->userId)) $o['userId'] = $this->userId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetUserAuth DTOs

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

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /user/{userId}/authorize HTTP/1.1 
Host: dev-api-booster.richemont.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

[]