This commit is contained in:
@@ -97,6 +97,24 @@ export interface Rollup {
|
||||
sum_latency: number;
|
||||
}
|
||||
|
||||
export type ChannelType = "webhook" | "smtp" | "discord" | "slack" | "telegram";
|
||||
|
||||
export interface NotificationChannel {
|
||||
channel_id: string;
|
||||
name: string;
|
||||
type: ChannelType;
|
||||
config: Record<string, string>;
|
||||
enabled: boolean;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ChannelInput {
|
||||
name: string;
|
||||
type: ChannelType;
|
||||
config: Record<string, string>;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export interface ConsoleConnectRequest {
|
||||
server_id: string;
|
||||
protocol: string;
|
||||
@@ -370,6 +388,27 @@ export const api = {
|
||||
return request<Rollup[]>(`/monitors/${monitorId}/uptime`);
|
||||
},
|
||||
|
||||
// Notification channels
|
||||
listChannels(): Promise<NotificationChannel[]> {
|
||||
return request<NotificationChannel[]>("/channels");
|
||||
},
|
||||
|
||||
createChannel(input: ChannelInput): Promise<NotificationChannel> {
|
||||
return request<NotificationChannel>("/channels", { method: "POST", body: JSON.stringify(input) });
|
||||
},
|
||||
|
||||
updateChannel(channelId: string, input: Partial<ChannelInput>): Promise<void> {
|
||||
return request<void>(`/channels/${channelId}`, { method: "PUT", body: JSON.stringify(input) });
|
||||
},
|
||||
|
||||
deleteChannel(channelId: string): Promise<void> {
|
||||
return request<void>(`/channels/${channelId}`, { method: "DELETE" });
|
||||
},
|
||||
|
||||
testChannel(channelId: string): Promise<{ status: string }> {
|
||||
return request<{ status: string }>(`/channels/${channelId}/test`, { method: "POST" });
|
||||
},
|
||||
|
||||
getLatestAgentVersion(): Promise<{ version: string }> {
|
||||
return request<{ version: string }>("/agent/latest-version");
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user