Skip to main content

ApiV3Client

Struct ApiV3Client 

Source
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: Client§session_cookie: Option<String>

Implementations§

Source§

impl ApiV3Client

Source

pub async fn create_download( &self, request: &Aria2CreateRequest<'_>, ) -> Result<(), Error>

Create offline download

Source

pub async fn list_downloading(&self) -> Result<Vec<Aria2Task>, Error>

List downloading tasks

Source

pub async fn list_finished(&self) -> Result<Vec<Aria2Task>, Error>

List finished tasks

Source

pub async fn delete_task(&self, gid: &str) -> Result<(), Error>

Delete task

Source§

impl ApiV3Client

Source

pub async fn list_directory(&self, path: &str) -> Result<DirectoryList, Error>

List directory contents

Source

pub async fn create_directory( &self, request: &CreateDirectoryRequest<'_>, ) -> Result<(), Error>

Create a directory

Source§

impl ApiV3Client

Source

pub async fn upload_file( &self, request: &UploadFileRequest<'_>, ) -> Result<UploadSession, Error>

Source

pub async fn complete_upload(&self, session_id: &str) -> Result<(), Error>

Source

pub async fn upload_chunk( &self, session_id: &str, _chunk_index: u32, data: Vec<u8>, ) -> Result<(), Error>

Source

pub async fn download_file(&self, id: &str) -> Result<DownloadUrl, Error>

Source

pub async fn get_file_source( &self, request: &FileSourceRequest, ) -> Result<Vec<FileSource>, Error>

Source

pub async fn preview_file(&self, id: &str) -> Result<DirectoryList, Error>

Source

pub async fn get_thumbnail(&self, id: &str) -> Result<DirectoryList, Error>

Source

pub async fn create_file( &self, request: &CreateFileRequest<'_>, ) -> Result<(), Error>

Source§

impl ApiV3Client

Source

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

Source

pub async fn rename_object( &self, request: &RenameObjectRequest<'_>, ) -> Result<(), Error>

Rename object

Source

pub async fn move_object( &self, request: &MoveObjectRequest<'_>, ) -> Result<(), Error>

Move object

Source

pub async fn copy_object( &self, request: &CopyObjectRequest<'_>, ) -> Result<(), Error>

Copy object

Source

pub async fn delete_object( &self, request: &DeleteObjectRequest<'_>, ) -> Result<(), Error>

Delete object

Source§

impl ApiV3Client

Source

pub async fn login(&mut self, request: &LoginRequest<'_>) -> Result<User, Error>

Login with email and password

Source

pub async fn login_2fa( &mut self, request: &OtpLoginRequest, ) -> Result<User, Error>

Login with OTP (Two-Factor Authentication)

Source

pub async fn logout(&self) -> Result<(), Error>

Logout from current session

Source§

impl ApiV3Client

Source

pub async fn create_share(&self, request: &ShareRequest) -> Result<Share, Error>

Create a share link Note: The V3 API may return either an ApiResponse object or a plain string URL

Source§

impl ApiV3Client

Source

pub async fn get_site_config(&self) -> Result<SiteConfig, Error>

Get site configuration

Source

pub async fn get_captcha(&mut self) -> Result<CaptchaResponse, Error>

Get CAPTCHA for login

Source

pub async fn is_captcha_required(&self) -> Result<bool, Error>

Check if CAPTCHA is required for login

Source

pub async fn get_user_storage(&self) -> Result<StorageInfo, Error>

Get user storage information

Source

pub async fn ping(&self) -> Result<String, Error>

Ping the server and get server version

Source

pub async fn get_version(&self) -> Result<VersionInfo, Error>

Get API version information

Source

pub async fn get_user_settings(&self) -> Result<StorageInfo, Error>

Get user settings

Source

pub async fn get_task_queue(&self) -> Result<Vec<Aria2Task>, Error>

Get task queue

Source§

impl ApiV3Client

Source

pub async fn get_webdav_accounts(&self) -> Result<Vec<WebdavAccount>, Error>

Get WebDAV accounts

Source§

impl ApiV3Client

Source

pub fn new(base_url: &str) -> Self

Source

pub fn get_url(&self, endpoint: &str) -> String

Source

pub async fn get<T>(&self, endpoint: &str) -> Result<T, Error>

Source

pub async fn post<T>( &self, endpoint: &str, body: &impl Serialize, ) -> Result<T, Error>

Source

pub async fn post_raw( &self, endpoint: &str, body: &impl Serialize, ) -> Result<String, Error>

POST request that returns raw text instead of parsing JSON

Source

pub async fn put<T>( &self, endpoint: &str, body: &impl Serialize, ) -> Result<T, Error>

Source

pub async fn patch<T>( &self, endpoint: &str, body: &impl Serialize, ) -> Result<T, Error>

Source

pub async fn delete<T>(&self, endpoint: &str) -> Result<T, Error>

Source

pub async fn delete_with_body<T>( &self, endpoint: &str, body: &impl Serialize, ) -> Result<T, Error>

Source

pub async fn put_text( &self, endpoint: &str, body: &impl Serialize, ) -> Result<String, Error>

PUT request that returns raw text response instead of JSON

Trait Implementations§

Source§

impl Clone for ApiV3Client

Source§

fn clone(&self) -> ApiV3Client

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ApiV3Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more