Richemont.Booster2.PublicApi

<back to all web services

GetRoles

Requires Authentication
The following routes are available for this service:
GET/rolesGet 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 Roles implements JsonSerializable
{
    public function __construct(
        /** @description Role Code */
        // @ApiMember(Description="Role Code", IsRequired=true)
        /** @var string */
        public string $roleCode='',

        /** @description Role Description */
        // @ApiMember(Description="Role Description", IsRequired=true)
        /** @var string */
        public string $roleDs='',

        /** @description Role Type */
        // @ApiMember(Description="Role Type", IsRequired=true)
        /** @var int */
        public int $roleType=0
    ) {
    }

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

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

class GetRoles implements JsonSerializable
{
    public function __construct(
        /** @description User type id */
        // @ApiMember(Description="User type id", IsRequired=true)
        /** @var string */
        public string $type=''
    ) {
    }

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

PHP GetRoles 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 /roles HTTP/1.1 
Host: dev-api-booster.richemont.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

[]