export type DeleteApiContainersIdArgs = {id: string, v?: boolean | undefined, force?: boolean | undefined, link?: boolean | undefined}; export type DeleteApiContainersIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Remove a container * * DELETE /containers/{id} */ export const deleteApiContainersId = async (args: DeleteApiContainersIdArgs, options: DeleteApiContainersIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.v != null) query.append("v", String(args.v)) if (args.force != null) query.append("force", String(args.force)) if (args.link != null) query.append("link", String(args.link)) const url = `${baseUrl.replace(/\/+$/, '')}/containers/${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 };