forked from charlires/go-auth0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompt.go
59 lines (49 loc) · 2.11 KB
/
prompt.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
package management
// Prompt is used within the Login Page.
//
// See: https://auth0.com/docs/customize/universal-login-pages/customize-login-text-prompts
type Prompt struct {
// Which login experience to use. Can be `new` or `classic`.
UniversalLoginExperience string `json:"universal_login_experience,omitempty"`
// IdentifierFirst determines if the login screen prompts for just the identifier, identifier and password first.
IdentifierFirst *bool `json:"identifier_first,omitempty"`
// WebAuthnPlatformFirstFactor determines if the login screen uses identifier and biometrics first.
WebAuthnPlatformFirstFactor *bool `json:"webauthn_platform_first_factor,omitempty"`
}
// PromptManager is used for managing a Prompt.
type PromptManager struct {
*Management
}
type promptCustomText struct {
Text *string
}
func newPromptManager(m *Management) *PromptManager {
return &PromptManager{m}
}
// Read retrieves prompts settings.
//
// See: https://auth0.com/docs/api/management/v2#!/Prompts/get_prompts
func (m *PromptManager) Read(opts ...RequestOption) (p *Prompt, err error) {
err = m.Request("GET", m.URI("prompts"), &p, opts...)
return
}
// Update prompts settings.
//
// See: https://auth0.com/docs/api/management/v2#!/Prompts/patch_prompts
func (m *PromptManager) Update(p *Prompt, opts ...RequestOption) error {
return m.Request("PATCH", m.URI("prompts"), p, opts...)
}
// CustomText retrieves the custom text for a specific prompt and language.
//
// See: https://auth0.com/docs/api/management/v2#!/Prompts/get_custom_text_by_language
func (m *PromptManager) CustomText(p string, l string, opts ...RequestOption) (t map[string]interface{}, err error) {
err = m.Request("GET", m.URI("prompts", p, "custom-text", l), &t, opts...)
return
}
// SetCustomText sets the custom text for a specific prompt. Existing texts will be overwritten.
//
// See: https://auth0.com/docs/api/management/v2#!/Prompts/put_custom_text_by_language
func (m *PromptManager) SetCustomText(p string, l string, b map[string]interface{}, opts ...RequestOption) (err error) {
err = m.Request("PUT", m.URI("prompts", p, "custom-text", l), &b, opts...)
return
}