export type CreateApiContainersIdKillArgs = {id: string, signal?: string | undefined}; export type CreateApiContainersIdKillOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Kill a container * * POST /containers/{id}/kill */ export const createApiContainersIdKill = async (args: CreateApiContainersIdKillArgs, options: CreateApiContainersIdKillOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.signal != null) query.append("signal", String(args.signal)) const url = `${baseUrl.replace(/\/+$/, '')}/containers/${encodeURIComponent(String(args.id))}/kill${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };