export type GetApiV1FlowZeroDteLeaderboardArgs = {metric?: string | undefined, n?: number | undefined}; export type GetApiV1FlowZeroDteLeaderboardOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/flow/zero-dte/leaderboard */ export const getApiV1FlowZeroDteLeaderboard = async (args: GetApiV1FlowZeroDteLeaderboardArgs, options: GetApiV1FlowZeroDteLeaderboardOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.metric != null) query.append("metric", String(args.metric)) if (args.n != null) query.append("n", String(args.n)) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/flow/zero-dte/leaderboard${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };