export type GetApiV1ExposureOiDiffSymbolArgs = {symbol: string, topN?: number | undefined}; export type GetApiV1ExposureOiDiffSymbolOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/exposure/oi-diff/{symbol} */ export const getApiV1ExposureOiDiffSymbol = async (args: GetApiV1ExposureOiDiffSymbolArgs, options: GetApiV1ExposureOiDiffSymbolOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.topN != null) query.append("topN", String(args.topN)) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/exposure/oi-diff/${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 };