export type UpdateApiContainersIdArchiveArgs = {id: string, path: string, noOverwriteDirNonDir?: string | undefined, copyUIDGID?: string | undefined, body: BodyInit}; export type UpdateApiContainersIdArchiveOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Extract an archive of files or folders to a directory in a container * * PUT /containers/{id}/archive */ export const updateApiContainersIdArchive = async (args: UpdateApiContainersIdArchiveArgs, options: UpdateApiContainersIdArchiveOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/x-tar") if (args.path != null) query.append("path", String(args.path)) if (args.noOverwriteDirNonDir != null) query.append("noOverwriteDirNonDir", String(args.noOverwriteDirNonDir)) if (args.copyUIDGID != null) query.append("copyUIDGID", String(args.copyUIDGID)) const url = `${baseUrl.replace(/\/+$/, '')}/containers/${encodeURIComponent(String(args.id))}/archive${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };