Six4Win.WebApi

<back to all web services

GetFeedHeartbeat

The following routes are available for this service:
All Verbs/qry/feed/hb
<?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 Stages : int
{
    case None = 0;
    case Countdown = 1;
    case Processing = 2;
    case Draw = 3;
    case Results = 4;
}

class Progress implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $step=0,
        /** @var int */
        public int $steps=0,
        /** @var float */
        public float $pct=0.0
    ) {
    }

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

class FeedHeartbeat implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $roundId=null,
        /** @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(),
        /** @var int */
        public int $lockdownStepFromEnd=0,
        /** @var Progress|null */
        public ?Progress $overall=null,
        /** @var bool|null */
        public ?bool $isHappyHour=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['roundId'])) $this->roundId = $o['roundId'];
        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']);
        if (isset($o['lockdownStepFromEnd'])) $this->lockdownStepFromEnd = $o['lockdownStepFromEnd'];
        if (isset($o['overall'])) $this->overall = JsonConverters::from('Progress', $o['overall']);
        if (isset($o['isHappyHour'])) $this->isHappyHour = $o['isHappyHour'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->roundId)) $o['roundId'] = $this->roundId;
        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);
        if (isset($this->lockdownStepFromEnd)) $o['lockdownStepFromEnd'] = $this->lockdownStepFromEnd;
        if (isset($this->overall)) $o['overall'] = JsonConverters::to('Progress', $this->overall);
        if (isset($this->isHappyHour)) $o['isHappyHour'] = $this->isHappyHour;
        return empty($o) ? new class(){} : $o;
    }
}

class GetFeedHeartbeat implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetFeedHeartbeat DTOs

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

HTTP + OTHER

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

POST /qry/feed/hb HTTP/1.1 
Host: s4w2.api.bettor.cc 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"roundId":"String","stage":0,"step":0,"steps":0,"utcTimestamp":"0001-01-01T00:00:00.0000000Z","lockdownStepFromEnd":0,"overall":{"step":0,"steps":0,"pct":0},"isHappyHour":false}