Interface ShareResources


  • public interface ShareResources

    This interface provides methods to access Share resources.

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

    • Method Detail

      • listShares

        @Deprecated(since="2.0.0",
                    forRemoval=true)
        PagedResult<Share> listShares​(long objectId,
                                      PaginationParameters parameters)
                               throws SmartsheetException
        Deprecated, for removal: This API element is subject to removal in a future version.
        As of release 2.0. Please use the other listShares method in this class and pass `includeWorkspaceShares` as `false`

        List shares of a given object.

        It mirrors to the following Smartsheet REST API method:

        GET /workspace/{id}/shares

        GET /sheet/{id}/shares

        Parameters:
        objectId - the object id
        parameters - the pagination parameters
        Returns:
        the list of Share objects (note that an empty list will be returned if there is none).
        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
      • listShares

        PagedResult<Share> listShares​(long objectId,
                                      PaginationParameters parameters,
                                      java.lang.Boolean includeWorkspaceShares)
                               throws SmartsheetException

        List shares of a given object.

        It mirrors to the following Smartsheet REST API method:

        GET /workspace/{id}/shares

        GET /sheet/{id}/shares

        Parameters:
        objectId - the object id
        parameters - the pagination parameters
        includeWorkspaceShares - include workspace shares in enumeration
        Returns:
        the list of Share objects (note that an empty list will be returned if there is none).
        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
      • getShare

        Share getShare​(long objectId,
                       java.lang.String shareId)
                throws SmartsheetException

        Get a Share.

        It mirrors to the following Smartsheet REST API method:

        GET /workspaces/{workspaceId}/shares/{shareId}

        GET /sheets/{sheetId}/shares/{shareId}

        GET /reports/{reportId}/shares

        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) ResourceNotFoundException : if the resource can not be found 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:
        objectId - the ID of the object to share
        shareId - the ID of the share
        Returns:
        the share (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null).
        Throws:
        SmartsheetException - the smartsheet exception
      • shareTo

        java.util.List<Share> shareTo​(long objectId,
                                      java.util.List<Share> shares,
                                      java.lang.Boolean sendEmail)
                               throws SmartsheetException

        Shares the object with the specified Users and Groups.

        It mirrors to the following Smartsheet REST API method:

        POST /workspaces/{id}/shares

        POST /sheets/{id}/shares

        POST /reports/{reportId}/shares

        Exceptions: IllegalArgumentException : if multiShare is null 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 can not be found 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:
        objectId - the ID of the object to share
        shares - list of share objects
        sendEmail - whether to send email
        Returns:
        the created shares
        Throws:
        SmartsheetException - the smartsheet exception
      • updateShare

        Share updateShare​(long objectId,
                          Share share)
                   throws SmartsheetException

        Update a share.

        It mirrors to the following Smartsheet REST API method:

        PUT /workspaces/{workspaceId}/shares/{shareId}

        PUT /sheets/{sheetId}/shares/{shareId}

        PUT /reports/{reportId}/shares/{shareId}

        Parameters:
        objectId - the ID of the object to share
        share - the share
        Returns:
        the updated share (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
      • deleteShare

        void deleteShare​(long objectId,
                         java.lang.String shareId)
                  throws SmartsheetException

        Delete a share.

        It mirrors to the following Smartsheet REST API method:

        DELETE /workspaces/{workspaceId}/shares/{shareId}

        DELETE /sheets/{sheetId}/shares/{shareId}

        DELETE /reports/{reportId}/shares/{shareId}

        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) ResourceNotFoundException : if the resource can not be found 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:
        objectId - the ID of the object to share
        shareId - the ID of the share to delete
        Throws:
        SmartsheetException - the smartsheet exception