diff --git a/management/management.gen.go b/management/management.gen.go index be81a50d..5ea6e7ce 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -9091,12 +9091,12 @@ func (p *PromptRendering) GetPrompt() *PromptType { return p.Prompt } -// GetRenderingMode returns the RenderingMode field if it's non-nil, zero value otherwise. -func (p *PromptRendering) GetRenderingMode() string { - if p == nil || p.RenderingMode == nil { - return "" +// GetRenderingMode returns the RenderingMode field. +func (p *PromptRendering) GetRenderingMode() *RenderingMode { + if p == nil { + return nil } - return *p.RenderingMode + return p.RenderingMode } // GetScreen returns the Screen field. diff --git a/management/management.gen_test.go b/management/management.gen_test.go index f61e1198..a1f9a353 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -11408,10 +11408,7 @@ func TestPromptRendering_GetPrompt(tt *testing.T) { } func TestPromptRendering_GetRenderingMode(tt *testing.T) { - var zeroValue string - p := &PromptRendering{RenderingMode: &zeroValue} - p.GetRenderingMode() - p = &PromptRendering{} + p := &PromptRendering{} p.GetRenderingMode() p = nil p.GetRenderingMode() diff --git a/management/prompt.go b/management/prompt.go index c4815965..069c9909 100644 --- a/management/prompt.go +++ b/management/prompt.go @@ -6,6 +6,17 @@ import ( "fmt" ) +// RenderingMode is a type that represents the rendering mode. +type RenderingMode string + +var ( + // RenderingModeStandard represents the standard rendering mode. + RenderingModeStandard RenderingMode = "standard" + + // RenderingModeAdvanced represents the advanced rendering mode. + RenderingModeAdvanced RenderingMode = "advanced" +) + const ( // PromptSignup represents the signup prompt. PromptSignup PromptType = "signup" @@ -432,32 +443,32 @@ type PromptPartials struct { // PromptRendering is used to retrieve and set the settings for the ACUL. type PromptRendering struct { - Tenant *string `json:"tenant,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"` - HeadTags []interface{} `json:"head_tags,omitempty"` + Tenant *string `json:"tenant,omitempty"` + Prompt *PromptType `json:"prompt,omitempty"` + Screen *ScreenName `json:"screen,omitempty"` + RenderingMode *RenderingMode `json:"rendering_mode,omitempty"` + ContextConfiguration *[]string `json:"context_configuration,omitempty"` + DefaultHeadTagsDisabled *bool `json:"default_head_tags_disabled,omitempty"` + HeadTags []interface{} `json:"head_tags,omitempty"` } // MarshalJSON implements a custom [json.Marshaler]. func (c *PromptRendering) MarshalJSON() ([]byte, error) { type RenderingSubSet struct { - RenderMode *string `json:"rendering_mode,omitempty"` - ContextConfiguration *[]string `json:"context_configuration,omitempty"` - DefaultHeadTagsDisabled *bool `json:"default_head_tags_disabled,omitempty"` - HeadTags []interface{} `json:"head_tags,omitempty"` + RenderingMode *RenderingMode `json:"rendering_mode,omitempty"` + ContextConfiguration *[]string `json:"context_configuration,omitempty"` + DefaultHeadTagsDisabled *bool `json:"default_head_tags_disabled,omitempty"` + HeadTags []interface{} `json:"head_tags,omitempty"` } - if c.RenderingMode != nil && *c.RenderingMode == "standard" { + if c.RenderingMode != nil && *c.RenderingMode == RenderingModeStandard { return json.Marshal(&RenderingSubSet{ - RenderMode: c.RenderingMode, + RenderingMode: c.RenderingMode, }) } return json.Marshal(&RenderingSubSet{ - RenderMode: c.RenderingMode, + RenderingMode: c.RenderingMode, ContextConfiguration: c.ContextConfiguration, DefaultHeadTagsDisabled: c.DefaultHeadTagsDisabled, HeadTags: c.HeadTags, diff --git a/management/prompt_test.go b/management/prompt_test.go index e7d2339a..97cd716c 100644 --- a/management/prompt_test.go +++ b/management/prompt_test.go @@ -170,7 +170,7 @@ func TestPromptManager_UpdateRenderingWithStandardMode(t *testing.T) { _ = givenACustomDomain(t) _ = givenAUniversalLoginTemplate(t) expected := givenAPromptRendering(t) - expected.RenderingMode = auth0.String("standard") + expected.RenderingMode = &RenderingModeStandard expected.ContextConfiguration = &[]string{"branding.settings", "branding.themes.default", "client.logo_uri"} expected.DefaultHeadTagsDisabled = auth0.Bool(true) @@ -357,7 +357,7 @@ func givenAPromptRendering(t *testing.T) *PromptRendering { t.Helper() settings := &PromptRendering{ - RenderingMode: auth0.String("advanced"), + RenderingMode: &RenderingModeStandard, ContextConfiguration: &[]string{"branding.settings", "branding.themes.default"}, DefaultHeadTagsDisabled: auth0.Bool(false), HeadTags: []interface{}{