api

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package api connects to the Unified Feed API interface

Index

Constants

This section is empty.

Variables

View Source
var RequestTimeout = 32 * time.Second

RequestTimeout timeout for an API call

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API for communication with BetRadar API

func Dial

func Dial(ctx context.Context, env uof.Environment, token string) (*API, error)

Dial connect to the staging or production api environment

func Production

func Production(exitSig context.Context, token string) (*API, error)

Production connects to the production system

func ProductionGlobal

func ProductionGlobal(exitSig context.Context, token string) (*API, error)

ProductionGlobal connects to the production global system

func Staging

func Staging(exitSig context.Context, token string) (*API, error)

Staging connects to the staging system

func (*API) Competitor

func (a *API) Competitor(lang uof.Lang, playerID int) (*uof.CompetitorPlayer, error)

func (*API) Fixture

func (a *API) Fixture(lang uof.Lang, eventURN uof.URN) (*uof.Fixture, error)

Fixture lists the fixture for a specified sport event

func (*API) Fixtures

func (a *API) Fixtures(lang uof.Lang, to time.Time) (<-chan uof.Fixture, <-chan error)

Fixtures gets all the fixtures with schedule before to

func (*API) GetBookmakerDetails

func (a *API) GetBookmakerDetails() (*BookmakerDetails, error)

GetBookmakerDetails returns BookmakerDetails include token's expire_time

func (*API) MarketVariant

func (a *API) MarketVariant(lang uof.Lang, marketID int, variant string) (uof.MarketDescriptions, error)

MarketVariant returns market descriptions

func (*API) Markets

func (a *API) Markets(lang uof.Lang) (uof.MarketDescriptions, error)

Markets all currently available markets for a language

func (*API) Ping

func (a *API) Ping() error

Ping server

func (*API) Player

func (a *API) Player(lang uof.Lang, playerID int) (*uof.Player, error)

Player returns player information

func (*API) RequestFullOddsRecovery

func (a *API) RequestFullOddsRecovery(producer uof.Producer, requestID int) error

RequestFullOddsRecovery does recovery of odds over the feed. Subscribes client to feed messages.

func (*API) RequestRecovery

func (a *API) RequestRecovery(producer uof.Producer, timestamp int, requestID int) error

RequestRecovery from a timestamp

func (*API) RequestRecoverySinceTimestamp

func (a *API) RequestRecoverySinceTimestamp(producer uof.Producer, timestamp int, requestID int) error

RequestRecoverySinceTimestamp does recovery of odds and stateful messages over the feed since after timestamp. Subscribes client to feed messages.

func (*API) Summary

func (a *API) Summary(lang uof.Lang, eventURN uof.URN) (*uof.Summary, error)

Fixture with extra information

func (*API) Tournament

func (a *API) Tournament(lang uof.Lang, eventURN uof.URN) (*uof.FixtureTournament, error)

type BookmakerDetails

type BookmakerDetails struct {
	XMLName      xml.Name `xml:"bookmaker_details"`
	ResponseCode string   `xml:"response_code,attr"`
	ExpireAt     string   `xml:"expire_at,attr"`
	BookmakerID  string   `xml:"bookmaker_id,attr"`
	VirtualHost  string   `xml:"virtual_host,attr"`
}

type ReplayAPI

type ReplayAPI struct {
	// contains filtered or unexported fields
}

ReplayAPI for communicating to Replay server

func Replay

func Replay(exitSig context.Context, token string, stag bool) (*ReplayAPI, error)

Replay service for unified feed methods set prod to true to run it on production, default will be run on staging

func (*ReplayAPI) Add

func (r *ReplayAPI) Add(eventURN uof.URN) error

Add to the end of the replay queue.

func (*ReplayAPI) Play

func (r *ReplayAPI) Play(speed, maxDelay int) error

Play replay the events from replay queue. Events are played in the order they were played in reality. Parameters 'speed' and 'max_delay' specify the speed of replay and what should be the maximum delay between messages. Default values for these are speed = 10 and max_delay = 10000. This means that messages will be sent 10x faster than in reality, and that if there was some delay between messages that was longer than 10 seconds it will be reduced to exactly 10 seconds/10 000 ms (this is helpful especially in pre-match odds where delay can be even a few hours or more). If player is already in play, nothing will happen.

func (*ReplayAPI) Reset

func (r *ReplayAPI) Reset() error

Reset the player if it is currently playing and clear the replay queue. If player is already stopped, the queue is cleared.

func (*ReplayAPI) StartEvent

func (r *ReplayAPI) StartEvent(eventURN uof.URN, speed, maxDelay int) error

StartEvent starts replay of a single event.

func (*ReplayAPI) StartScenario

func (r *ReplayAPI) StartScenario(scenarioID, speed, maxDelay int) error

StartScenario replay of the scenario from replay queue. Your current playlist will be wiped, and populated with events from specified scenario. Events are played in the order they were played in reality. Parameters 'speed' and 'max_delay' specify the speed of replay and what should be the maximum delay between messages. Default values for these are speed = 10 and max_delay = 10000. This means that messages will be sent 10x faster than in reality, and that if there was some delay between messages that was longer than 10 seconds it will be reduced to exactly 10 seconds/10 000 ms (this is helpful especially in pre-match odds where delay can be even a few hours or more). If player is already in play, nothing will happen.

func (*ReplayAPI) Stop

func (r *ReplayAPI) Stop() error

Stop the player if it is currently playing. If player is already stopped, nothing will happen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL