[][src]Struct google_drive::GoogleDrive

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.

Auto Trait Implementations

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> Instrument for T[src]

impl<T> Instrument 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.