From 88c52f80d50c6288036703bccefe8e011fac763d Mon Sep 17 00:00:00 2001 From: Cyril David Date: Fri, 30 Apr 2021 15:11:38 -0700 Subject: [PATCH] fix: just make client.List / Read work for all cases Thish should be fixed on the SDK level --- internal/cli/apps.go | 10 +++++----- internal/cli/quickstarts.go | 10 +++++----- internal/cli/template.go | 2 +- internal/cli/test.go | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/cli/apps.go b/internal/cli/apps.go index 5cdc9a81e..4e32cda13 100644 --- a/internal/cli/apps.go +++ b/internal/cli/apps.go @@ -111,7 +111,7 @@ var ( Help: "List of grant types supported for this application. Can include code, implicit, refresh-token, credentials, password, password-realm, mfa-oob, mfa-otp, mfa-recovery-code, and device-code.", IsRequired: false, } - exludedFields = []string{ + clientExcludedList = []string{ // woraround for issue when ocassionally // (probably legacy apps) arrive at the SDK // with a `lifetime_in_seconds` value as string instead of int: @@ -203,7 +203,7 @@ auth0 apps ls`, if err := ansi.Waiting(func() error { var err error - list, err = cli.api.Client.List(management.ExcludeFields(exludedFields...)) + list, err = cli.api.Client.List(management.ExcludeFields(clientExcludedList...)) return err }); err != nil { return fmt.Errorf("An unexpected error occurred: %w", err) @@ -246,7 +246,7 @@ auth0 apps show `, if err := ansi.Waiting(func() error { var err error - a, err = cli.api.Client.Read(inputs.ID) + a, err = cli.api.Client.Read(inputs.ID, management.ExcludeFields(clientExcludedList...)) return err }); err != nil { return fmt.Errorf("Unable to load application. The Id %v specified doesn't exist", inputs.ID) @@ -293,7 +293,7 @@ auth0 apps delete `, } return ansi.Spinner("Deleting Application", func() error { - _, err := cli.api.Client.Read(inputs.ID) + _, err := cli.api.Client.Read(inputs.ID, management.ExcludeFields(clientExcludedList...)) if err != nil { return fmt.Errorf("Unable to delete application. The specified Id: %v doesn't exist", inputs.ID) @@ -498,7 +498,7 @@ auth0 apps update -n myapp --type [native|spa|regular|m2m]`, // Load app by id if err := ansi.Waiting(func() error { var err error - current, err = cli.api.Client.Read(inputs.ID) + current, err = cli.api.Client.Read(inputs.ID, management.ExcludeFields(clientExcludedList...)) return err }); err != nil { return fmt.Errorf("Unable to load application. The Id %v specified doesn't exist", inputs.ID) diff --git a/internal/cli/quickstarts.go b/internal/cli/quickstarts.go index 3edf52dd0..c83a16a72 100644 --- a/internal/cli/quickstarts.go +++ b/internal/cli/quickstarts.go @@ -106,10 +106,10 @@ func downloadQuickstartCmd(cli *cli) *cobra.Command { } cmd := &cobra.Command{ - Use: "download", - Args: cobra.MaximumNArgs(1), - Short: "Download a Quickstart sample app for a specific tech stack", - Long: "Download a Quickstart sample app for a specific tech stack.", + Use: "download", + Args: cobra.MaximumNArgs(1), + Short: "Download a Quickstart sample app for a specific tech stack", + Long: "Download a Quickstart sample app for a specific tech stack.", Example: `auth0 quickstarts download --stack auth0 qs download --stack `, PreRun: func(cmd *cobra.Command, args []string) { @@ -132,7 +132,7 @@ auth0 qs download --stack `, var client *management.Client err := ansi.Waiting(func() error { var err error - client, err = cli.api.Client.Read(inputs.ClientID) + client, err = cli.api.Client.Read(inputs.ClientID, management.ExcludeFields(clientExcludedList...)) return err }) diff --git a/internal/cli/template.go b/internal/cli/template.go index 8362ed18f..d7175637b 100644 --- a/internal/cli/template.go +++ b/internal/cli/template.go @@ -183,7 +183,7 @@ func (cli *cli) obtainCustomTemplateData(ctx context.Context) (*branding.Templat g.Go(func() error { var err error - clients, err = cli.api.Client.List() + clients, err = cli.api.Client.List(management.ExcludeFields(clientExcludedList...)) return err }) diff --git a/internal/cli/test.go b/internal/cli/test.go index 06e36aac9..f2f081eaf 100644 --- a/internal/cli/test.go +++ b/internal/cli/test.go @@ -118,7 +118,7 @@ auth0 test login --connection `, defer cleanupTempApplication(isTempClient, cli, inputs.ClientID) - client, err := cli.api.Client.Read(inputs.ClientID) + client, err := cli.api.Client.Read(inputs.ClientID, management.ExcludeFields(clientExcludedList...)) if err != nil { return fmt.Errorf("Unable to find client %s; if you specified a client, please verify it exists, otherwise re-run the command", inputs.ClientID) } @@ -209,7 +209,7 @@ auth0 test token --client-id --audience --scopes inputs.ClientID = client.GetClientID() } - client, err := cli.api.Client.Read(inputs.ClientID) + client, err := cli.api.Client.Read(inputs.ClientID, management.ExcludeFields(clientExcludedList...)) if err != nil { return fmt.Errorf("Unable to find client %s; if you specified a client, please verify it exists, otherwise re-run the command", inputs.ClientID) }