export type DeleteApiV1BusinessesBusinessIdMonitorArgs = {business_id: string}; export type DeleteApiV1BusinessesBusinessIdMonitorOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a monitor for a business * * DELETE /v1/businesses/{business_id}/monitor */ export const deleteApiV1BusinessesBusinessIdMonitor = async (args: DeleteApiV1BusinessesBusinessIdMonitorArgs, options?: DeleteApiV1BusinessesBusinessIdMonitorOptions) => { const {baseUrl = "https://api.middesk.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/businesses/${encodeURIComponent(String(args.business_id))}/monitor${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 };