export type DeleteApiApiChurchAdminEventsEventIdArgs = {event_id: number, ca_session?: (string | null) | undefined}; export type DeleteApiApiChurchAdminEventsEventIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete Event * * DELETE /api/church-admin/events/{event_id} */ export const deleteApiApiChurchAdminEventsEventId = async (args: DeleteApiApiChurchAdminEventsEventIdArgs, options: DeleteApiApiChurchAdminEventsEventIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const cookies: string[] = [] if (args.ca_session != null) cookies.push("ca_session=" + encodeURIComponent(String(args.ca_session))) if (cookies.length > 0) headers.set('cookie', cookies.join('; ')) const url = `${baseUrl.replace(/\/+$/, '')}/api/church-admin/events/${encodeURIComponent(String(args.event_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 };