PeerTube/shared/models/server/emailer.model.ts

50 lines
915 B
TypeScript
Raw Normal View History

2021-03-12 03:22:17 -06:00
type From = string | { name?: string, address: string }
2020-04-23 02:32:53 -05:00
2021-03-12 03:22:17 -06:00
interface Base extends Partial<SendEmailDefaultMessageOptions> {
to: string[] | string
}
interface MailTemplate extends Base {
template: string
locals?: { [key: string]: any }
2021-03-12 03:22:17 -06:00
text?: undefined
}
interface MailText extends Base {
text: string
2021-03-12 03:22:17 -06:00
locals?: Partial<SendEmailDefaultLocalsOptions> & {
title?: string
action?: {
url: string
text: string
}
}
2020-04-23 02:32:53 -05:00
}
2021-03-12 03:22:17 -06:00
interface SendEmailDefaultLocalsOptions {
instanceName: string
text: string
subject: string
}
interface SendEmailDefaultMessageOptions {
to: string[] | string
from: From
subject: string
replyTo: string
}
export type SendEmailDefaultOptions = {
template: 'common'
message: SendEmailDefaultMessageOptions
locals: SendEmailDefaultLocalsOptions & {
WEBSERVER: any
EMAIL: any
}
}
export type SendEmailOptions = MailTemplate | MailText