export type GetApiFinancialDatasetsKpiMetricsArgs = {ticker: string, metric_name?: string | undefined, period?: string | undefined, report_period_gte?: string | undefined, report_period_lte?: string | undefined, limit?: number | undefined, cursor?: string | undefined}; export type GetApiFinancialDatasetsKpiMetricsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get sector-specific operational KPIs for a ticker. Includes metrics like load factor, CET1 ratio, same-store sales, FFO per share, and more. Sourced from SEC 8-K earnings releases. * * GET /financial-datasets/kpi/metrics */ export const getApiFinancialDatasetsKpiMetrics = async (args: GetApiFinancialDatasetsKpiMetricsArgs, options?: GetApiFinancialDatasetsKpiMetricsOptions) => { 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.metric_name != null) query.append("metric_name", String(args.metric_name)) if (args.period != null) query.append("period", String(args.period)) if (args.report_period_gte != null) query.append("report_period_gte", String(args.report_period_gte)) if (args.report_period_lte != null) query.append("report_period_lte", String(args.report_period_lte)) 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/kpi/metrics${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 };