Skip to content

Commit

Permalink
feat: renamed "loginID" to "loginIDOrUserID" in mgmt.user interface t…
Browse files Browse the repository at this point in the history
…o match the implementation (#495)
  • Loading branch information
yosiharan authored Jan 26, 2025
1 parent c825f9d commit 4ae4c7f
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions descope/sdk/mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,17 @@ type User interface {
// IMPORTANT: All parameters will override whatever values are currently set
// in the existing user. Use carefully.
// Instead, use Patch if you don't want to pass all parameters.
Update(ctx context.Context, loginID string, user *descope.UserRequest) (*descope.UserResponse, error)
Update(ctx context.Context, loginIDOrUserID string, user *descope.UserRequest) (*descope.UserResponse, error)

// Patches an existing user.
//
// Only the fields that are set in the request will be updated.
Patch(ctx context.Context, loginID string, user *descope.PatchUserRequest) (*descope.UserResponse, error)
Patch(ctx context.Context, loginIDOrUserID string, user *descope.PatchUserRequest) (*descope.UserResponse, error)

// Delete an existing user.
//
// IMPORTANT: This action is irreversible. Use carefully.
Delete(ctx context.Context, loginID string) error
Delete(ctx context.Context, loginIDOrUserID string) error

// Delete an existing user by User ID. The user ID can be found
// on the user's JWT.
Expand All @@ -224,8 +224,8 @@ type User interface {

// Load an existing user.
//
// The loginID is required and the user will be fetched according to it.
Load(ctx context.Context, loginID string) (*descope.UserResponse, error)
// The loginIDOrUserID parameter is required and the user will be fetched according to it.
Load(ctx context.Context, loginIDOrUserID string) (*descope.UserResponse, error)

// Load an existing user by User ID. The user ID can be found
// on the user's JWT.
Expand All @@ -250,10 +250,10 @@ type User interface {
SearchAllTestUsers(ctx context.Context, options *descope.UserSearchOptions) ([]*descope.UserResponse, int, error)

// Activate an existing user.
Activate(ctx context.Context, loginID string) (*descope.UserResponse, error)
Activate(ctx context.Context, loginIDOrUserID string) (*descope.UserResponse, error)

// Deactivate an existing user.
Deactivate(ctx context.Context, loginID string) (*descope.UserResponse, error)
Deactivate(ctx context.Context, loginIDOrUserID string) (*descope.UserResponse, error)

// Logout given user from all their devices, by login ID
LogoutUser(ctx context.Context, loginID string) error
Expand All @@ -272,72 +272,72 @@ type User interface {
//
// The isVerified flag must be true for the user to be able to login with
// the email address.
UpdateEmail(ctx context.Context, loginID, email string, isVerified bool) (*descope.UserResponse, error)
UpdateEmail(ctx context.Context, loginIDOrUserID, email string, isVerified bool) (*descope.UserResponse, error)

// Update the phone number for an existing user.
//
// The phone parameter can be empty in which case the phone will be removed.
//
// The isVerified flag must be true for the user to be able to login with
// the phone number.
UpdatePhone(ctx context.Context, loginID, phone string, isVerified bool) (*descope.UserResponse, error)
UpdatePhone(ctx context.Context, loginIDOrUserID, phone string, isVerified bool) (*descope.UserResponse, error)

// Update an existing user's display name (i.e., their full name).
//
// The displayName parameter can be empty in which case the name will be removed.
UpdateDisplayName(ctx context.Context, loginID, displayName string) (*descope.UserResponse, error)
UpdateDisplayName(ctx context.Context, loginIDOrUserID, displayName string) (*descope.UserResponse, error)

// Update an existing user's first/last/middle name.
//
// An empty parameter, means that this value will be removed.
UpdateUserNames(ctx context.Context, loginID, givenName, middleName, familyName string) (*descope.UserResponse, error)
UpdateUserNames(ctx context.Context, loginIDOrUserID, givenName, middleName, familyName string) (*descope.UserResponse, error)

// Update an existing user's picture (i.e., url to the avatar).
//
// The picture parameter can be empty in which case the picture will be removed.
UpdatePicture(ctx context.Context, loginID, picture string) (*descope.UserResponse, error)
UpdatePicture(ctx context.Context, loginIDOrUserID, picture string) (*descope.UserResponse, error)

// Update an existing user's custom attribute.
//
// key should be a custom attribute that was already declared in the Descope console app.
// value should match the type of the declared attribute
UpdateCustomAttribute(ctx context.Context, loginID, key string, value any) (*descope.UserResponse, error)
UpdateCustomAttribute(ctx context.Context, loginIDOrUserID, key string, value any) (*descope.UserResponse, error)

// Set roles for a user without tenant association. Use SetTenantRoles for users
// that are part of a multi-tenant project.
SetRoles(ctx context.Context, loginID string, roles []string) (*descope.UserResponse, error)
SetRoles(ctx context.Context, loginIDOrUserID string, roles []string) (*descope.UserResponse, error)

// Add roles for a user without tenant association. Use AddTenantRoles for users
// that are part of a multi-tenant project.
AddRoles(ctx context.Context, loginID string, roles []string) (*descope.UserResponse, error)
AddRoles(ctx context.Context, loginIDOrUserID string, roles []string) (*descope.UserResponse, error)

// Remove roles from a user without tenant association. Use RemoveTenantRoles for
// users that are part of a multi-tenant project.
RemoveRoles(ctx context.Context, loginID string, roles []string) (*descope.UserResponse, error)
RemoveRoles(ctx context.Context, loginIDOrUserID string, roles []string) (*descope.UserResponse, error)

// Associate SSO application for a user.
AddSSOApps(ctx context.Context, loginID string, ssoAppIDs []string) (*descope.UserResponse, error)
AddSSOApps(ctx context.Context, loginIDOrUserID string, ssoAppIDs []string) (*descope.UserResponse, error)

// Set (associate) SSO applications for a user.
SetSSOApps(ctx context.Context, loginID string, ssoAppIDs []string) (*descope.UserResponse, error)
SetSSOApps(ctx context.Context, loginIDOrUserID string, ssoAppIDs []string) (*descope.UserResponse, error)

// Remove SSO application association from a user.
RemoveSSOApps(ctx context.Context, loginID string, ssoAppIDs []string) (*descope.UserResponse, error)
RemoveSSOApps(ctx context.Context, loginIDOrUserID string, ssoAppIDs []string) (*descope.UserResponse, error)

// Add a tenant association for an existing user.
AddTenant(ctx context.Context, loginID string, tenantID string) (*descope.UserResponse, error)
AddTenant(ctx context.Context, loginIDOrUserID string, tenantID string) (*descope.UserResponse, error)

// Remove a tenant association from an existing user.
RemoveTenant(ctx context.Context, loginID string, tenantID string) (*descope.UserResponse, error)
RemoveTenant(ctx context.Context, loginIDOrUserID string, tenantID string) (*descope.UserResponse, error)

// Set roles for a user in a specific tenant.
SetTenantRoles(ctx context.Context, loginID string, tenantID string, roles []string) (*descope.UserResponse, error)
SetTenantRoles(ctx context.Context, loginIDOrUserID string, tenantID string, roles []string) (*descope.UserResponse, error)

// Add roles for a user in a specific tenant.
AddTenantRoles(ctx context.Context, loginID string, tenantID string, roles []string) (*descope.UserResponse, error)
AddTenantRoles(ctx context.Context, loginIDOrUserID string, tenantID string, roles []string) (*descope.UserResponse, error)

// Remove roles from a user in a specific tenant.
RemoveTenantRoles(ctx context.Context, loginID string, tenantID string, roles []string) (*descope.UserResponse, error)
RemoveTenantRoles(ctx context.Context, loginIDOrUserID string, tenantID string, roles []string) (*descope.UserResponse, error)

// Set a temporary password for the given login ID.
// Note: The password will automatically be set as expired.
Expand Down

0 comments on commit 4ae4c7f

Please sign in to comment.