export type DeleteApiApiV1SchedulingShiftsIdArgs = {id: string, recurrenceEditOption?: ('instance' | 'future' | 'all') | undefined}; export type DeleteApiApiV1SchedulingShiftsIdOptions = {baseUrl?: string | undefined, basic?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Delete Shift * * DELETE /api/v1/scheduling/shifts/{id} * * Also accepts auth: oauth, oauth */ export const deleteApiApiV1SchedulingShiftsId = async (args: DeleteApiApiV1SchedulingShiftsIdArgs, options?: DeleteApiApiV1SchedulingShiftsIdOptions) => { const {baseUrl = "https://companySubDomain.bamboohr.com", fetch: fetchFn = fetch, basic} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.recurrenceEditOption != null) query.append("recurrenceEditOption", String(args.recurrenceEditOption)) if (basic !== undefined) headers.set('authorization', `Basic ${btoa(`${basic.username}:${basic.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/scheduling/shifts/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };