-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.go
109 lines (92 loc) · 2.42 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package emailtemplates
// New is a function that creates a new config for the email templates
func New(options ...Option) (*Config, error) {
// initialize the resendEmailSender
c := &Config{}
// apply the options
for _, option := range options {
option(c)
}
return c, nil
}
// Option is a function that sets a field on an EmailMessage
type Option func(*Config)
// WithCompanyName sets the company name for the email
func WithCompanyName(name string) Option {
return func(t *Config) {
t.CompanyName = name
}
}
// WithCompanyAddress sets company address for the footer of the email
func WithCompanyAddress(address string) Option {
return func(t *Config) {
t.CompanyAddress = address
}
}
// WithCorporation sets the corporation used in the footer of the email
func WithCorporation(corp string) Option {
return func(t *Config) {
t.Corporation = corp
}
}
// WithRootDomain sets the root domain for the email
func WithRootDomain(domain string) Option {
return func(t *Config) {
t.URLS.Root = domain
}
}
// WithProductDomain sets the product domain for the email
func WithProductDomain(domain string) Option {
return func(t *Config) {
t.URLS.Product = domain
}
}
// WithDocsDomain sets the docs domain for the email
func WithDocsDomain(domain string) Option {
return func(t *Config) {
t.URLS.Docs = domain
}
}
// WithFromEmail sets the from email for the email
func WithFromEmail(email string) Option {
return func(t *Config) {
t.FromEmail = email
}
}
// WithSupportEmail sets the support email for the email
func WithSupportEmail(email string) Option {
return func(t *Config) {
t.SupportEmail = email
}
}
// WithVerifyURL sets the verify URL for the email
func WithVerifyURL(url string) Option {
return func(t *Config) {
t.URLS.Verify = url
}
}
// WithInviteURL sets the invite URL for the email
func WithInviteURL(url string) Option {
return func(t *Config) {
t.URLS.Invite = url
}
}
// WithResetURL sets the reset URL for the email
func WithResetURL(url string) Option {
return func(t *Config) {
t.URLS.PasswordReset = url
}
}
// WithVerifySubscriberURL sets the verify subscriber URL for the email
func WithVerifySubscriberURL(url string) Option {
return func(t *Config) {
t.URLS.VerifySubscriber = url
}
}
// WithLogoURL sets the logo URL for the email, this field is optional and
// omitted from the email if not provided
func WithLogoURL(url string) Option {
return func(t *Config) {
t.LogoURL = url
}
}