export type GetApiFinancialDatasetsMacroInflationSnapshotArgs = {series?: string | undefined}; export type GetApiFinancialDatasetsMacroInflationSnapshotOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * The most recent month of every CPI series (twelve rows), or of one series when series is given, each with the month-over-month and year-over-year percent changes. * * GET /financial-datasets/macro/inflation/snapshot */ export const getApiFinancialDatasetsMacroInflationSnapshot = async (args: GetApiFinancialDatasetsMacroInflationSnapshotArgs, options?: GetApiFinancialDatasetsMacroInflationSnapshotOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.series != null) query.append("series", String(args.series)) const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/macro/inflation/snapshot${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 };