export type DeleteApiNodesIdArgs = {id: string, force?: boolean | undefined}; export type DeleteApiNodesIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete a node * * DELETE /nodes/{id} */ export const deleteApiNodesId = async (args: DeleteApiNodesIdArgs, options: DeleteApiNodesIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.force != null) query.append("force", String(args.force)) const url = `${baseUrl.replace(/\/+$/, '')}/nodes/${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 };