UsersModule
public class UsersModule
Provides User management.
-
Initializer
Declaration
Swift
public init(boxClient: BoxClient)Parameters
boxClientRequired for communicating with Box APIs.
-
Get information about the user for which this client is authenticated.
Declaration
Parameters
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard user object or an error.
-
Get information about a user in the enterprise. Requires enterprise administration authorization.
Declaration
Parameters
userIdThe ID of the user.
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard user object or an error.
-
Get image of a user’s avatar
Declaration
Swift
public func getAvatar( userId: String, completion: @escaping Callback<Data> )Parameters
userIdThe ID of the user.
completionReturns the data object of the avatar image of the user or an error.
-
create(login:name:role:language:isSyncEnabled:jobTitle:phone:address:spaceAmount:trackingCodes:canSeeManagedUsers:timezone:isExternalCollabRestricted:isExemptFromDeviceLimits:isExemptFromLoginVerification:status:fields:completion:)Create a new managed user in an enterprise. This method only works for Box admins.
Declaration
Swift
public func create( login: String, name: String, role: UserRole? = nil, language: String? = nil, isSyncEnabled: Bool? = nil, jobTitle: String? = nil, phone: String? = nil, address: String? = nil, spaceAmount: Int64? = nil, trackingCodes: [User.TrackingCode]? = nil, canSeeManagedUsers: Bool? = nil, timezone: String? = nil, isExternalCollabRestricted: Bool? = nil, isExemptFromDeviceLimits: Bool? = nil, isExemptFromLoginVerification: Bool? = nil, status: UserStatus? = nil, fields: [String]? = nil, completion: @escaping Callback<User> )Parameters
loginThe email address the user uses to login
nameThe name of the user
roleThe user’s enterprise role. Can be coadmin or user
languageThe language of the user. Input format follows a modified version of the ISO 639-1 language code format. https://developer.box.com/docs/api-language-codes
isSyncEnabledWhether the user can use Box Sync
jobTitleThe user’s job title
phoneThe user’s phone number
addressThe user’s address
spaceAmountThe user’s total available space amount in bytes
trackingCodesAn array of key/value pairs set by the user’s admin
canSeeManagedUsersWhether the user can see other managed users
timezoneThe user’s timezone. Input format follows tz database timezones. https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
isExternalCollabRestrictedWhether the user is restricted from external collaboration
isExemptFromDeviceLimitsWhether to exempt the user from Enterprise device limits
isExemptFromLoginVerificationWhether the user must use two-factor authentication
statusactive, inactive, cannotDeleteOrEdit, or cannotDeleteEditOrupload
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard user object or an error.
-
update(userId:login:name:role:language:isSyncEnabled:jobTitle:phone:address:spaceAmount:trackingCodes:canSeeManagedUsers:timezone:isExternalCollabRestricted:isExemptFromDeviceLimits:isExemptFromLoginVerification:status:fields:completion:)Update the information for a user.
Declaration
Swift
public func update( userId: String, login: String? = nil, name: String? = nil, role: UserRole? = nil, language: String? = nil, isSyncEnabled: Bool? = nil, jobTitle: String? = nil, phone: String? = nil, address: String? = nil, spaceAmount: Int64? = nil, trackingCodes: [User.TrackingCode]? = nil, canSeeManagedUsers: Bool? = nil, timezone: String? = nil, isExternalCollabRestricted: Bool? = nil, isExemptFromDeviceLimits: Bool? = nil, isExemptFromLoginVerification: Bool? = nil, status: UserStatus? = nil, fields: [String]? = nil, completion: @escaping Callback<User> )Parameters
userIdThe ID of the user.
loginThe ID of the user.
nameThe name of the user
roleThe user’s enterprise role. Can be coadmin or user
languageThe language of the user. Input format follows a modified version of the ISO 639-1 language code format. https://developer.box.com/docs/api-language-codes
isSyncEnabledWhether the user can use Box Sync
jobTitleThe user’s job title
phoneThe user’s phone number
addressThe user’s address
spaceAmountThe user’s total available space amount in bytes
trackingCodesAn array of key/value pairs set by the user’s admin
canSeeManagedUsersWhether the user can see other managed users
timezoneThe user’s timezone. Input format follows tz database timezones. https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
isExternalCollabRestrictedWhether the user is restricted from external collaboration
isExemptFromDeviceLimitsWhether to exempt the user from Enterprise device limits
isExemptFromLoginVerificationWhether the user must use two-factor authentication
statusactive, inactive, cannotDeleteOrEdit, or cannotDeleteEditOrupload
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard user object or an error.
-
createAppUser(name:language:jobTitle:timezone:phone:address:spaceAmount:status:isExternalCollabRestricted:canSeeManagedUsers:fields:completion:)Create a new app user in an enterprise.
Declaration
Swift
public func createAppUser( name: String, language: String? = nil, jobTitle: String? = nil, timezone: String? = nil, phone: String? = nil, address: String? = nil, spaceAmount: Int64? = nil, status: UserStatus? = nil, isExternalCollabRestricted: Bool? = nil, canSeeManagedUsers: Bool? = nil, fields: [String]? = nil, completion: @escaping Callback<User> )Parameters
nameThe name of the user. All special characters are acceptable except for <, >, and “ ”.
languageThe language of the user. Input format follows a modified version of the ISO 639-1 language code format. https://developer.box.com/v2.0/docs/api-language-codes
jobTitleThe user’s job title
timezoneThe user’s timezone. Input format follows tz database timezones. https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
phoneThe user’s phone number
addressThe user’s address
spaceAmountThe user’s total available space amount in bytes
statusactive, inactive, cannotDeleteOrEdit, or cannotDeleteEditOrupload
isExternalCollabRestrictedWhether the user is restricted from external collaboration
canSeeManagedUsersWhether the user can see managed users
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard user object or an error.
-
Delete a user.
Declaration
Swift
public func delete( userId: String, notify: Bool? = nil, force: Bool? = nil, completion: @escaping Callback<Void> )Parameters
userIdThe ID of the user
notifyWhether the destination user will receive email notification of the transfer
forceWhether the user should be deleted even if this user still own files
completionAn empty response will be returned upon successful deletion. An error is thrown if the folder is not empty and the ‘recursive’ parameter is not included.
-
Returns all of the users for the Enterprise. Only available to admin accounts or service accounts.
Declaration
Swift
public func listForEnterprise( filterTerm: String? = nil, fields: [String]? = nil, offset: Int? = nil, limit: Int? = nil ) -> PaginationIterator<User>Parameters
filterTermOnly return users whose name or login matches the filter_term. See notes below for details on the matching.
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
offsetThe offset of the item at which to begin the response. See offset-based paging for details.
limitThe maximum number of items to return.
-
Invite an existing user to join an Enterprise.
Declaration
Parameters
enterpriseIdThe ID of the enterprise the user will be invited to
loginThe login of the user that will receive the invitation
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard Invite object or an error.
-
Move all of the items owned by a user into a new folder in another user’s account.
Declaration
Parameters
sourceUserIDThe ID of the user whose owned content will be moved
destinationUserIDThe ID of the user who the folder will be transferred to
notifyWhether the destination user should receive email notification of the transfer
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard Folder object or an error.
-
Used to convert one of the user’s confirmed email aliases into the user’s primary login.
Declaration
Parameters
userIdThe ID of the user
loginThe email alias to become the primary email
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard User object or an error.
-
Retrieves all email aliases for this user.
Declaration
Swift
public func listEmailAliases( userId: String, completion: @escaping Callback<EntryContainer<EmailAlias>> )Parameters
userIdThe ID of the user
completionReturns a collection of Email Aliases of the user or an error.
-
Adds a new email alias to the given user’s account.
Declaration
Swift
public func createEmailAlias( userId: String, email: String, completion: @escaping Callback<EmailAlias> )Parameters
userIdThe ID of the user
emailThe email address to add to the account as an alias
completionReturns a Email Aliases object or an error.
-
Removes an email alias from a user.
Declaration
Swift
public func deleteEmailAlias( userId: String, emailAliasId: String, completion: @escaping Callback<Void> )Parameters
userIdThe ID of the user
emailAliasIdThe ID of the email alias
completionAn empty response will be returned upon successful deletion. An error is thrown if the user don’t have permission to delete the email alias.
-
Roll a user out of their enterprise (and convert them to a standalone free user)
Declaration
Parameters
userIdThe ID of the user
notifyWhether the user should receive an email when they are rolled out of an enterprise
fieldsList of user object fields to include in the response. Only those fields will be populated on the resulting model object. If not passed, a default set of fields will be returned.
completionReturns a standard User object of the updated user, or an error.
UsersModule Class Reference