export type GetApiApiV1SchedulingSchedulesIdPdfArgs = {id: string, startYmd: string, endYmd: string, groupBy?: ('location' | 'department' | 'division' | 'jobTitle' | 'team') | undefined, 'employeeIds[]'?: Array | undefined, includeEmployeesWithoutShifts?: boolean | undefined, includeHolidays?: boolean | undefined, includeTimeOff?: boolean | undefined}; export type GetApiApiV1SchedulingSchedulesIdPdfOptions = {baseUrl?: string | undefined, oauth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Schedule PDF * * GET /api/v1/scheduling/schedules/{id}/pdf */ export const getApiApiV1SchedulingSchedulesIdPdf = async (args: GetApiApiV1SchedulingSchedulesIdPdfArgs, options?: GetApiApiV1SchedulingSchedulesIdPdfOptions) => { const {baseUrl = "https://companySubDomain.bamboohr.com", fetch: fetchFn = fetch, oauth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (args.startYmd != null) query.append("startYmd", String(args.startYmd)) if (args.endYmd != null) query.append("endYmd", String(args.endYmd)) if (args.groupBy != null) query.append("groupBy", String(args.groupBy)) for (const item of args['employeeIds[]'] ?? []) query.append("employeeIds[]", String(item)) if (args.includeEmployeesWithoutShifts != null) query.append("includeEmployeesWithoutShifts", String(args.includeEmployeesWithoutShifts)) if (args.includeHolidays != null) query.append("includeHolidays", String(args.includeHolidays)) if (args.includeTimeOff != null) query.append("includeTimeOff", String(args.includeTimeOff)) if (oauth !== undefined) headers.set('authorization', `Bearer ${oauth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/scheduling/schedules/${encodeURIComponent(String(args.id))}/pdf${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 res.blob() };