Greyhounds.WebApi

<back to all web services

GetFeed

The following routes are available for this service:
All Verbs/feed
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
Object = TypeVar('Object')


class RoundStatus(IntEnum):
    PENDING = 0
    IN_PROGRESS = 1
    ENDED = 2


class RTPStrategies(IntEnum):
    RNG = 0
    DEFAULT = 1


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RoundConfiguration:
    countdown_duration_in_seconds: int = 0
    race_duration_in_seconds: int = 0
    results_duration_in_seconds: int = 0
    rtp_strategy: Optional[RTPStrategies] = None


class OutcomeStatus(IntEnum):
    UNKNOWN = 0
    LOST = 1
    WON = 2
    VOID = 3


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Outcome:
    id: int = 0
    odds: float = 0.0
    status: Optional[OutcomeStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class JackpotInfo:
    is_given: bool = False
    id: Optional[str] = None
    slip_id: Optional[str] = None
    jp_id: Optional[str] = None
    amount: Decimal = decimal.Decimal(0)
    location_id: Optional[str] = None
    location_name: Optional[str] = None
    address_line: Optional[str] = None
    amount_accumulated: Decimal = decimal.Decimal(0)


class Stages(IntEnum):
    NONE = 0
    COUNTDOWN = 1
    PROCESSING = 2
    RACE = 3
    RESULTS = 4


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RoundProgress:
    stage: Optional[Stages] = None
    step: int = 0
    steps: int = 0
    utc_timestamp: datetime.datetime = datetime.datetime(1, 1, 1)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Round:
    id: Optional[str] = None
    created_at: datetime.datetime = datetime.datetime(1, 1, 1)
    updated_at: datetime.datetime = datetime.datetime(1, 1, 1)
    status: Optional[RoundStatus] = None
    configuration: Optional[RoundConfiguration] = None
    odds: Optional[Dict[int, Outcome]] = None
    jackpot_info: Optional[JackpotInfo] = None
    sequence: Optional[str] = None
    progress: Optional[RoundProgress] = None
    is_locked: bool = False
    is_calculated: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Feed:
    id: Optional[str] = None
    round: Optional[Round] = None
    last_jackpot_info: Optional[JackpotInfo] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GetFeed:
    pass

Python GetFeed 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 /feed HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

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

{
	id: String,
	round: 
	{
		id: String,
		createdAt: 0001-01-01,
		updatedAt: 0001-01-01,
		status: 0,
		configuration: 
		{
			countdownDurationInSeconds: 0,
			raceDurationInSeconds: 0,
			resultsDurationInSeconds: 0,
			rtpStrategy: 0
		},
		odds: 
		{
			0: 
			{
				id: 0,
				odds: 0,
				status: 0
			}
		},
		jackpotInfo: 
		{
			isGiven: False,
			id: String,
			slipId: String,
			jpId: String,
			amount: 0,
			locationId: String,
			locationName: String,
			addressLine: String,
			amountAccumulated: 0
		},
		sequence: String,
		progress: 
		{
			stage: 0,
			step: 0,
			steps: 0,
			utcTimestamp: 0001-01-01
		},
		isLocked: False,
		isCalculated: False
	},
	lastJackpotInfo: 
	{
		isGiven: False,
		id: String,
		slipId: String,
		jpId: String,
		amount: 0,
		locationId: String,
		locationName: String,
		addressLine: String,
		amountAccumulated: 0
	}
}