Class DriveItemFolderType

java.lang.Object
com.amilesend.onedrive.resource.DriveItemType
com.amilesend.onedrive.resource.DriveItemFolderType
Direct Known Subclasses:
DriveFolder, DrivePackage

public abstract class DriveItemFolderType extends DriveItemType
Defines shared operations between drive folders and packages.
See Also:
  • Constructor Details

    • DriveItemFolderType

      public DriveItemFolderType(DriveItem delegate)
      Creates a new DriveItemFolderType that wraps the given delegate DriveItem.
      Parameters:
      delegate - the drive item to wrap
  • Method Details

    • upload

      @Deprecated public DriveFile upload(File file) throws IOException
      Deprecated.
      use upload(Path) instead
      Uploads the given file under this folder.
      Parameters:
      file - the file to upload
      Returns:
      the drive file that represents the uploaded file
      Throws:
      IOException - if an error occurred while uploading the file
      See Also:
    • upload

      public DriveFile upload(Path filePath) throws IOException
      Uploads the given file under this folder.
      Parameters:
      filePath - the file to upload
      Returns:
      the drive file that represents the uploaded file
      Throws:
      IOException - if an error occurred while uploading the file
      See Also:
    • upload

      @Deprecated public DriveFile upload(File file, com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException
      Uploads the given file under this folder and reports transfer progress to the specified TransferProgressCallback.
      Parameters:
      file - the file to upload
      callback - the callback be notified of transfer progress
      Returns:
      the drive file that represents the uploaded file
      Throws:
      IOException - if an error occurred while uploading the file
      See Also:
    • upload

      public DriveFile upload(Path filePath, com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException
      Uploads the given file under this folder and reports transfer progress to the specified TransferProgressCallback.
      Parameters:
      filePath - the file to upload
      callback - the callback be notified of transfer progress
      Returns:
      the drive file that represents the uploaded file
      Throws:
      IOException - if an error occurred while uploading the file
      See Also:
    • uploadAsync

      @Deprecated public DriveFileUploadExecution uploadAsync(File file) throws IOException
      Deprecated.
      use uploadAsync(Path) instead
      Uploads the given file asynchronously under this folder.
      Parameters:
      file - the file to upload
      Returns:
      the async execution used to obtain the drive file once it has completed
      Throws:
      IOException - if an error occurred while uploading the file
      See Also:
    • uploadAsync

      public DriveFileUploadExecution uploadAsync(Path filePath) throws IOException
      Uploads the given file asynchronously under this folder.
      Parameters:
      filePath - the file to upload
      Returns:
      the async execution used to obtain the drive file once it has completed
      Throws:
      IOException - if an error occurred while uploading the file
      See Also:
    • uploadAsync

      @Deprecated public DriveFileUploadExecution uploadAsync(File file, com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException
      Uploads the given file asynchronously under this folder and reports transfer progress to the specified TransferProgressCallback.
      Parameters:
      file - the file to upload
      callback - the callback be notified of transfer progress
      Returns:
      the async execution used to obtain the drive file once it has completed
      Throws:
      IOException - if an error occurred while uploading the file
      See Also:
    • uploadAsync

      public DriveFileUploadExecution uploadAsync(Path filePath, com.amilesend.client.connection.file.TransferProgressCallback callback) throws IOException
      Uploads the given file asynchronously under this folder and reports transfer progress to the specified TransferProgressCallback.
      Parameters:
      filePath - the file to upload
      callback - the callback be notified of transfer progress
      Returns:
      the async execution used to obtain the drive file once it has completed
      Throws:
      IOException - if an error occurred while uploading the file
      See Also:
    • createFolder

      public DriveFolder createFolder(String name)
      Creates a new folder with the given name under this folder.
      Parameters:
      name - the name of the new folder
      Returns:
      the new drive folder
    • getChildPackages

      public List<DrivePackage> getChildPackages()
      Gets the list of child drive packages under this folder.
      Returns:
      the list of drive packages
    • getChildFolders

      public List<DriveFolder> getChildFolders()
      Gets the list of child drive folders under this folder.
      Returns:
      the list of drive folders
    • getChildFiles

      public List<DriveFile> getChildFiles()
      Gets the list of child drive files under this folder.
      Returns:
      the list of drive files
    • getChildren

      public List<? extends DriveItemType> getChildren()
      Gets the list of drive items (both folders and files) under this folder.
      Returns:
      the list of drive items
      See Also:
    • search

      public List<? extends DriveItemType> search(String query)
      Searches this folder for the given query (e.g., file name).
      Parameters:
      query - the search query
      Returns:
      the list of drive item types (either a DriveFolder or DriveFile).
      See Also:
    • update

      public DriveFolder update()
      Updates the attributes for this folder.
      Returns:
      the updated drive folder
    • move

      public DriveFolder move(DriveFolder destinationFolder)
      Moves this folder to the specified DriveFolder.
      Parameters:
      destinationFolder - the destination drive folder
      Returns:
      the updated drive file that represents this moved file
    • move

      public DriveFolder move(@NonNull DriveFolder destinationFolder, String newName)
      Moves this folder to the specified DriveFolder along with the new file name.
      Parameters:
      destinationFolder - the destination drive folder
      newName - the new name of the file
      Returns:
      the updated drive folder that represents this moved folder
    • move

      public DriveFolder move(String destinationParentId, String newName)
      Moves this folder to the specified newParentId (i.e., represents a new DriveFolder's ID) along with the new folder name.
      Parameters:
      destinationParentId - the new parent destination ID
      newName - the new name of the file
      Returns:
      the updated drive folder that represents this moved folder