export type PatchApiV1RunsIdScoreArgs = {id: string, body: {label?: string | undefined, value?: number | undefined, comment?: string | undefined}}; export type PatchApiV1RunsIdScoreOptions = {baseUrl?: string | undefined, ProjectPrivateApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update run score * * PATCH /v1/runs/{id}/score */ export const patchApiV1RunsIdScore = async (args: PatchApiV1RunsIdScoreArgs, options?: PatchApiV1RunsIdScoreOptions) => { const {baseUrl = "https://api.lunary.ai", fetch: fetchFn = fetch, ProjectPrivateApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ProjectPrivateApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ProjectPrivateApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/runs/${encodeURIComponent(String(args.id))}/score${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 };