pub struct ApiV4Client {
pub base_url: String,
pub http_client: Client,
pub token: Option<String>,
}Expand description
API v4 client structure
Fields§
§base_url: StringBase URL for the Cloudreve instance
http_client: ClientHTTP client for making requests
token: Option<String>Authentication token
Implementations§
Source§impl ApiV4Client
WebDAV account management methods
impl ApiV4Client
WebDAV account management methods
Sourcepub async fn list_dav_accounts(
&self,
page_size: u32,
next_page_token: Option<&str>,
) -> Result<DavAccountsResponse, Error>
pub async fn list_dav_accounts( &self, page_size: u32, next_page_token: Option<&str>, ) -> Result<DavAccountsResponse, Error>
List WebDAV accounts
Sourcepub async fn create_dav_account(
&self,
request: &CreateDavAccountRequest,
) -> Result<DavAccount, Error>
pub async fn create_dav_account( &self, request: &CreateDavAccountRequest, ) -> Result<DavAccount, Error>
Create a new WebDAV account
Sourcepub async fn update_dav_account(
&self,
id: &str,
request: &CreateDavAccountRequest,
) -> Result<DavAccount, Error>
pub async fn update_dav_account( &self, id: &str, request: &CreateDavAccountRequest, ) -> Result<DavAccount, Error>
Update a WebDAV account
Source§impl ApiV4Client
File management methods
impl ApiV4Client
File management methods
pub async fn upload_file( &self, request: &UploadRequest<'_>, ) -> Result<File, Error>
Sourcepub async fn list_files(
&self,
request: &ListFilesRequest<'_>,
) -> Result<ListResponse, Error>
pub async fn list_files( &self, request: &ListFilesRequest<'_>, ) -> Result<ListResponse, Error>
Lists files in a directory with full response including metadata
Returns a complete ListResponse containing:
files: Vector of files/folders in the directoryparent: Information about the parent directorypagination: Pagination information (page, total_items, etc.)storage_policy: Preferred storage policy for uploads to this directoryprops: Navigator capabilities and settings
§Arguments
request- ListFilesRequest with path and optional pagination params
pub async fn get_file_info(&self, file_path: &str) -> Result<File, Error>
pub async fn get_file_stat(&self, file_path: &str) -> Result<FileStat, Error>
pub async fn move_file( &self, request: &MoveFileRequest<'_>, ) -> Result<(), Error>
pub async fn copy_file( &self, request: &CopyFileRequest<'_>, ) -> Result<(), Error>
pub async fn rename_file( &self, request: &RenameFileRequest<'_>, ) -> Result<File, Error>
pub async fn delete_file(&self, file_path: &str) -> Result<(), Error>
pub async fn create_directory(&self, path: &str) -> Result<(), Error>
pub async fn set_file_permission( &self, request: &SetFilePermissionRequest<'_>, ) -> Result<(), Error>
pub async fn delete_file_permission(&self, path: &str) -> Result<(), Error>
pub async fn create_upload_session( &self, request: &CreateUploadSessionRequest<'_>, ) -> Result<UploadSessionResponse, Error>
pub async fn upload_file_chunk( &self, session_id: &str, index: u32, chunk_data: &[u8], ) -> Result<(), Error>
pub async fn delete_upload_session( &self, path: &str, session_id: &str, ) -> Result<(), Error>
pub async fn get_thumbnail_url( &self, path: &str, width: Option<u32>, height: Option<u32>, ) -> Result<String, Error>
pub async fn get_file_content(&self, path: &str) -> Result<String, Error>
pub async fn update_file_content( &self, request: &UpdateFileContentRequest<'_>, ) -> Result<(), Error>
pub async fn create_viewer_session( &self, request: &CreateViewerSessionRequest<'_>, ) -> Result<ViewerSessionResponse, Error>
pub async fn create_file( &self, request: &CreateFileRequest<'_>, ) -> Result<File, Error>
pub async fn rename_multiple( &self, request: &RenameMultipleRequest<'_>, ) -> Result<(), Error>
pub async fn move_copy_files( &self, request: &MoveCopyFileRequest<'_>, ) -> Result<(), Error>
pub async fn create_download_url( &self, request: &CreateDownloadUrlRequest<'_>, ) -> Result<DownloadUrlResponse, Error>
pub async fn restore_from_trash( &self, request: &RestoreFileRequest<'_>, ) -> Result<(), Error>
pub async fn force_unlock(&self, path: &str) -> Result<(), Error>
pub async fn patch_metadata( &self, path: &str, request: &UpdateMetadataRequest, ) -> Result<(), Error>
pub async fn mount_storage_policy( &self, path: &str, request: &MountStoragePolicyRequest, ) -> Result<(), Error>
pub async fn update_view_settings( &self, path: &str, request: &UpdateViewRequest, ) -> Result<(), Error>
pub async fn get_file_activities( &self, path: &str, page: Option<u32>, page_size: Option<u32>, ) -> Result<FileActivitiesResponse, Error>
pub async fn get_file_info_extended( &self, request: &GetFileInfoRequest<'_>, ) -> Result<File, Error>
pub async fn get_archive_list( &self, request: &GetArchiveListRequest<'_>, ) -> Result<ArchiveListResponse, Error>
Sourcepub async fn create_direct_link(
&self,
request: &CreateDirectLinkRequest<'_>,
) -> Result<Vec<DirectLinkItem>, Error>
pub async fn create_direct_link( &self, request: &CreateDirectLinkRequest<'_>, ) -> Result<Vec<DirectLinkItem>, Error>
Create direct links for files
Creates permanent direct links that can be used to access file content directly. Only file owners or administrators can create direct links.
§Arguments
request- CreateDirectLinkRequest with list of file URIs
§Returns
Vector of DirectLinkItem containing link and file_url
Source§impl ApiV4Client
impl ApiV4Client
pub async fn prepare_login( &self, email: &str, ) -> Result<LoginPreparation, Error>
pub async fn prepare_openid_signin( &self, request: &OpenIdPrepareRequest<'_>, ) -> Result<String, Error>
pub async fn finish_openid_signin( &self, request: &OpenIdFinishRequest<'_>, ) -> Result<LoginResponse, Error>
pub async fn unlink_openid(&self, provider_id: i32) -> Result<(), Error>
pub async fn prepare_passkey_signin( &self, ) -> Result<PasskeySignInPreparation, Error>
pub async fn finish_passkey_signin( &self, request: &PasskeySignInRequest<'_>, ) -> Result<LoginResponse, Error>
pub async fn login( &self, request: &LoginRequest<'_>, ) -> Result<LoginData, Error>
pub async fn finish_2fa_login( &self, request: &TwoFactorLoginRequest<'_>, ) -> Result<LoginData, Error>
pub async fn refresh_token( &self, request: &RefreshTokenRequest<'_>, ) -> Result<Token, Error>
pub async fn logout(&self) -> Result<(), Error>
Source§impl ApiV4Client
Share management methods
impl ApiV4Client
Share management methods
Source§impl ApiV4Client
impl ApiV4Client
Sourcepub async fn get_version(&self) -> Result<VersionInfo, Error>
pub async fn get_version(&self) -> Result<VersionInfo, Error>
Get API version information
pub async fn get_site_config( &self, section: SiteConfigSection, ) -> Result<SiteConfig, Error>
Sourcepub async fn get_site_config_str(
&self,
section: &str,
) -> Result<SiteConfig, Error>
pub async fn get_site_config_str( &self, section: &str, ) -> Result<SiteConfig, Error>
Get site config by section string (for backward compatibility)
pub async fn report_site_abuse( &self, request: &AbuseReportRequest<'_>, ) -> Result<(), Error>
pub async fn get_captcha(&self) -> Result<CaptchaResponse, Error>
Sourcepub async fn check_captcha_requirement(&self) -> Result<bool, Error>
pub async fn check_captcha_requirement(&self) -> Result<bool, Error>
Check if CAPTCHA is required for login
Source§impl ApiV4Client
impl ApiV4Client
pub async fn register( &self, request: &RegisterRequest<'_>, ) -> Result<User, Error>
pub async fn get_user_capacity(&self) -> Result<Quota, Error>
pub async fn search_users( &self, request: &SearchUserRequest<'_>, ) -> Result<Vec<User>, Error>
pub async fn get_credit_changes( &self, page: Option<u32>, page_size: Option<u32>, ) -> Result<Vec<CreditChangeRecord>, Error>
pub async fn get_payment_records( &self, page: Option<u32>, page_size: Option<u32>, ) -> Result<Vec<PaymentRecord>, Error>
pub async fn update_user_setting( &self, setting: &UpdateUserSettingRequest<'_>, ) -> Result<(), Error>
pub async fn get_user_setting(&self) -> Result<UserSettings, Error>
pub async fn enable_two_factor(&self) -> Result<TwoFactorSetup, Error>
pub async fn verify_two_factor( &self, request: &TwoFactorVerify, ) -> Result<(), Error>
pub async fn disable_two_factor(&self) -> Result<(), Error>
pub async fn get_user_avatar(&self, user_id: &str) -> Result<String, Error>
pub async fn get_user_info(&self, user_id: &str) -> Result<User, Error>
pub async fn update_profile( &self, request: &UpdateProfileRequest<'_>, ) -> Result<User, Error>
pub async fn change_password( &self, old_password: &str, new_password: &str, ) -> Result<(), Error>
pub async fn get_quota(&self) -> Result<Quota, Error>
pub async fn get_settings(&self) -> Result<UserSettings, Error>
pub async fn update_settings( &self, settings: &UserSettings, ) -> Result<UserSettings, Error>
pub async fn get_storage_policies(&self) -> Result<Vec<StoragePolicy>, Error>
Source§impl ApiV4Client
impl ApiV4Client
pub async fn create_download( &self, request: &CreateDownloadRequest<'_>, ) -> Result<Vec<Task>, Error>
pub async fn select_download_files( &self, task_id: &str, request: &SelectDownloadFilesRequest<'_>, ) -> Result<Vec<Task>, Error>
pub async fn cancel_download_task(&self, task_id: &str) -> Result<(), Error>
pub async fn list_workflow_tasks( &self, page_size: i32, category: &str, ) -> Result<TaskListResponse, Error>
pub async fn get_task_progress(&self, task_id: &str) -> Result<Progress, Error>
pub async fn create_archive( &self, request: &CreateArchiveRequest<'_>, ) -> Result<TaskResponse, Error>
pub async fn extract_archive( &self, request: &ExtractArchiveRequest<'_>, ) -> Result<TaskResponse, Error>
pub async fn relocate( &self, request: &RelocateRequest<'_>, ) -> Result<TaskResponse, Error>
pub async fn import( &self, request: &ImportRequest<'_>, ) -> Result<TaskResponse, Error>
Source§impl ApiV4Client
impl ApiV4Client
Sourcepub fn clear_token(&mut self)
pub fn clear_token(&mut self)
Clears the authentication token
Sourcepub async fn get<T>(&self, endpoint: &str) -> Result<T, Error>where
T: DeserializeOwned + Debug,
pub async fn get<T>(&self, endpoint: &str) -> Result<T, Error>where
T: DeserializeOwned + Debug,
Makes a GET request to the API
Sourcepub async fn post<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
pub async fn post<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
Makes a POST request to the API
Sourcepub async fn put<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
pub async fn put<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
Makes a PUT request to the API
pub async fn patch<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
Sourcepub async fn delete<T>(&self, endpoint: &str) -> Result<T, Error>where
T: DeserializeOwned + Debug,
pub async fn delete<T>(&self, endpoint: &str) -> Result<T, Error>where
T: DeserializeOwned + Debug,
Makes a DELETE request to the API
Sourcepub async fn delete_with_body<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
pub async fn delete_with_body<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
Makes a DELETE request with JSON body to the API
Trait Implementations§
Source§impl Clone for ApiV4Client
impl Clone for ApiV4Client
Source§fn clone(&self) -> ApiV4Client
fn clone(&self) -> ApiV4Client
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more