export type GetApiApiDtaoTaoFlowV1Args = {netuid?: number | undefined, block_start?: number | undefined, block_end?: number | undefined, timestamp_start?: number | undefined, timestamp_end?: number | undefined}; export type GetApiApiDtaoTaoFlowV1Options = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/dtao/tao_flow/v1 */ export const getApiApiDtaoTaoFlowV1 = async (args: GetApiApiDtaoTaoFlowV1Args, options?: GetApiApiDtaoTaoFlowV1Options) => { const {baseUrl = "https://api.taostats.io", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.netuid != null) query.append("netuid", String(args.netuid)) if (args.block_start != null) query.append("block_start", String(args.block_start)) if (args.block_end != null) query.append("block_end", String(args.block_end)) if (args.timestamp_start != null) query.append("timestamp_start", String(args.timestamp_start)) if (args.timestamp_end != null) query.append("timestamp_end", String(args.timestamp_end)) if (sec0 !== undefined) headers.set("Authorization", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/api/dtao/tao_flow/v1${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 (await res.json()) as unknown };