Six4Win.WebApi

<back to all web services

GetLocalCodePotAccumulations

The following routes are available for this service:
All Verbs/qry/lcp/accumulations
<?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 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 LCPConfiguration implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $isActive=null,
        /** @var ThresholdInterval|null */
        public ?ThresholdInterval $interval=null,
        /** @var float */
        public float $pct=0.0
    ) {
    }

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

class BettingApp implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $version=null
    ) {
    }

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

class Ref implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $val=''
    ) {
    }

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

class RefEx extends Ref implements JsonSerializable
{
    /**
     * @param string $id
     * @param string $val
     */
    public function __construct(
        string $id='',
        string $val='',
        /** @var RecordDictionary2<string, string>|null */
        public ?RecordDictionary2 $data=null
    ) {
        parent::__construct($id,$val);
    }

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

class Origin implements JsonSerializable
{
    public function __construct(
        /** @var BettingApp|null */
        public ?BettingApp $application=null,
        /** @var string|null */
        public ?string $ip=null,
        /** @var RefEx|null */
        public ?RefEx $organization=null,
        /** @var Ref|null */
        public ?Ref $region=null,
        /** @var Ref|null */
        public ?Ref $locationGroup=null,
        /** @var RefEx|null */
        public ?RefEx $location=null,
        /** @var RefEx|null */
        public ?RefEx $device=null,
        /** @var Ref|null */
        public ?Ref $clerk=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['application'])) $this->application = JsonConverters::from('BettingApp', $o['application']);
        if (isset($o['ip'])) $this->ip = $o['ip'];
        if (isset($o['organization'])) $this->organization = JsonConverters::from('RefEx', $o['organization']);
        if (isset($o['region'])) $this->region = JsonConverters::from('Ref', $o['region']);
        if (isset($o['locationGroup'])) $this->locationGroup = JsonConverters::from('Ref', $o['locationGroup']);
        if (isset($o['location'])) $this->location = JsonConverters::from('RefEx', $o['location']);
        if (isset($o['device'])) $this->device = JsonConverters::from('RefEx', $o['device']);
        if (isset($o['clerk'])) $this->clerk = JsonConverters::from('Ref', $o['clerk']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->application)) $o['application'] = JsonConverters::to('BettingApp', $this->application);
        if (isset($this->ip)) $o['ip'] = $this->ip;
        if (isset($this->organization)) $o['organization'] = JsonConverters::to('RefEx', $this->organization);
        if (isset($this->region)) $o['region'] = JsonConverters::to('Ref', $this->region);
        if (isset($this->locationGroup)) $o['locationGroup'] = JsonConverters::to('Ref', $this->locationGroup);
        if (isset($this->location)) $o['location'] = JsonConverters::to('RefEx', $this->location);
        if (isset($this->device)) $o['device'] = JsonConverters::to('RefEx', $this->device);
        if (isset($this->clerk)) $o['clerk'] = JsonConverters::to('Ref', $this->clerk);
        return empty($o) ? new class(){} : $o;
    }
}

class WinnerByCode implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $roundId=null,
        /** @var DateTime */
        public DateTime $drawnAtUtc=new DateTime(),
        /** @var string|null */
        public ?string $slipId=null,
        /** @var string|null */
        public ?string $betId=null,
        /** @var string|null */
        public ?string $code=null,
        /** @var float */
        public float $amount=0.0,
        /** @var Origin|null */
        public ?Origin $origin=null,
        /** @var Ref|null */
        public ?Ref $bettor=null,
        /** @var string|null */
        public ?string $locationAddressOrBettorInfo=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['roundId'])) $this->roundId = $o['roundId'];
        if (isset($o['drawnAtUtc'])) $this->drawnAtUtc = JsonConverters::from('DateTime', $o['drawnAtUtc']);
        if (isset($o['slipId'])) $this->slipId = $o['slipId'];
        if (isset($o['betId'])) $this->betId = $o['betId'];
        if (isset($o['code'])) $this->code = $o['code'];
        if (isset($o['amount'])) $this->amount = $o['amount'];
        if (isset($o['origin'])) $this->origin = JsonConverters::from('Origin', $o['origin']);
        if (isset($o['bettor'])) $this->bettor = JsonConverters::from('Ref', $o['bettor']);
        if (isset($o['locationAddressOrBettorInfo'])) $this->locationAddressOrBettorInfo = $o['locationAddressOrBettorInfo'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->roundId)) $o['roundId'] = $this->roundId;
        if (isset($this->drawnAtUtc)) $o['drawnAtUtc'] = JsonConverters::to('DateTime', $this->drawnAtUtc);
        if (isset($this->slipId)) $o['slipId'] = $this->slipId;
        if (isset($this->betId)) $o['betId'] = $this->betId;
        if (isset($this->code)) $o['code'] = $this->code;
        if (isset($this->amount)) $o['amount'] = $this->amount;
        if (isset($this->origin)) $o['origin'] = JsonConverters::to('Origin', $this->origin);
        if (isset($this->bettor)) $o['bettor'] = JsonConverters::to('Ref', $this->bettor);
        if (isset($this->locationAddressOrBettorInfo)) $o['locationAddressOrBettorInfo'] = $this->locationAddressOrBettorInfo;
        return empty($o) ? new class(){} : $o;
    }
}

