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
      • 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
      • 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