export type GetApiCompanyWorkScheduleDaysDayArgs = {day: string, page?: number | undefined, employees?: Array | undefined, branches?: Array | undefined, types?: ('working' | 'non_working') | undefined}; export type GetApiCompanyWorkScheduleDaysDayOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Work Schedule for the Day * * GET /company/work-schedule/days/{day} */ export const getApiCompanyWorkScheduleDaysDay = async (args: GetApiCompanyWorkScheduleDaysDayArgs, options?: GetApiCompanyWorkScheduleDaysDayOptions) => { const {baseUrl = "https://api.roapp.io/v2", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.page != null) query.append("page", String(args.page)) for (const item of args.employees ?? []) query.append("employees", String(item)) for (const item of args.branches ?? []) query.append("branches", String(item)) if (args.types != null) query.append("types", String(args.types)) if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/company/work-schedule/days/${encodeURIComponent(String(args.day))}${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 };