useGames
The useGames
hook is used to fetch pre-match and live games.
ℹ️
Hook represents a logic wrapper over TanStack Query's useQuery
hook. Explore TanStack Query docs (opens in a new tab) to understand what data the hook returns.
Usage
import { useGames } from '@azuro-org/sdk'
const { data, isFetching, error } = useGames(props)
Props
{
filter?: {
limit?: number // limit the number of rows returned from a query
offset?: number // omit a specified number of rows before the beginning of the result set
sportHub?: SportHub // returns games from specific hub
sportSlug?: string // returns games from specific sport
leaglueSlug?: string // returns games from specific league
maxMargin?: number // max marginality
conditionsState?: ConditionState | ConditionState[]
}
orderBy?: Game_OrderBy // default: Game_OrderBy.CreatedBlockTimestamp` - orders rows by passed rule
orderDir?: OrderDirection // order direction: asc, desc
isLive?: boolean // if `true`, the hook will retrieve live games
query?: QueryParameter<GamesQuery['games']> // useQuery params
}
enum SportHub {
Sports = 'sports',
Esports = 'esports',
Unique = 'unique'
}
Return Value
UseQueryResult<GamesQuery['games']>
import { type UseQueryResult } from '@tanstack/react-query'
type GamesQuery = {
__typename?: 'Query'
games: Array<{
__typename?: 'Game'
id: string
gameId: string
slug: string
title: string
startsAt: string
state: Types.GameState
turnover: string
sport: {
__typename?: 'Sport'
sportId: string
slug: string
name: string
sporthub: {
__typename?: 'SportHub'
id: string
slug: string
}
}
league: {
__typename?: 'League'
slug: string
name: string
}
country: {
__typename?: 'Country'
slug: string
name: string
}
participants: Array<{
__typename?: 'Participant'
image?: string | null
name: string
}>
}>
}