forked from jarias/stormpath-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
email_template.go
45 lines (37 loc) · 1.26 KB
/
email_template.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
package stormpath
//EmailTemplate represents an account creation policy email template
type EmailTemplate struct {
resource
FromEmailAddress string `json:"fromEmailAddress"`
FromName string `json:"fromName"`
Subject string `json:"subject"`
HTMLBody string `json:"htmlBody"`
TextBody string `json:"textBody"`
MimeType string `json:"mimeType"`
DefaultModel map[string]string `json:"defaultModel"`
}
//EmailTemplates represents a collection of EmailTemplate
type EmailTemplates struct {
collectionResource
Items []EmailTemplate `json:"items,omitempty"`
}
//GetEmailTemplate loads an email template by href
func GetEmailTemplate(href string) (*EmailTemplate, error) {
emailTemplate := &EmailTemplate{}
err := client.get(
href,
emailTemplate,
)
if err != nil {
return nil, err
}
return emailTemplate, nil
}
//Refresh refreshes the resource by doing a GET to the resource href endpoint
func (template *EmailTemplate) Refresh() error {
return client.get(template.Href, template)
}
//Update updates the given resource, by doing a POST to the resource Href
func (template *EmailTemplate) Update() error {
return client.post(template.Href, template, template)
}