export type DeleteApiApiOrgIdSyntheticsIdArgs = {org_id: string, id: string, folder?: string | undefined}; export type DeleteApiApiOrgIdSyntheticsIdOptions = {baseUrl: string, Authorization?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a synthetic * * DELETE /api/{org_id}/synthetics/{id} */ export const deleteApiApiOrgIdSyntheticsId = async (args: DeleteApiApiOrgIdSyntheticsIdArgs, options: DeleteApiApiOrgIdSyntheticsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, Authorization} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.folder != null) query.append("folder", String(args.folder)) if (Authorization !== undefined) headers.set("Authorization", Authorization) const url = `${baseUrl.replace(/\/+$/, '')}/api/${encodeURIComponent(String(args.org_id))}/synthetics/${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 };