| All Verbs | /rounds/stats |
|---|
<?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};
enum RoundStatus : int
{
case Pending = 0;
case InProgress = 1;
case Ended = 2;
}
class RoundStats implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var DateTime */
public DateTime $createdAt=new DateTime(),
/** @var RoundStatus|null */
public ?RoundStatus $status=null,
/** @var int */
public int $canceledCount=0,
/** @var float */
public float $canceledAmount=0.0,
/** @var int */
public int $betCount=0,
/** @var float */
public float $stakeAmount=0.0,
/** @var float */
public float $winningsAmount=0.0,
/** @var float */
public float $balanceAmount=0.0,
/** @var float */
public float $balancePct=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['createdAt'])) $this->createdAt = JsonConverters::from('DateTime', $o['createdAt']);
if (isset($o['status'])) $this->status = JsonConverters::from('RoundStatus', $o['status']);
if (isset($o['canceledCount'])) $this->canceledCount = $o['canceledCount'];
if (isset($o['canceledAmount'])) $this->canceledAmount = $o['canceledAmount'];
if (isset($o['betCount'])) $this->betCount = $o['betCount'];
if (isset($o['stakeAmount'])) $this->stakeAmount = $o['stakeAmount'];
if (isset($o['winningsAmount'])) $this->winningsAmount = $o['winningsAmount'];
if (isset($o['balanceAmount'])) $this->balanceAmount = $o['balanceAmount'];
if (isset($o['balancePct'])) $this->balancePct = $o['balancePct'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->createdAt)) $o['createdAt'] = JsonConverters::to('DateTime', $this->createdAt);
if (isset($this->status)) $o['status'] = JsonConverters::to('RoundStatus', $this->status);
if (isset($this->canceledCount)) $o['canceledCount'] = $this->canceledCount;
if (isset($this->canceledAmount)) $o['canceledAmount'] = $this->canceledAmount;
if (isset($this->betCount)) $o['betCount'] = $this->betCount;
if (isset($this->stakeAmount)) $o['stakeAmount'] = $this->stakeAmount;
if (isset($this->winningsAmount)) $o['winningsAmount'] = $this->winningsAmount;
if (isset($this->balanceAmount)) $o['balanceAmount'] = $this->balanceAmount;
if (isset($this->balancePct)) $o['balancePct'] = $this->balancePct;
return empty($o) ? new class(){} : $o;
}
}
class FindRoundStats implements JsonSerializable
{
public function __construct(
/** @var DateTime */
public DateTime $periodFrom=new DateTime(),
/** @var DateTime */
public DateTime $periodTo=new DateTime(),
/** @var int */
public int $currentPage=0,
/** @var int */
public int $pageSize=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['periodFrom'])) $this->periodFrom = JsonConverters::from('DateTime', $o['periodFrom']);
if (isset($o['periodTo'])) $this->periodTo = JsonConverters::from('DateTime', $o['periodTo']);
if (isset($o['currentPage'])) $this->currentPage = $o['currentPage'];
if (isset($o['pageSize'])) $this->pageSize = $o['pageSize'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->periodFrom)) $o['periodFrom'] = JsonConverters::to('DateTime', $this->periodFrom);
if (isset($this->periodTo)) $o['periodTo'] = JsonConverters::to('DateTime', $this->periodTo);
if (isset($this->currentPage)) $o['currentPage'] = $this->currentPage;
if (isset($this->pageSize)) $o['pageSize'] = $this->pageSize;
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class PaginatedResult implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): PaginatedResult {
$to = new PaginatedResult();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var array<RoundStats>|null */
public mixed $data=null,
/** @var int */
public mixed $currentPage=0,
/** @var int */
public mixed $pageSize=0,
/** @var int */
public mixed $totalItems=0,
/** @var int */
public mixed $totalPages=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['data'])) $this->data = JsonConverters::fromArray('RoundStats', $o['data']);
if (isset($o['currentPage'])) $this->currentPage = $o['currentPage'];
if (isset($o['pageSize'])) $this->pageSize = $o['pageSize'];
if (isset($o['totalItems'])) $this->totalItems = $o['totalItems'];
if (isset($o['totalPages'])) $this->totalPages = $o['totalPages'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->data)) $o['data'] = JsonConverters::toArray('RoundStats', $this->data);
if (isset($this->currentPage)) $o['currentPage'] = $this->currentPage;
if (isset($this->pageSize)) $o['pageSize'] = $this->pageSize;
if (isset($this->totalItems)) $o['totalItems'] = $this->totalItems;
if (isset($this->totalPages)) $o['totalPages'] = $this->totalPages;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /rounds/stats HTTP/1.1
Host: grh1.api.bettor.webhop.biz
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
periodFrom: 0001-01-01,
periodTo: 0001-01-01,
currentPage: 0,
pageSize: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
data:
[
{
id: String,
createdAt: 0001-01-01,
status: 0,
canceledCount: 0,
canceledAmount: 0,
betCount: 0,
stakeAmount: 0,
winningsAmount: 0,
balanceAmount: 0,
balancePct: 0
}
],
currentPage: 0,
pageSize: 0,
totalItems: 0,
totalPages: 0
}