API Client Modules
The shared library provides 16 domain-specific API client modules at frontend/shared/src/api/. Each client wraps the base ApiClient class and exposes typed methods for its corresponding backend service. All clients are initialized together through the initializeApiClients() factory function.
Client Architecture
initializeApiClients(config)
|
+-> ApiClient (base) # Fetch + auth + retry + timeout
| |
| +-> BIApiClient # bi-service
| +-> QueryApiClient # query-engine
| +-> SemanticApiClient # semantic-layer
| +-> AIApiClient # ai-service
| +-> MLApiClient # ml-service
| +-> DataApiClient # catalog-service
| +-> PipelineApiClient # pipeline-service
| +-> DbtApiClient # pipeline-service
| +-> DataQualityApiClient # data-quality-service
| +-> GovernanceApiClient # governance-service
| +-> OntologyApiClient # ontology-service
| +-> RenderApiClient # render-service
| +-> OpsAgentApiClient # ops-agent-service
| +-> AgentStudioApiClient # ai-service
| +-> NotificationApiClient # notification-service
| +-> BillingApiClient # billing-serviceBase Client Methods
class ApiClient {
get<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<T>;
post<T>(path: string, body?: unknown): Promise<T>;
put<T>(path: string, body?: unknown): Promise<T>;
patch<T>(path: string, body?: unknown): Promise<T>;
delete(path: string): Promise<void>;
getRaw(path: string, params?): Promise<Response>;
postRaw(path: string, body?: unknown): Promise<Response>;
updateConfig(config: Partial<ApiConfig>): void;
getBaseUrl(): string;
}BI API Client (api/bi.ts)
Manages dashboards, widgets, and BI-specific operations:
getDashboards(params)-- List dashboards with paginationgetDashboard(id)-- Get dashboard detailcreateDashboard(data)-- Create new dashboardupdateDashboard(id, data)-- Update dashboarddeleteDashboard(id)-- Delete dashboardgetWidgets(dashboardId)-- List widgets for a dashboardcreateWidget(dashboardId, data)-- Add widget to dashboardupdateWidget(dashboardId, widgetId, data)-- Update widget configurationexportDashboard(id, format)-- Export dashboard as PDF/PNG
Query API Client (api/query.ts)
Manages SQL query execution against the query engine:
executeQuery(sql, dataSourceId)-- Execute SQL querygetQueryStatus(queryId)-- Check query execution statusgetQueryResults(queryId, page, size)-- Fetch paginated resultscancelQuery(queryId)-- Cancel running querygetQueryHistory(params)-- List recent queriesexplainQuery(sql, dataSourceId)-- Get query execution plan
AI API Client (api/ai.ts)
Manages AI chat sessions and agent execution:
createChatSession(tenantId, userId)-- Create new chat sessionchat(request)-- Send message and get responsestreamChat(request)-- Stream chat response via SSEgetChatHistory(sessionId)-- Get session historygetSuggestions(context)-- Get AI-powered suggestions
ML API Client (api/ml.ts)
Manages experiments, models, and deployments:
getExperiments(params)-- List experimentscreateExperiment(data)-- Create new experimentgetModels(params)-- List registered modelsdeployModel(modelId, config)-- Deploy model to endpointgetDeployments(params)-- List active deploymentsgetTrainingRuns(experimentId)-- List training runs
Data API Client (api/data.ts)
Manages data catalog, lineage, and quality:
searchAssets(request)-- Search data assetsgetAssetDetail(assetId)-- Get asset metadatagetLineage(assetId, depth)-- Get lineage graphgetQualityProfile(assetId)-- Get quality profilecreateQualityRule(assetId, rule)-- Create quality rulegetGlossary()-- Get business glossary
Initialization
All workbenches initialize clients at startup:
import { initializeApiClients } from '@matih/shared';
const clients = initializeApiClients({
baseUrl: import.meta.env.VITE_API_BASE_URL || '/api',
tenantId: import.meta.env.VITE_TENANT_ID || 'default',
});