Richemont.Booster2.PublicApi

<back to all web services

GetCustomerKpi

Requires Authentication
The following routes are available for this service:
GET/customer/{boosterCustomerId}/kpiGet customer KPI details
<?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 GetCustomerKpiResponse implements JsonSerializable
{
    public function __construct(
        /** @description Booster Customer ID */
        // @ApiMember(Description="Booster Customer ID", IsRequired=true)
        /** @var int */
        public int $boosterCustomerId=0,

        /** @description Total Transaction */
        // @ApiMember(Description="Total Transaction", IsRequired=true)
        /** @var int */
        public int $totalTransaction=0,

        /** @description Total Sales */
        // @ApiMember(Description="Total Sales", IsRequired=true)
        /** @var int */
        public int $totalSales=0,

        /** @description Total Return */
        // @ApiMember(Description="Total Return", IsRequired=true)
        /** @var int */
        public int $totalReturn=0,

        /** @description Total Items */
        // @ApiMember(Description="Total Items", IsRequired=true)
        /** @var int */
        public int $totalItems=0,

        /** @description Average Basket Amount */
        // @ApiMember(Description="Average Basket Amount", IsRequired=true)
        /** @var float */
        public float $averageBasketAmount=0.0,

        /** @description Total Spending Amount */
        // @ApiMember(Description="Total Spending Amount", IsRequired=true)
        /** @var float */
        public float $totalSpendingAmount=0.0,

        /** @description Currency code e.g. 'EUR', 'CHF' */
        // @ApiMember(Description="Currency code e.g. 'EUR', 'CHF'", IsRequired=true)
        /** @var string */
        public string $currencyCode=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['boosterCustomerId'])) $this->boosterCustomerId = $o['boosterCustomerId'];
        if (isset($o['totalTransaction'])) $this->totalTransaction = $o['totalTransaction'];
        if (isset($o['totalSales'])) $this->totalSales = $o['totalSales'];
        if (isset($o['totalReturn'])) $this->totalReturn = $o['totalReturn'];
        if (isset($o['totalItems'])) $this->totalItems = $o['totalItems'];
        if (isset($o['averageBasketAmount'])) $this->averageBasketAmount = $o['averageBasketAmount'];
        if (isset($o['totalSpendingAmount'])) $this->totalSpendingAmount = $o['totalSpendingAmount'];
        if (isset($o['currencyCode'])) $this->currencyCode = $o['currencyCode'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->boosterCustomerId)) $o['boosterCustomerId'] = $this->boosterCustomerId;
        if (isset($this->totalTransaction)) $o['totalTransaction'] = $this->totalTransaction;
        if (isset($this->totalSales)) $o['totalSales'] = $this->totalSales;
        if (isset($this->totalReturn)) $o['totalReturn'] = $this->totalReturn;
        if (isset($this->totalItems)) $o['totalItems'] = $this->totalItems;
        if (isset($this->averageBasketAmount)) $o['averageBasketAmount'] = $this->averageBasketAmount;
        if (isset($this->totalSpendingAmount)) $o['totalSpendingAmount'] = $this->totalSpendingAmount;
        if (isset($this->currencyCode)) $o['currencyCode'] = $this->currencyCode;
        return empty($o) ? new class(){} : $o;
    }
}

class GetCustomerKpi implements JsonSerializable
{
    public function __construct(
        /** @description Booster Customer ID */
        // @ApiMember(Description="Booster Customer ID", IsRequired=true)
        /** @var int */
        public int $boosterCustomerId=0,

        /** @description Transaction Date From e.g. '2022-01-01' */
        // @ApiMember(Description="Transaction Date From e.g. '2022-01-01'")
        /** @var DateTime|null */
        public ?DateTime $transactionDateFrom=null,

        /** @description Transaction Date To e.g. '2023-11-01' */
        // @ApiMember(Description="Transaction Date To e.g. '2023-11-01'")
        /** @var DateTime|null */
        public ?DateTime $transactionDateTo=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['boosterCustomerId'])) $this->boosterCustomerId = $o['boosterCustomerId'];
        if (isset($o['transactionDateFrom'])) $this->transactionDateFrom = JsonConverters::from('DateTime', $o['transactionDateFrom']);
        if (isset($o['transactionDateTo'])) $this->transactionDateTo = JsonConverters::from('DateTime', $o['transactionDateTo']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->boosterCustomerId)) $o['boosterCustomerId'] = $this->boosterCustomerId;
        if (isset($this->transactionDateFrom)) $o['transactionDateFrom'] = JsonConverters::to('DateTime', $this->transactionDateFrom);
        if (isset($this->transactionDateTo)) $o['transactionDateTo'] = JsonConverters::to('DateTime', $this->transactionDateTo);
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetCustomerKpi 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 /customer/{boosterCustomerId}/kpi HTTP/1.1 
Host: dev-api-booster.richemont.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"boosterCustomerId":0,"totalTransaction":0,"totalSales":0,"totalReturn":0,"totalItems":0,"averageBasketAmount":0,"totalSpendingAmount":0,"currencyCode":"String"}