Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/app/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func LinkExistingApp(ctx context.Context, clients *shared.ClientFactory, app *ty
}

appIDs := []string{app.AppID}
_, err = clients.APIInterface().GetAppStatus(ctx, auth.Token, appIDs, app.TeamID)
_, err = clients.API().GetAppStatus(ctx, auth.Token, appIDs, app.TeamID)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/collaborators/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func runAddCommandFunc(ctx context.Context, clients *shared.ClientFactory, cmd *
if err != nil {
return err
}
err = clients.APIInterface().AddCollaborator(ctx, selection.Auth.Token, selection.App.AppID, slackUser)
err = clients.API().AddCollaborator(ctx, selection.Auth.Token, selection.App.AppID, slackUser)
if err != nil {
if clients.Config.WithExperimentOn(experiment.ReadOnlyAppCollaborators) && strings.Contains(err.Error(), "user_already_owner") {
cmd.Println()
Expand Down
2 changes: 1 addition & 1 deletion cmd/collaborators/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func runListCommand(cmd *cobra.Command, clients *shared.ClientFactory) error {
if err = cmdutil.AppExists(app, selection.Auth); err != nil {
return err
}
collaborators, err := clients.APIInterface().ListCollaborators(ctx, selection.Auth.Token, app.AppID)
collaborators, err := clients.API().ListCollaborators(ctx, selection.Auth.Token, app.AppID)
if err != nil {
return slackerror.Wrap(err, "Error listing collaborators")
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/collaborators/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func runRemoveCommandFunc(ctx context.Context, clients *shared.ClientFactory, cm
if err = cmdutil.AppExists(selection.App, selection.Auth); err != nil {
return err
}
warnings, err := clients.APIInterface().RemoveCollaborator(ctx, selection.Auth.Token, selection.App.AppID, slackUser)
warnings, err := clients.API().RemoveCollaborator(ctx, selection.Auth.Token, selection.App.AppID, slackUser)
if err != nil {
return err
}
Expand Down Expand Up @@ -120,7 +120,7 @@ func promptCollaboratorsRemoveSlackUserPrompts(
slackUser types.SlackUser,
err error,
) {
collaborators, err := clients.APIInterface().ListCollaborators(ctx, selection.Auth.Token, selection.App.AppID)
collaborators, err := clients.API().ListCollaborators(ctx, selection.Auth.Token, selection.App.AppID)
if err != nil {
return types.SlackUser{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/collaborators/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func runUpdateCommand(cmd *cobra.Command, clients *shared.ClientFactory, args []
return err
}

err = clients.APIInterface().UpdateCollaborator(ctx, selection.Auth.Token, app.AppID, slackUser)
err = clients.API().UpdateCollaborator(ctx, selection.Auth.Token, app.AppID, slackUser)
if err != nil {
return slackerror.Wrap(err, "Error updating collaborator")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/datastore/bulk_put.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func startBulkPutImport(ctx context.Context, clients *shared.ClientFactory, cmd
}

query.Items = currentBatch
bulkPutResult, err := clients.APIInterface().AppsDatastoreBulkPut(ctx, token, query)
bulkPutResult, err := clients.API().AppsDatastoreBulkPut(ctx, token, query)
if err != nil {
if len(err.(*slackerror.Error).Details) == 0 {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/datastore/count.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func runCountCommandFunc(
}

// Perform the count
countResult, err := clients.APIInterface().AppsDatastoreCount(ctx, selection.Auth.Token, count)
countResult, err := clients.API().AppsDatastoreCount(ctx, selection.Auth.Token, count)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/datastore/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func startQueryExport(ctx context.Context, clients *shared.ClientFactory, cmd *c
}

query.Limit = maxItemsToRead
queryResult, err := clients.APIInterface().AppsDatastoreQuery(ctx, token, query)
queryResult, err := clients.API().AppsDatastoreQuery(ctx, token, query)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/doctor/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func checkCLICreds(ctx context.Context, clients *shared.ClientFactory) (Section,
// the call. This results in incorrectly deeming tokens invalid if using multiple workspaces
// with different API hosts. (cc: @mbrooks)
clients.Config.APIHostResolved = clients.AuthInterface().ResolveAPIHost(ctx, clients.Config.APIHostFlag, &authInfo)
_, err := clients.APIInterface().ValidateSession(ctx, authInfo.Token)
_, err := clients.API().ValidateSession(ctx, authInfo.Token)
if err != nil {
validitySection.Value = "Invalid"
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/env/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func runEnvAddCommandFunc(clients *shared.ClientFactory, cmd *cobra.Command, arg
variableValue = args[1]
}

err = clients.APIInterface().AddVariable(
err = clients.API().AddVariable(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down
2 changes: 1 addition & 1 deletion cmd/env/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func runEnvListCommandFunc(
return err
}

variableNames, err := clients.APIInterface().ListVariables(
variableNames, err := clients.API().ListVariables(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down
4 changes: 2 additions & 2 deletions cmd/env/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func runEnvRemoveCommandFunc(clients *shared.ClientFactory, cmd *cobra.Command,
if len(args) > 0 {
variableName = args[0]
} else {
variables, err := clients.APIInterface().ListVariables(
variables, err := clients.API().ListVariables(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down Expand Up @@ -130,7 +130,7 @@ func runEnvRemoveCommandFunc(clients *shared.ClientFactory, cmd *cobra.Command,
}
}

err = clients.APIInterface().RemoveVariable(
err = clients.API().RemoveVariable(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down
4 changes: 2 additions & 2 deletions cmd/externalauth/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func runAddCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
}

// Get the oauth2 provider keys
providerAuths, err := clients.APIInterface().AppsAuthExternalList(
providerAuths, err := clients.API().AppsAuthExternalList(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down Expand Up @@ -132,7 +132,7 @@ func runAddCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
return slackerror.New(fmt.Sprintf("Error: No client secret exists. Add one with %s", command))
}

authorizationURL, err := clients.APIInterface().AppsAuthExternalStart(
authorizationURL, err := clients.API().AppsAuthExternalStart(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down
4 changes: 2 additions & 2 deletions cmd/externalauth/add_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func runAddClientSecretCommand(clients *shared.ClientFactory, cmd *cobra.Command
}

// Get the oauth2 provider keys
providerAuths, err := clients.APIInterface().AppsAuthExternalList(
providerAuths, err := clients.API().AppsAuthExternalList(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down Expand Up @@ -121,7 +121,7 @@ func runAddClientSecretCommand(clients *shared.ClientFactory, cmd *cobra.Command
clientSecret = response.Value
}

err = clients.APIInterface().AppsAuthExternalClientSecretAdd(
err = clients.API().AppsAuthExternalClientSecretAdd(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down
10 changes: 5 additions & 5 deletions cmd/externalauth/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func runRemoveCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
return nil
}

err = clients.APIInterface().AppsAuthExternalDelete(
err = clients.API().AppsAuthExternalDelete(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand All @@ -142,7 +142,7 @@ func runRemoveCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
return nil
}

err = clients.APIInterface().AppsAuthExternalDelete(
err = clients.API().AppsAuthExternalDelete(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand All @@ -154,7 +154,7 @@ func runRemoveCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
}
} else {
// Get oauth2 providerAuths
providerAuths, err := clients.APIInterface().AppsAuthExternalList(
providerAuths, err := clients.API().AppsAuthExternalList(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down Expand Up @@ -191,7 +191,7 @@ func runRemoveCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
if externalTokenArg == "" {
return slackerror.New("Unable to get a provider selection")
}
err = clients.APIInterface().AppsAuthExternalDelete(
err = clients.API().AppsAuthExternalDelete(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand All @@ -202,7 +202,7 @@ func runRemoveCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
return err
}
} else {
err = clients.APIInterface().AppsAuthExternalDelete(
err = clients.API().AppsAuthExternalDelete(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down
4 changes: 2 additions & 2 deletions cmd/externalauth/select_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func runSelectAuthCommand(clients *shared.ClientFactory, cmd *cobra.Command) err
}

// Get the oauth2 details for the app
externalAuths, err := clients.APIInterface().AppsAuthExternalList(
externalAuths, err := clients.API().AppsAuthExternalList(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down Expand Up @@ -142,7 +142,7 @@ func runSelectAuthCommand(clients *shared.ClientFactory, cmd *cobra.Command) err
return slackerror.New("Account is not used in the selected workflow")
}

err = clients.APIInterface().AppsAuthExternalSelectAuth(
err = clients.API().AppsAuthExternalSelectAuth(
ctx,
selection.Auth.Token,
selection.App.AppID,
Expand Down
32 changes: 16 additions & 16 deletions cmd/function/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func handleUpdate(
distribution = types.PermissionAppCollaborators
}

_, err := clients.APIInterface().FunctionDistributionSet(ctx, functionFlag, app.AppID, distribution, "")
_, err := clients.API().FunctionDistributionSet(ctx, functionFlag, app.AppID, distribution, "")
if err != nil {
return err
}
Expand All @@ -154,7 +154,7 @@ func handleUpdate(
return err
}

err = clients.APIInterface().FunctionDistributionAddUsers(ctx, functionFlag, app.AppID, distributeFlags.users)
err = clients.API().FunctionDistributionAddUsers(ctx, functionFlag, app.AppID, distributeFlags.users)
if err != nil {
return err
}
Expand All @@ -170,7 +170,7 @@ func handleUpdate(
return slackerror.New(slackerror.ErrMissingFlag).WithRemediation("To revoke a user's access, pass in their user ID with the --users flag: `--users U12345`")
}

err := clients.APIInterface().FunctionDistributionRemoveUsers(ctx, functionFlag, app.AppID, distributeFlags.users)
err := clients.API().FunctionDistributionRemoveUsers(ctx, functionFlag, app.AppID, distributeFlags.users)
if err != nil {
return err
}
Expand Down Expand Up @@ -205,7 +205,7 @@ func handleUpdate(
return err
}

err = clients.APIInterface().FunctionDistributionAddUsers(ctx, functionFlag, app.AppID, users)
err = clients.API().FunctionDistributionAddUsers(ctx, functionFlag, app.AppID, users)
if err != nil {
return err
}
Expand All @@ -216,7 +216,7 @@ func handleUpdate(
Text: fmt.Sprintf("Function access granted to the provided %s", style.Pluralize("user", "users", len(users))),
})))
case "remove":
err = clients.APIInterface().FunctionDistributionRemoveUsers(ctx, functionFlag, app.AppID, users)
err = clients.API().FunctionDistributionRemoveUsers(ctx, functionFlag, app.AppID, users)
if err != nil {
return err
}
Expand All @@ -228,7 +228,7 @@ func handleUpdate(
return printDistribution(ctx, cmd, clients, app)
}

_, err = clients.APIInterface().FunctionDistributionSet(ctx, functionFlag, app.AppID, dist, "")
_, err = clients.API().FunctionDistributionSet(ctx, functionFlag, app.AppID, dist, "")
if err != nil {
return err
}
Expand Down Expand Up @@ -298,7 +298,7 @@ func distributePermissionFile(ctx context.Context, clients *shared.ClientFactory
permissions.Type,
))
}
_, err := clients.APIInterface().FunctionDistributionSet(ctx, function, app.AppID, permissions.Type, "")
_, err := clients.API().FunctionDistributionSet(ctx, function, app.AppID, permissions.Type, "")
if err != nil {
return err
}
Expand All @@ -317,11 +317,11 @@ func updateNamedEntitiesDistribution(
entities []string,
) error {
updatedUsers := strings.Join(entities, ",")
_, err := clients.APIInterface().FunctionDistributionSet(ctx, function, app.AppID, types.PermissionNamedEntities, updatedUsers)
_, err := clients.API().FunctionDistributionSet(ctx, function, app.AppID, types.PermissionNamedEntities, updatedUsers)
if err != nil {
return err
}
_, currentUsers, err := clients.APIInterface().FunctionDistributionList(ctx, function, app.AppID)
_, currentUsers, err := clients.API().FunctionDistributionList(ctx, function, app.AppID)
if err != nil {
return err
}
Expand All @@ -339,7 +339,7 @@ func updateNamedEntitiesDistribution(
}
}
removals := strings.Join(removalSlice, ",")
err = clients.APIInterface().FunctionDistributionRemoveUsers(ctx, function, app.AppID, removals)
err = clients.API().FunctionDistributionRemoveUsers(ctx, function, app.AppID, removals)
if err != nil {
return err
}
Expand All @@ -348,7 +348,7 @@ func updateNamedEntitiesDistribution(

// printDistribution formats and displays access information
func printDistribution(ctx context.Context, cmd *cobra.Command, clients *shared.ClientFactory, app types.App) error {
dist, userAccessList, err := clients.APIInterface().FunctionDistributionList(ctx, functionFlag, app.AppID)
dist, userAccessList, err := clients.API().FunctionDistributionList(ctx, functionFlag, app.AppID)
if err != nil {
return err
}
Expand Down Expand Up @@ -387,7 +387,7 @@ func printDistribution(ctx context.Context, cmd *cobra.Command, clients *shared.

// printEntityAccess formats and displays the users with access to an app's functions
func printEntityAccess(ctx context.Context, cmd *cobra.Command, clients *shared.ClientFactory, app types.App) error {
distType, users, err := clients.APIInterface().FunctionDistributionList(ctx, functionFlag, app.AppID)
distType, users, err := clients.API().FunctionDistributionList(ctx, functionFlag, app.AppID)
if err != nil {
return err
}
Expand Down Expand Up @@ -421,7 +421,7 @@ func printEntityAccess(ctx context.Context, cmd *cobra.Command, clients *shared.

// handleDistributionType checks if the function's distribution type is named_entities and if not, updates it
func handleDistributionType(ctx context.Context, clients *shared.ClientFactory, app types.App) error {
distType, _, err := clients.APIInterface().FunctionDistributionList(ctx, functionFlag, app.AppID)
distType, _, err := clients.API().FunctionDistributionList(ctx, functionFlag, app.AppID)
if err != nil {
return err
}
Expand All @@ -430,7 +430,7 @@ func handleDistributionType(ctx context.Context, clients *shared.ClientFactory,
return nil
}

_, err = clients.APIInterface().FunctionDistributionSet(ctx, functionFlag, app.AppID, types.PermissionNamedEntities, "")
_, err = clients.API().FunctionDistributionSet(ctx, functionFlag, app.AppID, types.PermissionNamedEntities, "")
if err != nil {
return err
}
Expand All @@ -445,7 +445,7 @@ func AddCollaboratorsToNamedEntities(
app types.App,
token string,
) error {
collaborators, err := clients.APIInterface().ListCollaborators(ctx, token, app.AppID)
collaborators, err := clients.API().ListCollaborators(ctx, token, app.AppID)
if err != nil {
return err
}
Expand All @@ -464,5 +464,5 @@ func AddCollaboratorsToNamedEntities(
return err
}

return clients.APIInterface().FunctionDistributionAddUsers(ctx, functionFlag, app.AppID, userIDs)
return clients.API().FunctionDistributionAddUsers(ctx, functionFlag, app.AppID, userIDs)
}
2 changes: 1 addition & 1 deletion cmd/function/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func chooseDistributionPrompt(
) (types.Permission, error) {

// Get the function's active distribution type
currentDist, _, err := clients.APIInterface().FunctionDistributionList(ctx, functionFlag, app.AppID)
currentDist, _, err := clients.API().FunctionDistributionList(ctx, functionFlag, app.AppID)
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/openformresponse/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func runExportCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
}
}

err = clients.APIInterface().StepsResponsesExport(ctx, token, exportFlags.workflow, appID, stepID)
err = clients.API().StepsResponsesExport(ctx, token, exportFlags.workflow, appID, stepID)
if err != nil {
return err
}
Expand All @@ -105,7 +105,7 @@ func runExportCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
}

func pickStepFromPrompt(ctx context.Context, clients *shared.ClientFactory, token string, workflow string, appID string) (string, error) {
stepVersions, err := clients.APIInterface().StepsList(ctx, token, workflow, appID)
stepVersions, err := clients.API().StepsList(ctx, token, workflow, appID)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/platform/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func printDeployHostingCompletion(clients *shared.ClientFactory, cmd *cobra.Comm

parsedAppInfo := map[string]string{}

host := clients.APIInterface().Host()
host := clients.API().Host()
if appID := event.DataToString("appID"); appID != "" && host != "" {
parsedAppInfo["Dashboard"] = fmt.Sprintf("%s/apps/%s", host, appID)
}
Expand Down
Loading
Loading