export type DeleteApiVolumesNameArgs = {name: string, force?: boolean | undefined}; export type DeleteApiVolumesNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Remove a volume * * DELETE /volumes/{name} */ export const deleteApiVolumesName = async (args: DeleteApiVolumesNameArgs, options: DeleteApiVolumesNameOptions) => { 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(/\/+$/, '')}/volumes/${encodeURIComponent(String(args.name))}${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 };