| All Verbs | /feed |
|---|
<?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;
}
enum RTPStrategies : int
{
case RNG = 0;
case Default = 1;
}
class RoundConfiguration implements JsonSerializable
{
public function __construct(
/** @var int */
public int $countdownDurationInSeconds=0,
/** @var int */
public int $raceDurationInSeconds=0,
/** @var int */
public int $resultsDurationInSeconds=0,
/** @var RTPStrategies|null */
public ?RTPStrategies $rtpStrategy=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['countdownDurationInSeconds'])) $this->countdownDurationInSeconds = $o['countdownDurationInSeconds'];
if (isset($o['raceDurationInSeconds'])) $this->raceDurationInSeconds = $o['raceDurationInSeconds'];
if (isset($o['resultsDurationInSeconds'])) $this->resultsDurationInSeconds = $o['resultsDurationInSeconds'];
if (isset($o['rtpStrategy'])) $this->rtpStrategy = JsonConverters::from('RTPStrategies', $o['rtpStrategy']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->countdownDurationInSeconds)) $o['countdownDurationInSeconds'] = $this->countdownDurationInSeconds;
if (isset($this->raceDurationInSeconds)) $o['raceDurationInSeconds'] = $this->raceDurationInSeconds;
if (isset($this->resultsDurationInSeconds)) $o['resultsDurationInSeconds'] = $this->resultsDurationInSeconds;
if (isset($this->rtpStrategy)) $o['rtpStrategy'] = JsonConverters::to('RTPStrategies', $this->rtpStrategy);
return empty($o) ? new class(){} : $o;
}
}
enum OutcomeStatus : int
{
case Unknown = 0;
case Lost = 1;
case Won = 2;
case Void = 3;
}
class Outcome implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var float */
public float $odds=0.0,
/** @var OutcomeStatus|null */
public ?OutcomeStatus $status=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['odds'])) $this->odds = $o['odds'];
if (isset($o['status'])) $this->status = JsonConverters::from('OutcomeStatus', $o['status']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->odds)) $o['odds'] = $this->odds;
if (isset($this->status)) $o['status'] = JsonConverters::to('OutcomeStatus', $this->status);
return empty($o) ? new class(){} : $o;
}
}
class JackpotInfo implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $isGiven=null,
/** @var string|null */
public ?string $id=null,
/** @var string|null */
public ?string $slipId=null,
/** @var string|null */
public ?string $jpId=null,
/** @var float */
public float $amount=0.0,
/** @var string|null */
public ?string $locationId=null,
/** @var string|null */
public ?string $locationName=null,
/** @var string|null */
public ?string $addressLine=null,
/** @var float */
public float $amountAccumulated=0.0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['isGiven'])) $this->isGiven = $o['isGiven'];
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['slipId'])) $this->slipId = $o['slipId'];
if (isset($o['jpId'])) $this->jpId = $o['jpId'];
if (isset($o['amount'])) $this->amount = $o['amount'];
if (isset($o['locationId'])) $this->locationId = $o['locationId'];
if (isset($o['locationName'])) $this->locationName = $o['locationName'];
if (isset($o['addressLine'])) $this->addressLine = $o['addressLine'];
if (isset($o['amountAccumulated'])) $this->amountAccumulated = $o['amountAccumulated'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->isGiven)) $o['isGiven'] = $this->isGiven;
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->slipId)) $o['slipId'] = $this->slipId;
if (isset($this->jpId)) $o['jpId'] = $this->jpId;
if (isset($this->amount)) $o['amount'] = $this->amount;
if (isset($this->locationId)) $o['locationId'] = $this->locationId;
if (isset($this->locationName)) $o['locationName'] = $this->locationName;
if (isset($this->addressLine)) $o['addressLine'] = $this->addressLine;
if (isset($this->amountAccumulated)) $o['amountAccumulated'] = $this->amountAccumulated;
return empty($o) ? new class(){} : $o;
}
}
enum Stages : int
{
case None = 0;
case Countdown = 1;
case Processing = 2;
case Race = 3;
case Results = 4;
}
class RoundProgress implements JsonSerializable
{
public function __construct(
/** @var Stages|null */
public ?Stages $stage=null,
/** @var int */
public int $step=0,
/** @var int */
public int $steps=0,
/** @var DateTime */
public DateTime $utcTimestamp=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['stage'])) $this->stage = JsonConverters::from('Stages', $o['stage']);
if (isset($o['step'])) $this->step = $o['step'];
if (isset($o['steps'])) $this->steps = $o['steps'];
if (isset($o['utcTimestamp'])) $this->utcTimestamp = JsonConverters::from('DateTime', $o['utcTimestamp']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->stage)) $o['stage'] = JsonConverters::to('Stages', $this->stage);
if (isset($this->step)) $o['step'] = $this->step;
if (isset($this->steps)) $o['steps'] = $this->steps;
if (isset($this->utcTimestamp)) $o['utcTimestamp'] = JsonConverters::to('DateTime', $this->utcTimestamp);
return empty($o) ? new class(){} : $o;
}
}
class Round implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var DateTime */
public DateTime $createdAt=new DateTime(),
/** @var DateTime */
public DateTime $updatedAt=new DateTime(),
/** @var RoundStatus|null */
public ?RoundStatus $status=null,
/** @var RoundConfiguration|null */
public ?RoundConfiguration $configuration=null,
/** @var array<string,Outcome>|null */
public ?array $odds=null,
/** @var JackpotInfo|null */
public ?JackpotInfo $jackpotInfo=null,
/** @var string|null */
public ?string $sequence=null,
/** @var RoundProgress|null */
public ?RoundProgress $progress=null,
/** @var bool|null */
public ?bool $isLocked=null,
/** @var bool|null */
public ?bool $isCalculated=null
) {
}
/** @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['updatedAt'])) $this->updatedAt = JsonConverters::from('DateTime', $o['updatedAt']);
if (isset($o['status'])) $this->status = JsonConverters::from('RoundStatus', $o['status']);
if (isset($o['configuration'])) $this->configuration = JsonConverters::from('RoundConfiguration', $o['configuration']);
if (isset($o['odds'])) $this->odds = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['int','Outcome']), $o['odds']);
if (isset($o['jackpotInfo'])) $this->jackpotInfo = JsonConverters::from('JackpotInfo', $o['jackpotInfo']);
if (isset($o['sequence'])) $this->sequence = $o['sequence'];
if (isset($o['progress'])) $this->progress = JsonConverters::from('RoundProgress', $o['progress']);
if (isset($o['isLocked'])) $this->isLocked = $o['isLocked'];
if (isset($o['isCalculated'])) $this->isCalculated = $o['isCalculated'];
}
/** @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->updatedAt)) $o['updatedAt'] = JsonConverters::to('DateTime', $this->updatedAt);
if (isset($this->status)) $o['status'] = JsonConverters::to('RoundStatus', $this->status);
if (isset($this->configuration)) $o['configuration'] = JsonConverters::to('RoundConfiguration', $this->configuration);
if (isset($this->odds)) $o['odds'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['int','Outcome']), $this->odds);
if (isset($this->jackpotInfo)) $o['jackpotInfo'] = JsonConverters::to('JackpotInfo', $this->jackpotInfo);
if (isset($this->sequence)) $o['sequence'] = $this->sequence;
if (isset($this->progress)) $o['progress'] = JsonConverters::to('RoundProgress', $this->progress);
if (isset($this->isLocked)) $o['isLocked'] = $this->isLocked;
if (isset($this->isCalculated)) $o['isCalculated'] = $this->isCalculated;
return empty($o) ? new class(){} : $o;
}
}
class Feed implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var Round|null */
public ?Round $round=null,
/** @var JackpotInfo|null */
public ?JackpotInfo $lastJackpotInfo=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['round'])) $this->round = JsonConverters::from('Round', $o['round']);
if (isset($o['lastJackpotInfo'])) $this->lastJackpotInfo = JsonConverters::from('JackpotInfo', $o['lastJackpotInfo']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->round)) $o['round'] = JsonConverters::to('Round', $this->round);
if (isset($this->lastJackpotInfo)) $o['lastJackpotInfo'] = JsonConverters::to('JackpotInfo', $this->lastJackpotInfo);
return empty($o) ? new class(){} : $o;
}
}
class GetFeed implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
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 /feed HTTP/1.1
Host: grh1.api.bettor.webhop.biz
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
id: String,
round:
{
id: String,
createdAt: 0001-01-01,
updatedAt: 0001-01-01,
status: 0,
configuration:
{
countdownDurationInSeconds: 0,
raceDurationInSeconds: 0,
resultsDurationInSeconds: 0,
rtpStrategy: 0
},
odds:
{
0:
{
id: 0,
odds: 0,
status: 0
}
},
jackpotInfo:
{
isGiven: False,
id: String,
slipId: String,
jpId: String,
amount: 0,
locationId: String,
locationName: String,
addressLine: String,
amountAccumulated: 0
},
sequence: String,
progress:
{
stage: 0,
step: 0,
steps: 0,
utcTimestamp: 0001-01-01
},
isLocked: False,
isCalculated: False
},
lastJackpotInfo:
{
isGiven: False,
id: String,
slipId: String,
jpId: String,
amount: 0,
locationId: String,
locationName: String,
addressLine: String,
amountAccumulated: 0
}
}