Richemont.Booster2.PublicApi

<back to all web services

GetPosGroup

Requires Authentication
The following routes are available for this service:
GET/posGroupsGet the list of pos groups where user is authorized
<?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 Scope implements JsonSerializable
{
    public function __construct(
        /** @description Scope Code - combination of BU / Brand */
        // @ApiMember(Description="Scope Code - combination of BU / Brand", IsRequired=true)
        /** @var string */
        public string $scopeCode='',

        /** @description Business Unit Code */
        // @ApiMember(Description="Business Unit Code", IsRequired=true)
        /** @var string */
        public string $buCode='',

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

        /** @description Description of the combination */
        // @ApiMember(Description="Description of the combination", IsRequired=true)
        /** @var string */
        public string $description=''
    ) {
    }

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

class PosGroup extends Scope implements JsonSerializable
{
    /**
     * @param string $scopeCode
     * @param string $buCode
     * @param string $brand
     * @param string $description
     */
    public function __construct(
        string $scopeCode='',
        string $buCode='',
        string $brand='',
        string $description='',
        /** @description Pos Group code */
        // @ApiMember(Description="Pos Group code", IsRequired=true)
        /** @var int */
        public int $posGroupCode=0,

        /** @description Pos Group Description */
        // @ApiMember(Description="Pos Group Description", IsRequired=true)
        /** @var string */
        public string $posGroupDs='',

        /** @description Define if user is authorized to this pos group */
        // @ApiMember(Description="Define if user is authorized to this pos group", IsRequired=true)
        /** @var bool|null */
        public ?bool $isAuthorized=null
    ) {
        parent::__construct($scopeCode,$buCode,$brand,$description);
    }

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

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

class GetPosGroup implements JsonSerializable
{
    public function __construct(
        /** @description Brand Trigram */
        // @ApiMember(Description="Brand Trigram", IsRequired=true)
        /** @var string */
        public string $brand='',

        /** @description Business Unit Code */
        // @ApiMember(Description="Business Unit Code", IsRequired=true)
        /** @var string */
        public string $buCode=''
    ) {
    }

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

PHP GetPosGroup DTOs

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

HTTP + CSV

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

GET /posGroups HTTP/1.1 
Host: dev-api-booster.richemont.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

[]