export type PatchExperimentVersionRequest = {description?: string | undefined}; export type PatchApiDiV2ExperimentExpIdVersionVersionNameArgs = {exp_id: string, version_name: string, body: PatchExperimentVersionRequest}; export type PatchApiDiV2ExperimentExpIdVersionVersionNameOptions = {baseUrl?: string | undefined, basicAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * PatchExperimentVersion * * PATCH /di/v2/experiment/{exp_id}/version/{version_name} * * Also accepts auth: watsonAuthToken, watsonAuthTokenQuery */ export const patchApiDiV2ExperimentExpIdVersionVersionName = async (args: PatchApiDiV2ExperimentExpIdVersionVersionNameArgs, options?: PatchApiDiV2ExperimentExpIdVersionVersionNameOptions) => { const {baseUrl = "https://di.prophecis.com", fetch: fetchFn = fetch, basicAuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basicAuthToken !== undefined) headers.set("Authorization", basicAuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/di/v2/experiment/${encodeURIComponent(String(args.exp_id))}/version/${encodeURIComponent(String(args.version_name))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };