export type CreateApiContainersIdRestartArgs = {id: string, signal?: string | undefined, t?: number | undefined}; export type CreateApiContainersIdRestartOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Restart a container * * POST /containers/{id}/restart */ export const createApiContainersIdRestart = async (args: CreateApiContainersIdRestartArgs, options: CreateApiContainersIdRestartOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.signal != null) query.append("signal", String(args.signal)) if (args.t != null) query.append("t", String(args.t)) const url = `${baseUrl.replace(/\/+$/, '')}/containers/${encodeURIComponent(String(args.id))}/restart${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 };