export type GetApiV1FlowZeroDteSnapshotSymbolArgs = {symbol: string, expiry?: string | undefined}; export type GetApiV1FlowZeroDteSnapshotSymbolOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/flow/zero-dte/snapshot/{symbol} */ export const getApiV1FlowZeroDteSnapshotSymbol = async (args: GetApiV1FlowZeroDteSnapshotSymbolArgs, options: GetApiV1FlowZeroDteSnapshotSymbolOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.expiry != null) query.append("expiry", String(args.expiry)) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/flow/zero-dte/snapshot/${encodeURIComponent(String(args.symbol))}${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 };