pub struct ApiV3Client {
pub base_url: String,
pub http_client: Client,
pub session_cookie: Option<String>,
}Expand description
API v3 client structure
Fields§
§base_url: String§http_client: ClientImplementations§
Source§impl ApiV3Client
impl ApiV3Client
Sourcepub async fn create_download(
&self,
request: &Aria2CreateRequest<'_>,
) -> Result<(), Error>
pub async fn create_download( &self, request: &Aria2CreateRequest<'_>, ) -> Result<(), Error>
Create offline download
Source§impl ApiV3Client
impl ApiV3Client
Sourcepub async fn list_directory(&self, path: &str) -> Result<DirectoryList, Error>
pub async fn list_directory(&self, path: &str) -> Result<DirectoryList, Error>
List directory contents
Sourcepub async fn create_directory(
&self,
request: &CreateDirectoryRequest<'_>,
) -> Result<(), Error>
pub async fn create_directory( &self, request: &CreateDirectoryRequest<'_>, ) -> Result<(), Error>
Create a directory
Source§impl ApiV3Client
impl ApiV3Client
pub async fn upload_file( &self, request: &UploadFileRequest<'_>, ) -> Result<UploadSession, Error>
pub async fn complete_upload(&self, session_id: &str) -> Result<(), Error>
pub async fn upload_chunk( &self, session_id: &str, _chunk_index: u32, data: Vec<u8>, ) -> Result<(), Error>
pub async fn download_file(&self, id: &str) -> Result<DownloadUrl, Error>
pub async fn get_file_source( &self, request: &FileSourceRequest, ) -> Result<Vec<FileSource>, Error>
pub async fn preview_file(&self, id: &str) -> Result<DirectoryList, Error>
pub async fn get_thumbnail(&self, id: &str) -> Result<DirectoryList, Error>
pub async fn create_file( &self, request: &CreateFileRequest<'_>, ) -> Result<(), Error>
Source§impl ApiV3Client
impl ApiV3Client
Sourcepub async fn get_object_property(
&self,
id: &str,
is_folder: Option<bool>,
trace_root: Option<bool>,
) -> Result<Property, Error>
pub async fn get_object_property( &self, id: &str, is_folder: Option<bool>, trace_root: Option<bool>, ) -> Result<Property, Error>
Get object (file/folder) property
Sourcepub async fn rename_object(
&self,
request: &RenameObjectRequest<'_>,
) -> Result<(), Error>
pub async fn rename_object( &self, request: &RenameObjectRequest<'_>, ) -> Result<(), Error>
Rename object
Sourcepub async fn move_object(
&self,
request: &MoveObjectRequest<'_>,
) -> Result<(), Error>
pub async fn move_object( &self, request: &MoveObjectRequest<'_>, ) -> Result<(), Error>
Move object
Sourcepub async fn copy_object(
&self,
request: &CopyObjectRequest<'_>,
) -> Result<(), Error>
pub async fn copy_object( &self, request: &CopyObjectRequest<'_>, ) -> Result<(), Error>
Copy object
Sourcepub async fn delete_object(
&self,
request: &DeleteObjectRequest<'_>,
) -> Result<(), Error>
pub async fn delete_object( &self, request: &DeleteObjectRequest<'_>, ) -> Result<(), Error>
Delete object
Source§impl ApiV3Client
impl ApiV3Client
Source§impl ApiV3Client
impl ApiV3Client
Create a share link
Note: The V3 API may return either an ApiResponse
Source§impl ApiV3Client
impl ApiV3Client
Sourcepub async fn get_site_config(&self) -> Result<SiteConfig, Error>
pub async fn get_site_config(&self) -> Result<SiteConfig, Error>
Get site configuration
Sourcepub async fn get_user_storage(&self) -> Result<StorageInfo, Error>
pub async fn get_user_storage(&self) -> Result<StorageInfo, Error>
Get user storage information
Sourcepub async fn get_version(&self) -> Result<VersionInfo, Error>
pub async fn get_version(&self) -> Result<VersionInfo, Error>
Get API version information
Sourcepub async fn get_user_settings(&self) -> Result<StorageInfo, Error>
pub async fn get_user_settings(&self) -> Result<StorageInfo, Error>
Get user settings
Source§impl ApiV3Client
impl ApiV3Client
Sourcepub async fn get_webdav_accounts(&self) -> Result<Vec<WebdavAccount>, Error>
pub async fn get_webdav_accounts(&self) -> Result<Vec<WebdavAccount>, Error>
Get WebDAV accounts
Source§impl ApiV3Client
impl ApiV3Client
pub fn new(base_url: &str) -> Self
pub fn get_url(&self, endpoint: &str) -> String
pub async fn get<T>(&self, endpoint: &str) -> 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,
Sourcepub async fn post_raw(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<String, Error>
pub async fn post_raw( &self, endpoint: &str, body: &impl Serialize, ) -> Result<String, Error>
POST request that returns raw text instead of parsing JSON
pub async fn put<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
pub async fn patch<T>(
&self,
endpoint: &str,
body: &impl Serialize,
) -> Result<T, Error>where
T: DeserializeOwned + Debug,
pub async fn delete<T>(&self, endpoint: &str) -> 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,
Trait Implementations§
Source§impl Clone for ApiV3Client
impl Clone for ApiV3Client
Source§fn clone(&self) -> ApiV3Client
fn clone(&self) -> ApiV3Client
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ApiV3Client
impl !RefUnwindSafe for ApiV3Client
impl Send for ApiV3Client
impl Sync for ApiV3Client
impl Unpin for ApiV3Client
impl !UnwindSafe for ApiV3Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more