[][src]Struct onedrive_api::DriveClient

pub struct DriveClient { /* fields omitted */ }

The authorized client to access OneDrive resources in a specified Drive.

Methods

impl DriveClient[src]

pub fn new(token: String, drive: impl Into<DriveLocation>) -> Self[src]

Create a DriveClient to perform operations in a Drive.

pub fn get_drive_with_option(
    &self,
    option: ObjectOption<DriveField>
) -> Result<Drive>
[src]

Get Drive.

Retrieve the properties and relationships of a Drive resource.

See also

Microsoft Docs

pub fn get_drive(&self) -> Result<Drive>[src]

Shortcut to get_drive_with_option with default parameters.

pub fn list_children_with_option<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    if_none_match: Option<&Tag>,
    option: CollectionOption<DriveItemField>
) -> Result<Option<ListChildrenFetcher>>
[src]

List children of a DriveItem.

Return a collection of DriveItems in the children relationship of the given one.

Note

Will return Ok(None) if if_none_match is set and matches the item.

See also

Microsoft Docs

pub fn list_children<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    if_none_match: Option<&Tag>
) -> Result<Option<Vec<DriveItem>>>
[src]

Shortcut to list_children_with_option with default params and fetch all.

pub fn get_item_with_option<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    if_none_match: Option<&Tag>,
    option: ObjectOption<DriveItemField>
) -> Result<Option<DriveItem>>
[src]

Get a DriveItem resource.

Retrieve the metadata for a DriveItem by file system path or ID.

Errors

Will return Ok(None) if if_none_match is set and matches the item .

See also

Microsoft Docs

pub fn get_item<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    if_none_match: Option<&Tag>
) -> Result<Option<DriveItem>>
[src]

Shortcut to get_item_with_option with default parameters.

pub fn create_folder<'a>(
    &self,
    parent_item: impl Into<ItemLocation<'a>>,
    name: &FileName
) -> Result<DriveItem>
[src]

Create a new folder in a drive

Create a new folder DriveItem with a specified parent item or path.

Errors

Will return Err with HTTP CONFLICT if the target already exists.

See also

Microsoft Docs

pub fn upload_small<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    data: &[u8]
) -> Result<DriveItem>
[src]

Upload or replace the contents of a DriveItem

The simple upload API allows you to provide the contents of a new file or update the contents of an existing file in a single API call. This method only supports files up to 4MB in size.

See also

Microsoft Docs

pub fn new_upload_session<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    overwrite: bool,
    if_match: Option<&Tag>
) -> Result<UploadSession>
[src]

Create an upload session.

Create an upload session to allow your app to upload files up to the maximum file size. An upload session allows your app to upload ranges of the file in sequential API requests, which allows the transfer to be resumed if a connection is dropped while the upload is in progress.

Errors

Will return Err with HTTP PRECONDITION_FAILED if if_match is set but does not match the item.

See also

Microsoft Docs

pub fn get_upload_session(&self, upload_url: &str) -> Result<UploadSession>[src]

Resuming an in-progress upload

Query the status of the upload to find out which byte ranges have been received previously.

See also

Microsoft Docs

pub fn delete_upload_session(&self, sess: &UploadSession) -> Result<()>[src]

Cancel the upload session

This cleans up the temporary file holding the data previously uploaded. This should be used in scenarios where the upload is aborted, for example, if the user cancels the transfer.

Temporary files and their accompanying upload session are automatically cleaned up after the expirationDateTime has passed. Temporary files may not be deleted immedately after the expiration time has elapsed.

See also

Microsoft Docs

pub fn upload_to_session(
    &self,
    session: &UploadSession,
    data: &[u8],
    remote_range: Range<usize>,
    total_size: usize
) -> Result<Option<DriveItem>>
[src]

Upload bytes to the upload session

You can upload the entire file, or split the file into multiple byte ranges, as long as the maximum bytes in any given request is less than 60 MiB. The fragments of the file must be uploaded sequentially in order. Uploading fragments out of order will result in an error.

Note: If your app splits a file into multiple byte ranges, the size of each byte range MUST be a multiple of 320 KiB (327,680 bytes). Using a fragment size that does not divide evenly by 320 KiB will result in errors committing some files.

See also

Microsoft Docs

pub fn copy<'a, 'b>(
    &self,
    source_item: impl Into<ItemLocation<'a>>,
    dest_folder: impl Into<ItemLocation<'b>>,
    dest_name: &FileName
) -> Result<()>
[src]

Copy a DriveItem.

Asynchronously creates a copy of an driveItem (including any children), under a new parent item or with a new name.

See also

Microsoft Docs

pub fn move_<'a, 'b>(
    &self,
    source_item: impl Into<ItemLocation<'a>>,
    dest_directory: impl Into<ItemLocation<'b>>,
    dest_name: Option<&FileName>,
    if_match: Option<&Tag>
) -> Result<DriveItem>
[src]

Move a DriveItem to a new folder.

This is a special case of the Update method. Your app can combine moving an item to a new container and updating other properties of the item into a single request.

Note: Items cannot be moved between Drives using this request.

Errors

Will return Err with HTTP PRECONDITION_FAILED if if_match is set but doesn't match the item.

See also

Microsoft Docs

pub fn delete<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    if_match: Option<&Tag>
) -> Result<()>
[src]

Delete a DriveItem.

Delete a DriveItem by using its ID or path. Note that deleting items using this method will move the items to the recycle bin instead of permanently deleting the item.

Errors

Will return Err with HTTP PRECONDITION_FAILED if if_match is set but does not match the item.

See also

Microsoft Docs

pub fn track_changes_from_initial_with_option<'a>(
    &self,
    folder: impl Into<ItemLocation<'a>>,
    option: CollectionOption<DriveItemField>
) -> Result<TrackChangeFetcher>
[src]

Track changes for a folder from initial state (empty state) to snapshot of current states.

This method allows your app to track changes to a drive and its children over time. Deleted items are returned with the deleted facet. Items with this property set should be removed from your local state.

Note: you should only delete a folder locally if it is empty after syncing all the changes.

Return

The fetcher for fetching all changes from initial state (empty) to the snapshot of current states.

See also

Microsoft Docs

pub fn track_changes_from_initial<'a>(
    &self,
    folder: impl Into<ItemLocation<'a>>
) -> Result<(Vec<DriveItem>, String)>
[src]

Shortcut to track_changes_from_initial_with_option with default parameters.

pub fn track_changes_from_delta_url(
    &self,
    delta_url: &str
) -> Result<TrackChangeFetcher>
[src]

Track changes for a folder from snapshot (delta url) to snapshot of current states.

See also

DriveClient::track_changes_from_initial_with_option

pub fn get_latest_delta_url<'a>(
    &self,
    folder: impl Into<ItemLocation<'a>>
) -> Result<String>
[src]

Get a delta url representing the snapshot of current states.

See also

Microsoft Docs

Trait Implementations

impl Debug for DriveClient[src]

Auto Trait Implementations

impl Send for DriveClient

impl Sync for DriveClient

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.

impl<T> Erased for T