diff --git a/management/management.gen.go b/management/management.gen.go index 99685f73..25e56942 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -8988,6 +8988,59 @@ func (p *Prompt) String() string { return Stringify(p) } +// GetContextConfiguration returns the ContextConfiguration field if it's non-nil, zero value otherwise. +func (p *PromptACULSettings) GetContextConfiguration() []string { + if p == nil || p.ContextConfiguration == nil { + return nil + } + return *p.ContextConfiguration +} + +// GetDefaultHeadTagsDisabled returns the DefaultHeadTagsDisabled field if it's non-nil, zero value otherwise. +func (p *PromptACULSettings) GetDefaultHeadTagsDisabled() bool { + if p == nil || p.DefaultHeadTagsDisabled == nil { + return false + } + return *p.DefaultHeadTagsDisabled +} + +// GetPrompt returns the Prompt field. +func (p *PromptACULSettings) GetPrompt() *PromptType { + if p == nil { + return nil + } + return p.Prompt +} + +// GetRenderingMode returns the RenderingMode field if it's non-nil, zero value otherwise. +func (p *PromptACULSettings) GetRenderingMode() string { + if p == nil || p.RenderingMode == nil { + return "" + } + return *p.RenderingMode +} + +// GetScreen returns the Screen field. +func (p *PromptACULSettings) GetScreen() *ScreenName { + if p == nil { + return nil + } + return p.Screen +} + +// GetTenant returns the Tenant field if it's non-nil, zero value otherwise. +func (p *PromptACULSettings) GetTenant() string { + if p == nil || p.Tenant == nil { + return "" + } + return *p.Tenant +} + +// String returns a string representation of PromptACULSettings. +func (p *PromptACULSettings) String() string { + return Stringify(p) +} + // String returns a string representation of PromptPartials. func (p *PromptPartials) String() string { return Stringify(p) diff --git a/management/management.gen_test.go b/management/management.gen_test.go index 54e4832d..2266a3b4 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -11276,6 +11276,68 @@ func TestPrompt_String(t *testing.T) { } } +func TestPromptACULSettings_GetContextConfiguration(tt *testing.T) { + var zeroValue []string + p := &PromptACULSettings{ContextConfiguration: &zeroValue} + p.GetContextConfiguration() + p = &PromptACULSettings{} + p.GetContextConfiguration() + p = nil + p.GetContextConfiguration() +} + +func TestPromptACULSettings_GetDefaultHeadTagsDisabled(tt *testing.T) { + var zeroValue bool + p := &PromptACULSettings{DefaultHeadTagsDisabled: &zeroValue} + p.GetDefaultHeadTagsDisabled() + p = &PromptACULSettings{} + p.GetDefaultHeadTagsDisabled() + p = nil + p.GetDefaultHeadTagsDisabled() +} + +func TestPromptACULSettings_GetPrompt(tt *testing.T) { + p := &PromptACULSettings{} + p.GetPrompt() + p = nil + p.GetPrompt() +} + +func TestPromptACULSettings_GetRenderingMode(tt *testing.T) { + var zeroValue string + p := &PromptACULSettings{RenderingMode: &zeroValue} + p.GetRenderingMode() + p = &PromptACULSettings{} + p.GetRenderingMode() + p = nil + p.GetRenderingMode() +} + +func TestPromptACULSettings_GetScreen(tt *testing.T) { + p := &PromptACULSettings{} + p.GetScreen() + p = nil + p.GetScreen() +} + +func TestPromptACULSettings_GetTenant(tt *testing.T) { + var zeroValue string + p := &PromptACULSettings{Tenant: &zeroValue} + p.GetTenant() + p = &PromptACULSettings{} + p.GetTenant() + p = nil + p.GetTenant() +} + +func TestPromptACULSettings_String(t *testing.T) { + var rawJSON json.RawMessage + v := &PromptACULSettings{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestPromptPartials_String(t *testing.T) { var rawJSON json.RawMessage v := &PromptPartials{} diff --git a/management/prompt.go b/management/prompt.go index ea0049ee..c41f1849 100644 --- a/management/prompt.go +++ b/management/prompt.go @@ -283,8 +283,8 @@ type PromptPartials struct { // PromptACULSettings is used to retrieve and set the settings for the ACUL. type PromptACULSettings struct { Tenant *string `json:"tenant,omitempty"` - Prompt *string `json:"prompt,omitempty"` - Screen *string `json:"screen,omitempty"` + Prompt *PromptType `json:"prompt,omitempty"` + Screen *ScreenName `json:"screen,omitempty"` RenderingMode *string `json:"rendering_mode,omitempty"` ContextConfiguration *[]string `json:"context_configuration,omitempty"` DefaultHeadTagsDisabled *bool `json:"default_head_tags_disabled,omitempty"` diff --git a/management/prompt_test.go b/management/prompt_test.go index ec01579d..69316fb5 100644 --- a/management/prompt_test.go +++ b/management/prompt_test.go @@ -135,12 +135,12 @@ func TestPromptManager_ReadACULSettings(t *testing.T) { expected := givenAACULSettings(t) actual, err := api.Prompt.ReadACULSettings(context.Background(), PromptSignup, ScreenSignup) assert.NoError(t, err) - assert.Equal(t, expected.RenderingMode, actual.RenderingMode) - assert.Equal(t, expected.ContextConfiguration, actual.ContextConfiguration) - assert.Equal(t, expected.DefaultHeadTagsDisabled, actual.DefaultHeadTagsDisabled) + assert.Equal(t, expected.GetRenderingMode(), actual.GetRenderingMode()) + assert.Equal(t, expected.GetContextConfiguration(), actual.GetContextConfiguration()) + assert.Equal(t, expected.GetDefaultHeadTagsDisabled(), actual.GetDefaultHeadTagsDisabled()) assert.Equal(t, expected.HeadTags, actual.HeadTags) - assert.Equal(t, string(PromptSignup), *actual.Prompt) - assert.Equal(t, string(ScreenSignup), *actual.Screen) + assert.Equal(t, PromptSignup, *actual.GetPrompt()) + assert.Equal(t, ScreenSignup, *actual.GetScreen()) } func TestPromptManager_UpdateACULSettings(t *testing.T) { @@ -158,12 +158,12 @@ func TestPromptManager_UpdateACULSettings(t *testing.T) { actual, err := api.Prompt.ReadACULSettings(context.Background(), PromptSignup, ScreenSignup) assert.NoError(t, err) - assert.Equal(t, expected.RenderingMode, actual.RenderingMode) - assert.Equal(t, expected.ContextConfiguration, actual.ContextConfiguration) - assert.Equal(t, expected.DefaultHeadTagsDisabled, actual.DefaultHeadTagsDisabled) + assert.Equal(t, expected.GetRenderingMode(), actual.GetRenderingMode()) + assert.Equal(t, expected.GetContextConfiguration(), actual.GetContextConfiguration()) + assert.Equal(t, expected.GetDefaultHeadTagsDisabled(), actual.GetDefaultHeadTagsDisabled()) assert.Equal(t, expected.HeadTags, actual.HeadTags) - assert.Equal(t, string(PromptSignup), *actual.Prompt) - assert.Equal(t, string(ScreenSignup), *actual.Screen) + assert.Equal(t, PromptSignup, *actual.GetPrompt()) + assert.Equal(t, ScreenSignup, *actual.GetScreen()) } func TestPromptManager_GetPartialsGuardGuardError(t *testing.T) { diff --git a/test/data/recordings/TestPromptManager_ReadACULSettings.yaml b/test/data/recordings/TestPromptManager_ReadACULSettings.yaml index 2338c155..48881eab 100644 --- a/test/data/recordings/TestPromptManager_ReadACULSettings.yaml +++ b/test/data/recordings/TestPromptManager_ReadACULSettings.yaml @@ -13,7 +13,7 @@ interactions: remote_addr: "" request_uri: "" body: | - {"domain":"1730879337.auth.uat.auth0.com","type":"auth0_managed_certs","tls_policy":"recommended"} + {"domain":"1730881029.auth.uat.auth0.com","type":"auth0_managed_certs","tls_policy":"recommended"} form: {} headers: Content-Type: @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 328 uncompressed: false - body: '{"custom_domain_id":"cd_DeGXfsUqhbchzKf5","domain":"1730879337.auth.uat.auth0.com","primary":true,"status":"pending_verification","type":"auth0_managed_certs","verification":{"methods":[{"name":"CNAME","record":"go-auth0-dev.eu.auth0.com-cd-degxfsuqhbchzkf5.edge.tenants.us.auth0.com","domain":"1730879337.auth.uat.auth0.com"}]},"tls_policy":"recommended"}' + body: '{"custom_domain_id":"cd_7SgKHnrmHQNuTXEs","domain":"1730881029.auth.uat.auth0.com","primary":true,"status":"pending_verification","type":"auth0_managed_certs","verification":{"methods":[{"name":"CNAME","record":"go-auth0-dev.eu.auth0.com-cd-7sgkhnrmhqnutxes.edge.tenants.us.auth0.com","domain":"1730881029.auth.uat.auth0.com"}]},"tls_policy":"recommended"}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 974.35075ms + duration: 923.825708ms - id: 1 request: proto: HTTP/1.1 @@ -72,7 +72,7 @@ interactions: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 2.793827583s + duration: 2.783568542s - id: 2 request: proto: HTTP/1.1 @@ -108,7 +108,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 353.726833ms + duration: 345.701625ms - id: 3 request: proto: HTTP/1.1 @@ -143,7 +143,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 348.886583ms + duration: 348.5575ms - id: 4 request: proto: HTTP/1.1 @@ -178,7 +178,7 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 760.373ms + duration: 433.247666ms - id: 5 request: proto: HTTP/1.1 @@ -197,7 +197,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/custom-domains/cd_DeGXfsUqhbchzKf5 + url: https://go-auth0-dev.eu.auth0.com/api/v2/custom-domains/cd_7SgKHnrmHQNuTXEs method: DELETE response: proto: HTTP/2.0 @@ -213,4 +213,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 370.957958ms + duration: 383.460542ms diff --git a/test/data/recordings/TestPromptManager_UpdateACULSettings.yaml b/test/data/recordings/TestPromptManager_UpdateACULSettings.yaml index 9ed05789..7c2cc0bf 100644 --- a/test/data/recordings/TestPromptManager_UpdateACULSettings.yaml +++ b/test/data/recordings/TestPromptManager_UpdateACULSettings.yaml @@ -13,7 +13,7 @@ interactions: remote_addr: "" request_uri: "" body: | - {"domain":"1730879370.auth.uat.auth0.com","type":"auth0_managed_certs","tls_policy":"recommended"} + {"domain":"1730881040.auth.uat.auth0.com","type":"auth0_managed_certs","tls_policy":"recommended"} form: {} headers: Content-Type: @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 328 uncompressed: false - body: '{"custom_domain_id":"cd_rNXkRgJuAbM6W9fC","domain":"1730879370.auth.uat.auth0.com","primary":true,"status":"pending_verification","type":"auth0_managed_certs","verification":{"methods":[{"name":"CNAME","record":"go-auth0-dev.eu.auth0.com-cd-rnxkrgjuabm6w9fc.edge.tenants.us.auth0.com","domain":"1730879370.auth.uat.auth0.com"}]},"tls_policy":"recommended"}' + body: '{"custom_domain_id":"cd_mCgfHuD8KHAJLUPH","domain":"1730881040.auth.uat.auth0.com","primary":true,"status":"pending_verification","type":"auth0_managed_certs","verification":{"methods":[{"name":"CNAME","record":"go-auth0-dev.eu.auth0.com-cd-mcgfhud8khajluph.edge.tenants.us.auth0.com","domain":"1730881040.auth.uat.auth0.com"}]},"tls_policy":"recommended"}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 1.414983666s + duration: 931.885375ms - id: 1 request: proto: HTTP/1.1 @@ -72,7 +72,7 @@ interactions: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 2.783077583s + duration: 2.6563045s - id: 2 request: proto: HTTP/1.1 @@ -108,7 +108,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 383.213625ms + duration: 397.351625ms - id: 3 request: proto: HTTP/1.1 @@ -144,7 +144,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 408.439167ms + duration: 334.0825ms - id: 4 request: proto: HTTP/1.1 @@ -179,7 +179,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 338.8935ms + duration: 341.364959ms - id: 5 request: proto: HTTP/1.1 @@ -214,7 +214,7 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 426.412916ms + duration: 485.731875ms - id: 6 request: proto: HTTP/1.1 @@ -233,7 +233,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/custom-domains/cd_rNXkRgJuAbM6W9fC + url: https://go-auth0-dev.eu.auth0.com/api/v2/custom-domains/cd_mCgfHuD8KHAJLUPH method: DELETE response: proto: HTTP/2.0 @@ -249,4 +249,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 458.251375ms + duration: 487.402417ms