Six4Win.WebApi

<back to all web services

GetAccumulator

The following routes are available for this service:
All Verbs/qry/accumulator
<?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 Pool implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $name=null,
        /** @var float */
        public float $coefficient=0.0,
        /** @var float */
        public float $rtp=0.0,
        /** @var float */
        public float $threshold=0.0,
        /** @var float */
        public float $balance=0.0,
        /** @var float */
        public float $rrtp=0.0,
        /** @var float */
        public float $rBalance=0.0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['coefficient'])) $this->coefficient = $o['coefficient'];
        if (isset($o['rtp'])) $this->rtp = $o['rtp'];
        if (isset($o['threshold'])) $this->threshold = $o['threshold'];
        if (isset($o['balance'])) $this->balance = $o['balance'];
        if (isset($o['rrtp'])) $this->rrtp = $o['rrtp'];
        if (isset($o['rBalance'])) $this->rBalance = $o['rBalance'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->coefficient)) $o['coefficient'] = $this->coefficient;
        if (isset($this->rtp)) $o['rtp'] = $this->rtp;
        if (isset($this->threshold)) $o['threshold'] = $this->threshold;
        if (isset($this->balance)) $o['balance'] = $this->balance;
        if (isset($this->rrtp)) $o['rrtp'] = $this->rrtp;
        if (isset($this->rBalance)) $o['rBalance'] = $this->rBalance;
        return empty($o) ? new class(){} : $o;
    }
}

class Accumulator implements JsonSerializable
{
    public function __construct(
        /** @var array<Pool>|null */
        public ?array $pools=null,
        /** @var float */
        public float $rtp=0.0
    ) {
    }

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

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

PHP GetAccumulator DTOs

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

HTTP + CSV

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

POST /qry/accumulator HTTP/1.1 
Host: s4w2.api.bettor.cc 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

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

{"pools":[{"id":0,"name":"String","coefficient":0,"rtp":0,"threshold":0,"balance":0,"rrtp":0,"rBalance":0}],"rtp":0}