export type GetApiV1ScreenerDebugSearchArgs = {field?: string | undefined, op?: string | undefined, value?: string | undefined, fields?: string | undefined, limit?: number | undefined}; export type GetApiV1ScreenerDebugSearchOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/screener/debug/search */ export const getApiV1ScreenerDebugSearch = async (args: GetApiV1ScreenerDebugSearchArgs, options: GetApiV1ScreenerDebugSearchOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.field != null) query.append("field", String(args.field)) if (args.op != null) query.append("op", String(args.op)) if (args.value != null) query.append("value", String(args.value)) if (args.fields != null) query.append("fields", String(args.fields)) if (args.limit != null) query.append("limit", String(args.limit)) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/screener/debug/search${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 };