Greyhounds.WebApi

<back to all web services

GetAccumulatorConfig

The following routes are available for this service:
All Verbs/config/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
    ) {
    }

    /** @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'];
    }
    
    /** @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;
        return empty($o) ? new class(){} : $o;
    }
}

enum LocationOptimizationLevel : int
{
    case None = 0;
    case Low = 1;
    case Medium = 2;
    case High = 3;
}

class ThresholdInterval implements JsonSerializable
{
    public function __construct(
        /** @var float */
        public float $start=0.0,
        /** @var float */
        public float $end=0.0
    ) {
    }

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

class AccumulatorConfiguration implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var array<Pool>|null */
        public ?array $pools=null,
        /** @var float */
        public float $prevalentStake=0.0,
        /** @var LocationOptimizationLevel|null */
        public ?LocationOptimizationLevel $locationOptimizationLevel=null,
        /** @var ThresholdInterval|null */
        public ?ThresholdInterval $jackPotThresholdInterval=null
    ) {
    }

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

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

PHP GetAccumulatorConfig 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 /config/accumulator HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

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

<AccumulatorConfiguration xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Greyhounds.ReadModel">
  <Id>String</Id>
  <JackPotThresholdInterval>
    <End>0</End>
    <Start>0</Start>
  </JackPotThresholdInterval>
  <LocationOptimizationLevel>None</LocationOptimizationLevel>
  <Pools>
    <AccumulatorConfiguration.Pool>
      <Id>0</Id>
      <Name>String</Name>
      <RTP>0</RTP>
    </AccumulatorConfiguration.Pool>
  </Pools>
  <PrevalentStake>0</PrevalentStake>
</AccumulatorConfiguration>