FBiHBetting.Aggregator.WebApi

<back to all web services

ReportBetExpirations

The following routes are available for this service:
POST/bets/expire
<?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 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;
    }
}

enum ProductCategory : int
{
    case Sportsbook = 0;
    case RNG = 1;
}

class ProductReference implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $value=null,
        /** @var ProductCategory|null */
        public ?ProductCategory $category=null,
        /** @var Reference|null */
        public ?Reference $productProvider=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['value'])) $this->value = $o['value'];
        if (isset($o['category'])) $this->category = JsonConverters::from('ProductCategory', $o['category']);
        if (isset($o['productProvider'])) $this->productProvider = JsonConverters::from('Reference', $o['productProvider']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->value)) $o['value'] = $this->value;
        if (isset($this->category)) $o['category'] = JsonConverters::to('ProductCategory', $this->category);
        if (isset($this->productProvider)) $o['productProvider'] = JsonConverters::to('Reference', $this->productProvider);
        return empty($o) ? new class(){} : $o;
    }
}

class ProductInstanceRef implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var ProductReference|null */
        public ?ProductReference $product=null
    ) {
    }

    /** @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['product'])) $this->product = JsonConverters::from('ProductReference', $o['product']);
    }
    
    /** @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->product)) $o['product'] = JsonConverters::to('ProductReference', $this->product);
        return empty($o) ? new class(){} : $o;
    }
}

class Origin implements JsonSerializable
{
    public function __construct(
        /** @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 $organization=null,
        /** @var ProductInstanceRef|null */
        public ?ProductInstanceRef $productInstance=null
    ) {
    }

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

enum PaymentOrigin : int
{
    case POS = 0;
    case SMS = 1;
    case Internet = 2;
}

class PayoutRecap implements JsonSerializable
{
    public function __construct(
        /** @var float */
        public float $winnings=0.0,
        /** @var float */
        public float $taxAmount=0.0,
        /** @var float */
        public float $payout=0.0
    ) {
    }

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

class BetExpiration implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var Origin|null */
        public ?Origin $origin=null,
        /** @var DateTime */
        public DateTime $betExpiredAt=new DateTime(),
        /** @var PaymentOrigin|null */
        public ?PaymentOrigin $paymentOrigin=null,
        /** @var PayoutRecap|null */
        public ?PayoutRecap $payoutRecap=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['origin'])) $this->origin = JsonConverters::from('Origin', $o['origin']);
        if (isset($o['betExpiredAt'])) $this->betExpiredAt = JsonConverters::from('DateTime', $o['betExpiredAt']);
        if (isset($o['paymentOrigin'])) $this->paymentOrigin = JsonConverters::from('PaymentOrigin', $o['paymentOrigin']);
        if (isset($o['payoutRecap'])) $this->payoutRecap = JsonConverters::from('PayoutRecap', $o['payoutRecap']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->origin)) $o['origin'] = JsonConverters::to('Origin', $this->origin);
        if (isset($this->betExpiredAt)) $o['betExpiredAt'] = JsonConverters::to('DateTime', $this->betExpiredAt);
        if (isset($this->paymentOrigin)) $o['paymentOrigin'] = JsonConverters::to('PaymentOrigin', $this->paymentOrigin);
        if (isset($this->payoutRecap)) $o['payoutRecap'] = JsonConverters::to('PayoutRecap', $this->payoutRecap);
        return empty($o) ? new class(){} : $o;
    }
}

class ReportBetExpirations implements JsonSerializable
{
    public function __construct(
        /** @var array<BetExpiration>|null */
        public ?array $betExpirations=null
    ) {
    }

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

PHP ReportBetExpirations DTOs

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

HTTP + JSV

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

POST /bets/expire HTTP/1.1 
Host: fbihtaapi.bettor.webhop.biz 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	betExpirations: 
	[
		{
			id: String,
			origin: 
			{
				device: 
				{
					id: String,
					value: String
				},
				location: 
				{
					id: String,
					value: String
				},
				locationGroup: 
				{
					id: String,
					value: String
				},
				organization: 
				{
					id: String,
					value: String
				},
				productInstance: 
				{
					id: String,
					name: String,
					product: 
					{
						id: String,
						value: String,
						category: 0,
						productProvider: 
						{
							id: String,
							value: String
						}
					}
				}
			},
			betExpiredAt: 0001-01-01,
			paymentOrigin: 0,
			payoutRecap: 
			{
				winnings: 0,
				taxAmount: 0,
				payout: 0
			}
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	errorCode: String,
	message: String,
	stackTrace: String,
	errors: 
	[
		{
			errorCode: String,
			fieldName: String,
			message: String,
			meta: 
			{
				String: String
			}
		}
	],
	meta: 
	{
		String: String
	}
}