efun.id.api

<back to all web services

GetReceivedGiftcodeRequest

Requires Authentication
The following routes are available for this service:
GET/api/v1/games/{GameId}/giftcode/received
<?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 PagingRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $page=0,
        /** @var int */
        public int $limit=0,
        /** @var int */
        public int $offSet=0
    ) {
    }

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

class ReceivedGiftcodeResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $eventId=0,
        /** @var string */
        public string $eventName='',
        /** @var string|null */
        public ?string $eventUrl=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $iconUrl=null,
        /** @var string|null */
        public ?string $label=null,
        /** @var string|null */
        public ?string $labelColor=null,
        /** @var int */
        public int $eventType=0,
        /** @var string|null */
        public ?string $code=null,
        /** @var string|null */
        public ?string $serverId=null,
        /** @var string|null */
        public ?string $characterId=null,
        /** @var string|null */
        public ?string $characterName=null,
        /** @var DateTime|null */
        public ?DateTime $startDate=null,
        /** @var DateTime|null */
        public ?DateTime $dueDate=null,
        /** @var DateTime|null */
        public ?DateTime $eventStartDate=null,
        /** @var DateTime|null */
        public ?DateTime $eventEndDate=null,
        /** @var DateTime */
        public DateTime $createdDate=new DateTime(),
        /** @var bool|null */
        public ?bool $isUsed=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['eventId'])) $this->eventId = $o['eventId'];
        if (isset($o['eventName'])) $this->eventName = $o['eventName'];
        if (isset($o['eventUrl'])) $this->eventUrl = $o['eventUrl'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['iconUrl'])) $this->iconUrl = $o['iconUrl'];
        if (isset($o['label'])) $this->label = $o['label'];
        if (isset($o['labelColor'])) $this->labelColor = $o['labelColor'];
        if (isset($o['eventType'])) $this->eventType = $o['eventType'];
        if (isset($o['code'])) $this->code = $o['code'];
        if (isset($o['serverId'])) $this->serverId = $o['serverId'];
        if (isset($o['characterId'])) $this->characterId = $o['characterId'];
        if (isset($o['characterName'])) $this->characterName = $o['characterName'];
        if (isset($o['startDate'])) $this->startDate = JsonConverters::from('DateTime', $o['startDate']);
        if (isset($o['dueDate'])) $this->dueDate = JsonConverters::from('DateTime', $o['dueDate']);
        if (isset($o['eventStartDate'])) $this->eventStartDate = JsonConverters::from('DateTime', $o['eventStartDate']);
        if (isset($o['eventEndDate'])) $this->eventEndDate = JsonConverters::from('DateTime', $o['eventEndDate']);
        if (isset($o['createdDate'])) $this->createdDate = JsonConverters::from('DateTime', $o['createdDate']);
        if (isset($o['isUsed'])) $this->isUsed = $o['isUsed'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->eventId)) $o['eventId'] = $this->eventId;
        if (isset($this->eventName)) $o['eventName'] = $this->eventName;
        if (isset($this->eventUrl)) $o['eventUrl'] = $this->eventUrl;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->iconUrl)) $o['iconUrl'] = $this->iconUrl;
        if (isset($this->label)) $o['label'] = $this->label;
        if (isset($this->labelColor)) $o['labelColor'] = $this->labelColor;
        if (isset($this->eventType)) $o['eventType'] = $this->eventType;
        if (isset($this->code)) $o['code'] = $this->code;
        if (isset($this->serverId)) $o['serverId'] = $this->serverId;
        if (isset($this->characterId)) $o['characterId'] = $this->characterId;
        if (isset($this->characterName)) $o['characterName'] = $this->characterName;
        if (isset($this->startDate)) $o['startDate'] = JsonConverters::to('DateTime', $this->startDate);
        if (isset($this->dueDate)) $o['dueDate'] = JsonConverters::to('DateTime', $this->dueDate);
        if (isset($this->eventStartDate)) $o['eventStartDate'] = JsonConverters::to('DateTime', $this->eventStartDate);
        if (isset($this->eventEndDate)) $o['eventEndDate'] = JsonConverters::to('DateTime', $this->eventEndDate);
        if (isset($this->createdDate)) $o['createdDate'] = JsonConverters::to('DateTime', $this->createdDate);
        if (isset($this->isUsed)) $o['isUsed'] = $this->isUsed;
        return empty($o) ? new class(){} : $o;
    }
}

class GetReceivedGiftcodeRequest extends PagingRequest implements JsonSerializable
{
    /**
     * @param int $page
     * @param int $limit
     * @param int $offSet
     */
    public function __construct(
        int $page=0,
        int $limit=0,
        int $offSet=0,
        /** @var int */
        public int $gameId=0
    ) {
        parent::__construct($page,$limit,$offSet);
    }

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

class Pagination implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $total=0,
        /** @var int */
        public int $pages=0,
        /** @var int */
        public int $offset=0,
        /** @var int */
        public int $limit=0,
        /** @var int */
        public int $currentPage=0
    ) {
    }

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

/**
 * @template T
 */
class PageResponse implements IResponseRequest, JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): PageResponse {
        $to = new PageResponse();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        /** @var int */
        public mixed $code=0,
        /** @var string */
        public mixed $message='',
        /** @var array<ReceivedGiftcodeResponse>|null */
        public mixed $data=null,
        /** @var Pagination|null */
        public mixed $pagination=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['code'])) $this->code = $o['code'];
        if (isset($o['message'])) $this->message = $o['message'];
        if (isset($o['data'])) $this->data = JsonConverters::fromArray('ReceivedGiftcodeResponse', $o['data']);
        if (isset($o['pagination'])) $this->pagination = JsonConverters::from('Pagination', $o['pagination']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->code)) $o['code'] = $this->code;
        if (isset($this->message)) $o['message'] = $this->message;
        if (isset($this->data)) $o['data'] = JsonConverters::toArray('ReceivedGiftcodeResponse', $this->data);
        if (isset($this->pagination)) $o['pagination'] = JsonConverters::to('Pagination', $this->pagination);
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetReceivedGiftcodeRequest DTOs

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

HTTP + JSV

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

GET /api/v1/games/{GameId}/giftcode/received HTTP/1.1 
Host: efun-id-api-sandbox.efun.vn 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	code: 0,
	message: String,
	data: 
	[
		{
			eventId: 0,
			eventName: String,
			eventUrl: String,
			description: String,
			iconUrl: String,
			label: String,
			labelColor: String,
			eventType: 0,
			code: String,
			serverId: String,
			characterId: String,
			characterName: String,
			startDate: "0001-01-01T00:00:00.0000000+07:06",
			dueDate: "0001-01-01T00:00:00.0000000+07:06",
			eventStartDate: "0001-01-01T00:00:00.0000000+07:06",
			eventEndDate: "0001-01-01T00:00:00.0000000+07:06",
			isUsed: False
		}
	]
}