class LCPAccumulation implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $locId=null,
        /** @var string|null */
        public ?string $locName=null,
        /** @var float */
        public float $amount=0.0,
        /** @var float */
        public float $threshold=0.0,
        /** @var LCPConfiguration|null */
        public ?LCPConfiguration $cfg=null,
        /** @var array<WinnerByCode>|null */
        public ?array $winners=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['locId'])) $this->locId = $o['locId'];
        if (isset($o['locName'])) $this->locName = $o['locName'];
        if (isset($o['amount'])) $this->amount = $o['amount'];
        if (isset($o['threshold'])) $this->threshold = $o['threshold'];
        if (isset($o['cfg'])) $this->cfg = JsonConverters::from('LCPConfiguration', $o['cfg']);
        if (isset($o['winners'])) $this->winners = JsonConverters::fromArray('WinnerByCode', $o['winners']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->locId)) $o['locId'] = $this->locId;
        if (isset($this->locName)) $o['locName'] = $this->locName;
        if (isset($this->amount)) $o['amount'] = $this->amount;
        if (isset($this->threshold)) $o['threshold'] = $this->threshold;
        if (isset($this->cfg)) $o['cfg'] = JsonConverters::to('LCPConfiguration', $this->cfg);
        if (isset($this->winners)) $o['winners'] = JsonConverters::toArray('WinnerByCode', $this->winners);
        return empty($o) ? new class(){} : $o;
    }
}

class LocalCodePotAccumulations implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var array<string,LCPAccumulation>|null */
        public ?array $accumulations=null,
        /** @var string|null */
        public ?string $currentRoundId=null,
        /** @var string|null */
        public ?string $inertCode=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['accumulations'])) $this->accumulations = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','LCPAccumulation']), $o['accumulations']);
        if (isset($o['currentRoundId'])) $this->currentRoundId = $o['currentRoundId'];
        if (isset($o['inertCode'])) $this->inertCode = $o['inertCode'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->accumulations)) $o['accumulations'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','LCPAccumulation']), $this->accumulations);
        if (isset($this->currentRoundId)) $o['currentRoundId'] = $this->currentRoundId;
        if (isset($this->inertCode)) $o['inertCode'] = $this->inertCode;
        return empty($o) ? new class(){} : $o;
    }
}

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

/**
 * @template TKey
 * @template TVal
 * @template array of TKey
 * @template array1 of TVal
 */
class RecordDictionary2 extends array implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): RecordDictionary2 {
        $to = new RecordDictionary2();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetLocalCodePotAccumulations 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/lcp/accumulations HTTP/1.1 
Host: s4w2.api.bettor.cc 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<GetLocalCodePotAccumulations 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

<LocalCodePotAccumulations xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Six4Win.ReadModel">
  <Accumulations xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringLCPAccumulationQC5r2uXE>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value xmlns:d4p1="http://schemas.datacontract.org/2004/07/Six4Win">
        <d4p1:Amount>0</d4p1:Amount>
        <d4p1:Cfg>
          <d4p1:Interval>
            <d4p1:End>0</d4p1:End>
            <d4p1:Start>0</d4p1:Start>
          </d4p1:Interval>
          <d4p1:IsActive>false</d4p1:IsActive>
          <d4p1:Pct>0</d4p1:Pct>
        </d4p1:Cfg>
        <d4p1:LocId>String</d4p1:LocId>
        <d4p1:LocName>String</d4p1:LocName>
        <d4p1:Threshold>0</d4p1:Threshold>
        <d4p1:Winners xmlns:d5p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
          <d5p1:_array />
          <d5p1:_head>0</d5p1:_head>
          <d5p1:_size>0</d5p1:_size>
          <d5p1:_tail>0</d5p1:_tail>
          <d5p1:_version>0</d5p1:_version>
        </d4p1:Winners>
      </d2p1:Value>
    </d2p1:KeyValueOfstringLCPAccumulationQC5r2uXE>
  </Accumulations>
  <CurrentRoundId>String</CurrentRoundId>
  <Id>String</Id>
  <InertCode>String</InertCode>
</LocalCodePotAccumulations>