Interface UserResources


  • public interface UserResources

    This interface provides methods to access User resources.

    Thread Safety: Implementation of this interface must be thread safe.

    • Method Detail

      • listUsers

        PagedResult<User> listUsers​(java.util.Set<java.lang.String> email,
                                    PaginationParameters pagination)
                             throws SmartsheetException

        List all users.

        It mirrors to the following Smartsheet REST API method: GET /users

        Parameters:
        email - the list of email addresses
        pagination - object containing pagination query parameters
        Returns:
        the list of all users
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • listUsers

        PagedResult<User> listUsers​(java.util.Set<java.lang.String> email,
                                    java.util.EnumSet<ListUserInclusion> includes,
                                    PaginationParameters pagination)
                             throws SmartsheetException

        List all users.

        It mirrors to the following Smartsheet REST API method: GET /users

        Parameters:
        email - the list of email addresses
        includes - elements to include in response
        pagination - object containing pagination query parameters
        Returns:
        the list of all users
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • listUsers

        PagedResult<User> listUsers​(java.util.Set<java.lang.String> email,
                                    java.lang.Long planId,
                                    SeatType seatType,
                                    PaginationParameters pagination)
                             throws SmartsheetException
        List all users.

        It mirrors to the following Smartsheet REST API method: GET /users

        Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) - SmartsheetRestException : if there is any other REST API related error occurred during the operation - SmartsheetException : if there is any other error occurred during the operation

        Parameters:
        email - the list of email addresses
        pagination - the object containing the pagination query parameters
        planId - filtering all users part of the specific plan
        seatType - filter users by seat type
        Returns:
        all users (note that empty list will be returned if there is none)
        Throws:
        SmartsheetException - the smartsheet exception
      • addUser

        User addUser​(User user)
              throws SmartsheetException

        Add a user to the organization, without sending email.

        It mirrors to the following Smartsheet REST API method: POST /users

        Parameters:
        user - the user object
        Returns:
        the user
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • addUser

        User addUser​(User user,
                     boolean sendEmail)
              throws SmartsheetException

        Add a user to the organization, without sending email.

        It mirrors to the following Smartsheet REST API method: POST /users

        Parameters:
        user - the user
        sendEmail - the send email flag
        Returns:
        the user
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • getCurrentUser

        UserProfile getCurrentUser​(java.util.EnumSet<UserInclusion> includes)
                            throws SmartsheetException

        Get the current user.

        It mirrors to the following Smartsheet REST API method: GET /user/me

        Parameters:
        includes - used to specify the optional objects to include.
        Returns:
        the current user
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • listUserPlans

        TokenPaginatedResult<UserPlan> listUserPlans​(long userId,
                                                     java.lang.String lastKey,
                                                     java.lang.Long maxItems)
                                              throws SmartsheetException

        Fetch all user's plans.

        It mirrors to the following Smartsheet REST API method: GET /users/{userId}/plans

        Parameters:
        userId - the id of the user whose plans to fetch
        lastKey - lastKey from previous response to get next page of results
        Returns:
        UserPlansResponse json response
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • removeUserFromPlan

        void removeUserFromPlan​(long userId,
                                long planId)
                         throws SmartsheetException

        Remove's a user from a plan.

        It mirrors to the following Smartsheet REST API method: DELETE /2.0/users/{userId}/plans/{planId}

        Parameters:
        userId - the id of the user whose plans to fetch
        planId - the id of the plan from which to remove the user
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • upgradeUser

        void upgradeUser​(long userId,
                         long planId,
                         UpgradeSeatType seatType)
                  throws SmartsheetException

        Upgrades a user's seat type.

        It mirrors to the following Smartsheet REST API method: POST /users/{userId}/plans/{planId}/upgrade

        Parameters:
        userId - the ID of the user to upgrade
        planId - the ID of the plan to upgrade to
        seatType - the new seat type for the user
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available
        SmartsheetException - if there is any other error during the operation
      • downgradeUser

        void downgradeUser​(long userId,
                           long planId,
                           DowngradeSeatType seatType)
                    throws SmartsheetException

        Upgrades a user's seat type.

        It mirrors to the following Smartsheet REST API method: POST /users/{userId}/plans/{planId}/downgrade

        Parameters:
        userId - the ID of the user to downgrade
        planId - the ID of the plan to downgrade to
        seatType - the new seat type for the user
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available
        SmartsheetException - if there is any other error during the operation
      • deleteUser

        void deleteUser​(long id,
                        DeleteUserParameters parameters)
                 throws SmartsheetException

        Delete a user in the organization.

        It mirrors to the following Smartsheet REST API method: DELETE /user/{id}

        Parameters:
        id - the id of the user
        parameters - the object containing parameters for deleting users
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • listOrgSheets

        PagedResult<Sheet> listOrgSheets​(PaginationParameters pagination,
                                         java.util.Date modifiedSince)
                                  throws SmartsheetException

        List all organisation sheets.

        It mirrors to the following Smartsheet REST API method: GET /users/sheets

        Parameters:
        pagination - the object containing the pagination query parameters
        modifiedSince - restrict to sheets modified on or after this date
        Returns:
        the list of all organisation sheets
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • getAlternateEmail

        AlternateEmail getAlternateEmail​(long userId,
                                         long altEmailId)
                                  throws SmartsheetException

        Get alternate email.

        It mirrors to the following Smartsheet REST API method: GET /users/{userId}/alternateemails/{alternateEmailId}

        Parameters:
        userId - the id of the user
        altEmailId - the alternate email id for the alternate email to retrieve.
        Returns:
        the resource. Note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null.
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • addAlternateEmail

        java.util.List<AlternateEmail> addAlternateEmail​(long userId,
                                                         java.util.List<AlternateEmail> altEmails)
                                                  throws SmartsheetException

        Add an alternate email.

        It mirrors to the following Smartsheet REST API method: POST /users/{userId}/alternateemails

        Parameters:
        userId - the id of the user
        altEmails - List of alternate email address to add.
        Returns:
        List of added alternate email(s).
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • deleteAlternateEmail

        void deleteAlternateEmail​(long userId,
                                  long altEmailId)
                           throws SmartsheetException

        Delete an alternate email.

        It mirrors to the following Smartsheet REST API method: DELETE /users/{userId}/alternateemails/{alternateEmailId}

        Parameters:
        userId - the id of the user
        altEmailId - the alternate email id for the alternate email to retrieve.
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - if there is any other error during the operation
      • promoteAlternateEmail

        AlternateEmail promoteAlternateEmail​(long userId,
                                             long altEmailId)
                                      throws SmartsheetException

        Promote and alternate email to primary.

        Parameters:
        userId - id of the user
        altEmailId - alternate email id
        Returns:
        alternateEmail of the primary
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - f there is any other error during the operation
      • addProfileImage

        User addProfileImage​(long userId,
                             java.lang.String file,
                             java.lang.String fileType)
                      throws SmartsheetException,
                             java.io.FileNotFoundException

        Uploads a profile image for the specified user.

        Parameters:
        userId - id of the user
        file - path to the image file
        fileType - content type of the image file
        Returns:
        user
        Throws:
        java.lang.IllegalArgumentException - if any argument is null or empty string
        InvalidRequestException - if there is any problem with the REST API request
        AuthorizationException - if there is any problem with the REST API authorization (access token)
        ResourceNotFoundException - if the resource cannot be found
        ServiceUnavailableException - if the REST API service is not available (possibly due to rate limiting)
        SmartsheetException - f there is any other error during the operation
        java.io.FileNotFoundException