diff --git a/docs/auth0_universal-login.md b/docs/auth0_universal-login.md index 45468c0a3..7170b3131 100644 --- a/docs/auth0_universal-login.md +++ b/docs/auth0_universal-login.md @@ -10,6 +10,7 @@ Manage a consistent, branded Universal Login experience that can handle all of y ## Commands - [auth0 universal-login customize](auth0_universal-login_customize.md) - Customize the Universal Login experience +- [auth0 universal-login partials](auth0_universal-login_partials.md) - Manage partials for prompts - [auth0 universal-login prompts](auth0_universal-login_prompts.md) - Manage custom text for prompts - [auth0 universal-login show](auth0_universal-login_show.md) - Display the custom branding settings for Universal Login - [auth0 universal-login templates](auth0_universal-login_templates.md) - Manage custom Universal Login templates diff --git a/docs/auth0_universal-login_customize.md b/docs/auth0_universal-login_customize.md index 727ad77ed..35b191f18 100644 --- a/docs/auth0_universal-login_customize.md +++ b/docs/auth0_universal-login_customize.md @@ -35,6 +35,7 @@ auth0 universal-login customize [flags] ## Related Commands - [auth0 universal-login customize](auth0_universal-login_customize.md) - Customize the Universal Login experience +- [auth0 universal-login partials](auth0_universal-login_partials.md) - Manage partials for prompts - [auth0 universal-login prompts](auth0_universal-login_prompts.md) - Manage custom text for prompts - [auth0 universal-login show](auth0_universal-login_show.md) - Display the custom branding settings for Universal Login - [auth0 universal-login templates](auth0_universal-login_templates.md) - Manage custom Universal Login templates diff --git a/docs/auth0_universal-login_partials.md b/docs/auth0_universal-login_partials.md new file mode 100644 index 000000000..c4598f948 --- /dev/null +++ b/docs/auth0_universal-login_partials.md @@ -0,0 +1,16 @@ +--- +layout: default +has_toc: false +has_children: true +--- +# auth0 universal-login partials + +Manage [partials for prompts](https://auth0.com/docs/customize/universal-login-pages/customize-signup-and-login-prompts) + +## Commands + +- [auth0 universal-login partials create](auth0_universal-login_partials_create.md) - Create partials for a prompt segment +- [auth0 universal-login partials delete](auth0_universal-login_partials_delete.md) - Delete partials for a prompt segment +- [auth0 universal-login partials show](auth0_universal-login_partials_show.md) - Show partials for a prompt segment +- [auth0 universal-login partials update](auth0_universal-login_partials_update.md) - Update partials for a prompt segment + diff --git a/docs/auth0_universal-login_partials_create.md b/docs/auth0_universal-login_partials_create.md new file mode 100644 index 000000000..82a37b6cd --- /dev/null +++ b/docs/auth0_universal-login_partials_create.md @@ -0,0 +1,54 @@ +--- +layout: default +parent: auth0 universal-login partials +has_toc: false +--- +# auth0 universal-login partials create + +Create partials for a prompt segment. + +## Usage +``` +auth0 universal-login partials create [flags] +``` + +## Examples + +``` + auth0 universal-login partials create + auth0 ul partials create --input-file + auth0 ul partials create login --input-file /tmp/login/input-file.json +``` + + +## Flags + +``` + --form-content-end string Content for the Form Content End Partial + --form-content-start string Content for the Form Content Start Partial + --form-footer-end string Content for the Form Footer End Partial + --form-footer-start string Content for the Form Footer Start Partial + --input-file string Path to a file that contains partial definitions for a prompt segment. + --secondary-actions-end string Content for the Secondary Actions End Partial + --secondary-actions-start string Content for the Secondary Actions Start Partial +``` + + +## Inherited Flags + +``` + --debug Enable debug mode. + --no-color Disable colors. + --no-input Disable interactivity. + --tenant string Specific tenant to use. +``` + + +## Related Commands + +- [auth0 universal-login partials create](auth0_universal-login_partials_create.md) - Create partials for a prompt segment +- [auth0 universal-login partials delete](auth0_universal-login_partials_delete.md) - Delete partials for a prompt segment +- [auth0 universal-login partials show](auth0_universal-login_partials_show.md) - Show partials for a prompt segment +- [auth0 universal-login partials update](auth0_universal-login_partials_update.md) - Update partials for a prompt segment + + diff --git a/docs/auth0_universal-login_partials_delete.md b/docs/auth0_universal-login_partials_delete.md new file mode 100644 index 000000000..08477c9da --- /dev/null +++ b/docs/auth0_universal-login_partials_delete.md @@ -0,0 +1,41 @@ +--- +layout: default +parent: auth0 universal-login partials +has_toc: false +--- +# auth0 universal-login partials delete + +Delete partials for a prompt segment. + +## Usage +``` +auth0 universal-login partials delete [flags] +``` + +## Examples + +``` + auth0 universal-login partials delete +``` + + + + +## Inherited Flags + +``` + --debug Enable debug mode. + --no-color Disable colors. + --no-input Disable interactivity. + --tenant string Specific tenant to use. +``` + + +## Related Commands + +- [auth0 universal-login partials create](auth0_universal-login_partials_create.md) - Create partials for a prompt segment +- [auth0 universal-login partials delete](auth0_universal-login_partials_delete.md) - Delete partials for a prompt segment +- [auth0 universal-login partials show](auth0_universal-login_partials_show.md) - Show partials for a prompt segment +- [auth0 universal-login partials update](auth0_universal-login_partials_update.md) - Update partials for a prompt segment + + diff --git a/docs/auth0_universal-login_partials_show.md b/docs/auth0_universal-login_partials_show.md new file mode 100644 index 000000000..c7f269466 --- /dev/null +++ b/docs/auth0_universal-login_partials_show.md @@ -0,0 +1,42 @@ +--- +layout: default +parent: auth0 universal-login partials +has_toc: false +--- +# auth0 universal-login partials show + +Show partials for a prompt segment. + +## Usage +``` +auth0 universal-login partials show [flags] +``` + +## Examples + +``` + auth0 universal-login partials show + auth0 ul partials show login +``` + + + + +## Inherited Flags + +``` + --debug Enable debug mode. + --no-color Disable colors. + --no-input Disable interactivity. + --tenant string Specific tenant to use. +``` + + +## Related Commands + +- [auth0 universal-login partials create](auth0_universal-login_partials_create.md) - Create partials for a prompt segment +- [auth0 universal-login partials delete](auth0_universal-login_partials_delete.md) - Delete partials for a prompt segment +- [auth0 universal-login partials show](auth0_universal-login_partials_show.md) - Show partials for a prompt segment +- [auth0 universal-login partials update](auth0_universal-login_partials_update.md) - Update partials for a prompt segment + + diff --git a/docs/auth0_universal-login_partials_update.md b/docs/auth0_universal-login_partials_update.md new file mode 100644 index 000000000..82cd21623 --- /dev/null +++ b/docs/auth0_universal-login_partials_update.md @@ -0,0 +1,54 @@ +--- +layout: default +parent: auth0 universal-login partials +has_toc: false +--- +# auth0 universal-login partials update + +Update partials for a prompt segment. + +## Usage +``` +auth0 universal-login partials update [flags] +``` + +## Examples + +``` + auth0 universal-login partials update + auth0 ul partials update --input-file + auth0 ul partials update login --input-file /tmp/login/input-file.json +``` + + +## Flags + +``` + --form-content-end string Content for the Form Content End Partial + --form-content-start string Content for the Form Content Start Partial + --form-footer-end string Content for the Form Footer End Partial + --form-footer-start string Content for the Form Footer Start Partial + --input-file string Path to a file that contains partial definitions for a prompt segment. + --secondary-actions-end string Content for the Secondary Actions End Partial + --secondary-actions-start string Content for the Secondary Actions Start Partial +``` + + +## Inherited Flags + +``` + --debug Enable debug mode. + --no-color Disable colors. + --no-input Disable interactivity. + --tenant string Specific tenant to use. +``` + + +## Related Commands + +- [auth0 universal-login partials create](auth0_universal-login_partials_create.md) - Create partials for a prompt segment +- [auth0 universal-login partials delete](auth0_universal-login_partials_delete.md) - Delete partials for a prompt segment +- [auth0 universal-login partials show](auth0_universal-login_partials_show.md) - Show partials for a prompt segment +- [auth0 universal-login partials update](auth0_universal-login_partials_update.md) - Update partials for a prompt segment + + diff --git a/docs/auth0_universal-login_show.md b/docs/auth0_universal-login_show.md index 53ab7fe33..829e79246 100644 --- a/docs/auth0_universal-login_show.md +++ b/docs/auth0_universal-login_show.md @@ -41,6 +41,7 @@ auth0 universal-login show [flags] ## Related Commands - [auth0 universal-login customize](auth0_universal-login_customize.md) - Customize the Universal Login experience +- [auth0 universal-login partials](auth0_universal-login_partials.md) - Manage partials for prompts - [auth0 universal-login prompts](auth0_universal-login_prompts.md) - Manage custom text for prompts - [auth0 universal-login show](auth0_universal-login_show.md) - Display the custom branding settings for Universal Login - [auth0 universal-login templates](auth0_universal-login_templates.md) - Manage custom Universal Login templates diff --git a/docs/auth0_universal-login_update.md b/docs/auth0_universal-login_update.md index 30349e800..4406416c3 100644 --- a/docs/auth0_universal-login_update.md +++ b/docs/auth0_universal-login_update.md @@ -51,6 +51,7 @@ auth0 universal-login update [flags] ## Related Commands - [auth0 universal-login customize](auth0_universal-login_customize.md) - Customize the Universal Login experience +- [auth0 universal-login partials](auth0_universal-login_partials.md) - Manage partials for prompts - [auth0 universal-login prompts](auth0_universal-login_prompts.md) - Manage custom text for prompts - [auth0 universal-login show](auth0_universal-login_show.md) - Display the custom branding settings for Universal Login - [auth0 universal-login templates](auth0_universal-login_templates.md) - Manage custom Universal Login templates diff --git a/go.mod b/go.mod index 361301933..29e8503b8 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/AlecAivazis/survey/v2 v2.3.7 github.com/PuerkitoBio/rehttp v1.3.0 - github.com/auth0/go-auth0 v1.4.0 + github.com/auth0/go-auth0 v1.4.1-0.20240201214156-f9765fcec826 github.com/briandowns/spinner v1.23.0 github.com/charmbracelet/glamour v0.6.0 github.com/fsnotify/fsnotify v1.7.0 diff --git a/go.sum b/go.sum index cbc71d9cc..d6da6888c 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,8 @@ github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/ github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= -github.com/auth0/go-auth0 v1.4.0 h1:oZL3xIBBPW2ckLQmp6BSqpx5RV5yuqqOEVEPp4cipR4= -github.com/auth0/go-auth0 v1.4.0/go.mod h1:X1o5gVvYUYAQltayD5HrLimFZN9tfZUlJDUh+lz8h9I= +github.com/auth0/go-auth0 v1.4.1-0.20240201214156-f9765fcec826 h1:wspJkFQVLCO05U89SlCDANWJssrMhALjfwzM220UvWw= +github.com/auth0/go-auth0 v1.4.1-0.20240201214156-f9765fcec826/go.mod h1:wvUAydnwKdTCCTEgpLlGUA0aQGH1g241ktMEIR6y4+M= github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48= github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0/go.mod h1:6L7zgvqo0idzI7IO8de6ZC051AfXb5ipkIJ7bIA2tGA= github.com/aymanbagabas/go-osc52 v1.0.3 h1:DTwqENW7X9arYimJrPeGZcV0ln14sGMt3pHZspWD+Mg= diff --git a/internal/auth/mock/auth.go b/internal/auth/mock/auth.go index 1d9906831..f1884fea5 100644 --- a/internal/auth/mock/auth.go +++ b/internal/auth/mock/auth.go @@ -4,60 +4,3 @@ // Package mock is a generated GoMock package. package mock -import ( - reflect "reflect" - - gomock "github.com/golang/mock/gomock" -) - -// MockSecretStore is a mock of SecretStore interface. -type MockSecretStore struct { - ctrl *gomock.Controller - recorder *MockSecretStoreMockRecorder -} - -// MockSecretStoreMockRecorder is the mock recorder for MockSecretStore. -type MockSecretStoreMockRecorder struct { - mock *MockSecretStore -} - -// NewMockSecretStore creates a new mock instance. -func NewMockSecretStore(ctrl *gomock.Controller) *MockSecretStore { - mock := &MockSecretStore{ctrl: ctrl} - mock.recorder = &MockSecretStoreMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockSecretStore) EXPECT() *MockSecretStoreMockRecorder { - return m.recorder -} - -// Delete mocks base method. -func (m *MockSecretStore) Delete(namespace, key string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Delete", namespace, key) - ret0, _ := ret[0].(error) - return ret0 -} - -// Delete indicates an expected call of Delete. -func (mr *MockSecretStoreMockRecorder) Delete(namespace, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockSecretStore)(nil).Delete), namespace, key) -} - -// Get mocks base method. -func (m *MockSecretStore) Get(namespace, key string) (string, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", namespace, key) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Get indicates an expected call of Get. -func (mr *MockSecretStoreMockRecorder) Get(namespace, key interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockSecretStore)(nil).Get), namespace, key) -} diff --git a/internal/auth0/branding_prompt.go b/internal/auth0/branding_prompt.go index ccc87fd6a..064e380d2 100644 --- a/internal/auth0/branding_prompt.go +++ b/internal/auth0/branding_prompt.go @@ -28,4 +28,24 @@ type PromptAPI interface { // // See: https://auth0.com/docs/api/management/v2#!/Prompts/put_custom_text_by_language SetCustomText(ctx context.Context, p string, l string, b map[string]interface{}, opts ...management.RequestOption) (err error) + + // CreatePartials creates new custom prompt partials for a given segment. + // + // See: https://auth0.com/docs/sign-up-prompt-customizations#use-the-api-to-edit-custom-prompts + CreatePartials(ctx context.Context, c *management.PartialsPrompt, opts ...management.RequestOption) error + + // UpdatePartials updates custom prompt partials for a given segment. + // + // See: https://auth0.com/docs/sign-up-prompt-customizations#use-the-api-to-edit-custom-prompts + UpdatePartials(ctx context.Context, c *management.PartialsPrompt, opts ...management.RequestOption) error + + // ReadPartials reads custom prompt partials for a given segment. + // + // See: https://auth0.com/docs/sign-up-prompt-customizations#use-the-api-to-edit-custom-prompts + ReadPartials(ctx context.Context, segment management.PartialsPromptSegment, opts ...management.RequestOption) (c *management.PartialsPrompt, err error) + + // DeletePartials deletes custom prompt partials for a given segment. + // + // See: https://auth0.com/docs/sign-up-prompt-customizations#use-the-api-to-edit-custom-prompts + DeletePartials(ctx context.Context, c *management.PartialsPrompt, opts ...management.RequestOption) error } diff --git a/internal/auth0/mock/action_mock.go b/internal/auth0/mock/action_mock.go index 25f0b780c..531766d37 100644 --- a/internal/auth0/mock/action_mock.go +++ b/internal/auth0/mock/action_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockActionAPI is a mock of ActionAPI interface. +// MockActionAPI is a mock of ActionAPI interface type MockActionAPI struct { ctrl *gomock.Controller recorder *MockActionAPIMockRecorder } -// MockActionAPIMockRecorder is the mock recorder for MockActionAPI. +// MockActionAPIMockRecorder is the mock recorder for MockActionAPI type MockActionAPIMockRecorder struct { mock *MockActionAPI } -// NewMockActionAPI creates a new mock instance. +// NewMockActionAPI creates a new mock instance func NewMockActionAPI(ctrl *gomock.Controller) *MockActionAPI { mock := &MockActionAPI{ctrl: ctrl} mock.recorder = &MockActionAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockActionAPI) EXPECT() *MockActionAPIMockRecorder { return m.recorder } -// Create mocks base method. +// Create mocks base method func (m *MockActionAPI) Create(ctx context.Context, a *management.Action, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, a} @@ -47,53 +46,72 @@ func (m *MockActionAPI) Create(ctx context.Context, a *management.Action, opts . return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockActionAPIMockRecorder) Create(ctx, a interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, a}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockActionAPI)(nil).Create), varargs...) } -// Delete mocks base method. -func (m *MockActionAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { +// Read mocks base method +func (m *MockActionAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Action, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Delete", varargs...) + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.Action) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Read indicates an expected call of Read +func (mr *MockActionAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockActionAPI)(nil).Read), varargs...) +} + +// Update mocks base method +func (m *MockActionAPI) Update(ctx context.Context, id string, a *management.Action, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, id, a} + for _, a_2 := range opts { + varargs = append(varargs, a_2) + } + ret := m.ctrl.Call(m, "Update", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Delete indicates an expected call of Delete. -func (mr *MockActionAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Update indicates an expected call of Update +func (mr *MockActionAPIMockRecorder) Update(ctx, id, a interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockActionAPI)(nil).Delete), varargs...) + varargs := append([]interface{}{ctx, id, a}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockActionAPI)(nil).Update), varargs...) } -// Deploy mocks base method. -func (m *MockActionAPI) Deploy(ctx context.Context, id string, opts ...management.RequestOption) (*management.ActionVersion, error) { +// Delete mocks base method +func (m *MockActionAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Deploy", varargs...) - ret0, _ := ret[0].(*management.ActionVersion) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Delete", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// Deploy indicates an expected call of Deploy. -func (mr *MockActionAPIMockRecorder) Deploy(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Delete indicates an expected call of Delete +func (mr *MockActionAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deploy", reflect.TypeOf((*MockActionAPI)(nil).Deploy), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockActionAPI)(nil).Delete), varargs...) } -// List mocks base method. +// List mocks base method func (m *MockActionAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.ActionList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -106,34 +124,14 @@ func (m *MockActionAPI) List(ctx context.Context, opts ...management.RequestOpti return ret0, ret1 } -// List indicates an expected call of List. +// List indicates an expected call of List func (mr *MockActionAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockActionAPI)(nil).List), varargs...) } -// Read mocks base method. -func (m *MockActionAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Action, error) { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.Action) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Read indicates an expected call of Read. -func (mr *MockActionAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockActionAPI)(nil).Read), varargs...) -} - -// Triggers mocks base method. +// Triggers mocks base method func (m *MockActionAPI) Triggers(ctx context.Context, opts ...management.RequestOption) (*management.ActionTriggerList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -146,15 +144,15 @@ func (m *MockActionAPI) Triggers(ctx context.Context, opts ...management.Request return ret0, ret1 } -// Triggers indicates an expected call of Triggers. +// Triggers indicates an expected call of Triggers func (mr *MockActionAPIMockRecorder) Triggers(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Triggers", reflect.TypeOf((*MockActionAPI)(nil).Triggers), varargs...) } -// Bindings mocks base method. -func (m *MockActionAPI) Bindings(ctx context.Context, triggerID string, opts ...management.RequestOption) (bl *management.ActionBindingList, err error) { +// Bindings mocks base method +func (m *MockActionAPI) Bindings(ctx context.Context, triggerID string, opts ...management.RequestOption) (*management.ActionBindingList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, triggerID} for _, a := range opts { @@ -166,28 +164,29 @@ func (m *MockActionAPI) Bindings(ctx context.Context, triggerID string, opts ... return ret0, ret1 } -// Bindings indicates an expected call of Bindings. -func (mr *MockActionAPIMockRecorder) Bindings(ctx interface{}, triggerID interface{}, opts ...interface{}) *gomock.Call { +// Bindings indicates an expected call of Bindings +func (mr *MockActionAPIMockRecorder) Bindings(ctx, triggerID interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, triggerID}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Bindings", reflect.TypeOf((*MockActionAPI)(nil).Bindings), varargs...) } -// Update mocks base method. -func (m *MockActionAPI) Update(ctx context.Context, id string, a *management.Action, opts ...management.RequestOption) error { +// Deploy mocks base method +func (m *MockActionAPI) Deploy(ctx context.Context, id string, opts ...management.RequestOption) (*management.ActionVersion, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, a} - for _, a_2 := range opts { - varargs = append(varargs, a_2) + varargs := []interface{}{ctx, id} + for _, a := range opts { + varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "Deploy", varargs...) + ret0, _ := ret[0].(*management.ActionVersion) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Update indicates an expected call of Update. -func (mr *MockActionAPIMockRecorder) Update(ctx, id, a interface{}, opts ...interface{}) *gomock.Call { +// Deploy indicates an expected call of Deploy +func (mr *MockActionAPIMockRecorder) Deploy(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, a}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockActionAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deploy", reflect.TypeOf((*MockActionAPI)(nil).Deploy), varargs...) } diff --git a/internal/auth0/mock/branding_mock.go b/internal/auth0/mock/branding_mock.go index ca26dbcd7..9a7c2c179 100644 --- a/internal/auth0/mock/branding_mock.go +++ b/internal/auth0/mock/branding_mock.go @@ -6,55 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockBrandingAPI is a mock of BrandingAPI interface. +// MockBrandingAPI is a mock of BrandingAPI interface type MockBrandingAPI struct { ctrl *gomock.Controller recorder *MockBrandingAPIMockRecorder } -// MockBrandingAPIMockRecorder is the mock recorder for MockBrandingAPI. +// MockBrandingAPIMockRecorder is the mock recorder for MockBrandingAPI type MockBrandingAPIMockRecorder struct { mock *MockBrandingAPI } -// NewMockBrandingAPI creates a new mock instance. +// NewMockBrandingAPI creates a new mock instance func NewMockBrandingAPI(ctrl *gomock.Controller) *MockBrandingAPI { mock := &MockBrandingAPI{ctrl: ctrl} mock.recorder = &MockBrandingAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockBrandingAPI) EXPECT() *MockBrandingAPIMockRecorder { return m.recorder } -// DeleteUniversalLogin mocks base method. -func (m *MockBrandingAPI) DeleteUniversalLogin(ctx context.Context, opts ...management.RequestOption) error { - m.ctrl.T.Helper() - varargs := []interface{}{ctx} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "DeleteUniversalLogin", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteUniversalLogin indicates an expected call of DeleteUniversalLogin. -func (mr *MockBrandingAPIMockRecorder) DeleteUniversalLogin(ctx interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUniversalLogin", reflect.TypeOf((*MockBrandingAPI)(nil).DeleteUniversalLogin), varargs...) -} - -// Read mocks base method. +// Read mocks base method func (m *MockBrandingAPI) Read(ctx context.Context, opts ...management.RequestOption) (*management.Branding, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -67,33 +47,33 @@ func (m *MockBrandingAPI) Read(ctx context.Context, opts ...management.RequestOp return ret0, ret1 } -// Read indicates an expected call of Read. +// Read indicates an expected call of Read func (mr *MockBrandingAPIMockRecorder) Read(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockBrandingAPI)(nil).Read), varargs...) } -// SetUniversalLogin mocks base method. -func (m *MockBrandingAPI) SetUniversalLogin(ctx context.Context, ul *management.BrandingUniversalLogin, opts ...management.RequestOption) error { +// Update mocks base method +func (m *MockBrandingAPI) Update(ctx context.Context, t *management.Branding, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, ul} + varargs := []interface{}{ctx, t} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "SetUniversalLogin", varargs...) + ret := m.ctrl.Call(m, "Update", varargs...) ret0, _ := ret[0].(error) return ret0 } -// SetUniversalLogin indicates an expected call of SetUniversalLogin. -func (mr *MockBrandingAPIMockRecorder) SetUniversalLogin(ctx, ul interface{}, opts ...interface{}) *gomock.Call { +// Update indicates an expected call of Update +func (mr *MockBrandingAPIMockRecorder) Update(ctx, t interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, ul}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetUniversalLogin", reflect.TypeOf((*MockBrandingAPI)(nil).SetUniversalLogin), varargs...) + varargs := append([]interface{}{ctx, t}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockBrandingAPI)(nil).Update), varargs...) } -// UniversalLogin mocks base method. +// UniversalLogin mocks base method func (m *MockBrandingAPI) UniversalLogin(ctx context.Context, opts ...management.RequestOption) (*management.BrandingUniversalLogin, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -106,28 +86,47 @@ func (m *MockBrandingAPI) UniversalLogin(ctx context.Context, opts ...management return ret0, ret1 } -// UniversalLogin indicates an expected call of UniversalLogin. +// UniversalLogin indicates an expected call of UniversalLogin func (mr *MockBrandingAPIMockRecorder) UniversalLogin(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UniversalLogin", reflect.TypeOf((*MockBrandingAPI)(nil).UniversalLogin), varargs...) } -// Update mocks base method. -func (m *MockBrandingAPI) Update(ctx context.Context, t *management.Branding, opts ...management.RequestOption) error { +// SetUniversalLogin mocks base method +func (m *MockBrandingAPI) SetUniversalLogin(ctx context.Context, ul *management.BrandingUniversalLogin, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, t} + varargs := []interface{}{ctx, ul} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) + ret := m.ctrl.Call(m, "SetUniversalLogin", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Update indicates an expected call of Update. -func (mr *MockBrandingAPIMockRecorder) Update(ctx, t interface{}, opts ...interface{}) *gomock.Call { +// SetUniversalLogin indicates an expected call of SetUniversalLogin +func (mr *MockBrandingAPIMockRecorder) SetUniversalLogin(ctx, ul interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, t}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockBrandingAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx, ul}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetUniversalLogin", reflect.TypeOf((*MockBrandingAPI)(nil).SetUniversalLogin), varargs...) +} + +// DeleteUniversalLogin mocks base method +func (m *MockBrandingAPI) DeleteUniversalLogin(ctx context.Context, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteUniversalLogin", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeleteUniversalLogin indicates an expected call of DeleteUniversalLogin +func (mr *MockBrandingAPIMockRecorder) DeleteUniversalLogin(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteUniversalLogin", reflect.TypeOf((*MockBrandingAPI)(nil).DeleteUniversalLogin), varargs...) } diff --git a/internal/auth0/mock/branding_prompt_mock.go b/internal/auth0/mock/branding_prompt_mock.go index a6b1d0d67..259a29aa5 100644 --- a/internal/auth0/mock/branding_prompt_mock.go +++ b/internal/auth0/mock/branding_prompt_mock.go @@ -6,76 +6,94 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockPromptAPI is a mock of PromptAPI interface. +// MockPromptAPI is a mock of PromptAPI interface type MockPromptAPI struct { ctrl *gomock.Controller recorder *MockPromptAPIMockRecorder } -// MockPromptAPIMockRecorder is the mock recorder for MockPromptAPI. +// MockPromptAPIMockRecorder is the mock recorder for MockPromptAPI type MockPromptAPIMockRecorder struct { mock *MockPromptAPI } -// NewMockPromptAPI creates a new mock instance. +// NewMockPromptAPI creates a new mock instance func NewMockPromptAPI(ctrl *gomock.Controller) *MockPromptAPI { mock := &MockPromptAPI{ctrl: ctrl} mock.recorder = &MockPromptAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockPromptAPI) EXPECT() *MockPromptAPIMockRecorder { return m.recorder } -// CustomText mocks base method. -func (m *MockPromptAPI) CustomText(ctx context.Context, p, l string, opts ...management.RequestOption) (map[string]interface{}, error) { +// Read mocks base method +func (m *MockPromptAPI) Read(ctx context.Context, opts ...management.RequestOption) (*management.Prompt, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, p, l} + varargs := []interface{}{ctx} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "CustomText", varargs...) - ret0, _ := ret[0].(map[string]interface{}) + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.Prompt) ret1, _ := ret[1].(error) return ret0, ret1 } -// CustomText indicates an expected call of CustomText. -func (mr *MockPromptAPIMockRecorder) CustomText(ctx, p, l interface{}, opts ...interface{}) *gomock.Call { +// Read indicates an expected call of Read +func (mr *MockPromptAPIMockRecorder) Read(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, p, l}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CustomText", reflect.TypeOf((*MockPromptAPI)(nil).CustomText), varargs...) + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockPromptAPI)(nil).Read), varargs...) } -// Read mocks base method. -func (m *MockPromptAPI) Read(ctx context.Context, opts ...management.RequestOption) (*management.Prompt, error) { +// Update mocks base method +func (m *MockPromptAPI) Update(ctx context.Context, p *management.Prompt, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []interface{}{ctx, p} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.Prompt) + ret := m.ctrl.Call(m, "Update", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// Update indicates an expected call of Update +func (mr *MockPromptAPIMockRecorder) Update(ctx, p interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, p}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockPromptAPI)(nil).Update), varargs...) +} + +// CustomText mocks base method +func (m *MockPromptAPI) CustomText(ctx context.Context, p, l string, opts ...management.RequestOption) (map[string]interface{}, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, p, l} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CustomText", varargs...) + ret0, _ := ret[0].(map[string]interface{}) ret1, _ := ret[1].(error) return ret0, ret1 } -// Read indicates an expected call of Read. -func (mr *MockPromptAPIMockRecorder) Read(ctx interface{}, opts ...interface{}) *gomock.Call { +// CustomText indicates an expected call of CustomText +func (mr *MockPromptAPIMockRecorder) CustomText(ctx, p, l interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockPromptAPI)(nil).Read), varargs...) + varargs := append([]interface{}{ctx, p, l}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CustomText", reflect.TypeOf((*MockPromptAPI)(nil).CustomText), varargs...) } -// SetCustomText mocks base method. +// SetCustomText mocks base method func (m *MockPromptAPI) SetCustomText(ctx context.Context, p, l string, b map[string]interface{}, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, p, l, b} @@ -87,28 +105,86 @@ func (m *MockPromptAPI) SetCustomText(ctx context.Context, p, l string, b map[st return ret0 } -// SetCustomText indicates an expected call of SetCustomText. +// SetCustomText indicates an expected call of SetCustomText func (mr *MockPromptAPIMockRecorder) SetCustomText(ctx, p, l, b interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, p, l, b}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCustomText", reflect.TypeOf((*MockPromptAPI)(nil).SetCustomText), varargs...) } -// Update mocks base method. -func (m *MockPromptAPI) Update(ctx context.Context, p *management.Prompt, opts ...management.RequestOption) error { +// CreatePartials mocks base method +func (m *MockPromptAPI) CreatePartials(ctx context.Context, c *management.PartialsPrompt, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, p} + varargs := []interface{}{ctx, c} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) + ret := m.ctrl.Call(m, "CreatePartials", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Update indicates an expected call of Update. -func (mr *MockPromptAPIMockRecorder) Update(ctx, p interface{}, opts ...interface{}) *gomock.Call { +// CreatePartials indicates an expected call of CreatePartials +func (mr *MockPromptAPIMockRecorder) CreatePartials(ctx, c interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, p}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockPromptAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx, c}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreatePartials", reflect.TypeOf((*MockPromptAPI)(nil).CreatePartials), varargs...) +} + +// UpdatePartials mocks base method +func (m *MockPromptAPI) UpdatePartials(ctx context.Context, c *management.PartialsPrompt, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, c} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "UpdatePartials", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdatePartials indicates an expected call of UpdatePartials +func (mr *MockPromptAPIMockRecorder) UpdatePartials(ctx, c interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, c}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatePartials", reflect.TypeOf((*MockPromptAPI)(nil).UpdatePartials), varargs...) +} + +// ReadPartials mocks base method +func (m *MockPromptAPI) ReadPartials(ctx context.Context, segment management.PartialsPromptSegment, opts ...management.RequestOption) (*management.PartialsPrompt, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, segment} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ReadPartials", varargs...) + ret0, _ := ret[0].(*management.PartialsPrompt) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReadPartials indicates an expected call of ReadPartials +func (mr *MockPromptAPIMockRecorder) ReadPartials(ctx, segment interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, segment}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadPartials", reflect.TypeOf((*MockPromptAPI)(nil).ReadPartials), varargs...) +} + +// DeletePartials mocks base method +func (m *MockPromptAPI) DeletePartials(ctx context.Context, c *management.PartialsPrompt, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, c} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeletePartials", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// DeletePartials indicates an expected call of DeletePartials +func (mr *MockPromptAPIMockRecorder) DeletePartials(ctx, c interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, c}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeletePartials", reflect.TypeOf((*MockPromptAPI)(nil).DeletePartials), varargs...) } diff --git a/internal/auth0/mock/branding_theme_mock.go b/internal/auth0/mock/branding_theme_mock.go index 041f28ac9..9e6f7b2a5 100644 --- a/internal/auth0/mock/branding_theme_mock.go +++ b/internal/auth0/mock/branding_theme_mock.go @@ -6,55 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockBrandingThemeAPI is a mock of BrandingThemeAPI interface. +// MockBrandingThemeAPI is a mock of BrandingThemeAPI interface type MockBrandingThemeAPI struct { ctrl *gomock.Controller recorder *MockBrandingThemeAPIMockRecorder } -// MockBrandingThemeAPIMockRecorder is the mock recorder for MockBrandingThemeAPI. +// MockBrandingThemeAPIMockRecorder is the mock recorder for MockBrandingThemeAPI type MockBrandingThemeAPIMockRecorder struct { mock *MockBrandingThemeAPI } -// NewMockBrandingThemeAPI creates a new mock instance. +// NewMockBrandingThemeAPI creates a new mock instance func NewMockBrandingThemeAPI(ctrl *gomock.Controller) *MockBrandingThemeAPI { mock := &MockBrandingThemeAPI{ctrl: ctrl} mock.recorder = &MockBrandingThemeAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockBrandingThemeAPI) EXPECT() *MockBrandingThemeAPIMockRecorder { return m.recorder } -// Create mocks base method. -func (m *MockBrandingThemeAPI) Create(ctx context.Context, theme *management.BrandingTheme, opts ...management.RequestOption) error { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, theme} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "Create", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// Create indicates an expected call of Create. -func (mr *MockBrandingThemeAPIMockRecorder) Create(ctx, theme interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, theme}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockBrandingThemeAPI)(nil).Create), varargs...) -} - -// Default mocks base method. +// Default mocks base method func (m *MockBrandingThemeAPI) Default(ctx context.Context, opts ...management.RequestOption) (*management.BrandingTheme, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -67,33 +47,33 @@ func (m *MockBrandingThemeAPI) Default(ctx context.Context, opts ...management.R return ret0, ret1 } -// Default indicates an expected call of Default. +// Default indicates an expected call of Default func (mr *MockBrandingThemeAPIMockRecorder) Default(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Default", reflect.TypeOf((*MockBrandingThemeAPI)(nil).Default), varargs...) } -// Delete mocks base method. -func (m *MockBrandingThemeAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { +// Create mocks base method +func (m *MockBrandingThemeAPI) Create(ctx context.Context, theme *management.BrandingTheme, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx, theme} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Delete", varargs...) + ret := m.ctrl.Call(m, "Create", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Delete indicates an expected call of Delete. -func (mr *MockBrandingThemeAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Create indicates an expected call of Create +func (mr *MockBrandingThemeAPIMockRecorder) Create(ctx, theme interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockBrandingThemeAPI)(nil).Delete), varargs...) + varargs := append([]interface{}{ctx, theme}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockBrandingThemeAPI)(nil).Create), varargs...) } -// Read mocks base method. +// Read mocks base method func (m *MockBrandingThemeAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.BrandingTheme, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -106,14 +86,14 @@ func (m *MockBrandingThemeAPI) Read(ctx context.Context, id string, opts ...mana return ret0, ret1 } -// Read indicates an expected call of Read. +// Read indicates an expected call of Read func (mr *MockBrandingThemeAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockBrandingThemeAPI)(nil).Read), varargs...) } -// Update mocks base method. +// Update mocks base method func (m *MockBrandingThemeAPI) Update(ctx context.Context, id string, theme *management.BrandingTheme, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id, theme} @@ -125,9 +105,28 @@ func (m *MockBrandingThemeAPI) Update(ctx context.Context, id string, theme *man return ret0 } -// Update indicates an expected call of Update. +// Update indicates an expected call of Update func (mr *MockBrandingThemeAPIMockRecorder) Update(ctx, id, theme interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id, theme}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockBrandingThemeAPI)(nil).Update), varargs...) } + +// Delete mocks base method +func (m *MockBrandingThemeAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, id} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Delete", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete +func (mr *MockBrandingThemeAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockBrandingThemeAPI)(nil).Delete), varargs...) +} diff --git a/internal/auth0/mock/client_mock.go b/internal/auth0/mock/client_mock.go index 03c899cf6..7567996ed 100644 --- a/internal/auth0/mock/client_mock.go +++ b/internal/auth0/mock/client_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockClientAPI is a mock of ClientAPI interface. +// MockClientAPI is a mock of ClientAPI interface type MockClientAPI struct { ctrl *gomock.Controller recorder *MockClientAPIMockRecorder } -// MockClientAPIMockRecorder is the mock recorder for MockClientAPI. +// MockClientAPIMockRecorder is the mock recorder for MockClientAPI type MockClientAPIMockRecorder struct { mock *MockClientAPI } -// NewMockClientAPI creates a new mock instance. +// NewMockClientAPI creates a new mock instance func NewMockClientAPI(ctrl *gomock.Controller) *MockClientAPI { mock := &MockClientAPI{ctrl: ctrl} mock.recorder = &MockClientAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockClientAPI) EXPECT() *MockClientAPIMockRecorder { return m.recorder } -// Create mocks base method. +// Create mocks base method func (m *MockClientAPI) Create(ctx context.Context, c *management.Client, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, c} @@ -47,33 +46,34 @@ func (m *MockClientAPI) Create(ctx context.Context, c *management.Client, opts . return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockClientAPIMockRecorder) Create(ctx, c interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, c}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockClientAPI)(nil).Create), varargs...) } -// Delete mocks base method. -func (m *MockClientAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { +// Read mocks base method +func (m *MockClientAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Client, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Delete", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.Client) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Delete indicates an expected call of Delete. -func (mr *MockClientAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Read indicates an expected call of Read +func (mr *MockClientAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockClientAPI)(nil).Delete), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockClientAPI)(nil).Read), varargs...) } -// List mocks base method. +// List mocks base method func (m *MockClientAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.ClientList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -86,34 +86,33 @@ func (m *MockClientAPI) List(ctx context.Context, opts ...management.RequestOpti return ret0, ret1 } -// List indicates an expected call of List. +// List indicates an expected call of List func (mr *MockClientAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockClientAPI)(nil).List), varargs...) } -// Read mocks base method. -func (m *MockClientAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Client, error) { +// Update mocks base method +func (m *MockClientAPI) Update(ctx context.Context, id string, c *management.Client, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx, id, c} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.Client) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Update", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// Read indicates an expected call of Read. -func (mr *MockClientAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Update indicates an expected call of Update +func (mr *MockClientAPIMockRecorder) Update(ctx, id, c interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockClientAPI)(nil).Read), varargs...) + varargs := append([]interface{}{ctx, id, c}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockClientAPI)(nil).Update), varargs...) } -// RotateSecret mocks base method. +// RotateSecret mocks base method func (m *MockClientAPI) RotateSecret(ctx context.Context, id string, opts ...management.RequestOption) (*management.Client, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -126,28 +125,28 @@ func (m *MockClientAPI) RotateSecret(ctx context.Context, id string, opts ...man return ret0, ret1 } -// RotateSecret indicates an expected call of RotateSecret. +// RotateSecret indicates an expected call of RotateSecret func (mr *MockClientAPIMockRecorder) RotateSecret(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RotateSecret", reflect.TypeOf((*MockClientAPI)(nil).RotateSecret), varargs...) } -// Update mocks base method. -func (m *MockClientAPI) Update(ctx context.Context, id string, c *management.Client, opts ...management.RequestOption) error { +// Delete mocks base method +func (m *MockClientAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, c} + varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) + ret := m.ctrl.Call(m, "Delete", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Update indicates an expected call of Update. -func (mr *MockClientAPIMockRecorder) Update(ctx, id, c interface{}, opts ...interface{}) *gomock.Call { +// Delete indicates an expected call of Delete +func (mr *MockClientAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, c}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockClientAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockClientAPI)(nil).Delete), varargs...) } diff --git a/internal/auth0/mock/connection_mock.go b/internal/auth0/mock/connection_mock.go index 0060253aa..6dc682fbc 100644 --- a/internal/auth0/mock/connection_mock.go +++ b/internal/auth0/mock/connection_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockConnectionAPI is a mock of ConnectionAPI interface. +// MockConnectionAPI is a mock of ConnectionAPI interface type MockConnectionAPI struct { ctrl *gomock.Controller recorder *MockConnectionAPIMockRecorder } -// MockConnectionAPIMockRecorder is the mock recorder for MockConnectionAPI. +// MockConnectionAPIMockRecorder is the mock recorder for MockConnectionAPI type MockConnectionAPIMockRecorder struct { mock *MockConnectionAPI } -// NewMockConnectionAPI creates a new mock instance. +// NewMockConnectionAPI creates a new mock instance func NewMockConnectionAPI(ctrl *gomock.Controller) *MockConnectionAPI { mock := &MockConnectionAPI{ctrl: ctrl} mock.recorder = &MockConnectionAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockConnectionAPI) EXPECT() *MockConnectionAPIMockRecorder { return m.recorder } -// Create mocks base method. +// Create mocks base method func (m *MockConnectionAPI) Create(ctx context.Context, c *management.Connection, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, c} @@ -47,53 +46,14 @@ func (m *MockConnectionAPI) Create(ctx context.Context, c *management.Connection return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockConnectionAPIMockRecorder) Create(ctx, c interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, c}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockConnectionAPI)(nil).Create), varargs...) } -// Delete mocks base method. -func (m *MockConnectionAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "Delete", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// Delete indicates an expected call of Delete. -func (mr *MockConnectionAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockConnectionAPI)(nil).Delete), varargs...) -} - -// List mocks base method. -func (m *MockConnectionAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.ConnectionList, error) { - m.ctrl.T.Helper() - varargs := []interface{}{ctx} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "List", varargs...) - ret0, _ := ret[0].(*management.ConnectionList) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// List indicates an expected call of List. -func (mr *MockConnectionAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockConnectionAPI)(nil).List), varargs...) -} - -// Read mocks base method. +// Read mocks base method func (m *MockConnectionAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Connection, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -106,14 +66,14 @@ func (m *MockConnectionAPI) Read(ctx context.Context, id string, opts ...managem return ret0, ret1 } -// Read indicates an expected call of Read. +// Read indicates an expected call of Read func (mr *MockConnectionAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockConnectionAPI)(nil).Read), varargs...) } -// ReadByName mocks base method. +// ReadByName mocks base method func (m *MockConnectionAPI) ReadByName(ctx context.Context, id string, opts ...management.RequestOption) (*management.Connection, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -126,14 +86,14 @@ func (m *MockConnectionAPI) ReadByName(ctx context.Context, id string, opts ...m return ret0, ret1 } -// ReadByName indicates an expected call of ReadByName. +// ReadByName indicates an expected call of ReadByName func (mr *MockConnectionAPIMockRecorder) ReadByName(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadByName", reflect.TypeOf((*MockConnectionAPI)(nil).ReadByName), varargs...) } -// Update mocks base method. +// Update mocks base method func (m *MockConnectionAPI) Update(ctx context.Context, id string, c *management.Connection, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id, c} @@ -145,9 +105,48 @@ func (m *MockConnectionAPI) Update(ctx context.Context, id string, c *management return ret0 } -// Update indicates an expected call of Update. +// Update indicates an expected call of Update func (mr *MockConnectionAPIMockRecorder) Update(ctx, id, c interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id, c}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockConnectionAPI)(nil).Update), varargs...) } + +// Delete mocks base method +func (m *MockConnectionAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, id} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Delete", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete +func (mr *MockConnectionAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockConnectionAPI)(nil).Delete), varargs...) +} + +// List mocks base method +func (m *MockConnectionAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.ConnectionList, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].(*management.ConnectionList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List +func (mr *MockConnectionAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockConnectionAPI)(nil).List), varargs...) +} diff --git a/internal/auth0/mock/custom_domain_mock.go b/internal/auth0/mock/custom_domain_mock.go index a819a6e93..0ab4fe8eb 100644 --- a/internal/auth0/mock/custom_domain_mock.go +++ b/internal/auth0/mock/custom_domain_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockCustomDomainAPI is a mock of CustomDomainAPI interface. +// MockCustomDomainAPI is a mock of CustomDomainAPI interface type MockCustomDomainAPI struct { ctrl *gomock.Controller recorder *MockCustomDomainAPIMockRecorder } -// MockCustomDomainAPIMockRecorder is the mock recorder for MockCustomDomainAPI. +// MockCustomDomainAPIMockRecorder is the mock recorder for MockCustomDomainAPI type MockCustomDomainAPIMockRecorder struct { mock *MockCustomDomainAPI } -// NewMockCustomDomainAPI creates a new mock instance. +// NewMockCustomDomainAPI creates a new mock instance func NewMockCustomDomainAPI(ctrl *gomock.Controller) *MockCustomDomainAPI { mock := &MockCustomDomainAPI{ctrl: ctrl} mock.recorder = &MockCustomDomainAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockCustomDomainAPI) EXPECT() *MockCustomDomainAPIMockRecorder { return m.recorder } -// Create mocks base method. +// Create mocks base method func (m *MockCustomDomainAPI) Create(ctx context.Context, c *management.CustomDomain, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, c} @@ -47,53 +46,14 @@ func (m *MockCustomDomainAPI) Create(ctx context.Context, c *management.CustomDo return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockCustomDomainAPIMockRecorder) Create(ctx, c interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, c}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockCustomDomainAPI)(nil).Create), varargs...) } -// Delete mocks base method. -func (m *MockCustomDomainAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "Delete", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// Delete indicates an expected call of Delete. -func (mr *MockCustomDomainAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockCustomDomainAPI)(nil).Delete), varargs...) -} - -// List mocks base method. -func (m *MockCustomDomainAPI) List(ctx context.Context, opts ...management.RequestOption) ([]*management.CustomDomain, error) { - m.ctrl.T.Helper() - varargs := []interface{}{ctx} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "List", varargs...) - ret0, _ := ret[0].([]*management.CustomDomain) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// List indicates an expected call of List. -func (mr *MockCustomDomainAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockCustomDomainAPI)(nil).List), varargs...) -} - -// Read mocks base method. +// Read mocks base method func (m *MockCustomDomainAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.CustomDomain, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -106,14 +66,14 @@ func (m *MockCustomDomainAPI) Read(ctx context.Context, id string, opts ...manag return ret0, ret1 } -// Read indicates an expected call of Read. +// Read indicates an expected call of Read func (mr *MockCustomDomainAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockCustomDomainAPI)(nil).Read), varargs...) } -// Update mocks base method. +// Update mocks base method func (m *MockCustomDomainAPI) Update(ctx context.Context, id string, c *management.CustomDomain, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id, c} @@ -125,14 +85,33 @@ func (m *MockCustomDomainAPI) Update(ctx context.Context, id string, c *manageme return ret0 } -// Update indicates an expected call of Update. +// Update indicates an expected call of Update func (mr *MockCustomDomainAPIMockRecorder) Update(ctx, id, c interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id, c}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockCustomDomainAPI)(nil).Update), varargs...) } -// Verify mocks base method. +// Delete mocks base method +func (m *MockCustomDomainAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, id} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Delete", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete +func (mr *MockCustomDomainAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockCustomDomainAPI)(nil).Delete), varargs...) +} + +// Verify mocks base method func (m *MockCustomDomainAPI) Verify(ctx context.Context, id string, opts ...management.RequestOption) (*management.CustomDomain, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -145,9 +124,29 @@ func (m *MockCustomDomainAPI) Verify(ctx context.Context, id string, opts ...man return ret0, ret1 } -// Verify indicates an expected call of Verify. +// Verify indicates an expected call of Verify func (mr *MockCustomDomainAPIMockRecorder) Verify(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Verify", reflect.TypeOf((*MockCustomDomainAPI)(nil).Verify), varargs...) } + +// List mocks base method +func (m *MockCustomDomainAPI) List(ctx context.Context, opts ...management.RequestOption) ([]*management.CustomDomain, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].([]*management.CustomDomain) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// List indicates an expected call of List +func (mr *MockCustomDomainAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockCustomDomainAPI)(nil).List), varargs...) +} diff --git a/internal/auth0/mock/log_mock.go b/internal/auth0/mock/log_mock.go index 70dc7d05e..70c04bb5f 100644 --- a/internal/auth0/mock/log_mock.go +++ b/internal/auth0/mock/log_mock.go @@ -6,76 +6,75 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockLogAPI is a mock of LogAPI interface. +// MockLogAPI is a mock of LogAPI interface type MockLogAPI struct { ctrl *gomock.Controller recorder *MockLogAPIMockRecorder } -// MockLogAPIMockRecorder is the mock recorder for MockLogAPI. +// MockLogAPIMockRecorder is the mock recorder for MockLogAPI type MockLogAPIMockRecorder struct { mock *MockLogAPI } -// NewMockLogAPI creates a new mock instance. +// NewMockLogAPI creates a new mock instance func NewMockLogAPI(ctrl *gomock.Controller) *MockLogAPI { mock := &MockLogAPI{ctrl: ctrl} mock.recorder = &MockLogAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockLogAPI) EXPECT() *MockLogAPIMockRecorder { return m.recorder } -// List mocks base method. -func (m *MockLogAPI) List(ctx context.Context, opts ...management.RequestOption) ([]*management.Log, error) { +// Read mocks base method +func (m *MockLogAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Log, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "List", varargs...) - ret0, _ := ret[0].([]*management.Log) + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.Log) ret1, _ := ret[1].(error) return ret0, ret1 } -// List indicates an expected call of List. -func (mr *MockLogAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { +// Read indicates an expected call of Read +func (mr *MockLogAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockLogAPI)(nil).List), varargs...) + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockLogAPI)(nil).Read), varargs...) } -// Read mocks base method. -func (m *MockLogAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Log, error) { +// List mocks base method +func (m *MockLogAPI) List(ctx context.Context, opts ...management.RequestOption) ([]*management.Log, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.Log) + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].([]*management.Log) ret1, _ := ret[1].(error) return ret0, ret1 } -// Read indicates an expected call of Read. -func (mr *MockLogAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// List indicates an expected call of List +func (mr *MockLogAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockLogAPI)(nil).Read), varargs...) + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockLogAPI)(nil).List), varargs...) } -// Search mocks base method. +// Search mocks base method func (m *MockLogAPI) Search(ctx context.Context, opts ...management.RequestOption) ([]*management.Log, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -88,7 +87,7 @@ func (m *MockLogAPI) Search(ctx context.Context, opts ...management.RequestOptio return ret0, ret1 } -// Search indicates an expected call of Search. +// Search indicates an expected call of Search func (mr *MockLogAPIMockRecorder) Search(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) diff --git a/internal/auth0/mock/log_stream_mock.go b/internal/auth0/mock/log_stream_mock.go index 4018c77c6..9bcbab4bd 100644 --- a/internal/auth0/mock/log_stream_mock.go +++ b/internal/auth0/mock/log_stream_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockLogStreamAPI is a mock of LogStreamAPI interface. +// MockLogStreamAPI is a mock of LogStreamAPI interface type MockLogStreamAPI struct { ctrl *gomock.Controller recorder *MockLogStreamAPIMockRecorder } -// MockLogStreamAPIMockRecorder is the mock recorder for MockLogStreamAPI. +// MockLogStreamAPIMockRecorder is the mock recorder for MockLogStreamAPI type MockLogStreamAPIMockRecorder struct { mock *MockLogStreamAPI } -// NewMockLogStreamAPI creates a new mock instance. +// NewMockLogStreamAPI creates a new mock instance func NewMockLogStreamAPI(ctrl *gomock.Controller) *MockLogStreamAPI { mock := &MockLogStreamAPI{ctrl: ctrl} mock.recorder = &MockLogStreamAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockLogStreamAPI) EXPECT() *MockLogStreamAPIMockRecorder { return m.recorder } -// Create mocks base method. +// Create mocks base method func (m *MockLogStreamAPI) Create(ctx context.Context, ls *management.LogStream, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, ls} @@ -47,87 +46,87 @@ func (m *MockLogStreamAPI) Create(ctx context.Context, ls *management.LogStream, return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockLogStreamAPIMockRecorder) Create(ctx, ls interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, ls}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockLogStreamAPI)(nil).Create), varargs...) } -// Delete mocks base method. -func (m *MockLogStreamAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { +// Read mocks base method +func (m *MockLogStreamAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.LogStream, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Delete", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.LogStream) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Delete indicates an expected call of Delete. -func (mr *MockLogStreamAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Read indicates an expected call of Read +func (mr *MockLogStreamAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockLogStreamAPI)(nil).Delete), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockLogStreamAPI)(nil).Read), varargs...) } -// List mocks base method. -func (m *MockLogStreamAPI) List(ctx context.Context, opts ...management.RequestOption) ([]*management.LogStream, error) { +// Update mocks base method +func (m *MockLogStreamAPI) Update(ctx context.Context, id string, ls *management.LogStream, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []interface{}{ctx, id, ls} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "List", varargs...) - ret0, _ := ret[0].([]*management.LogStream) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Update", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// List indicates an expected call of List. -func (mr *MockLogStreamAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { +// Update indicates an expected call of Update +func (mr *MockLogStreamAPIMockRecorder) Update(ctx, id, ls interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockLogStreamAPI)(nil).List), varargs...) + varargs := append([]interface{}{ctx, id, ls}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockLogStreamAPI)(nil).Update), varargs...) } -// Read mocks base method. -func (m *MockLogStreamAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.LogStream, error) { +// List mocks base method +func (m *MockLogStreamAPI) List(ctx context.Context, opts ...management.RequestOption) ([]*management.LogStream, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.LogStream) + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].([]*management.LogStream) ret1, _ := ret[1].(error) return ret0, ret1 } -// Read indicates an expected call of Read. -func (mr *MockLogStreamAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// List indicates an expected call of List +func (mr *MockLogStreamAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockLogStreamAPI)(nil).Read), varargs...) + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockLogStreamAPI)(nil).List), varargs...) } -// Update mocks base method. -func (m *MockLogStreamAPI) Update(ctx context.Context, id string, ls *management.LogStream, opts ...management.RequestOption) error { +// Delete mocks base method +func (m *MockLogStreamAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, ls} + varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) + ret := m.ctrl.Call(m, "Delete", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Update indicates an expected call of Update. -func (mr *MockLogStreamAPIMockRecorder) Update(ctx, id, ls interface{}, opts ...interface{}) *gomock.Call { +// Delete indicates an expected call of Delete +func (mr *MockLogStreamAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, ls}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockLogStreamAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockLogStreamAPI)(nil).Delete), varargs...) } diff --git a/internal/auth0/mock/organization_mock.go b/internal/auth0/mock/organization_mock.go index cca000203..341fcf09d 100644 --- a/internal/auth0/mock/organization_mock.go +++ b/internal/auth0/mock/organization_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockOrganizationAPI is a mock of OrganizationAPI interface. +// MockOrganizationAPI is a mock of OrganizationAPI interface type MockOrganizationAPI struct { ctrl *gomock.Controller recorder *MockOrganizationAPIMockRecorder } -// MockOrganizationAPIMockRecorder is the mock recorder for MockOrganizationAPI. +// MockOrganizationAPIMockRecorder is the mock recorder for MockOrganizationAPI type MockOrganizationAPIMockRecorder struct { mock *MockOrganizationAPI } -// NewMockOrganizationAPI creates a new mock instance. +// NewMockOrganizationAPI creates a new mock instance func NewMockOrganizationAPI(ctrl *gomock.Controller) *MockOrganizationAPI { mock := &MockOrganizationAPI{ctrl: ctrl} mock.recorder = &MockOrganizationAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockOrganizationAPI) EXPECT() *MockOrganizationAPIMockRecorder { return m.recorder } -// Create mocks base method. +// Create mocks base method func (m *MockOrganizationAPI) Create(ctx context.Context, o *management.Organization, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, o} @@ -47,14 +46,53 @@ func (m *MockOrganizationAPI) Create(ctx context.Context, o *management.Organiza return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockOrganizationAPIMockRecorder) Create(ctx, o interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, o}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockOrganizationAPI)(nil).Create), varargs...) } -// Delete mocks base method. +// Read mocks base method +func (m *MockOrganizationAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Organization, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, id} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.Organization) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Read indicates an expected call of Read +func (mr *MockOrganizationAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockOrganizationAPI)(nil).Read), varargs...) +} + +// Update mocks base method +func (m *MockOrganizationAPI) Update(ctx context.Context, id string, o *management.Organization, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, id, o} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "Update", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// Update indicates an expected call of Update +func (mr *MockOrganizationAPIMockRecorder) Update(ctx, id, o interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, id, o}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockOrganizationAPI)(nil).Update), varargs...) +} + +// Delete mocks base method func (m *MockOrganizationAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -66,14 +104,14 @@ func (m *MockOrganizationAPI) Delete(ctx context.Context, id string, opts ...man return ret0 } -// Delete indicates an expected call of Delete. +// Delete indicates an expected call of Delete func (mr *MockOrganizationAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockOrganizationAPI)(nil).Delete), varargs...) } -// List mocks base method. +// List mocks base method func (m *MockOrganizationAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.OrganizationList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -86,34 +124,14 @@ func (m *MockOrganizationAPI) List(ctx context.Context, opts ...management.Reque return ret0, ret1 } -// List indicates an expected call of List. +// List indicates an expected call of List func (mr *MockOrganizationAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockOrganizationAPI)(nil).List), varargs...) } -// MemberRoles mocks base method. -func (m *MockOrganizationAPI) MemberRoles(ctx context.Context, id, userID string, opts ...management.RequestOption) (*management.OrganizationMemberRoleList, error) { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, userID} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "MemberRoles", varargs...) - ret0, _ := ret[0].(*management.OrganizationMemberRoleList) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// MemberRoles indicates an expected call of MemberRoles. -func (mr *MockOrganizationAPIMockRecorder) MemberRoles(ctx, id, userID interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, userID}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MemberRoles", reflect.TypeOf((*MockOrganizationAPI)(nil).MemberRoles), varargs...) -} - -// Members mocks base method. +// Members mocks base method func (m *MockOrganizationAPI) Members(ctx context.Context, id string, opts ...management.RequestOption) (*management.OrganizationMemberList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -126,53 +144,34 @@ func (m *MockOrganizationAPI) Members(ctx context.Context, id string, opts ...ma return ret0, ret1 } -// Members indicates an expected call of Members. +// Members indicates an expected call of Members func (mr *MockOrganizationAPIMockRecorder) Members(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Members", reflect.TypeOf((*MockOrganizationAPI)(nil).Members), varargs...) } -// Read mocks base method. -func (m *MockOrganizationAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Organization, error) { +// MemberRoles mocks base method +func (m *MockOrganizationAPI) MemberRoles(ctx context.Context, id, userID string, opts ...management.RequestOption) (*management.OrganizationMemberRoleList, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx, id, userID} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.Organization) + ret := m.ctrl.Call(m, "MemberRoles", varargs...) + ret0, _ := ret[0].(*management.OrganizationMemberRoleList) ret1, _ := ret[1].(error) return ret0, ret1 } -// Read indicates an expected call of Read. -func (mr *MockOrganizationAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockOrganizationAPI)(nil).Read), varargs...) -} - -// Update mocks base method. -func (m *MockOrganizationAPI) Update(ctx context.Context, id string, o *management.Organization, opts ...management.RequestOption) error { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, o} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "Update", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// Update indicates an expected call of Update. -func (mr *MockOrganizationAPIMockRecorder) Update(ctx, id, o interface{}, opts ...interface{}) *gomock.Call { +// MemberRoles indicates an expected call of MemberRoles +func (mr *MockOrganizationAPIMockRecorder) MemberRoles(ctx, id, userID interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, o}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockOrganizationAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx, id, userID}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MemberRoles", reflect.TypeOf((*MockOrganizationAPI)(nil).MemberRoles), varargs...) } -// Connections mocks base method. +// Connections mocks base method func (m *MockOrganizationAPI) Connections(ctx context.Context, id string, opts ...management.RequestOption) (*management.OrganizationConnectionList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -185,9 +184,9 @@ func (m *MockOrganizationAPI) Connections(ctx context.Context, id string, opts . return ret0, ret1 } -// Connections indicates an expected call of Connections. +// Connections indicates an expected call of Connections func (mr *MockOrganizationAPIMockRecorder) Connections(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connections", reflect.TypeOf((*MockOrganizationAPI)(nil).Connections), varargs...) -} \ No newline at end of file +} diff --git a/internal/auth0/mock/resource_server_mock.go b/internal/auth0/mock/resource_server_mock.go index e73afb323..ef558822a 100644 --- a/internal/auth0/mock/resource_server_mock.go +++ b/internal/auth0/mock/resource_server_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockResourceServerAPI is a mock of ResourceServerAPI interface. +// MockResourceServerAPI is a mock of ResourceServerAPI interface type MockResourceServerAPI struct { ctrl *gomock.Controller recorder *MockResourceServerAPIMockRecorder } -// MockResourceServerAPIMockRecorder is the mock recorder for MockResourceServerAPI. +// MockResourceServerAPIMockRecorder is the mock recorder for MockResourceServerAPI type MockResourceServerAPIMockRecorder struct { mock *MockResourceServerAPI } -// NewMockResourceServerAPI creates a new mock instance. +// NewMockResourceServerAPI creates a new mock instance func NewMockResourceServerAPI(ctrl *gomock.Controller) *MockResourceServerAPI { mock := &MockResourceServerAPI{ctrl: ctrl} mock.recorder = &MockResourceServerAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockResourceServerAPI) EXPECT() *MockResourceServerAPIMockRecorder { return m.recorder } -// Create mocks base method. +// Create mocks base method func (m *MockResourceServerAPI) Create(ctx context.Context, rs *management.ResourceServer, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, rs} @@ -47,87 +46,87 @@ func (m *MockResourceServerAPI) Create(ctx context.Context, rs *management.Resou return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockResourceServerAPIMockRecorder) Create(ctx, rs interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, rs}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockResourceServerAPI)(nil).Create), varargs...) } -// Delete mocks base method. -func (m *MockResourceServerAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { +// Read mocks base method +func (m *MockResourceServerAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.ResourceServer, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Delete", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.ResourceServer) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Delete indicates an expected call of Delete. -func (mr *MockResourceServerAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Read indicates an expected call of Read +func (mr *MockResourceServerAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockResourceServerAPI)(nil).Delete), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockResourceServerAPI)(nil).Read), varargs...) } -// List mocks base method. -func (m *MockResourceServerAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.ResourceServerList, error) { +// Update mocks base method +func (m *MockResourceServerAPI) Update(ctx context.Context, id string, rs *management.ResourceServer, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []interface{}{ctx, id, rs} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "List", varargs...) - ret0, _ := ret[0].(*management.ResourceServerList) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Update", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// List indicates an expected call of List. -func (mr *MockResourceServerAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { +// Update indicates an expected call of Update +func (mr *MockResourceServerAPIMockRecorder) Update(ctx, id, rs interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockResourceServerAPI)(nil).List), varargs...) + varargs := append([]interface{}{ctx, id, rs}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockResourceServerAPI)(nil).Update), varargs...) } -// Read mocks base method. -func (m *MockResourceServerAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.ResourceServer, error) { +// Delete mocks base method +func (m *MockResourceServerAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.ResourceServer) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Delete", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// Read indicates an expected call of Read. -func (mr *MockResourceServerAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Delete indicates an expected call of Delete +func (mr *MockResourceServerAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockResourceServerAPI)(nil).Read), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockResourceServerAPI)(nil).Delete), varargs...) } -// Update mocks base method. -func (m *MockResourceServerAPI) Update(ctx context.Context, id string, rs *management.ResourceServer, opts ...management.RequestOption) error { +// List mocks base method +func (m *MockResourceServerAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.ResourceServerList, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, rs} + varargs := []interface{}{ctx} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].(*management.ResourceServerList) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Update indicates an expected call of Update. -func (mr *MockResourceServerAPIMockRecorder) Update(ctx, id, rs interface{}, opts ...interface{}) *gomock.Call { +// List indicates an expected call of List +func (mr *MockResourceServerAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, rs}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockResourceServerAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockResourceServerAPI)(nil).List), varargs...) } diff --git a/internal/auth0/mock/roles_mock.go b/internal/auth0/mock/roles_mock.go index 4416e45d0..d41d3cafa 100644 --- a/internal/auth0/mock/roles_mock.go +++ b/internal/auth0/mock/roles_mock.go @@ -6,55 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockRoleAPI is a mock of RoleAPI interface. +// MockRoleAPI is a mock of RoleAPI interface type MockRoleAPI struct { ctrl *gomock.Controller recorder *MockRoleAPIMockRecorder } -// MockRoleAPIMockRecorder is the mock recorder for MockRoleAPI. +// MockRoleAPIMockRecorder is the mock recorder for MockRoleAPI type MockRoleAPIMockRecorder struct { mock *MockRoleAPI } -// NewMockRoleAPI creates a new mock instance. +// NewMockRoleAPI creates a new mock instance func NewMockRoleAPI(ctrl *gomock.Controller) *MockRoleAPI { mock := &MockRoleAPI{ctrl: ctrl} mock.recorder = &MockRoleAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockRoleAPI) EXPECT() *MockRoleAPIMockRecorder { return m.recorder } -// AssociatePermissions mocks base method. -func (m *MockRoleAPI) AssociatePermissions(ctx context.Context, id string, permissions []*management.Permission, opts ...management.RequestOption) error { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, permissions} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "AssociatePermissions", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// AssociatePermissions indicates an expected call of AssociatePermissions. -func (mr *MockRoleAPIMockRecorder) AssociatePermissions(ctx, id, permissions interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, permissions}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssociatePermissions", reflect.TypeOf((*MockRoleAPI)(nil).AssociatePermissions), varargs...) -} - -// Create mocks base method. +// Create mocks base method func (m *MockRoleAPI) Create(ctx context.Context, r *management.Role, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, r} @@ -66,33 +46,34 @@ func (m *MockRoleAPI) Create(ctx context.Context, r *management.Role, opts ...ma return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockRoleAPIMockRecorder) Create(ctx, r interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, r}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockRoleAPI)(nil).Create), varargs...) } -// Delete mocks base method. -func (m *MockRoleAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { +// Read mocks base method +func (m *MockRoleAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Role, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Delete", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.Role) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Delete indicates an expected call of Delete. -func (mr *MockRoleAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Read indicates an expected call of Read +func (mr *MockRoleAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRoleAPI)(nil).Delete), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockRoleAPI)(nil).Read), varargs...) } -// List mocks base method. +// List mocks base method func (m *MockRoleAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.RoleList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -105,87 +86,105 @@ func (m *MockRoleAPI) List(ctx context.Context, opts ...management.RequestOption return ret0, ret1 } -// List indicates an expected call of List. +// List indicates an expected call of List func (mr *MockRoleAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockRoleAPI)(nil).List), varargs...) } -// Permissions mocks base method. -func (m *MockRoleAPI) Permissions(ctx context.Context, id string, opts ...management.RequestOption) (*management.PermissionList, error) { +// Update mocks base method +func (m *MockRoleAPI) Update(ctx context.Context, id string, r *management.Role, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx, id, r} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Permissions", varargs...) - ret0, _ := ret[0].(*management.PermissionList) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Update", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// Permissions indicates an expected call of Permissions. -func (mr *MockRoleAPIMockRecorder) Permissions(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Update indicates an expected call of Update +func (mr *MockRoleAPIMockRecorder) Update(ctx, id, r interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Permissions", reflect.TypeOf((*MockRoleAPI)(nil).Permissions), varargs...) + varargs := append([]interface{}{ctx, id, r}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockRoleAPI)(nil).Update), varargs...) } -// Read mocks base method. -func (m *MockRoleAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Role, error) { +// Delete mocks base method +func (m *MockRoleAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.Role) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Delete", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// Read indicates an expected call of Read. -func (mr *MockRoleAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Delete indicates an expected call of Delete +func (mr *MockRoleAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockRoleAPI)(nil).Read), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRoleAPI)(nil).Delete), varargs...) } -// RemovePermissions mocks base method. -func (m *MockRoleAPI) RemovePermissions(ctx context.Context, id string, permissions []*management.Permission, opts ...management.RequestOption) error { +// AssociatePermissions mocks base method +func (m *MockRoleAPI) AssociatePermissions(ctx context.Context, id string, permissions []*management.Permission, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id, permissions} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "RemovePermissions", varargs...) + ret := m.ctrl.Call(m, "AssociatePermissions", varargs...) ret0, _ := ret[0].(error) return ret0 } -// RemovePermissions indicates an expected call of RemovePermissions. -func (mr *MockRoleAPIMockRecorder) RemovePermissions(ctx, id, permissions interface{}, opts ...interface{}) *gomock.Call { +// AssociatePermissions indicates an expected call of AssociatePermissions +func (mr *MockRoleAPIMockRecorder) AssociatePermissions(ctx, id, permissions interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id, permissions}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemovePermissions", reflect.TypeOf((*MockRoleAPI)(nil).RemovePermissions), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssociatePermissions", reflect.TypeOf((*MockRoleAPI)(nil).AssociatePermissions), varargs...) } -// Update mocks base method. -func (m *MockRoleAPI) Update(ctx context.Context, id string, r *management.Role, opts ...management.RequestOption) error { +// Permissions mocks base method +func (m *MockRoleAPI) Permissions(ctx context.Context, id string, opts ...management.RequestOption) (*management.PermissionList, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, r} + varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) + ret := m.ctrl.Call(m, "Permissions", varargs...) + ret0, _ := ret[0].(*management.PermissionList) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Permissions indicates an expected call of Permissions +func (mr *MockRoleAPIMockRecorder) Permissions(ctx, id interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Permissions", reflect.TypeOf((*MockRoleAPI)(nil).Permissions), varargs...) +} + +// RemovePermissions mocks base method +func (m *MockRoleAPI) RemovePermissions(ctx context.Context, id string, permissions []*management.Permission, opts ...management.RequestOption) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, id, permissions} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RemovePermissions", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Update indicates an expected call of Update. -func (mr *MockRoleAPIMockRecorder) Update(ctx, id, r interface{}, opts ...interface{}) *gomock.Call { +// RemovePermissions indicates an expected call of RemovePermissions +func (mr *MockRoleAPIMockRecorder) RemovePermissions(ctx, id, permissions interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, r}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockRoleAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx, id, permissions}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemovePermissions", reflect.TypeOf((*MockRoleAPI)(nil).RemovePermissions), varargs...) } diff --git a/internal/auth0/mock/rule_mock.go b/internal/auth0/mock/rule_mock.go index 7c2a60819..535455623 100644 --- a/internal/auth0/mock/rule_mock.go +++ b/internal/auth0/mock/rule_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockRuleAPI is a mock of RuleAPI interface. +// MockRuleAPI is a mock of RuleAPI interface type MockRuleAPI struct { ctrl *gomock.Controller recorder *MockRuleAPIMockRecorder } -// MockRuleAPIMockRecorder is the mock recorder for MockRuleAPI. +// MockRuleAPIMockRecorder is the mock recorder for MockRuleAPI type MockRuleAPIMockRecorder struct { mock *MockRuleAPI } -// NewMockRuleAPI creates a new mock instance. +// NewMockRuleAPI creates a new mock instance func NewMockRuleAPI(ctrl *gomock.Controller) *MockRuleAPI { mock := &MockRuleAPI{ctrl: ctrl} mock.recorder = &MockRuleAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockRuleAPI) EXPECT() *MockRuleAPIMockRecorder { return m.recorder } -// Create mocks base method. +// Create mocks base method func (m *MockRuleAPI) Create(ctx context.Context, r *management.Rule, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, r} @@ -47,87 +46,87 @@ func (m *MockRuleAPI) Create(ctx context.Context, r *management.Rule, opts ...ma return ret0 } -// Create indicates an expected call of Create. +// Create indicates an expected call of Create func (mr *MockRuleAPIMockRecorder) Create(ctx, r interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, r}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockRuleAPI)(nil).Create), varargs...) } -// Delete mocks base method. -func (m *MockRuleAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { +// Read mocks base method +func (m *MockRuleAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Rule, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Delete", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "Read", varargs...) + ret0, _ := ret[0].(*management.Rule) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Delete indicates an expected call of Delete. -func (mr *MockRuleAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Read indicates an expected call of Read +func (mr *MockRuleAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRuleAPI)(nil).Delete), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockRuleAPI)(nil).Read), varargs...) } -// List mocks base method. -func (m *MockRuleAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.RuleList, error) { +// Update mocks base method +func (m *MockRuleAPI) Update(ctx context.Context, id string, r *management.Rule, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []interface{}{ctx, id, r} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "List", varargs...) - ret0, _ := ret[0].(*management.RuleList) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Update", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// List indicates an expected call of List. -func (mr *MockRuleAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { +// Update indicates an expected call of Update +func (mr *MockRuleAPIMockRecorder) Update(ctx, id, r interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockRuleAPI)(nil).List), varargs...) + varargs := append([]interface{}{ctx, id, r}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockRuleAPI)(nil).Update), varargs...) } -// Read mocks base method. -func (m *MockRuleAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.Rule, error) { +// Delete mocks base method +func (m *MockRuleAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Read", varargs...) - ret0, _ := ret[0].(*management.Rule) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Delete", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// Read indicates an expected call of Read. -func (mr *MockRuleAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Delete indicates an expected call of Delete +func (mr *MockRuleAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockRuleAPI)(nil).Read), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRuleAPI)(nil).Delete), varargs...) } -// Update mocks base method. -func (m *MockRuleAPI) Update(ctx context.Context, id string, r *management.Rule, opts ...management.RequestOption) error { +// List mocks base method +func (m *MockRuleAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.RuleList, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, r} + varargs := []interface{}{ctx} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].(*management.RuleList) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Update indicates an expected call of Update. -func (mr *MockRuleAPIMockRecorder) Update(ctx, id, r interface{}, opts ...interface{}) *gomock.Call { +// List indicates an expected call of List +func (mr *MockRuleAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, r}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockRuleAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockRuleAPI)(nil).List), varargs...) } diff --git a/internal/auth0/mock/tenant_mock.go b/internal/auth0/mock/tenant_mock.go index 3eb5510f9..e6b636755 100644 --- a/internal/auth0/mock/tenant_mock.go +++ b/internal/auth0/mock/tenant_mock.go @@ -6,36 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockTenantAPI is a mock of TenantAPI interface. +// MockTenantAPI is a mock of TenantAPI interface type MockTenantAPI struct { ctrl *gomock.Controller recorder *MockTenantAPIMockRecorder } -// MockTenantAPIMockRecorder is the mock recorder for MockTenantAPI. +// MockTenantAPIMockRecorder is the mock recorder for MockTenantAPI type MockTenantAPIMockRecorder struct { mock *MockTenantAPI } -// NewMockTenantAPI creates a new mock instance. +// NewMockTenantAPI creates a new mock instance func NewMockTenantAPI(ctrl *gomock.Controller) *MockTenantAPI { mock := &MockTenantAPI{ctrl: ctrl} mock.recorder = &MockTenantAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockTenantAPI) EXPECT() *MockTenantAPIMockRecorder { return m.recorder } -// Read mocks base method. +// Read mocks base method func (m *MockTenantAPI) Read(ctx context.Context, opts ...management.RequestOption) (*management.Tenant, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -48,7 +47,7 @@ func (m *MockTenantAPI) Read(ctx context.Context, opts ...management.RequestOpti return ret0, ret1 } -// Read indicates an expected call of Read. +// Read indicates an expected call of Read func (mr *MockTenantAPIMockRecorder) Read(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) diff --git a/internal/auth0/mock/user.go b/internal/auth0/mock/user.go index 38034f884..4e02a7e79 100644 --- a/internal/auth0/mock/user.go +++ b/internal/auth0/mock/user.go @@ -6,55 +6,35 @@ package mock import ( context "context" - reflect "reflect" - management "github.com/auth0/go-auth0/management" gomock "github.com/golang/mock/gomock" + reflect "reflect" ) -// MockUserAPI is a mock of UserAPI interface. +// MockUserAPI is a mock of UserAPI interface type MockUserAPI struct { ctrl *gomock.Controller recorder *MockUserAPIMockRecorder } -// MockUserAPIMockRecorder is the mock recorder for MockUserAPI. +// MockUserAPIMockRecorder is the mock recorder for MockUserAPI type MockUserAPIMockRecorder struct { mock *MockUserAPI } -// NewMockUserAPI creates a new mock instance. +// NewMockUserAPI creates a new mock instance func NewMockUserAPI(ctrl *gomock.Controller) *MockUserAPI { mock := &MockUserAPI{ctrl: ctrl} mock.recorder = &MockUserAPIMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use. +// EXPECT returns an object that allows the caller to indicate expected use func (m *MockUserAPI) EXPECT() *MockUserAPIMockRecorder { return m.recorder } -// AssignRoles mocks base method. -func (m *MockUserAPI) AssignRoles(ctx context.Context, id string, roles []*management.Role, opts ...management.RequestOption) error { - m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, roles} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "AssignRoles", varargs...) - ret0, _ := ret[0].(error) - return ret0 -} - -// AssignRoles indicates an expected call of AssignRoles. -func (mr *MockUserAPIMockRecorder) AssignRoles(ctx, id, roles interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, roles}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssignRoles", reflect.TypeOf((*MockUserAPI)(nil).AssignRoles), varargs...) -} - -// Blocks mocks base method. +// Blocks mocks base method func (m *MockUserAPI) Blocks(ctx context.Context, id string, opts ...management.RequestOption) ([]*management.UserBlock, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -67,17 +47,17 @@ func (m *MockUserAPI) Blocks(ctx context.Context, id string, opts ...management. return ret0, ret1 } -// Blocks indicates an expected call of Blocks. +// Blocks indicates an expected call of Blocks func (mr *MockUserAPIMockRecorder) Blocks(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Blocks", reflect.TypeOf((*MockUserAPI)(nil).Blocks), varargs...) } -// BlocksByIdentifier mocks base method. -func (m *MockUserAPI) BlocksByIdentifier(ctx context.Context, id string, opts ...management.RequestOption) ([]*management.UserBlock, error) { +// BlocksByIdentifier mocks base method +func (m *MockUserAPI) BlocksByIdentifier(ctx context.Context, identifier string, opts ...management.RequestOption) ([]*management.UserBlock, error) { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx, identifier} for _, a := range opts { varargs = append(varargs, a) } @@ -87,72 +67,71 @@ func (m *MockUserAPI) BlocksByIdentifier(ctx context.Context, id string, opts .. return ret0, ret1 } -// BlocksByIdentifier indicates an expected call of BlocksByIdentifier. -func (mr *MockUserAPIMockRecorder) BlocksByIdentifier(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// BlocksByIdentifier indicates an expected call of BlocksByIdentifier +func (mr *MockUserAPIMockRecorder) BlocksByIdentifier(ctx, identifier interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) + varargs := append([]interface{}{ctx, identifier}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlocksByIdentifier", reflect.TypeOf((*MockUserAPI)(nil).BlocksByIdentifier), varargs...) } -// Create mocks base method. -func (m *MockUserAPI) Create(ctx context.Context, u *management.User, opts ...management.RequestOption) error { +// Unblock mocks base method +func (m *MockUserAPI) Unblock(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, u} + varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Create", varargs...) + ret := m.ctrl.Call(m, "Unblock", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Create indicates an expected call of Create. -func (mr *MockUserAPIMockRecorder) Create(ctx, u interface{}, opts ...interface{}) *gomock.Call { +// Unblock indicates an expected call of Unblock +func (mr *MockUserAPIMockRecorder) Unblock(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, u}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockUserAPI)(nil).Create), varargs...) + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unblock", reflect.TypeOf((*MockUserAPI)(nil).Unblock), varargs...) } -// Delete mocks base method. -func (m *MockUserAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { +// UnblockByIdentifier mocks base method +func (m *MockUserAPI) UnblockByIdentifier(ctx context.Context, identifier string, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx, identifier} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Delete", varargs...) + ret := m.ctrl.Call(m, "UnblockByIdentifier", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Delete indicates an expected call of Delete. -func (mr *MockUserAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// UnblockByIdentifier indicates an expected call of UnblockByIdentifier +func (mr *MockUserAPIMockRecorder) UnblockByIdentifier(ctx, identifier interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockUserAPI)(nil).Delete), varargs...) + varargs := append([]interface{}{ctx, identifier}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnblockByIdentifier", reflect.TypeOf((*MockUserAPI)(nil).UnblockByIdentifier), varargs...) } -// List mocks base method. -func (m *MockUserAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.UserList, error) { +// Create mocks base method +func (m *MockUserAPI) Create(ctx context.Context, u *management.User, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx} + varargs := []interface{}{ctx, u} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "List", varargs...) - ret0, _ := ret[0].(*management.UserList) - ret1, _ := ret[1].(error) - return ret0, ret1 + ret := m.ctrl.Call(m, "Create", varargs...) + ret0, _ := ret[0].(error) + return ret0 } -// List indicates an expected call of List. -func (mr *MockUserAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { +// Create indicates an expected call of Create +func (mr *MockUserAPIMockRecorder) Create(ctx, u interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockUserAPI)(nil).List), varargs...) + varargs := append([]interface{}{ctx, u}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockUserAPI)(nil).Create), varargs...) } -// Read mocks base method. +// Read mocks base method func (m *MockUserAPI) Read(ctx context.Context, id string, opts ...management.RequestOption) (*management.User, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} @@ -165,53 +144,72 @@ func (m *MockUserAPI) Read(ctx context.Context, id string, opts ...management.Re return ret0, ret1 } -// Read indicates an expected call of Read. +// Read indicates an expected call of Read func (mr *MockUserAPIMockRecorder) Read(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockUserAPI)(nil).Read), varargs...) } -// RemoveRoles mocks base method. -func (m *MockUserAPI) RemoveRoles(ctx context.Context, id string, roles []*management.Role, opts ...management.RequestOption) error { +// Update mocks base method +func (m *MockUserAPI) Update(ctx context.Context, id string, u *management.User, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, roles} + varargs := []interface{}{ctx, id, u} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "RemoveRoles", varargs...) + ret := m.ctrl.Call(m, "Update", varargs...) ret0, _ := ret[0].(error) return ret0 } -// RemoveRoles indicates an expected call of RemoveRoles. -func (mr *MockUserAPIMockRecorder) RemoveRoles(ctx, id, roles interface{}, opts ...interface{}) *gomock.Call { +// Update indicates an expected call of Update +func (mr *MockUserAPIMockRecorder) Update(ctx, id, u interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, roles}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRoles", reflect.TypeOf((*MockUserAPI)(nil).RemoveRoles), varargs...) + varargs := append([]interface{}{ctx, id, u}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockUserAPI)(nil).Update), varargs...) } -// Roles mocks base method. -func (m *MockUserAPI) Roles(ctx context.Context, id string, opts ...management.RequestOption) (*management.RoleList, error) { +// Delete mocks base method +func (m *MockUserAPI) Delete(ctx context.Context, id string, opts ...management.RequestOption) error { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Roles", varargs...) - ret0, _ := ret[0].(*management.RoleList) + ret := m.ctrl.Call(m, "Delete", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete +func (mr *MockUserAPIMockRecorder) Delete(ctx, id interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, id}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockUserAPI)(nil).Delete), varargs...) +} + +// List mocks base method +func (m *MockUserAPI) List(ctx context.Context, opts ...management.RequestOption) (*management.UserList, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "List", varargs...) + ret0, _ := ret[0].(*management.UserList) ret1, _ := ret[1].(error) return ret0, ret1 } -// Roles indicates an expected call of Roles. -func (mr *MockUserAPIMockRecorder) Roles(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// List indicates an expected call of List +func (mr *MockUserAPIMockRecorder) List(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Roles", reflect.TypeOf((*MockUserAPI)(nil).Roles), varargs...) + varargs := append([]interface{}{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockUserAPI)(nil).List), varargs...) } -// Search mocks base method. +// Search mocks base method func (m *MockUserAPI) Search(ctx context.Context, opts ...management.RequestOption) (*management.UserList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx} @@ -224,66 +222,67 @@ func (m *MockUserAPI) Search(ctx context.Context, opts ...management.RequestOpti return ret0, ret1 } -// Search indicates an expected call of Search. +// Search indicates an expected call of Search func (mr *MockUserAPIMockRecorder) Search(ctx interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Search", reflect.TypeOf((*MockUserAPI)(nil).Search), varargs...) } -// Unblock mocks base method. -func (m *MockUserAPI) Unblock(ctx context.Context, id string, opts ...management.RequestOption) error { +// Roles mocks base method +func (m *MockUserAPI) Roles(ctx context.Context, id string, opts ...management.RequestOption) (*management.RoleList, error) { m.ctrl.T.Helper() varargs := []interface{}{ctx, id} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Unblock", varargs...) - ret0, _ := ret[0].(error) - return ret0 + ret := m.ctrl.Call(m, "Roles", varargs...) + ret0, _ := ret[0].(*management.RoleList) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Unblock indicates an expected call of Unblock. -func (mr *MockUserAPIMockRecorder) Unblock(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// Roles indicates an expected call of Roles +func (mr *MockUserAPIMockRecorder) Roles(ctx, id interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unblock", reflect.TypeOf((*MockUserAPI)(nil).Unblock), varargs...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Roles", reflect.TypeOf((*MockUserAPI)(nil).Roles), varargs...) } -// UnblockByIdentifier mocks base method. -func (m *MockUserAPI) UnblockByIdentifier(ctx context.Context, id string, opts ...management.RequestOption) error { +// AssignRoles mocks base method +func (m *MockUserAPI) AssignRoles(ctx context.Context, id string, roles []*management.Role, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id} + varargs := []interface{}{ctx, id, roles} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "UnblockByIdentifier", varargs...) + ret := m.ctrl.Call(m, "AssignRoles", varargs...) ret0, _ := ret[0].(error) return ret0 } -// UnblockByIdentifier indicates an expected call of UnblockByIdentifier. -func (mr *MockUserAPIMockRecorder) UnblockByIdentifier(ctx, id interface{}, opts ...interface{}) *gomock.Call { +// AssignRoles indicates an expected call of AssignRoles +func (mr *MockUserAPIMockRecorder) AssignRoles(ctx, id, roles interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnblockByIdentifier", reflect.TypeOf((*MockUserAPI)(nil).UnblockByIdentifier), varargs...) + varargs := append([]interface{}{ctx, id, roles}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssignRoles", reflect.TypeOf((*MockUserAPI)(nil).AssignRoles), varargs...) } -// Update mocks base method. -func (m *MockUserAPI) Update(ctx context.Context, id string, u *management.User, opts ...management.RequestOption) error { +// RemoveRoles mocks base method +func (m *MockUserAPI) RemoveRoles(ctx context.Context, id string, roles []*management.Role, opts ...management.RequestOption) error { m.ctrl.T.Helper() - varargs := []interface{}{ctx, id, u} + varargs := []interface{}{ctx, id, roles} for _, a := range opts { varargs = append(varargs, a) } - ret := m.ctrl.Call(m, "Update", varargs...) + ret := m.ctrl.Call(m, "RemoveRoles", varargs...) ret0, _ := ret[0].(error) return ret0 } -// Update indicates an expected call of Update. -func (mr *MockUserAPIMockRecorder) Update(ctx, id, u interface{}, opts ...interface{}) *gomock.Call { +// RemoveRoles indicates an expected call of RemoveRoles +func (mr *MockUserAPIMockRecorder) RemoveRoles(ctx, id, roles interface{}, opts ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{ctx, id, u}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockUserAPI)(nil).Update), varargs...) + varargs := append([]interface{}{ctx, id, roles}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveRoles", reflect.TypeOf((*MockUserAPI)(nil).RemoveRoles), varargs...) } diff --git a/internal/cli/prompts_partials.go b/internal/cli/prompts_partials.go new file mode 100644 index 000000000..26dbb9289 --- /dev/null +++ b/internal/cli/prompts_partials.go @@ -0,0 +1,468 @@ +package cli + +import ( + "context" + "encoding/json" + "fmt" + "io" + "os" + "reflect" + "strings" + + "github.com/auth0/go-auth0/management" + "github.com/spf13/cobra" + + "github.com/auth0/auth0-cli/internal/ansi" +) + +const ( + partialsDocsURL = "https://auth0.com/docs/customize/universal-login-pages/customize-signup-and-login-prompts" +) + +var ( + partialsSegmentTypes = []management.PartialsPromptSegment{ + management.PartialsPromptLogin, + management.PartialsPromptLoginID, + management.PartialsPromptLoginPassword, + management.PartialsPromptSignup, + management.PartialsPromptSignupID, + management.PartialsPromptSignupPassword, + } + partialsPrompt = Argument{ + Name: "Prompt", + Help: "The prompt segment you want to modify.", + } + partialsSegmentFields = map[string]string{ + "form-content-start": "Form Content Start", + "form-content-end": "Form Content End", + "form-footer-start": "Form Footer Start", + "form-footer-end": "Form Footer End", + "secondary-actions-start": "Secondary Actions Start", + "secondary-actions-end": "Secondary Actions End", + } +) + +type promptsPartialsInput struct { + Segment string + InputFile string + PartialsPrompt management.PartialsPrompt +} + +func promptsPartialsCmd(cli *cli) *cobra.Command { + cmd := &cobra.Command{ + Use: "partials", + Short: "Manage partials for prompts", + Long: fmt.Sprintf("Manage [partials for prompts](%s)", partialsDocsURL), + } + + cmd.SetUsageTemplate(resourceUsageTemplate()) + + cmd.AddCommand(partialsShowCmd(cli)) + cmd.AddCommand(partialsCreateCmd(cli)) + cmd.AddCommand(partialsUpdateCmd(cli)) + cmd.AddCommand(partialsDeleteCmd(cli)) + + return cmd +} + +func partialsShowCmd(cli *cli) *cobra.Command { + var inputs promptsPartialsInput + + cmd := &cobra.Command{ + Use: "show", + Args: cobra.MaximumNArgs(1), + Short: "Show partials for a prompt segment", + Long: "Show partials for a prompt segment.", + Example: ` auth0 universal-login partials show + auth0 ul partials show login`, + RunE: showPromptsPartials(cli, &inputs), + } + + return cmd +} + +func partialsCreateCmd(cli *cli) *cobra.Command { + var inputs promptsPartialsInput + + cmd := &cobra.Command{ + Use: "create", + Args: cobra.MaximumNArgs(1), + Short: "Create partials for a prompt segment", + Long: "Create partials for a prompt segment.", + Example: ` auth0 universal-login partials create + auth0 ul partials create --input-file + auth0 ul partials create login --input-file /tmp/login/input-file.json`, + RunE: createPromptsPartials(cli, &inputs), + } + + cmd.Flags().StringVar(&inputs.InputFile, "input-file", "", "Path to a file that contains partial definitions for a prompt segment.") + addCommonPromptPartialsFlags(cmd, &inputs) + + return cmd +} + +func partialsUpdateCmd(cli *cli) *cobra.Command { + var inputs promptsPartialsInput + + cmd := &cobra.Command{ + Use: "update", + Args: cobra.MaximumNArgs(1), + Short: "Update partials for a prompt segment", + Long: "Update partials for a prompt segment.", + Example: ` auth0 universal-login partials update + auth0 ul partials update --input-file + auth0 ul partials update login --input-file /tmp/login/input-file.json`, + RunE: updatePromptsPartials(cli, &inputs), + } + + cmd.Flags().StringVar(&inputs.InputFile, "input-file", "", "Path to a file that contains partial definitions for a prompt segment.") + addCommonPromptPartialsFlags(cmd, &inputs) + + return cmd +} + +func partialsDeleteCmd(cli *cli) *cobra.Command { + var inputs promptsPartialsInput + + cmd := &cobra.Command{ + Use: "delete", + Args: cobra.MaximumNArgs(1), + Short: "Delete partials for a prompt segment", + Long: "Delete partials for a prompt segment.", + Example: ` auth0 universal-login partials delete `, + RunE: deletePromptsPartials(cli, &inputs), + } + + return cmd +} + +func showPromptsPartials(cli *cli, inputs *promptsPartialsInput) func(cmd *cobra.Command, args []string) error { + return func(cmd *cobra.Command, args []string) error { + if err := checkPromptsPartialsAvailable(cli); err != nil { + return fmt.Errorf("error minimum requirements not met: %w", err) + } + + if len(args) == 0 { + if err := partialsPrompt.Pick(cmd, &inputs.Segment, promptsPartialsSegmentOptions); err != nil { + return err + } + } else { + if !validSegment(args[0]) { + return errorInvalidSegment(args[0]) + } + inputs.Segment = args[0] + } + + partials := &inputs.PartialsPrompt + if err := ansi.Waiting(func() (err error) { + partials, err = cli.api.Prompt.ReadPartials(context.Background(), management.PartialsPromptSegment(inputs.Segment)) + return err + }); err != nil { + return fmt.Errorf("failed to fetch partials for prompt segment (%s)", ansi.Bold(inputs.Segment)) + } + + partialsJSON, err := json.MarshalIndent(partials, "", " ") + if err != nil { + return fmt.Errorf("failed to serialize the partials for prompt segment (%s) to json: %w", ansi.Bold(inputs.Segment), err) + } + + cli.renderer.PromptsPartialsShow(string(partialsJSON), inputs.Segment) + + return nil + } +} + +func createPromptsPartials(cli *cli, inputs *promptsPartialsInput) func(cmd *cobra.Command, args []string) error { + return func(cmd *cobra.Command, args []string) error { + if err := checkPromptsPartialsAvailable(cli); err != nil { + return fmt.Errorf("error minimum requirements not met: %w", err) + } + + if len(args) == 0 { + if err := partialsPrompt.Pick(cmd, &inputs.Segment, promptsPartialsSegmentOptions); err != nil { + return err + } + } else { + if !validSegment(args[0]) { + return errorInvalidSegment(args[0]) + } + inputs.Segment = args[0] + } + + inputs.PartialsPrompt.Segment = management.PartialsPromptSegment(inputs.Segment) + + if err := promptPartialsFromInputs(inputs); err != nil { + return err + } + + if ok, _ := cmd.Flags().GetBool("no-input"); !ok { + if err := editPartialsPrompt(cli, cmd, inputs); err != nil { + return fmt.Errorf("failed to edit partials for prompt segment (%s): %w", ansi.Bold(inputs.Segment), err) + } + } + + if err := ansi.Waiting(func() error { + return cli.api.Prompt.CreatePartials(context.Background(), &inputs.PartialsPrompt) + }); err != nil { + return fmt.Errorf("failed to create partials for prompt segment (%s): %w", ansi.Bold(inputs.Segment), err) + } + + partialsJSON, err := json.MarshalIndent(inputs.PartialsPrompt, "", " ") + if err != nil { + return fmt.Errorf("failed to serialize the partials for prompt segment (%s) to json: %w", ansi.Bold(inputs.Segment), err) + } + + cli.renderer.PromptsPartialsCreate(string(partialsJSON), inputs.Segment) + + return nil + } +} + +func updatePromptsPartials(cli *cli, inputs *promptsPartialsInput) func(cmd *cobra.Command, args []string) error { + return func(cmd *cobra.Command, args []string) error { + if err := checkPromptsPartialsAvailable(cli); err != nil { + return fmt.Errorf("error minimum requirements not met: %w", err) + } + + if len(args) == 0 { + if err := partialsPrompt.Pick(cmd, &inputs.Segment, promptsPartialsSegmentOptions); err != nil { + return err + } + } else { + if !validSegment(args[0]) { + return errorInvalidSegment(args[0]) + } + inputs.Segment = args[0] + } + + inputs.PartialsPrompt.Segment = management.PartialsPromptSegment(inputs.Segment) + + currentPartials, err := cli.api.Prompt.ReadPartials(context.Background(), management.PartialsPromptSegment(inputs.Segment)) + if err != nil { + return fmt.Errorf("failed to read current partials for prompt segment (%s): %w", ansi.Bold(inputs.Segment), err) + } + + if err := promptPartialsFromInputs(inputs); err != nil { + return err + } + + if err := mergePartialsPrompts(&inputs.PartialsPrompt, currentPartials); err != nil { + return fmt.Errorf("failed to merge initial partials with current partials for prompt segment (%s): %w", ansi.Bold(inputs.Segment), err) + } + + if ok, _ := cmd.Flags().GetBool("no-input"); !ok { + if err := editPartialsPrompt(cli, cmd, inputs); err != nil { + return fmt.Errorf("failed to edit partials for prompt segment (%s): %w", ansi.Bold(inputs.Segment), err) + } + } + + if err := ansi.Waiting(func() error { + return cli.api.Prompt.UpdatePartials(context.Background(), &inputs.PartialsPrompt) + }); err != nil { + return fmt.Errorf("failed to create partials for prompt segment (%s): %w", ansi.Bold(inputs.Segment), err) + } + + partialsJSON, err := json.MarshalIndent(inputs.PartialsPrompt, "", " ") + if err != nil { + return fmt.Errorf("failed to serialize the partials for prompt segment (%s) to json: %w", ansi.Bold(inputs.Segment), err) + } + + cli.renderer.PromptsPartialsUpdate(string(partialsJSON), inputs.Segment) + + return nil + } +} + +func deletePromptsPartials(cli *cli, inputs *promptsPartialsInput) func(cmd *cobra.Command, args []string) error { + return func(cmd *cobra.Command, args []string) error { + if err := checkPromptsPartialsAvailable(cli); err != nil { + return fmt.Errorf("error minimum requirements not met: %w", err) + } + + if len(args) == 0 { + if err := partialsPrompt.Pick(cmd, &inputs.Segment, promptsPartialsSegmentOptions); err != nil { + return err + } + } else { + if !validSegment(args[0]) { + return errorInvalidSegment(args[0]) + } + inputs.Segment = args[0] + } + + inputs.PartialsPrompt.Segment = management.PartialsPromptSegment(inputs.Segment) + + if err := ansi.Waiting(func() error { + return cli.api.Prompt.DeletePartials(context.Background(), &inputs.PartialsPrompt) + }); err != nil { + return fmt.Errorf("failed to delete partials for prompt segment (%s): %w", ansi.Bold(inputs.Segment), err) + } + + partialsJSON, err := json.MarshalIndent(inputs.PartialsPrompt, "", " ") + if err != nil { + return fmt.Errorf("failed to serialize the partials for prompt segment (%s) to json: %w", ansi.Bold(inputs.Segment), err) + } + + cli.renderer.PromptsPartialsDelete(string(partialsJSON), inputs.Segment) + + return nil + } +} + +func promptsPartialsSegmentOptions(_ context.Context) (pickerOptions, error) { + var opts pickerOptions + for _, segment := range partialsSegmentTypes { + s := string(segment) + opts = append(opts, pickerOption{value: s, label: s}) + } + return opts, nil +} + +func validSegment(segment string) bool { + s := management.PartialsPromptSegment(segment) + for _, v := range partialsSegmentTypes { + if s == v { + return true + } + } + return false +} + +func errorInvalidSegment(segment string) error { + return fmt.Errorf("error invalid prompt segment (%s) for partials", segment) +} + +func promptPartialsFromInputs(inputs *promptsPartialsInput) error { + inputs.PartialsPrompt.Segment = management.PartialsPromptSegment(inputs.Segment) + + if inputs.InputFile != "" { + file, err := os.Open(inputs.InputFile) + if err != nil { + return fmt.Errorf("failed to open input file (%s): %w", ansi.Bold(inputs.InputFile), err) + } + defer func(file *os.File) { + _ = file.Close() + }(file) + + inputJSON, err := io.ReadAll(file) + if err != nil { + return fmt.Errorf("failed to read input file (%s): %w", ansi.Bold(inputs.InputFile), err) + } + + if err := json.Unmarshal(inputJSON, &inputs.PartialsPrompt); err != nil { + return fmt.Errorf("failed to deserialize input file (%s): %w", ansi.Bold(inputs.InputFile), err) + } + } + + return nil +} + +func addCommonPromptPartialsFlags(cmd *cobra.Command, inputs *promptsPartialsInput) { + // TODO: look for an automated way of adding flags. + cmd.Flags().StringVar(&inputs.PartialsPrompt.FormContentStart, "form-content-start", "", "Content for the Form Content Start Partial") + cmd.Flags().StringVar(&inputs.PartialsPrompt.FormContentEnd, "form-content-end", "", "Content for the Form Content End Partial") + cmd.Flags().StringVar(&inputs.PartialsPrompt.FormFooterStart, "form-footer-start", "", "Content for the Form Footer Start Partial") + cmd.Flags().StringVar(&inputs.PartialsPrompt.FormFooterEnd, "form-footer-end", "", "Content for the Form Footer End Partial") + cmd.Flags().StringVar(&inputs.PartialsPrompt.SecondaryActionsStart, "secondary-actions-start", "", "Content for the Secondary Actions Start Partial") + cmd.Flags().StringVar(&inputs.PartialsPrompt.SecondaryActionsEnd, "secondary-actions-end", "", "Content for the Secondary Actions End Partial") +} + +func checkPromptsPartialsAvailable(cli *cli) error { + domains, err := cli.api.CustomDomain.List(context.Background()) + if err != nil { + return fmt.Errorf("custom domain error: %w", err) + } + if len(domains) < 1 { + return fmt.Errorf("a custom domain must be created first") + } + if _, err := cli.api.Branding.Read(context.Background()); err != nil { + return fmt.Errorf("branding must be enabled first: %w", err) + } + return nil +} + +func editPartialsPrompt(cli *cli, cmd *cobra.Command, inputs *promptsPartialsInput) error { + for { + var editPartials string + cli.renderer.Infof("Would you like edit your partials? (y/n)") + if err := partialsPrompt.Ask(cmd, &editPartials); err != nil { + return err + } + + if editPartials == "n" || editPartials == "N" { + return nil + } + + cli.renderer.Infof("Choose a Partial to Edit") + var partialKey string + if err := partialsPrompt.Pick(cmd, &partialKey, func(ctx context.Context) (pickerOptions, error) { + var opts pickerOptions + for key, label := range partialsSegmentFields { + opts = append(opts, pickerOption{value: key, label: label}) + } + return opts, nil + }); err != nil { + return err + } + + partialInput := getPartialsPromptsValueForKey(&inputs.PartialsPrompt, partialKey) + fileName := fmt.Sprintf("%s-partials-prompt.json", inputs.Segment) + if err := textBody.OpenEditor(cmd, &partialInput, partialInput, fileName, func() { + cli.renderer.Infof( + "%s Once you close the editor, the custom text will be saved. To cancel, press CTRL+C.", + ansi.Faint("Hint:"), + ) + }); err != nil { + return fmt.Errorf("failed editing (%s) for partials prompt (%s): %w", partialKey, inputs.Segment, err) + } + + if err := setPartialsPromptsValueForKey(&inputs.PartialsPrompt, partialKey, partialInput); err != nil { + return fmt.Errorf("failed editing (%s) for partials prompt (%s): %w", partialKey, inputs.Segment, err) + } + } +} + +func getPartialsPromptsValueForKey(input *management.PartialsPrompt, key string) string { + partialsValue := reflect.ValueOf(input) + partialsType := reflect.TypeOf(*input) + + for i := 0; i < partialsType.NumField(); i++ { + tag := strings.Split(partialsType.Field(i).Tag.Get("json"), ",")[0] + if tag == key { + return partialsValue.Elem().Field(i).String() + } + } + + return "" +} + +func setPartialsPromptsValueForKey(input *management.PartialsPrompt, key, value string) error { + partialsValue := reflect.ValueOf(input) + partialsType := reflect.TypeOf(*input) + + for i := 0; i < partialsType.NumField(); i++ { + tag := strings.Split(partialsType.Field(i).Tag.Get("json"), ",")[0] + if tag == key { + partialsValue.Elem().Field(i).Set(reflect.ValueOf(value)) + return nil + } + } + + return fmt.Errorf("error key (%s) not found", ansi.Bold(key)) +} + +func mergePartialsPrompts(initial, current *management.PartialsPrompt) error { + currentValue := reflect.ValueOf(current) + currentType := reflect.TypeOf(*current) + initialValue := reflect.ValueOf(initial) + + for i := 0; i < currentType.NumField(); i++ { + cfield := currentValue.Elem().Field(i) + ifield := initialValue.Elem().Field(i) + if ifield.String() == "" { + ifield.Set(cfield) + } + } + + return nil +} diff --git a/internal/cli/prompts_partials_test.go b/internal/cli/prompts_partials_test.go new file mode 100644 index 000000000..9af84c8aa --- /dev/null +++ b/internal/cli/prompts_partials_test.go @@ -0,0 +1,48 @@ +package cli + +import ( + "testing" + + "github.com/auth0/go-auth0/management" + "github.com/stretchr/testify/assert" +) + +func TestPromptsPartials_mergePartialsPrompt(t *testing.T) { + a := &management.PartialsPrompt{Segment: "login", FormContentStart: "
a
"} + b := &management.PartialsPrompt{Segment: "login", FormContentEnd: "
b
"} + expected := &management.PartialsPrompt{Segment: "login", FormContentStart: a.FormContentStart, FormContentEnd: b.FormContentEnd} + + err := mergePartialsPrompts(a, b) + assert.NoError(t, err) + assert.Equal(t, a, expected) +} + +func TestPromptsPartials_setPartialsValueForKey(t *testing.T) { + input := "
test
" + a := &management.PartialsPrompt{Segment: "login"} + expected := &management.PartialsPrompt{Segment: a.Segment, FormContentStart: input} + + err := setPartialsPromptsValueForKey(a, "foobar", input) + assert.Error(t, err) + + err = setPartialsPromptsValueForKey(a, "form-content-start", input) + assert.NoError(t, err) + assert.Equal(t, a, expected) +} + +func TestPromptsPartials_getPartialsPromptsValueFromKey(t *testing.T) { + content := "
test
" + a := &management.PartialsPrompt{FormContentStart: content} + expected := content + got := getPartialsPromptsValueForKey(a, "form-content-start") + assert.Equal(t, expected, got) +} + +func TestPromptsPartials_setPartialsPromptsValueForKey(t *testing.T) { + content := "
test
" + a := &management.PartialsPrompt{} + expected := content + err := setPartialsPromptsValueForKey(a, "form-content-start", content) + assert.NoError(t, err) + assert.Equal(t, expected, a.FormContentStart) +} diff --git a/internal/cli/root.go b/internal/cli/root.go index bdb86cde0..aea923e93 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -102,11 +102,7 @@ func buildRootCmd(cli *cli) *cobra.Command { } }() - if err := cli.setupWithAuthentication(cmd.Context()); err != nil { - return err - } - - return nil + return cli.setupWithAuthentication(cmd.Context()) }, } diff --git a/internal/cli/universal_login.go b/internal/cli/universal_login.go index 514599715..104e7c971 100644 --- a/internal/cli/universal_login.go +++ b/internal/cli/universal_login.go @@ -68,6 +68,7 @@ func universalLoginCmd(cli *cli) *cobra.Command { cmd.AddCommand(updateUniversalLoginCmd(cli)) cmd.AddCommand(universalLoginTemplatesCmd(cli)) cmd.AddCommand(universalLoginPromptsTextCmd(cli)) + cmd.AddCommand(promptsPartialsCmd(cli)) return cmd } diff --git a/internal/display/prompts_partials.go b/internal/display/prompts_partials.go new file mode 100644 index 000000000..3555fe394 --- /dev/null +++ b/internal/display/prompts_partials.go @@ -0,0 +1,35 @@ +package display + +import ( + "fmt" + + "github.com/auth0/auth0-cli/internal/ansi" +) + +func (r *Renderer) promptsPartialsAction(partialJSON, segment, action string) { + r.Heading( + fmt.Sprintf( + "partials for prompt (%s) %s", + ansi.Bold(segment), + action, + ), + ) + r.Output(ansi.ColorizeJSON(partialJSON)) + r.Newline() +} + +func (r *Renderer) PromptsPartialsShow(partialJSON, segment string) { + r.promptsPartialsAction(partialJSON, segment, "viewed") +} + +func (r *Renderer) PromptsPartialsCreate(partialJSON, segment string) { + r.promptsPartialsAction(partialJSON, segment, "created") +} + +func (r *Renderer) PromptsPartialsUpdate(partialJSON, segment string) { + r.promptsPartialsAction(partialJSON, segment, "updated") +} + +func (r *Renderer) PromptsPartialsDelete(partialJSON, segment string) { + r.promptsPartialsAction(partialJSON, segment, "deleted") +}