Struct baiduyun_api::YunApi

source ·
pub struct YunApi { /* private fields */ }
Expand description

要使用本api,必须使用YunApi结构体

Implementations§

source§

impl YunApi

source

pub fn new(in_token: &str) -> YunApi

创建一个YunApi结构体.

其中参数in_token表示的是用户认证后获得的access_token

source

pub fn get_user_info(&self) -> Result<UserInfo, ApiError>

得到用户的基本信息

返回信息的具体字段参见UserInfo

source

pub fn get_quota_info(&self) -> Result<QuotaInfo, ApiError>

得到网盘的空间占用信息

返回信息的具体的字段见QuotaInfo

source

pub fn get_files_info<T>( &self, file_ids: &[T] ) -> Result<Vec<FileInfoEx>, ApiError>
where T: FileId,

查询文件信息,可以获取下载链接之用.

只有实现了FileId trait的类型可以用在这里 查询结果 FileInfoEx 其各个字段详见其描述.

source

pub fn get_files_list( &self, dir: &str, start: i64, limit: i64 ) -> Result<FileInfoIter, ApiError>

根据目录名得到该目录下的文件

其中参数dir表示目录名,limit表示每次最多的条数(即每页limit个条目),start表示当前查询的总序号. limit不可超过10000 返回信息的具体的字段见FileInfo FileInfoIter 是一个FileInfo的迭代器.

根据提供的文件列表返回相应的下载链接

只有实现了FileId trait的类型可以用在这里 注意:

  • 传递的列表中只处理文件类型,而不处理目录类型
  • 得到的链接只存活8小时

和 [get_files_dlink_vec]类似,但是只查询单个文件

只有实现了FileId trait的类型可以用在这里

source

pub fn search_with_key( &self, search_key: &str, search_dir: &str, is_recursive: bool, in_page: i64, in_num: i64, in_web: bool ) -> Result<Vec<SearchResult>, ApiError>

根据关键字进行搜索

  • search_key 表示要搜索的关键字,可以使用中文.
  • search_dir 表示要搜索的根目录.
  • is_recursive 表示是否递归地进行搜索.
  • in_num 表示每页的项目.
  • in_page表示当前搜索的页号.
  • in_web 表示是否返回缩略图

Auto Trait Implementations§

§

impl !RefUnwindSafe for YunApi

§

impl Send for YunApi

§

impl Sync for YunApi

§

impl Unpin for YunApi

§

impl !UnwindSafe for YunApi

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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