@azuro-org/toolkit
Version:
This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.
36 lines (35 loc) • 1.25 kB
TypeScript
import type { ChainId } from '../../config';
import { type GameState, OrderDirection } from '../../global';
import { GameOrderBy, type PaginatedGamesResponse, type SportHubSlug } from './types';
export type GetGamesByFiltersParams = {
chainId: ChainId;
state: GameState.Live | GameState.Prematch;
sportHub?: SportHubSlug;
sportIds?: string | number | (string | number)[];
sportSlug?: string;
leagueSlug?: string;
orderBy?: GameOrderBy;
orderDir?: OrderDirection;
/** 1-based, default: 1 */
page?: number;
/** 1-based, default: 100 */
perPage?: number;
};
export type GetGamesByFiltersResult = PaginatedGamesResponse;
/**
* Fetches games by applying various filters such as sport, league, or game state.
* Returns paginated results ideal for building sport/country/league listing pages.
*
* - Docs: https://gem.azuro.org/hub/apps/toolkit/feed/getGamesByFilters
*
* @example
* import { GameState, getGamesByFilters } from '@azuro-org/toolkit'
*
* const games = await getGamesByFilters({
* chainId: 137,
* state: GameState.Prematch,
* page: 2,
* perPage: 50,
* })
* */
export declare const getGamesByFilters: (props: GetGamesByFiltersParams) => Promise<GetGamesByFiltersResult>;