Documentation ¶
Overview ¶
Package notify provides notification functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NopService = &Service{}
NopService is do-nothing notifier, without destinations
Functions ¶
This section is empty.
Types ¶
type Destination ¶
Destination defines interface for a given destination service, like telegram, email and so on
type Email ¶ added in v1.5.0
type Email struct { EmailParams SMTPParams // contains filtered or unexported fields }
Email implements notify.Destination for email
func NewEmail ¶ added in v1.5.0
func NewEmail(emailParams EmailParams, smtpParams SMTPParams) (*Email, error)
NewEmail makes new Email object, returns error in case of e.MsgTemplate or e.VerificationTemplate parsing error
type EmailParams ¶ added in v1.5.0
type EmailParams struct { From string // from email address MsgTemplate string // request message template VerificationSubject string // verification message subject VerificationTemplate string // verification message template SubscribeURL string // full subscribe handler URL UnsubscribeURL string // full unsubscribe handler URL TokenGenFn func(userID, email, site string) (string, error) // Unsubscribe token generation function }
EmailParams contain settings for email notifications
type MockDest ¶ added in v1.5.0
type MockDest struct {
// contains filtered or unexported fields
}
MockDest is a destination mock
type Request ¶ added in v1.5.0
type Request struct { Comment store.Comment // if set sent notifications about new comment Email string // if set (also) send email ForAdmin bool // if set, message supposed to be sent to administrator Verification VerificationMetadata // if set sent verification notification // contains filtered or unexported fields }
Request notification either about comment or about particular user verification
type SMTPParams ¶ added in v1.6.0
type SMTPParams struct { Host string // SMTP host Port int // SMTP port TLS bool // TLS auth Username string // user name Password string // password TimeOut time.Duration // TCP connection timeout }
SMTPParams contain settings for smtp server connection
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service delivers notifications to multiple destinations
func NewService ¶
func NewService(dataService Store, size int, destinations ...Destination) *Service
NewService makes notification service routing comments to all destinations.
type Store ¶
type Store interface { Get(locator store.Locator, id string, user store.User) (store.Comment, error) GetUserEmail(siteID string, userID string) (string, error) }
Store defines the minimal interface accessing stored comments used by notifier
type Telegram ¶
type Telegram struct {
// contains filtered or unexported fields
}
Telegram implements notify.Destination for telegram
func NewTelegram ¶
func NewTelegram(token string, channelID string, timeout time.Duration, api string) (*Telegram, error)
NewTelegram makes telegram bot for notifications
type VerificationMetadata ¶ added in v1.5.0
VerificationMetadata required to send notify method verification message