Package dev.dosya.sdk.resource
Class FoldersResource
java.lang.Object
dev.dosya.sdk.resource.FoldersResource
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 Summary
ConstructorsConstructorDescriptionFoldersResource(@NotNull DosyaHttpClient http) Creates a newFoldersResourcebacked by the given HTTP client. -
Method Summary
Modifier and TypeMethodDescription@NotNull CreateFolderResponseCreates a new folder at the root of a workspace.@NotNull CreateFolderResponseCreates a new folder in a workspace, optionally nested under a parent folder.voidDeletes a folder.@NotNull FolderDetailRetrieves detailed information about a single folder.voidLocks a folder with the specified lock mode without a password.voidLocks a folder with the specified lock mode and optional password.voidMoves a folder to a new parent folder.@NotNull StringRenames a folder and returns the new name.@NotNull List<FolderTreeItem>Retrieves the folder tree for a workspace.voidRemoves the lock from a folder.
-
Constructor Details
-
FoldersResource
Creates a newFoldersResourcebacked 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 foldername- the name of the new folderparentId- the parent folder ID, ornullto 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 foldername- 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
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 foldername- 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
Deletes a folder.- Parameters:
folderId- the unique identifier of the folder to delete- Throws:
DosyaApiException- if the API returns an error
-
move
Moves a folder to a new parent folder.- Parameters:
folderId- the unique identifier of the folder to moveparentId- the target parent folder ID- Throws:
DosyaApiException- if the API returns an error
-
tree
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 locklockMode- the lock mode (e.g. "password", "readonly")password- the password for the lock, ornullif not required- Throws:
DosyaApiException- if the API returns an error
-
lock
Locks a folder with the specified lock mode without a password.- Parameters:
folderId- the unique identifier of the folder to locklockMode- the lock mode (e.g. "password", "readonly")- Throws:
DosyaApiException- if the API returns an error
-
unlock
Removes the lock from a folder.- Parameters:
folderId- the unique identifier of the folder to unlock- Throws:
DosyaApiException- if the API returns an error
-