Class FoldersResource

java.lang.Object
dev.dosya.sdk.resource.FoldersResource

public final class FoldersResource extends Object
Provides operations for managing folders in Dosya workspaces.

This resource handles creating, retrieving, renaming, deleting, moving, locking, unlocking, and listing folder trees.

Since:
0.1.0
  • Constructor Details

    • FoldersResource

      public FoldersResource(@NotNull @NotNull DosyaHttpClient http)
      Creates a new FoldersResource backed by the given HTTP client.
      Parameters:
      http - the HTTP client used to make API requests
  • Method Details

    • create

      @NotNull public @NotNull CreateFolderResponse create(@NotNull @NotNull String workspaceId, @NotNull @NotNull String name, @Nullable @Nullable String parentId)
      Creates a new folder in a workspace, optionally nested under a parent folder.
      Parameters:
      workspaceId - the workspace in which to create the folder
      name - the name of the new folder
      parentId - the parent folder ID, or null to create at the workspace root
      Returns:
      the response containing the created folder detail and count
      Throws:
      DosyaApiException - if the API returns an error
    • create

      @NotNull public @NotNull CreateFolderResponse create(@NotNull @NotNull String workspaceId, @NotNull @NotNull String name)
      Creates a new folder at the root of a workspace.
      Parameters:
      workspaceId - the workspace in which to create the folder
      name - the name of the new folder
      Returns:
      the response containing the created folder detail and count
      Throws:
      DosyaApiException - if the API returns an error
    • get

      @NotNull public @NotNull FolderDetail get(@NotNull @NotNull String folderId)
      Retrieves detailed information about a single folder.
      Parameters:
      folderId - the unique identifier of the folder
      Returns:
      the folder detail
      Throws:
      DosyaApiException - if the API returns an error
    • rename

      @NotNull public @NotNull String rename(@NotNull @NotNull String folderId, @NotNull @NotNull String name)
      Renames a folder and returns the new name.
      Parameters:
      folderId - the unique identifier of the folder
      name - the new name for the folder
      Returns:
      the updated folder name as confirmed by the server
      Throws:
      DosyaApiException - if the API returns an error
    • delete

      public void delete(@NotNull @NotNull String folderId)
      Deletes a folder.
      Parameters:
      folderId - the unique identifier of the folder to delete
      Throws:
      DosyaApiException - if the API returns an error
    • move

      public void move(@NotNull @NotNull String folderId, @NotNull @NotNull String parentId)
      Moves a folder to a new parent folder.
      Parameters:
      folderId - the unique identifier of the folder to move
      parentId - the target parent folder ID
      Throws:
      DosyaApiException - if the API returns an error
    • tree

      @NotNull public @NotNull List<FolderTreeItem> tree(@NotNull @NotNull String workspaceId)
      Retrieves the folder tree for a workspace.
      Parameters:
      workspaceId - the workspace whose folder tree to retrieve
      Returns:
      the list of folder tree items
      Throws:
      DosyaApiException - if the API returns an error
    • lock

      public void lock(@NotNull @NotNull String folderId, @NotNull @NotNull String lockMode, @Nullable @Nullable String password)
      Locks a folder with the specified lock mode and optional password.
      Parameters:
      folderId - the unique identifier of the folder to lock
      lockMode - the lock mode (e.g. "password", "readonly")
      password - the password for the lock, or null if not required
      Throws:
      DosyaApiException - if the API returns an error
    • lock

      public void lock(@NotNull @NotNull String folderId, @NotNull @NotNull String lockMode)
      Locks a folder with the specified lock mode without a password.
      Parameters:
      folderId - the unique identifier of the folder to lock
      lockMode - the lock mode (e.g. "password", "readonly")
      Throws:
      DosyaApiException - if the API returns an error
    • unlock

      public void unlock(@NotNull @NotNull String folderId)
      Removes the lock from a folder.
      Parameters:
      folderId - the unique identifier of the folder to unlock
      Throws:
      DosyaApiException - if the API returns an error