1
0
mirror of https://github.com/fallenbagel/jellyseerr.git synced 2026-01-11 09:06:55 -05:00
Files
jellyseerr/server/lib/notifications/agents/agent.ts

26 lines
670 B
TypeScript

import { Notification } from '..';
import { User } from '../../../entity/User';
import { NotificationAgentConfig } from '../../settings';
export interface NotificationPayload {
subject: string;
notifyUser: User;
image?: string;
message?: string;
extra?: { name: string; value: string }[];
}
export abstract class BaseAgent<T extends NotificationAgentConfig> {
protected settings?: T;
public constructor(settings?: T) {
this.settings = settings;
}
protected abstract getSettings(): T;
}
export interface NotificationAgent {
shouldSend(type: Notification): boolean;
send(type: Notification, payload: NotificationPayload): Promise<boolean>;
}