export type ServicePut = {cpu?: number | undefined, gpu?: string | undefined, memory?: number | undefined, modelversion_id?: number | undefined, modelversion?: string | undefined, source?: string | undefined, service_id?: number | undefined, namespace?: string | undefined, service_name?: string | undefined, remark?: string | undefined}; export type UpdateApiMfV1ServiceIdArgs = {id: number, body: ServicePut}; export type UpdateApiMfV1ServiceIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a Service in the given Namesapce * * PUT /mf/v1/service/{id} */ export const updateApiMfV1ServiceId = async (args: UpdateApiMfV1ServiceIdArgs, options?: UpdateApiMfV1ServiceIdOptions) => { 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/service/${encodeURIComponent(String(args.id))}${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 };