export type GetApiFinancialDatasetsMacroLaborSnapshotArgs = {series?: string | undefined}; export type GetApiFinancialDatasetsMacroLaborSnapshotOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * The most recent print of every labor market series (24 rows: monthly series on their latest month, weekly series on their latest week), or of one series when series is given. * * GET /financial-datasets/macro/labor/snapshot */ export const getApiFinancialDatasetsMacroLaborSnapshot = async (args: GetApiFinancialDatasetsMacroLaborSnapshotArgs, options?: GetApiFinancialDatasetsMacroLaborSnapshotOptions) => { 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/labor/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 };