watchtower-node-sdk
Version:
A TypeScript Node.js SDK for the Watchtower API, providing API key management, connection string generation, and more
116 lines (104 loc) • 2.38 kB
text/typescript
export interface Metric {
name: string;
friendly_name: string;
value: any;
unit: string;
}
export interface LogData {
item_id: string;
timestamp: string;
purpose?: string;
context?: string;
level?: string;
message?: string;
friendly_name?: string;
metadata?: Record<string, any>;
metrics?: Metric[];
}
export interface LogResponse {
id: number;
app_id: string;
tenant_id?: string;
item_id: string;
friendly_name?: string;
log_data: string; // Raw log data as string
created_at: string;
}
export interface ParsedLogResponse {
id: number;
app_id: string;
tenant_id?: string;
item_id: string;
friendly_name?: string;
log_data: LogData; // Parsed log data
created_at: string;
}
export interface LatestLogsResponse {
logs: ParsedLogResponse[];
}
export interface CreateLogRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
item_id: string;
timestamp: string;
purpose?: string;
context?: string;
level?: string;
message?: string;
friendly_name?: string;
metadata?: Record<string, any>;
metrics?: Metric[];
}
export interface BatchLog {
item_id: string;
timestamp: string;
purpose?: string;
context?: string;
level?: string;
message?: string;
friendly_name?: string;
metadata?: Record<string, any>;
metrics?: Metric[];
}
export interface BatchLogRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
logs: BatchLog[];
}
export interface BatchLogResponse {
success_count: number;
failed_count: number;
failed_logs?: string[];
}
export interface GetLogsRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
item_id: string;
page_size: number;
page: number;
before?: string;
after?: string;
}
export interface PaginatedLogResponse {
logs: ParsedLogResponse[];
total_count: number;
page_size: number;
page: number;
total_pages: number;
has_more: boolean;
}
export interface GetLatestLogsRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
item_id: string;
limit?: number;
}
export interface GetLogByIdRequest {
organization_apikey: string;
app_apikey: string;
tenant_apikey?: string;
}