rokot-notification
Version:
Rokot - [Rocketmakers](http://www.rocketmakers.com/) TypeScript NodeJs Platform
55 lines (54 loc) • 1.78 kB
TypeScript
export declare type Frequency = "immediate" | "daily" | "weekly" | "never";
export declare const AllFrequency: Frequency[];
export declare type PromiseOrResult<T> = Promise<T> | T;
export declare type ItemOrArray<T> = T | T[];
export interface INewable<T> {
new (...args: any[]): T;
}
export interface INotificationDispatchHandlerTransport {
methodName: string;
defaultFrequency: string;
availableFrequencies: string[];
}
export interface INotificationHandlerDecoration {
HandlerClass?: INewable<INotificationHandler<any>>;
notificationType: string;
validators: string[];
testCases: string[];
templates: string[];
name: string;
group: string;
transports: INotificationDispatchHandlerTransport[];
}
export interface INotificationHandlerConstructor {
(decoration: INotificationHandlerDecoration): INotificationHandler<any>;
}
export interface INotificationDispatchResult {
transport: string;
sent?: string[];
failed?: {
token: string;
error: any;
}[];
error?: any;
native?: any;
}
export interface INotificationDispatchHandler {
transportName: string;
onDispatch(notification: INotification, notificationHandler: INotificationHandler<any>): Promise<INotificationDispatchResult>;
shutdown?(): void;
}
export interface INotificationTransport<TNative> {
shutdown(): void;
resolveTokens(recipients: NotificationRecipients): Promise<string[]>;
native: TNative;
}
export interface INotificationHandler<TNotification extends INotification> {
}
export interface INotificationRecipient {
}
export declare type NotificationRecipients = ItemOrArray<INotificationRecipient | string>;
export interface INotification {
type: string;
recipient: NotificationRecipients;
}