Six4Win.WebApi

<back to all web services

GetGameConfig

The following routes are available for this service:
All Verbs/qry/config/game
<?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 CountdownConfiguration implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $lockdownStepFromEnd=0,
        /** @var int */
        public int $assertLockdownStepFromEnd=0
    ) {
    }

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

class DrawConfiguration implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $introIntervalInMs=0,
        /** @var int */
        public int $animationIntervalInMs=0,
        /** @var int */
        public int $outroIntervalInMs=0
    ) {
    }

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

enum RTPStrategies : int
{
    case RNG = 0;
    case Accumulator = 1;
}

class HappyHourConfiguration implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $isHappyHour=null,
        /** @var float */
        public float $oddsModifier=0.0,
        /** @var float */
        public float $roundPoolBonusPct=0.0
    ) {
    }

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

class RoundConfiguration implements JsonSerializable
{
    public function __construct(
        /** @var RecordList<float>|null */
        public ?RecordList $coefficients=null,
        /** @var bool|null */
        public ?bool $isDoubleTripleActive=null,
        /** @var bool|null */
        public ?bool $isJackpot5Active=null,
        /** @var int */
        public int $countdownDurationInSeconds=0,
        /** @var CountdownConfiguration|null */
        public ?CountdownConfiguration $countdownConfiguration=null,
        /** @var DrawConfiguration|null */
        public ?DrawConfiguration $drawConfiguration=null,
        /** @var int */
        public int $resultsDurationInSeconds=0,
        /** @var RTPStrategies|null */
        public ?RTPStrategies $rtpStrategy=null,
        /** @var HappyHourConfiguration|null */
        public ?HappyHourConfiguration $happyHourConfiguration=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['coefficients'])) $this->coefficients = JsonConverters::from(JsonConverters::context('RecordList',genericArgs:['int']), $o['coefficients']);
        if (isset($o['isDoubleTripleActive'])) $this->isDoubleTripleActive = $o['isDoubleTripleActive'];
        if (isset($o['isJackpot5Active'])) $this->isJackpot5Active = $o['isJackpot5Active'];
        if (isset($o['countdownDurationInSeconds'])) $this->countdownDurationInSeconds = $o['countdownDurationInSeconds'];
        if (isset($o['countdownConfiguration'])) $this->countdownConfiguration = JsonConverters::from('CountdownConfiguration', $o['countdownConfiguration']);
        if (isset($o['drawConfiguration'])) $this->drawConfiguration = JsonConverters::from('DrawConfiguration', $o['drawConfiguration']);
        if (isset($o['resultsDurationInSeconds'])) $this->resultsDurationInSeconds = $o['resultsDurationInSeconds'];
        if (isset($o['rtpStrategy'])) $this->rtpStrategy = JsonConverters::from('RTPStrategies', $o['rtpStrategy']);
        if (isset($o['happyHourConfiguration'])) $this->happyHourConfiguration = JsonConverters::from('HappyHourConfiguration', $o['happyHourConfiguration']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->coefficients)) $o['coefficients'] = JsonConverters::to(JsonConverters::context('RecordList',genericArgs:['int']), $this->coefficients);
        if (isset($this->isDoubleTripleActive)) $o['isDoubleTripleActive'] = $this->isDoubleTripleActive;
        if (isset($this->isJackpot5Active)) $o['isJackpot5Active'] = $this->isJackpot5Active;
        if (isset($this->countdownDurationInSeconds)) $o['countdownDurationInSeconds'] = $this->countdownDurationInSeconds;
        if (isset($this->countdownConfiguration)) $o['countdownConfiguration'] = JsonConverters::to('CountdownConfiguration', $this->countdownConfiguration);
        if (isset($this->drawConfiguration)) $o['drawConfiguration'] = JsonConverters::to('DrawConfiguration', $this->drawConfiguration);
        if (isset($this->resultsDurationInSeconds)) $o['resultsDurationInSeconds'] = $this->resultsDurationInSeconds;
        if (isset($this->rtpStrategy)) $o['rtpStrategy'] = JsonConverters::to('RTPStrategies', $this->rtpStrategy);
        if (isset($this->happyHourConfiguration)) $o['happyHourConfiguration'] = JsonConverters::to('HappyHourConfiguration', $this->happyHourConfiguration);
        return empty($o) ? new class(){} : $o;
    }
}

