export type UpdateApiModelsModelIdSchemasArgs = {model_id: number, body: BodyInit}; export type UpdateApiModelsModelIdSchemasOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creating new schemas for a model * * PUT /models/{model_id}/schemas */ export const updateApiModelsModelIdSchemas = async (args: UpdateApiModelsModelIdSchemasArgs, options?: UpdateApiModelsModelIdSchemasOptions) => { const {baseUrl = "http://localhost:8080/v1", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "*/*") headers.set('accept', "*/*") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/models/${encodeURIComponent(String(args.model_id))}/schemas${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 res.blob() };