export type DeploySetting = {can_deploy_as_offline_service?: boolean | undefined}; export type PatchExperimentRequest = {name?: string | undefined, group_id?: string | undefined, group_name?: string | undefined, description?: string | undefined, tags?: Array | undefined, flow_json?: string | undefined, deploy_setting?: DeploySetting | undefined}; export type PatchApiDiV2ExperimentExpIdArgs = {exp_id: string, body: PatchExperimentRequest}; export type PatchApiDiV2ExperimentExpIdOptions = {baseUrl?: string | undefined, basicAuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * PatchExperiment * * PATCH /di/v2/experiment/{exp_id} * * Also accepts auth: watsonAuthToken, watsonAuthTokenQuery */ export const patchApiDiV2ExperimentExpId = async (args: PatchApiDiV2ExperimentExpIdArgs, options?: PatchApiDiV2ExperimentExpIdOptions) => { 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))}${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 };