Struct google_drive::GoogleDrive[][src]

pub struct GoogleDrive { /* fields omitted */ }

Entrypoint for interacting with the Google Drive API.

Implementations

impl GoogleDrive[src]

pub fn new(token: AccessToken) -> Self[src]

Create a new Drive client struct. It takes a type that can convert into an &str (String or Vec<u8> for example). As long as the function is given a valid API Key and Secret your requests will work.

pub fn get_token(&self) -> &AccessToken[src]

Get the currently set authorization token.

pub async fn download_file_by_id(&self, id: &str) -> Result<Bytes, APIError>[src]

Download a file stored on Google Drive by it’s ID.

pub async fn get_file_contents_by_id(
    &self,
    id: &str
) -> Result<String, APIError>
[src]

Get a file’s contents by it’s ID. Only works for Google Docs.

pub async fn get_file_by_id(&self, id: &str) -> Result<File, APIError>[src]

Get a file by it’s ID.

pub async fn get_file_by_name(
    &self,
    drive_id: &str,
    name: &str
) -> Result<Vec<File>, APIError>
[src]

Get a file by it’s name.

pub async fn list_drives(&self) -> Result<Vec<Drive>, APIError>[src]

List drives.

pub async fn get_drive_by_name(&self, name: &str) -> Result<Drive, APIError>[src]

Get a drive by it’s name.

pub async fn create_folder(
    &self,
    drive_id: &str,
    parent_id: &str,
    name: &str
) -> Result<String, APIError>
[src]

Create a folder.

pub async fn create_or_upload_file(
    &self,
    drive_id: &str,
    parent_id: &str,
    name: &str,
    mime_type: &str,
    contents: &[u8]
) -> Result<(), APIError>
[src]

Create or update a file in a drive. If the file already exists, it will update it. If the file does not exist, it will create it.

pub async fn delete_file_by_name(
    &self,
    drive_id: &str,
    name: &str
) -> Result<(), APIError>
[src]

Delete a file by its name.

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

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

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

fn in_current_span(self) -> Instrumented<Self>[src]

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

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.