Greyhounds.WebApi

<back to all web services

BatchCancelBets

The following routes are available for this service:
POST/bets/cancel/batch
<?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 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 Reference implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $value=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['value'])) $this->value = $o['value'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->value)) $o['value'] = $this->value;
        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 Reference|null */
        public ?Reference $organization=null,
        /** @var Reference|null */
        public ?Reference $device=null,
        /** @var Reference|null */
        public ?Reference $location=null,
        /** @var Reference|null */
        public ?Reference $locationGroup=null,
        /** @var Reference|null */
        public ?Reference $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('Reference', $o['organization']);
        if (isset($o['device'])) $this->device = JsonConverters::from('Reference', $o['device']);
        if (isset($o['location'])) $this->location = JsonConverters::from('Reference', $o['location']);
        if (isset($o['locationGroup'])) $this->locationGroup = JsonConverters::from('Reference', $o['locationGroup']);
        if (isset($o['clerk'])) $this->clerk = JsonConverters::from('Reference', $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('Reference', $this->organization);
        if (isset($this->device)) $o['device'] = JsonConverters::to('Reference', $this->device);
        if (isset($this->location)) $o['location'] = JsonConverters::to('Reference', $this->location);
        if (isset($this->locationGroup)) $o['locationGroup'] = JsonConverters::to('Reference', $this->locationGroup);
        if (isset($this->clerk)) $o['clerk'] = JsonConverters::to('Reference', $this->clerk);
        return empty($o) ? new class(){} : $o;
    }
}

class BatchCancelBets implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $slipId=null,
        /** @var Origin|null */
        public ?Origin $origin=null,
        /** @var array<string>|null */
        public ?array $betIds=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['slipId'])) $this->slipId = $o['slipId'];
        if (isset($o['origin'])) $this->origin = JsonConverters::from('Origin', $o['origin']);
        if (isset($o['betIds'])) $this->betIds = JsonConverters::fromArray('string', $o['betIds']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->slipId)) $o['slipId'] = $this->slipId;
        if (isset($this->origin)) $o['origin'] = JsonConverters::to('Origin', $this->origin);
        if (isset($this->betIds)) $o['betIds'] = JsonConverters::toArray('string', $this->betIds);
        return empty($o) ? new class(){} : $o;
    }
}

PHP BatchCancelBets 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 /bets/cancel/batch HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<BatchCancelBets xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Greyhounds.WebApi.ServiceModel">
  <BetIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>String</d2p1:string>
  </BetIds>
  <Id>String</Id>
  <Origin>
    <Application>
      <Name>String</Name>
      <Version>String</Version>
    </Application>
    <Clerk>
      <Id>String</Id>
      <Value>String</Value>
    </Clerk>
    <Device>
      <Id>String</Id>
      <Value>String</Value>
    </Device>
    <IP>String</IP>
    <Location>
      <Id>String</Id>
      <Value>String</Value>
    </Location>
    <LocationGroup>
      <Id>String</Id>
      <Value>String</Value>
    </LocationGroup>
    <Organization>
      <Id>String</Id>
      <Value>String</Value>
    </Organization>
  </Origin>
  <SlipId>String</SlipId>
</BatchCancelBets>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ResponseStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <ErrorCode>String</ErrorCode>
  <Message>String</Message>
  <StackTrace>String</StackTrace>
  <Errors>
    <ResponseError>
      <ErrorCode>String</ErrorCode>
      <FieldName>String</FieldName>
      <Message>String</Message>
      <Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringstring>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value>String</d4p1:Value>
        </d4p1:KeyValueOfstringstring>
      </Meta>
    </ResponseError>
  </Errors>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
</ResponseStatus>