Documentation
¶
Index ¶
- Constants
- Variables
- func FeedbackCategoryLabel(category string) string
- func FormatDiscordFeedbackContent(feedback SupportFeedback) string
- func NormalizeFeedbackCategory(category string) (string, error)
- func NormalizeFeedbackDetails(details string) (string, error)
- func NormalizeFeedbackPagePath(pagePath string) string
- func SupportFeedbackToEmail() string
- type DatabaseEmailSettingsProvider
- type DiscordWebhookClient
- type EmailService
- type EmailServiceConfig
- type EmailSettingsProvider
- type MagicCodeTemplateData
- type NoopEmailService
- func (s *NoopEmailService) Reset()
- func (s *NoopEmailService) SendMagicCodeEmail(toEmail, code, magicLink string) error
- func (s *NoopEmailService) SendSupportFeedbackEmail(toEmail string, feedback SupportFeedback) error
- func (s *NoopEmailService) SendWorkOrderNotificationEmail(toEmail, subject string, data WorkOrderNotificationTemplateData) error
- func (s *NoopEmailService) SentMagicCodeEmails() []SentMagicCodeEmail
- func (s *NoopEmailService) SentSupportFeedbackEmails() []SentSupportFeedbackEmail
- func (s *NoopEmailService) SentWorkOrderNotificationEmails() []SentWorkOrderNotificationEmail
- type ResendEmailService
- func (s *ResendEmailService) SendMagicCodeEmail(toEmail, code, magicLink string) error
- func (s *ResendEmailService) SendSupportFeedbackEmail(toEmail string, feedback SupportFeedback) error
- func (s *ResendEmailService) SendWorkOrderNotificationEmail(toEmail, subject string, data WorkOrderNotificationTemplateData) error
- type SMTPEmailService
- func (s *SMTPEmailService) SendMagicCodeEmail(toEmail, code, magicLink string) error
- func (s *SMTPEmailService) SendSupportFeedbackEmail(toEmail string, feedback SupportFeedback) error
- func (s *SMTPEmailService) SendWorkOrderNotificationEmail(toEmail, subject string, data WorkOrderNotificationTemplateData) error
- type SMTPSettings
- type SentMagicCodeEmail
- type SentSupportFeedbackEmail
- type SentWorkOrderNotificationEmail
- type SupportFeedback
- type SupportFeedbackAttachment
- type SupportFeedbackTemplateData
- type WorkOrderNotificationTemplateData
Constants ¶
View Source
const ( FeedbackCategoryBug = "bug" FeedbackCategoryFeature = "feature" FeedbackCategoryOther = "other" DefaultSupportFeedbackToEmail = "support@superplane.com" MaxSupportFeedbackDetailsRunes = 8000 MaxSupportFeedbackAttachmentBytes = 5 << 20 MaxSupportFeedbackRequestBytes = MaxSupportFeedbackAttachmentBytes + 1<<20 MaxSupportFeedbackPagePathRunes = 500 MaxSupportFeedbackAttachmentNameLen = 255 )
Variables ¶
View Source
var ( ErrFeedbackCategoryInvalid = errors.New("feedback category is invalid") ErrFeedbackDetailsRequired = errors.New("feedback details are required") ErrFeedbackDetailsTooLong = errors.New("feedback details are too long") ErrFeedbackAttachmentTooLarge = errors.New("feedback attachment is too large") ErrFeedbackAttachmentType = errors.New("feedback attachment type is not allowed") ErrFeedbackAttachmentName = errors.New("feedback attachment name is invalid") )
Functions ¶
func FeedbackCategoryLabel ¶
func FormatDiscordFeedbackContent ¶
func FormatDiscordFeedbackContent(feedback SupportFeedback) string
func SupportFeedbackToEmail ¶
func SupportFeedbackToEmail() string
Types ¶
type DatabaseEmailSettingsProvider ¶ added in v0.0.43
func (*DatabaseEmailSettingsProvider) GetSMTPSettings ¶ added in v0.0.43
func (p *DatabaseEmailSettingsProvider) GetSMTPSettings(ctx context.Context) (*SMTPSettings, error)
type DiscordWebhookClient ¶
func NewDiscordWebhookClient ¶
func NewDiscordWebhookClient(webhookURL string) *DiscordWebhookClient
func (*DiscordWebhookClient) Enabled ¶
func (c *DiscordWebhookClient) Enabled() bool
func (*DiscordWebhookClient) SendSupportFeedback ¶
func (c *DiscordWebhookClient) SendSupportFeedback(feedback SupportFeedback) error
type EmailService ¶
type EmailService interface {
SendMagicCodeEmail(toEmail, code, magicLink string) error
SendWorkOrderNotificationEmail(toEmail, subject string, data WorkOrderNotificationTemplateData) error
SendSupportFeedbackEmail(toEmail string, feedback SupportFeedback) error
}
func BuildEmailService ¶ added in v0.14.0
func BuildEmailService(encryptor crypto.Encryptor, cfg EmailServiceConfig) EmailService
BuildEmailService creates an EmailService based on the provided configuration. Returns nil if required configuration is missing.
type EmailServiceConfig ¶ added in v0.14.0
type EmailSettingsProvider ¶ added in v0.0.43
type EmailSettingsProvider interface {
GetSMTPSettings(ctx context.Context) (*SMTPSettings, error)
}
type MagicCodeTemplateData ¶ added in v0.14.0
type NoopEmailService ¶ added in v0.0.43
type NoopEmailService struct {
// contains filtered or unexported fields
}
func NewNoopEmailService ¶ added in v0.0.43
func NewNoopEmailService() *NoopEmailService
func (*NoopEmailService) Reset ¶ added in v0.0.43
func (s *NoopEmailService) Reset()
func (*NoopEmailService) SendMagicCodeEmail ¶ added in v0.14.0
func (s *NoopEmailService) SendMagicCodeEmail(toEmail, code, magicLink string) error
func (*NoopEmailService) SendSupportFeedbackEmail ¶
func (s *NoopEmailService) SendSupportFeedbackEmail(toEmail string, feedback SupportFeedback) error
func (*NoopEmailService) SendWorkOrderNotificationEmail ¶
func (s *NoopEmailService) SendWorkOrderNotificationEmail( toEmail, subject string, data WorkOrderNotificationTemplateData, ) error
func (*NoopEmailService) SentMagicCodeEmails ¶ added in v0.14.0
func (s *NoopEmailService) SentMagicCodeEmails() []SentMagicCodeEmail
func (*NoopEmailService) SentSupportFeedbackEmails ¶
func (s *NoopEmailService) SentSupportFeedbackEmails() []SentSupportFeedbackEmail
func (*NoopEmailService) SentWorkOrderNotificationEmails ¶
func (s *NoopEmailService) SentWorkOrderNotificationEmails() []SentWorkOrderNotificationEmail
type ResendEmailService ¶
type ResendEmailService struct {
// contains filtered or unexported fields
}
func NewResendEmailService ¶
func NewResendEmailService(apiKey, fromName, fromEmail, templateDir string) *ResendEmailService
func (*ResendEmailService) SendMagicCodeEmail ¶ added in v0.14.0
func (s *ResendEmailService) SendMagicCodeEmail(toEmail, code, magicLink string) error
func (*ResendEmailService) SendSupportFeedbackEmail ¶
func (s *ResendEmailService) SendSupportFeedbackEmail(toEmail string, feedback SupportFeedback) error
func (*ResendEmailService) SendWorkOrderNotificationEmail ¶
func (s *ResendEmailService) SendWorkOrderNotificationEmail( toEmail, subject string, data WorkOrderNotificationTemplateData, ) error
type SMTPEmailService ¶ added in v0.0.43
type SMTPEmailService struct {
// contains filtered or unexported fields
}
func NewSMTPEmailService ¶ added in v0.0.43
func NewSMTPEmailService(settingsProvider EmailSettingsProvider, templateDir string) *SMTPEmailService
func (*SMTPEmailService) SendMagicCodeEmail ¶ added in v0.14.0
func (s *SMTPEmailService) SendMagicCodeEmail(toEmail, code, magicLink string) error
func (*SMTPEmailService) SendSupportFeedbackEmail ¶
func (s *SMTPEmailService) SendSupportFeedbackEmail(toEmail string, feedback SupportFeedback) error
func (*SMTPEmailService) SendWorkOrderNotificationEmail ¶
func (s *SMTPEmailService) SendWorkOrderNotificationEmail( toEmail, subject string, data WorkOrderNotificationTemplateData, ) error
type SMTPSettings ¶ added in v0.0.43
type SentMagicCodeEmail ¶ added in v0.14.0
type SentSupportFeedbackEmail ¶
type SentSupportFeedbackEmail struct {
ToEmail string
Feedback SupportFeedback
}
type SentWorkOrderNotificationEmail ¶
type SentWorkOrderNotificationEmail struct {
ToEmail string
Subject string
Data WorkOrderNotificationTemplateData
}
type SupportFeedback ¶
type SupportFeedback struct {
Category string
Details string
UserName string
UserEmail string
OrganizationID string
OrganizationName string
PagePath string
Attachment *SupportFeedbackAttachment
}
func (SupportFeedback) EmailSubject ¶
func (f SupportFeedback) EmailSubject() string
func (SupportFeedback) TemplateData ¶
func (f SupportFeedback) TemplateData() SupportFeedbackTemplateData
type SupportFeedbackAttachment ¶
func NormalizeFeedbackAttachment ¶
func NormalizeFeedbackAttachment(filename, contentType string, content []byte) (*SupportFeedbackAttachment, error)
type WorkOrderNotificationTemplateData ¶
type WorkOrderNotificationTemplateData struct {
// Summary is the one-line event description, for example
// "Ana Souza commented on SP-42".
Summary string
WorkOrderKey string
WorkOrderTitle string
// Detail is optional supporting text (comment excerpt, state change).
Detail string
WorkOrderLink string
// DetailCtaLabel and DetailCtaURL render a secondary HTML link under
// the detail block (status-note CTAs). Empty URL skips the link.
DetailCtaLabel string
DetailCtaURL string
// Kanban-card fields. Colors are light-theme hex values so the HTML
// email matches the work order board card.
StatusLabel string
StatusFg string
StatusBg string
StatusBorder string
StatusDot string
LineStepLabel string
UpdatedLabel string
AssigneeInitials string
AssigneeOverflow string
}
WorkOrderNotificationTemplateData feeds the shared work_order_notification templates. One template renders every notification type; the consumer builds the summary and detail lines.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.