export type MetricAlias = {name: string, alias: string}; export type TableColumn = {unit?: string | undefined, color?: string | undefined, aggFunc?: ('min' | 'max' | 'sum' | 'avg' | 'avg_zero' | 'median' | 'last') | undefined, sparklineDisabled?: boolean | undefined}; export type DashboardTableUpdate = {name?: string | undefined, tableMetrics?: Array | undefined, tableQuery?: string | undefined, tableColumnMap?: {[key: string]: TableColumn} | undefined}; export type UpdateApiInternalV1DashboardsProjectIdDashboardIdTableArgs = {project_id: number, dashboard_id: number, body: DashboardTableUpdate}; export type UpdateApiInternalV1DashboardsProjectIdDashboardIdTableOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update dashboard table * * PUT /internal/v1/dashboards/{project_id}/{dashboard_id}/table * * Also accepts auth: authTokenQuery */ export const updateApiInternalV1DashboardsProjectIdDashboardIdTable = async (args: UpdateApiInternalV1DashboardsProjectIdDashboardIdTableArgs, options?: UpdateApiInternalV1DashboardsProjectIdDashboardIdTableOptions) => { const {baseUrl = "https://api.uptrace.dev", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/internal/v1/dashboards/${encodeURIComponent(String(args.project_id))}/${encodeURIComponent(String(args.dashboard_id))}/table${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 };