Skip to content

SudoSOS Back-end API / notifications/channels/abstract-channel / NotificationChannel

Abstract Class: NotificationChannel<TTemplate, TParams, TRendered> ​

A channel capable of delivering a notification (email, signal, SMS, etc.) using a specific template type, parameter type, and rendered output type.

Extended by ​

Type Parameters ​

Type ParameterDescription
TTemplate extends TemplateObject<TParams, TRendered>The template object type that this channel supports. Must implement TemplateObject<TParams, TRendered>.
TParams extends TemplateOptionsThe parameter type accepted by the template. This represents the data object used to fill in template variables.
TRenderedThe type of the rendered output after applying a template. Example: a MailMessage for email.

Constructors ​

Constructor ​

ts
new NotificationChannel<TTemplate, TParams, TRendered>(): NotificationChannel<TTemplate, TParams, TRendered>;

Returns ​

NotificationChannel<TTemplate, TParams, TRendered>

Properties ​

PropertyModifierType
nameabstractEMAIL
templatesabstractRecord<string, TTemplate>

Methods ​

apply() ​

ts
abstract apply(template, params): Promise<TRendered>;

Parameters ​

ParameterType
templateTTemplate
paramsTParams

Returns ​

Promise<TRendered>


getTemplate() ​

ts
getTemplate(type): TTemplate;

Parameters ​

ParameterType
typestring

Returns ​

TTemplate


log() ​

ts
log(user, code): Promise<void>;

Parameters ​

ParameterType
userUser
codeNotificationTypes

Returns ​

Promise<void>


send() ​

ts
abstract send(user, content): Promise<void>;

Parameters ​

ParameterType
userUser
contentTRendered

Returns ​

Promise<void>


supports() ​

ts
supports(type): boolean;

Parameters ​

ParameterType
typestring

Returns ​

boolean