[][src]Struct ucare::file::Service

pub struct Service<'a> { /* fields omitted */ }

Service is used to make calls to file API.

Implementations

impl<'_> Service<'_>[src]

pub fn info(&self, file_id: &str) -> Result<Info>[src]

Acquires some file specific info

pub fn list(&self, params: ListParams) -> Result<List>[src]

Returns a list of files

This example is not tested

let params = file::ListParams{
    limit: Some(10),
    ordering: Some(file::Ordering::Size),
    from: None,
};
let list = file_svc.list(params)?;
let mut next_page = list.next;

let mut files = list.results.unwrap();
while let Some(next) = next_page {
    let new_page = file_svc.get_page(&next).unwrap();
    next_page = new_page.next;
    files.extend(new_page.results.unwrap());
}

for f in files.iter() {
    println!("file: {}", f);
}

pub fn get_page(&self, url: &str) -> Result<List>[src]

Gets next page by its url

pub fn store(&self, file_id: &str) -> Result<Info>[src]

Store a single file by its id

pub fn batch_store(&self, file_ids: &[&str]) -> Result<BatchInfo>[src]

Used to store multiple files in one go. Up to 100 files are supported per request.

pub fn delete(&self, file_id: &str) -> Result<Info>[src]

Removes file by its id

pub fn batch_delete(&self, file_ids: &[&str]) -> Result<BatchInfo>[src]

Used to delete multiple files in one go. Up to 100 files are supported per request.

pub fn copy(&self, params: CopyParams) -> Result<LocalCopyInfo>[src]

Copy is the APIv05 version of the LocalCopy and RemoteCopy, use them instead

pub fn local_copy(&self, params: CopyParams) -> Result<LocalCopyInfo>[src]

Used to copy original files or their modified versions to default storage. Source files MAY either be stored or just uploaded and MUST NOT be deleted

pub fn remote_copy(&self, params: CopyParams) -> Result<RemoteCopyInfo>[src]

Used to copy original files or their modified versions to a custom storage. Source files MAY either be stored or just uploaded and MUST NOT be deleted.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Service<'a>

impl<'a> !Send for Service<'a>

impl<'a> !Sync for Service<'a>

impl<'a> Unpin for Service<'a>

impl<'a> !UnwindSafe for Service<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.