@azuro-org/sdk
Version:
One-stop solution for building betting dApps on the Azuro Protocol.
42 lines (41 loc) • 2.15 kB
TypeScript
import { type ChainId, type SearchGamesResult } from '@azuro-org/toolkit';
import { type UseQueryResult } from '@tanstack/react-query';
import { type QueryParameterWithSelect } from '../../global';
export type UseSearchGamesQueryFnData = SearchGamesResult;
export type UseSearchGamesProps<TData = UseSearchGamesQueryFnData> = {
input: string;
chainId?: ChainId;
/** page number (1-based), default: 1 */
page?: number;
/** items per page, default: 10 */
perPage?: number;
debounceMs?: number;
query?: QueryParameterWithSelect<UseSearchGamesQueryFnData, TData>;
};
export type GetUseSearchGamesQueryOptionsProps<TData = UseSearchGamesQueryFnData> = UseSearchGamesProps<TData> & {
chainId: ChainId;
};
export declare const getUseSearchGamesQueryOptions: <TData = UseSearchGamesQueryFnData>(params: GetUseSearchGamesQueryOptionsProps<TData>) => import("@tanstack/query-core").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("@azuro-org/toolkit").PaginatedGamesResponse, Error, TData, readonly unknown[]>, "queryFn"> & {
queryFn?: import("@tanstack/query-core").QueryFunction<import("@azuro-org/toolkit").PaginatedGamesResponse, readonly unknown[], never> | undefined;
} & {
queryKey: readonly unknown[] & {
[dataTagSymbol]: import("@azuro-org/toolkit").PaginatedGamesResponse;
[dataTagErrorSymbol]: Error;
};
};
export type UseSearchGames = <TData = UseSearchGamesQueryFnData>(props: UseSearchGamesProps<TData>) => UseQueryResult<TData>;
/**
* Search active prematch and live games by text.
* Searching for game participants / leagues / countries.
*
* `input` value is debounced by `debounceMs` prop (default: 300ms) and trimmed (`.trim()`).
*
* - Docs: https://gem.azuro.org/hub/apps/sdk/data-hooks/useSearchGames
*
* @example
* import { useSearchGames } from '@azuro-org/sdk'
*
* const { data, isFetching } = useSearchGames({ input: 'Man' })
* const { games, page, perPage, total, totalPages } = data || {}
* */
export declare const useSearchGames: <TData = UseSearchGamesQueryFnData>(props: UseSearchGamesProps<TData>) => UseQueryResult<NoInfer<TData>, Error>;