export type ModelVersion = {id?: number | undefined, version: string, creation_timestamp?: string | undefined, latest_flag?: number | undefined, source: string, filepath: string, model_id?: number | undefined, enable_flag?: number | undefined, training_id?: string | undefined, training_flag?: number | undefined, push_timestamp?: string | undefined, push_id?: number | undefined, file_name?: string | undefined, params?: string | undefined}; export type ModelRequest = {model_name?: string | undefined, model_type?: string | undefined, file_name?: string | undefined, s3_path?: string | undefined, root_path?: string | undefined, child_path?: string | undefined, model_version?: ModelVersion | undefined, group_id?: number | undefined}; export type UpdateApiMfV1ModelModelIDArgs = {modelID: number, body: ModelRequest}; export type UpdateApiMfV1ModelModelIDOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a Model in the given Model ID * * PUT /mf/v1/model/{modelID} */ export const updateApiMfV1ModelModelID = async (args: UpdateApiMfV1ModelModelIDArgs, options?: UpdateApiMfV1ModelModelIDOptions) => { const {baseUrl = "http://gateway.mlss.mf", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/mf/v1/model/${encodeURIComponent(String(args.modelID))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };