Interface FolderResources


  • public interface FolderResources

    This interface provides methods to access Folder resources.

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

    • Method Detail

      • updateFolder

        Folder updateFolder​(Folder folder)
                     throws SmartsheetException

        Update a folder.

        Parameters:
        folder - the folder to update
        Returns:
        the updated folder (note that if there is no such folder, this method will throw Resource Not Found Exception 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
      • deleteFolder

        void deleteFolder​(long folderId)
                   throws SmartsheetException

        Delete a folder.

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

        Parameters:
        folderId - the folder id
        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
      • createFolder

        Folder createFolder​(long parentFolderId,
                            Folder folder)
                     throws SmartsheetException

        Create a folder.

        It mirrors to the following Smartsheet REST API method: POST /folder/{id}/folders

        Parameters:
        parentFolderId - the parent folder id
        folder - the folder to create
        Returns:
        the created folder
        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
      • copyFolder

        Folder copyFolder​(long folderId,
                          ContainerDestination containerDestination,
                          java.util.EnumSet<FolderCopyInclusion> includes,
                          java.util.EnumSet<FolderRemapExclusion> skipRemap)
                   throws SmartsheetException

        Creates a copy of the specified Folder.

        It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/copy

        Exceptions: IllegalArgumentException : if folder 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) 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:
        folderId - the folder id
        containerDestination - describes the destination container
        includes - optional parameters to include
        skipRemap - optional parameters to exclude
        Returns:
        the folder
        Throws:
        SmartsheetException - the smartsheet exception
      • copyFolder

        Folder copyFolder​(long folderId,
                          ContainerDestination containerDestination,
                          java.util.EnumSet<FolderCopyInclusion> includes,
                          java.util.EnumSet<FolderRemapExclusion> skipRemap,
                          java.util.EnumSet<CopyExclusion> excludes)
                   throws SmartsheetException

        Creates a copy of the specified Folder.

        It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/copy

        Exceptions: IllegalArgumentException : if folder 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) 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:
        folderId - the folder id
        containerDestination - describes the destination container
        includes - optional parameters to include
        skipRemap - optional parameters to NOT re-map in the new folder
        excludes - optional parameters to exclude
        Returns:
        the folder
        Throws:
        SmartsheetException - the smartsheet exception
      • moveFolder

        Folder moveFolder​(long folderId,
                          ContainerDestination containerDestination)
                   throws SmartsheetException

        Moves the specified Folder to another location.

        It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/move

        Exceptions: IllegalArgumentException : if folder 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) 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:
        folderId - the folder id
        containerDestination - describes the destination container
        Returns:
        the folder
        Throws:
        SmartsheetException - the smartsheet exception
      • getFolderMetadata

        Folder getFolderMetadata​(long folderId,
                                 java.util.EnumSet<GetFolderMetadataInclusion> includes)
                          throws SmartsheetException

        Get metadata of a folder.

        It mirrors to the following Smartsheet REST API method: GET /folders/{folderId}/metadata

        Parameters:
        folderId - the folder id
        includes - the include parameters (optional)
        Returns:
        the folder metadata (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
      • getFolderChildren

        TokenPaginatedResult<java.lang.Object> getFolderChildren​(long folderId,
                                                                 java.util.EnumSet<ChildrenResourceType> childrenResourceTypes,
                                                                 java.util.EnumSet<GetFolderChildrenInclusion> includes,
                                                                 java.lang.String lastKey,
                                                                 java.lang.Integer maxItems)
                                                          throws SmartsheetException

        Get children of a folder.

        This method largely mirrors the REST API operation, except that the data items in the TokenPaginatedResult it returns are deserialized into Folder, Sheet, Report, Sight, or Template objects. The childrenResourceTypes parameter filters on the resource (item) types returned.

        HTTP Method: GET
        REST API path: /2.0/folders/{folderId}/children

        Parameters:
        folderId - the folder id
        childrenResourceTypes - the resource type to filter by (optional)
        includes - the include parameters (optional)
        lastKey - the last key for pagination (optional)
        maxItems - the maximum number of items to return (optional)
        Returns:
        the paginated children 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
      • getFolderPath

        FolderPathNode getFolderPath​(long folderId)
                              throws SmartsheetException

        Get the path of a folder (workspace/folder hierarchy).

        It mirrors to the following Smartsheet REST API method: GET /folders/{folderId}/path

        Parameters:
        folderId - the folder id
        Returns:
        the container path representing the hierarchy from the workspace down to the folder
        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