mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-09-28 05:59:47 -04:00
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { ApiClient } from './client';
|
|
|
|
export type NotificationProviderType =
|
|
| 'notifiarr'
|
|
| 'apprise'
|
|
| 'ntfy'
|
|
| 'telegram'
|
|
| 'discord'
|
|
| 'pushover'
|
|
| 'gotify';
|
|
|
|
export class NotificationsApi {
|
|
constructor(private readonly client: ApiClient) {}
|
|
|
|
list(): Promise<Response> {
|
|
return this.client.get('/api/configuration/notification_providers');
|
|
}
|
|
|
|
appriseCliStatus(): Promise<Response> {
|
|
return this.client.get('/api/configuration/notification_providers/apprise/cli-status');
|
|
}
|
|
|
|
create(type: NotificationProviderType, body: Record<string, unknown>): Promise<Response> {
|
|
return this.client.post(`/api/configuration/notification_providers/${type}`, body);
|
|
}
|
|
|
|
update(
|
|
type: NotificationProviderType,
|
|
id: string,
|
|
body: Record<string, unknown>,
|
|
): Promise<Response> {
|
|
return this.client.put(`/api/configuration/notification_providers/${type}/${id}`, body);
|
|
}
|
|
|
|
delete(id: string): Promise<Response> {
|
|
return this.client.delete(`/api/configuration/notification_providers/${id}`);
|
|
}
|
|
|
|
test(type: NotificationProviderType, body: Record<string, unknown>): Promise<Response> {
|
|
return this.client.post(`/api/configuration/notification_providers/${type}/test`, body);
|
|
}
|
|
}
|