export type DeleteApiV2TimeOffTimeOffIdArgs = {'x-api-version'?: string | undefined, 'x-company-guid'?: string | undefined, time_off_id: number}; export type DeleteApiV2TimeOffTimeOffIdOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Time Off * * DELETE /v2/time_off/{time_off_id} * * Also accepts auth: cookieAuth */ export const deleteApiV2TimeOffTimeOffId = async (args: DeleteApiV2TimeOffTimeOffIdArgs, options?: DeleteApiV2TimeOffTimeOffIdOptions) => { const {baseUrl = "https://api.7shifts.com", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-api-version'] != null) headers.set("x-api-version", String(args['x-api-version'])) if (args['x-company-guid'] != null) headers.set("x-company-guid", String(args['x-company-guid'])) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/time_off/${encodeURIComponent(String(args.time_off_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 };