export type GetApiFinancialDatasetsCompanyFactsArgs = {ticker?: string | undefined, cik?: string | undefined}; export type GetApiFinancialDatasetsCompanyFactsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get company facts for a ticker. * * GET /financial-datasets/company/facts */ export const getApiFinancialDatasetsCompanyFacts = async (args: GetApiFinancialDatasetsCompanyFactsArgs, options?: GetApiFinancialDatasetsCompanyFactsOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.ticker != null) query.append("ticker", String(args.ticker)) if (args.cik != null) query.append("cik", String(args.cik)) const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/company/facts${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 };