From 7da5537b2fba49ddc57a89326a2ed71f066010a0 Mon Sep 17 00:00:00 2001 From: Kunal Dawar Date: Wed, 6 Nov 2024 15:12:24 +0530 Subject: [PATCH] Update Methods Name --- management/management.gen.go | 26 ++++++++-------- management/management.gen_test.go | 52 +++++++++++++++---------------- management/prompt.go | 18 +++++------ management/prompt_test.go | 20 ++++++------ 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/management/management.gen.go b/management/management.gen.go index 25e56942..b2635cbf 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -8988,8 +8988,13 @@ func (p *Prompt) String() string { return Stringify(p) } +// String returns a string representation of PromptPartials. +func (p *PromptPartials) String() string { + return Stringify(p) +} + // GetContextConfiguration returns the ContextConfiguration field if it's non-nil, zero value otherwise. -func (p *PromptACULSettings) GetContextConfiguration() []string { +func (p *PromptRendering) GetContextConfiguration() []string { if p == nil || p.ContextConfiguration == nil { return nil } @@ -8997,7 +9002,7 @@ func (p *PromptACULSettings) GetContextConfiguration() []string { } // GetDefaultHeadTagsDisabled returns the DefaultHeadTagsDisabled field if it's non-nil, zero value otherwise. -func (p *PromptACULSettings) GetDefaultHeadTagsDisabled() bool { +func (p *PromptRendering) GetDefaultHeadTagsDisabled() bool { if p == nil || p.DefaultHeadTagsDisabled == nil { return false } @@ -9005,7 +9010,7 @@ func (p *PromptACULSettings) GetDefaultHeadTagsDisabled() bool { } // GetPrompt returns the Prompt field. -func (p *PromptACULSettings) GetPrompt() *PromptType { +func (p *PromptRendering) GetPrompt() *PromptType { if p == nil { return nil } @@ -9013,7 +9018,7 @@ func (p *PromptACULSettings) GetPrompt() *PromptType { } // GetRenderingMode returns the RenderingMode field if it's non-nil, zero value otherwise. -func (p *PromptACULSettings) GetRenderingMode() string { +func (p *PromptRendering) GetRenderingMode() string { if p == nil || p.RenderingMode == nil { return "" } @@ -9021,7 +9026,7 @@ func (p *PromptACULSettings) GetRenderingMode() string { } // GetScreen returns the Screen field. -func (p *PromptACULSettings) GetScreen() *ScreenName { +func (p *PromptRendering) GetScreen() *ScreenName { if p == nil { return nil } @@ -9029,20 +9034,15 @@ func (p *PromptACULSettings) GetScreen() *ScreenName { } // GetTenant returns the Tenant field if it's non-nil, zero value otherwise. -func (p *PromptACULSettings) GetTenant() string { +func (p *PromptRendering) 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 { +// String returns a string representation of PromptRendering. +func (p *PromptRendering) String() string { return Stringify(p) } diff --git a/management/management.gen_test.go b/management/management.gen_test.go index 2266a3b4..cfaf98f5 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -11276,71 +11276,71 @@ func TestPrompt_String(t *testing.T) { } } -func TestPromptACULSettings_GetContextConfiguration(tt *testing.T) { +func TestPromptPartials_String(t *testing.T) { + var rawJSON json.RawMessage + v := &PromptPartials{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestPromptRendering_GetContextConfiguration(tt *testing.T) { var zeroValue []string - p := &PromptACULSettings{ContextConfiguration: &zeroValue} + p := &PromptRendering{ContextConfiguration: &zeroValue} p.GetContextConfiguration() - p = &PromptACULSettings{} + p = &PromptRendering{} p.GetContextConfiguration() p = nil p.GetContextConfiguration() } -func TestPromptACULSettings_GetDefaultHeadTagsDisabled(tt *testing.T) { +func TestPromptRendering_GetDefaultHeadTagsDisabled(tt *testing.T) { var zeroValue bool - p := &PromptACULSettings{DefaultHeadTagsDisabled: &zeroValue} + p := &PromptRendering{DefaultHeadTagsDisabled: &zeroValue} p.GetDefaultHeadTagsDisabled() - p = &PromptACULSettings{} + p = &PromptRendering{} p.GetDefaultHeadTagsDisabled() p = nil p.GetDefaultHeadTagsDisabled() } -func TestPromptACULSettings_GetPrompt(tt *testing.T) { - p := &PromptACULSettings{} +func TestPromptRendering_GetPrompt(tt *testing.T) { + p := &PromptRendering{} p.GetPrompt() p = nil p.GetPrompt() } -func TestPromptACULSettings_GetRenderingMode(tt *testing.T) { +func TestPromptRendering_GetRenderingMode(tt *testing.T) { var zeroValue string - p := &PromptACULSettings{RenderingMode: &zeroValue} + p := &PromptRendering{RenderingMode: &zeroValue} p.GetRenderingMode() - p = &PromptACULSettings{} + p = &PromptRendering{} p.GetRenderingMode() p = nil p.GetRenderingMode() } -func TestPromptACULSettings_GetScreen(tt *testing.T) { - p := &PromptACULSettings{} +func TestPromptRendering_GetScreen(tt *testing.T) { + p := &PromptRendering{} p.GetScreen() p = nil p.GetScreen() } -func TestPromptACULSettings_GetTenant(tt *testing.T) { +func TestPromptRendering_GetTenant(tt *testing.T) { var zeroValue string - p := &PromptACULSettings{Tenant: &zeroValue} + p := &PromptRendering{Tenant: &zeroValue} p.GetTenant() - p = &PromptACULSettings{} + p = &PromptRendering{} p.GetTenant() p = nil p.GetTenant() } -func TestPromptACULSettings_String(t *testing.T) { +func TestPromptRendering_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{} + v := &PromptRendering{} if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { t.Errorf("failed to produce a valid json") } diff --git a/management/prompt.go b/management/prompt.go index c41f1849..9c5c3979 100644 --- a/management/prompt.go +++ b/management/prompt.go @@ -280,8 +280,8 @@ type PromptPartials struct { Prompt PromptType `json:"-"` } -// PromptACULSettings is used to retrieve and set the settings for the ACUL. -type PromptACULSettings 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"` @@ -292,14 +292,14 @@ type PromptACULSettings struct { } // MarshalJSON implements a custom [json.Marshaler]. -func (c *PromptACULSettings) MarshalJSON() ([]byte, error) { - type ACULSettingsSubSet struct { +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"` } - return json.Marshal(&ACULSettingsSubSet{ + return json.Marshal(&RenderingSubSet{ RenderMode: c.RenderingMode, ContextConfiguration: c.ContextConfiguration, DefaultHeadTagsDisabled: c.DefaultHeadTagsDisabled, @@ -464,17 +464,17 @@ func guardAgainstPromptTypesWithNoPartials(prompt PromptType) error { return fmt.Errorf("cannot customize partials for prompt: %q", prompt) } -// ReadACULSettings retrieves the settings for the ACUL. +// ReadRendering retrieves the settings for the ACUL. // // See: https://auth0.com/docs/api/management/v2#!/Prompts/get_acul -func (m *PromptManager) ReadACULSettings(ctx context.Context, prompt PromptType, screen ScreenName, opts ...RequestOption) (c *PromptACULSettings, err error) { +func (m *PromptManager) ReadRendering(ctx context.Context, prompt PromptType, screen ScreenName, opts ...RequestOption) (c *PromptRendering, err error) { err = m.management.Request(ctx, "GET", m.management.URI("prompts", string(prompt), "screen", string(screen), "rendering"), &c, opts...) return } -// UpdateACULSettings updates the settings for the ACUL. +// UpdateRendering updates the settings for the ACUL. // // See: https://auth0.com/docs/api/management/v2#!/Prompts/patch_acul -func (m *PromptManager) UpdateACULSettings(ctx context.Context, prompt PromptType, screen ScreenName, c *PromptACULSettings, opts ...RequestOption) error { +func (m *PromptManager) UpdateRendering(ctx context.Context, prompt PromptType, screen ScreenName, c *PromptRendering, opts ...RequestOption) error { return m.management.Request(ctx, "PATCH", m.management.URI("prompts", string(prompt), "screen", string(screen), "rendering"), c, opts...) } diff --git a/management/prompt_test.go b/management/prompt_test.go index 69316fb5..ef4b1ed4 100644 --- a/management/prompt_test.go +++ b/management/prompt_test.go @@ -127,13 +127,13 @@ func TestPromptManager_SetPartials(t *testing.T) { assert.Equal(t, expected, actual) } -func TestPromptManager_ReadACULSettings(t *testing.T) { +func TestPromptManager_ReadRendering(t *testing.T) { configureHTTPTestRecordings(t) _ = givenACustomDomain(t) _ = givenAUniversalLoginTemplate(t) - expected := givenAACULSettings(t) - actual, err := api.Prompt.ReadACULSettings(context.Background(), PromptSignup, ScreenSignup) + expected := givenAPromptRendering(t) + actual, err := api.Prompt.ReadRendering(context.Background(), PromptSignup, ScreenSignup) assert.NoError(t, err) assert.Equal(t, expected.GetRenderingMode(), actual.GetRenderingMode()) assert.Equal(t, expected.GetContextConfiguration(), actual.GetContextConfiguration()) @@ -143,20 +143,20 @@ func TestPromptManager_ReadACULSettings(t *testing.T) { assert.Equal(t, ScreenSignup, *actual.GetScreen()) } -func TestPromptManager_UpdateACULSettings(t *testing.T) { +func TestPromptManager_UpdateRendering(t *testing.T) { configureHTTPTestRecordings(t) _ = givenACustomDomain(t) _ = givenAUniversalLoginTemplate(t) - expected := givenAACULSettings(t) + expected := givenAPromptRendering(t) expected.RenderingMode = auth0.String("standard") expected.ContextConfiguration = &[]string{"branding.settings", "branding.themes.default", "client.logo_uri"} expected.DefaultHeadTagsDisabled = auth0.Bool(true) - err := api.Prompt.UpdateACULSettings(context.Background(), PromptSignup, ScreenSignup, expected) + err := api.Prompt.UpdateRendering(context.Background(), PromptSignup, ScreenSignup, expected) assert.NoError(t, err) - actual, err := api.Prompt.ReadACULSettings(context.Background(), PromptSignup, ScreenSignup) + actual, err := api.Prompt.ReadRendering(context.Background(), PromptSignup, ScreenSignup) assert.NoError(t, err) assert.Equal(t, expected.GetRenderingMode(), actual.GetRenderingMode()) assert.Equal(t, expected.GetContextConfiguration(), actual.GetContextConfiguration()) @@ -332,10 +332,10 @@ func givenAPartialPrompt(t *testing.T, prompt PromptType) *PromptScreenPartials return partials } -func givenAACULSettings(t *testing.T) *PromptACULSettings { +func givenAPromptRendering(t *testing.T) *PromptRendering { t.Helper() - settings := &PromptACULSettings{ + settings := &PromptRendering{ RenderingMode: auth0.String("advanced"), ContextConfiguration: &[]string{"branding.settings", "branding.themes.default"}, DefaultHeadTagsDisabled: auth0.Bool(false), @@ -355,7 +355,7 @@ func givenAACULSettings(t *testing.T) *PromptACULSettings { }, } - err := api.Prompt.UpdateACULSettings(context.Background(), PromptSignup, ScreenSignup, settings) + err := api.Prompt.UpdateRendering(context.Background(), PromptSignup, ScreenSignup, settings) assert.NoError(t, err) return settings