export type GetApiFinancialDatasetsMacroInterestRatesSnapshotArgs = {bank: string}; export type GetApiFinancialDatasetsMacroInterestRatesSnapshotOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the current interest rates from all major central banks in the world. * * GET /financial-datasets/macro/interest-rates/snapshot */ export const getApiFinancialDatasetsMacroInterestRatesSnapshot = async (args: GetApiFinancialDatasetsMacroInterestRatesSnapshotArgs, options?: GetApiFinancialDatasetsMacroInterestRatesSnapshotOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.bank != null) query.append("bank", String(args.bank)) const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/macro/interest-rates/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 };