export type GetApiFinancialDatasetsMacroLaborArgs = {series: string, start_date?: string | undefined, end_date?: string | undefined, cursor?: string | undefined}; export type GetApiFinancialDatasetsMacroLaborOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * US labor market history for one series: nonfarm payrolls, unemployment rate, participation, hourly earnings, JOLTS job openings, hires, quits, and weekly jobless claims, with period-over-period and year-over-year changes. * * GET /financial-datasets/macro/labor */ export const getApiFinancialDatasetsMacroLabor = async (args: GetApiFinancialDatasetsMacroLaborArgs, options?: GetApiFinancialDatasetsMacroLaborOptions) => { 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)) if (args.start_date != null) query.append("start_date", String(args.start_date)) if (args.end_date != null) query.append("end_date", String(args.end_date)) if (args.cursor != null) query.append("cursor", String(args.cursor)) const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/macro/labor${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 };