Skip to content

Commit

Permalink
Update Methods Name
Browse files Browse the repository at this point in the history
  • Loading branch information
developerkunal committed Nov 6, 2024
1 parent 79570d0 commit 7da5537
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 58 deletions.
26 changes: 13 additions & 13 deletions management/management.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 26 additions & 26 deletions management/management.gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions management/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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,
Expand Down Expand Up @@ -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...)
}
20 changes: 10 additions & 10 deletions management/prompt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down Expand Up @@ -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),
Expand All @@ -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
Expand Down

0 comments on commit 7da5537

Please sign in to comment.