export type WorkingHourTable = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11; export type WorkingHour = {id?: number | undefined, departmentIds?: (string | null) | undefined, groupIndex?: number | undefined, dayIndis?: number | undefined, tableType?: WorkingHourTable | undefined, tableId?: number | undefined, startTime?: (string | null) | undefined, endTime?: (string | null) | undefined}; export type CreateApiV1SettingsWorkinghoursArgs = {body: Array}; export type CreateApiV1SettingsWorkinghoursOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create working hours * * POST /v1/settings/workinghours * * Also accepts auth: API Key */ export const createApiV1SettingsWorkinghours = async (args: CreateApiV1SettingsWorkinghoursArgs, options: CreateApiV1SettingsWorkinghoursOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/settings/workinghours${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };