| All Verbs | /locations/byRound |
|---|
<?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 Order : int
{
case None = 0;
case Ascending = 1;
case Descending = 2;
}
class FindLocationRoundStats implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $roundId=null,
/** @var string|null */
public ?string $search=null,
/** @var string|null */
public ?string $orderBy=null,
/** @var Order|null */
public ?Order $order=null,
/** @var int */
public int $currentPage=0,
/** @var int */
public int $pageSize=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['roundId'])) $this->roundId = $o['roundId'];
if (isset($o['search'])) $this->search = $o['search'];
if (isset($o['orderBy'])) $this->orderBy = $o['orderBy'];
if (isset($o['order'])) $this->order = JsonConverters::from('Order', $o['order']);
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->roundId)) $o['roundId'] = $this->roundId;
if (isset($this->search)) $o['search'] = $this->search;
if (isset($this->orderBy)) $o['orderBy'] = $this->orderBy;
if (isset($this->order)) $o['order'] = JsonConverters::to('Order', $this->order);
if (isset($this->currentPage)) $o['currentPage'] = $this->currentPage;
if (isset($this->pageSize)) $o['pageSize'] = $this->pageSize;
return empty($o) ? new class(){} : $o;
}
}
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;
}
}
/**
* @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;
}
}
PHP FindLocationRoundStats DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /locations/byRound HTTP/1.1
Host: grh1.api.bettor.webhop.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<FindLocationRoundStats xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Greyhounds.WebApi.ServiceModel">
<CurrentPage>0</CurrentPage>
<Order>None</Order>
<OrderBy>String</OrderBy>
<PageSize>0</PageSize>
<RoundId>String</RoundId>
<Search>String</Search>
</FindLocationRoundStats>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<PaginatedResultOfLocationRoundStatsHTcU5Hwp xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Greyhounds.ReadModel">
<CurrentPage>0</CurrentPage>
<Data>
<LocationRoundStats>
<BetAmount>0</BetAmount>
<BetCount>0</BetCount>
<Location>String</Location>
<LocationId>String</LocationId>
<Pct>0</Pct>
<RoundId>String</RoundId>
</LocationRoundStats>
</Data>
<PageSize>0</PageSize>
<TotalItems>0</TotalItems>
<TotalPages>0</TotalPages>
</PaginatedResultOfLocationRoundStatsHTcU5Hwp>