This repository has been archived by the owner on Apr 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
account_creation_policy.go
57 lines (45 loc) · 2.27 KB
/
account_creation_policy.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
package stormpath
//AccountCreationPolicy represents a directory account creation policy object
//
//See: http://docs.stormpath.com/rest/product-guide/#directory-account-creation-policy
type AccountCreationPolicy struct {
resource
VerificationEmailStatus string `json:"verificationEmailStatus,omitempty"`
VerificationEmailTemplates *EmailTemplates `json:"verificationEmailTemplates,omitempty"`
VerificationSuccessEmailStatus string `json:"verificationSuccessEmailStatus,omitempty"`
VerificationSuccessEmailTemplates *EmailTemplates `json:"verificationSuccessEmailTemplates,omitempty"`
WelcomeEmailStatus string `json:"welcomeEmailStatus,omitempty"`
WelcomeEmailTemplates *EmailTemplates `json:"welcomeEmailTemplates,omitempty"`
}
//Refresh refreshes the resource by doing a GET to the resource href endpoint
func (policy *AccountCreationPolicy) Refresh() error {
return client.get(policy.Href, policy)
}
//Update updates the given resource, by doing a POST to the resource Href
func (policy *AccountCreationPolicy) Update() error {
return client.post(policy.Href, policy, policy)
}
//GetVerificationEmailTemplates loads the policy VerificationEmailTemplates collection and returns it
func (policy *AccountCreationPolicy) GetVerificationEmailTemplates() (*EmailTemplates, error) {
err := client.get(policy.VerificationEmailTemplates.Href, policy.VerificationEmailTemplates)
if err != nil {
return nil, err
}
return policy.VerificationEmailTemplates, nil
}
//GetVerificationSuccessEmailTemplates loads the policy VerificationSuccessEmailTemplates collection and returns it
func (policy *AccountCreationPolicy) GetVerificationSuccessEmailTemplates() (*EmailTemplates, error) {
err := client.get(policy.VerificationSuccessEmailTemplates.Href, policy.VerificationSuccessEmailTemplates)
if err != nil {
return nil, err
}
return policy.VerificationSuccessEmailTemplates, nil
}
//GetWelcomeEmailTemplates loads the policy WelcomeEmailTemplates collection and returns it
func (policy *AccountCreationPolicy) GetWelcomeEmailTemplates() (*EmailTemplates, error) {
err := client.get(policy.WelcomeEmailTemplates.Href, policy.WelcomeEmailTemplates)
if err != nil {
return nil, err
}
return policy.WelcomeEmailTemplates, nil
}