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 Parameter | Description |
|---|---|
TTemplate extends TemplateObject<TParams, TRendered> | The template object type that this channel supports. Must implement TemplateObject<TParams, TRendered>. |
TParams extends TemplateOptions | The parameter type accepted by the template. This represents the data object used to fill in template variables. |
TRendered | The 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 ​
| Property | Modifier | Type |
|---|---|---|
name | abstract | EMAIL |
templates | abstract | Record<string, TTemplate> |
Methods ​
apply() ​
ts
abstract apply(template, params): Promise<TRendered>;Parameters ​
| Parameter | Type |
|---|---|
template | TTemplate |
params | TParams |
Returns ​
Promise<TRendered>
getTemplate() ​
ts
getTemplate(type): TTemplate;Parameters ​
| Parameter | Type |
|---|---|
type | string |
Returns ​
TTemplate
log() ​
ts
log(user, code): Promise<void>;Parameters ​
| Parameter | Type |
|---|---|
user | User |
code | NotificationTypes |
Returns ​
Promise<void>
send() ​
ts
abstract send(user, content): Promise<void>;Parameters ​
| Parameter | Type |
|---|---|
user | User |
content | TRendered |
Returns ​
Promise<void>
supports() ​
ts
supports(type): boolean;Parameters ​
| Parameter | Type |
|---|---|
type | string |
Returns ​
boolean