export type DeleteApiCalendarEventsCalendarEventIdArgs = {calendarEventId: number, body: {deleteOnDate?: (string | null) | undefined, deleteAllRecurring?: ('TRUE' | 'FALSE' | null) | undefined, deleteAllGrouped?: ('TRUE' | 'FALSE' | null) | undefined}}; export type DeleteApiCalendarEventsCalendarEventIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a calendar event. * * DELETE /calendarEvents/{calendarEventId} * * Also accepts auth: PersonalAccessToken */ export const deleteApiCalendarEventsCalendarEventId = async (args: DeleteApiCalendarEventsCalendarEventIdArgs, options?: DeleteApiCalendarEventsCalendarEventIdOptions) => { const {baseUrl = "https://api.fergus.com", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/calendarEvents/${encodeURIComponent(String(args.calendarEventId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };