Six4Win.WebApi

<back to all web services

GetLastRoundsStats

The following routes are available for this service:
All Verbs/qry/stats/last10
<?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 Rating implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $val=0,
        /** @var int */
        public int $count=0
    ) {
    }

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

class Comparison implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $v1=0,
        /** @var int */
        public int $v2=0,
        /** @var float */
        public float $p1=0.0,
        /** @var float */
        public float $p2=0.0
    ) {
    }

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

class LastRoundsStats implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var int[]|null */
        public ?array $topSix=null,
        /** @var int[]|null */
        public ?array $bottomSix=null,
        /** @var array<Rating>|null */
        public ?array $topFirstColors=null,
        /** @var array<Rating>|null */
        public ?array $topColors=null,
        /** @var Comparison|null */
        public ?Comparison $firstNrEvenVsOdd=null,
        /** @var Comparison|null */
        public ?Comparison $firstNrLessVsGreater24_5=null,
        /** @var Comparison|null */
        public ?Comparison $sumOfFirstFiveLessVsGreaterThan122_5=null,
        /** @var Comparison|null */
        public ?Comparison $totalEvenVsOdd=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['topSix'])) $this->topSix = JsonConverters::fromArray('int', $o['topSix']);
        if (isset($o['bottomSix'])) $this->bottomSix = JsonConverters::fromArray('int', $o['bottomSix']);
        if (isset($o['topFirstColors'])) $this->topFirstColors = JsonConverters::fromArray('Rating', $o['topFirstColors']);
        if (isset($o['topColors'])) $this->topColors = JsonConverters::fromArray('Rating', $o['topColors']);
        if (isset($o['firstNrEvenVsOdd'])) $this->firstNrEvenVsOdd = JsonConverters::from('Comparison', $o['firstNrEvenVsOdd']);
        if (isset($o['firstNrLessVsGreater24_5'])) $this->firstNrLessVsGreater24_5 = JsonConverters::from('Comparison', $o['firstNrLessVsGreater24_5']);
        if (isset($o['sumOfFirstFiveLessVsGreaterThan122_5'])) $this->sumOfFirstFiveLessVsGreaterThan122_5 = JsonConverters::from('Comparison', $o['sumOfFirstFiveLessVsGreaterThan122_5']);
        if (isset($o['totalEvenVsOdd'])) $this->totalEvenVsOdd = JsonConverters::from('Comparison', $o['totalEvenVsOdd']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->topSix)) $o['topSix'] = JsonConverters::toArray('int', $this->topSix);
        if (isset($this->bottomSix)) $o['bottomSix'] = JsonConverters::toArray('int', $this->bottomSix);
        if (isset($this->topFirstColors)) $o['topFirstColors'] = JsonConverters::toArray('Rating', $this->topFirstColors);
        if (isset($this->topColors)) $o['topColors'] = JsonConverters::toArray('Rating', $this->topColors);
        if (isset($this->firstNrEvenVsOdd)) $o['firstNrEvenVsOdd'] = JsonConverters::to('Comparison', $this->firstNrEvenVsOdd);
        if (isset($this->firstNrLessVsGreater24_5)) $o['firstNrLessVsGreater24_5'] = JsonConverters::to('Comparison', $this->firstNrLessVsGreater24_5);
        if (isset($this->sumOfFirstFiveLessVsGreaterThan122_5)) $o['sumOfFirstFiveLessVsGreaterThan122_5'] = JsonConverters::to('Comparison', $this->sumOfFirstFiveLessVsGreaterThan122_5);
        if (isset($this->totalEvenVsOdd)) $o['totalEvenVsOdd'] = JsonConverters::to('Comparison', $this->totalEvenVsOdd);
        return empty($o) ? new class(){} : $o;
    }
}

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

PHP GetLastRoundsStats DTOs

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

HTTP + XML

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

POST /qry/stats/last10 HTTP/1.1 
Host: s4w2.api.bettor.cc 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<GetLastRoundsStats xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Six4Win.WebApi.ServiceModel" />
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<LastRoundsStats xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Six4Win.ReadModel.Stats">
  <BottomSix xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </BottomSix>
  <FirstNrEvenVsOdd>
    <V1>0</V1>
    <V2>0</V2>
  </FirstNrEvenVsOdd>
  <FirstNrLessVsGreater24_5>
    <V1>0</V1>
    <V2>0</V2>
  </FirstNrLessVsGreater24_5>
  <Id>String</Id>
  <SumOfFirstFiveLessVsGreaterThan122_5>
    <V1>0</V1>
    <V2>0</V2>
  </SumOfFirstFiveLessVsGreaterThan122_5>
  <TopColors>
    <LastRoundsStats.Rating>
      <Count>0</Count>
      <Val>0</Val>
    </LastRoundsStats.Rating>
  </TopColors>
  <TopFirstColors>
    <LastRoundsStats.Rating>
      <Count>0</Count>
      <Val>0</Val>
    </LastRoundsStats.Rating>
  </TopFirstColors>
  <TopSix xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </TopSix>
  <TotalEvenVsOdd>
    <V1>0</V1>
    <V2>0</V2>
  </TotalEvenVsOdd>
</LastRoundsStats>