Files
sct-overseerr/server/lib/notifications/agents/agent.ts
Ryan Cohen f5864b49de refactor: update a few dev deps and convert to using type imports where possible (#2886)
* build: bump deps and add some new eslint rules

* refactor: run eslint --fix on code to convert to type imports where possible
2022-08-03 12:57:51 +09:00

36 lines
1020 B
TypeScript

import type { Notification } from '..';
import type Issue from '../../../entity/Issue';
import type IssueComment from '../../../entity/IssueComment';
import type Media from '../../../entity/Media';
import type { MediaRequest } from '../../../entity/MediaRequest';
import type { User } from '../../../entity/User';
import type { NotificationAgentConfig } from '../../settings';
export interface NotificationPayload {
event?: string;
subject: string;
notifyAdmin: boolean;
notifyUser?: User;
media?: Media;
image?: string;
message?: string;
extra?: { name: string; value: string }[];
request?: MediaRequest;
issue?: Issue;
comment?: IssueComment;
}
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(): boolean;
send(type: Notification, payload: NotificationPayload): Promise<boolean>;
}