[][src]Struct onedrive_api::OneDrive

pub struct OneDrive { /* fields omitted */ }

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

Methods

impl OneDrive[src]

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

Create a new OneDrive instance with token to perform operations in a Drive.

pub fn token(&self) -> &str[src]

Get the token used to create the OneDrive instance.

pub fn get_drive_with_option(
    &self,
    option: ObjectOption<DriveField>
) -> impl Api<Response = Drive>
[src]

Get current Drive.

Retrieve the properties and relationships of a resource::Drive resource.

See also

Microsoft Docs

pub fn get_drive(&self) -> impl Api<Response = Drive>[src]

Shortcut to get_drive_with_option with default parameters.

See also

get_drive_with_option

pub fn list_children_with_option<'t, 'a>(
    &'t self,
    item: impl Into<ItemLocation<'a>>,
    option: CollectionOption<DriveItemField>
) -> impl Api<Response = Option<ListChildrenFetcher<'t>>>
[src]

List children of a DriveItem.

Retrieve a collection of resource::DriveItems in the children relationship of the given one.

Response

If successful, respond a fetcher for fetching changes from initial state (empty) to the snapshot of current states. See ListChildrenFetcher for more details.

If if_none_match is set and it matches the item tag, return an None.

See also

Microsoft Docs

pub fn list_children<'a, 's>(
    &'s self,
    item: impl Into<ItemLocation<'a>> + 's
) -> impl Api<Response = Vec<DriveItem>> + 's
[src]

Shortcut to list_children_with_option with default params, and fetch and collect all children.

See also

list_children_with_option

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

Get a DriveItem resource.

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

Errors

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

See also

Microsoft Docs

pub fn get_item<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = DriveItem>
[src]

Shortcut to get_item_with_option with default parameters.

See also

get_item_with_option

pub fn create_folder_with_option<'a>(
    &self,
    parent_item: impl Into<ItemLocation<'a>>,
    name: &FileName,
    option: DriveItemPutOption
) -> impl Api<Response = DriveItem>
[src]

Create a new folder under an DriveItem

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

Errors

Will result in Err with HTTP 409 CONFLICT if conflict_behavior is set to Fail and the target already exists.

See also

Microsoft Docs

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

Shortcut to create_folder_with_option with default options.

See also

create_folder_with_option

pub fn update_item_with_option<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    patch: &DriveItem,
    option: ObjectOption<DriveItemField>
) -> impl Api<Response = DriveItem>
[src]

Update DriveItem properties

Update the metadata for a DriveItem.

If you want to rename or move an DriveItem to another place, you should use move_ (or move_with_option) instead of this, which is a wrapper to this API endpoint to make things easier.

See also

Microsoft Docs

pub fn update_item<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    patch: &DriveItem
) -> impl Api<Response = DriveItem>
[src]

Shortcut to update_item_with_option with default options.

See also

update_item_with_option

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

Upload or replace the contents of a DriveItem file.

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.

Panic

Panic if data is larger than 4 MB (4,000,000 bytes).

See also

Microsoft Docs

pub fn new_upload_session_with_option<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    option: DriveItemPutOption
) -> impl Api<Response = 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 412 PRECONDITION_FAILED if if_match is set but does not match the item.

Note

conflict_behavior is supported.

See also

Microsoft Docs

pub fn new_upload_session<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = UploadSession>
[src]

Shortcut to new_upload_session_with_option with ConflictBehavior::Fail.

See also

new_upload_session_with_option

pub fn get_upload_session(
    &self,
    upload_url: &str
) -> impl Api<Response = 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
) -> impl Api<Response = ()>
[src]

Cancel an 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
) -> impl Api<Response = Option<DriveItem>>
[src]

Upload bytes to an 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.

Response

  • If the part is uploaded successfully, but the file is not complete yet, will respond None.
  • If this is the last part and it is uploaded successfully, will return Some(<newly_created_drive_item>).

Error

When the file is completely uploaded, if an item with the same name is created during uploading, the last upload_to_session call will return Err with HTTP 409 CONFLICT.

Panic

Panic if remote_range is invalid, not match the length of data, or data is larger than 60 MiB (62,914,560 bytes).

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
) -> impl Api<Response = CopyProgressMonitor>
[src]

Copy a DriveItem.

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

Note

The conflict behavior is not mentioned in Microsoft Docs, and cannot be specified.

But it seems to behave as Rename if the destination folder is just the current parent folder, and Fail overwise.

See also

Microsoft Docs

pub fn move_with_option<'a, 'b>(
    &self,
    source_item: impl Into<ItemLocation<'a>>,
    dest_folder: impl Into<ItemLocation<'b>>,
    dest_name: Option<&FileName>,
    option: DriveItemPutOption
) -> impl Api<Response = 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.

Note

conflict_behavior is supported.

Errors

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

See also

Microsoft Docs

pub fn move_<'a, 'b>(
    &self,
    source_item: impl Into<ItemLocation<'a>>,
    dest_folder: impl Into<ItemLocation<'b>>,
    dest_name: Option<&FileName>
) -> impl Api<Response = DriveItem>
[src]

Shortcut to move_with_option with ConflictBehavior::Fail.

See also

move_with_option

pub fn delete_with_option<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>,
    option: DriveItemPutOption
) -> impl Api<Response = ()>
[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.

Error

Will result in error with HTTP 412 PRECONDITION_FAILED if if_match is set but does not match the item.

Panic

conflict_behavior is NOT supported. Set it will cause a panic.

See also

Microsoft Docs

pub fn delete<'a>(
    &self,
    item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = ()>
[src]

Shortcut to delete_with_option.

See also

delete_with_option

pub fn track_changes_from_initial_with_option<'a>(
    &self,
    folder: impl Into<ItemLocation<'a>>,
    option: CollectionOption<DriveItemField>
) -> impl Api<Response = 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.

Response

Respond a fetcher for fetching changes from initial state (empty) to the snapshot of current states. See TrackChangeFetcher for more details.

See also

Microsoft Docs

pub fn track_changes_from_initial<'a>(
    &self,
    folder: impl Into<ItemLocation<'a>>
) -> impl Api<Response = TrackChangeFetcher>
[src]

Shortcut to track_changes_from_initial_with_option with default parameters.

See also

track_changes_from_initial_with_option

TrackChangeFetcher

pub fn track_changes_from_delta_url<'t>(
    &'t self,
    delta_url: &str
) -> impl Api<Response = TrackChangeFetcher>
[src]

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

See also

OneDrive::track_changes_from_initial_with_option

TrackChangeFetcher

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

Get a delta url representing the snapshot of current states.

The delta url can be used in track_changes_from_delta_url later to get diffs between two snapshots of states.

See also

Microsoft Docs

Trait Implementations

impl Debug for OneDrive[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

type Error = !

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.

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

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

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

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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