export type RunId = string; export type PointId = string; export type PointValue = {value?: number | undefined}; export type UpdateApiRunsRunIdPointsPointIdArgs = {runId: RunId, pointId: PointId, body: PointValue}; export type UpdateApiRunsRunIdPointsPointIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set value for single point * * PUT /runs/{runId}/points/{pointId} */ export const updateApiRunsRunIdPointsPointId = async (args: UpdateApiRunsRunIdPointsPointIdArgs, options?: UpdateApiRunsRunIdPointsPointIdOptions) => { const {baseUrl = "https://api.server.test/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/runs/${encodeURIComponent(String(args.runId))}/points/${encodeURIComponent(String(args.pointId))}${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 };