export type DeleteApiCalendarConnectionIdEventIdArgs = {connection_id: string, id: string}; export type DeleteApiCalendarConnectionIdEventIdOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove an event * * DELETE /calendar/{connection_id}/event/{id} */ export const deleteApiCalendarConnectionIdEventId = async (args: DeleteApiCalendarConnectionIdEventIdArgs, options?: DeleteApiCalendarConnectionIdEventIdOptions) => { const {baseUrl = "https://api.unified.to", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (jwt !== undefined) headers.set("authorization", jwt) const url = `${baseUrl.replace(/\/+$/, '')}/calendar/${encodeURIComponent(String(args.connection_id))}/event/${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 };