export type GetApiFinancialDatasetsFilingsArgs = {cik?: string | undefined, ticker?: string | undefined, filing_type?: Array | undefined, limit?: number | undefined, cursor?: string | undefined}; export type GetApiFinancialDatasetsFilingsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get SEC filings for a company. * * GET /financial-datasets/filings */ export const getApiFinancialDatasetsFilings = async (args: GetApiFinancialDatasetsFilingsArgs, options?: GetApiFinancialDatasetsFilingsOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.cik != null) query.append("cik", String(args.cik)) if (args.ticker != null) query.append("ticker", String(args.ticker)) for (const item of args.filing_type ?? []) query.append("filing_type", String(item)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.cursor != null) query.append("cursor", String(args.cursor)) const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/filings${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 };