export type DeleteApiV3SchedulesIdArgs = {id: string}; export type DeleteApiV3SchedulesIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a schedule * * DELETE /v3/schedules/{id} */ export const deleteApiV3SchedulesId = async (args: DeleteApiV3SchedulesIdArgs, options?: DeleteApiV3SchedulesIdOptions) => { const {baseUrl = "https://api.pagerduty.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v3/schedules/${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 };