class TimePoint implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $hour=0,
        /** @var int */
        public int $minute=0
    ) {
    }

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

class TimeInterval implements JsonSerializable
{
    public function __construct(
        /** @var TimePoint|null */
        public ?TimePoint $start=null,
        /** @var TimePoint|null */
        public ?TimePoint $end=null
    ) {
    }

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

class HappyHourItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var TimeInterval|null */
        public ?TimeInterval $interval=null,
        /** @var float */
        public float $oddsModifier=0.0,
        /** @var float */
        public float $roundPoolBonusPct=0.0
    ) {
    }

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

class HappyHourConfig implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $isActive=null,
        /** @var array<HappyHourItem>|null */
        public ?array $items=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['isActive'])) $this->isActive = $o['isActive'];
        if (isset($o['items'])) $this->items = JsonConverters::fromArray('HappyHourItem', $o['items']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->isActive)) $o['isActive'] = $this->isActive;
        if (isset($this->items)) $o['items'] = JsonConverters::toArray('HappyHourItem', $this->items);
        return empty($o) ? new class(){} : $o;
    }
}

class GameConfiguration implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var int */
        public int $queueSize=0,
        /** @var RoundConfiguration|null */
        public ?RoundConfiguration $roundConfiguration=null,
        /** @var HappyHourConfig|null */
        public ?HappyHourConfig $happyHourConfig=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['queueSize'])) $this->queueSize = $o['queueSize'];
        if (isset($o['roundConfiguration'])) $this->roundConfiguration = JsonConverters::from('RoundConfiguration', $o['roundConfiguration']);
        if (isset($o['happyHourConfig'])) $this->happyHourConfig = JsonConverters::from('HappyHourConfig', $o['happyHourConfig']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->queueSize)) $o['queueSize'] = $this->queueSize;
        if (isset($this->roundConfiguration)) $o['roundConfiguration'] = JsonConverters::to('RoundConfiguration', $this->roundConfiguration);
        if (isset($this->happyHourConfig)) $o['happyHourConfig'] = JsonConverters::to('HappyHourConfig', $this->happyHourConfig);
        return empty($o) ? new class(){} : $o;
    }
}

class GetGameConfig implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $locationId=null
    ) {
    }

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

/**
 * @template T
 * @template array of T
 */
class RecordList extends \ArrayObject implements JsonSerializable
{
    public function __construct(T ...$items) {
        parent::__construct($items, \ArrayObject::STD_PROP_LIST);
    }
    
    /** @throws \Exception */
    public function append($value): void {
        if ($value instanceof T)
            parent::append($value);
        else
            throw new \Exception("Can only append a T to " . __CLASS__);
    }
    
    /** @throws Exception */
    public function fromMap($o): void {
        foreach ($o as $item) {
            $el = new T();
            $el->fromMap($item);
            $this->append($el);
        }
    }
    
    /** @throws Exception */
    public function jsonSerialize(): array {
        return parent::getArrayCopy();
    }
}

PHP GetGameConfig 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.

POST /qry/config/game HTTP/1.1 
Host: s4w2.api.bettor.cc 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	locationId: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	id: String,
	queueSize: 0,
	roundConfiguration: 
	{
		coefficients: 
		[
			0
		],
		isDoubleTripleActive: False,
		isJackpot5Active: False,
		countdownDurationInSeconds: 0,
		countdownConfiguration: 
		{
			lockdownStepFromEnd: 0,
			assertLockdownStepFromEnd: 0
		},
		drawConfiguration: 
		{
			introIntervalInMs: 0,
			animationIntervalInMs: 0,
			outroIntervalInMs: 0
		},
		resultsDurationInSeconds: 0,
		rtpStrategy: 0,
		happyHourConfiguration: 
		{
			isHappyHour: False,
			oddsModifier: 0,
			roundPoolBonusPct: 0
		}
	},
	happyHourConfig: 
	{
		isActive: False,
		items: 
		[
			{
				id: 0,
				interval: 
				{
					start: 
					{
						hour: 0,
						minute: 0
					},
					end: 
					{
						hour: 0,
						minute: 0
					}
				},
				oddsModifier: 0,
				roundPoolBonusPct: 0
			}
		]
	}
}