[−][src]Struct onedrive_api::DriveClient
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]
&self,
option: ObjectOption<DriveField>
) -> Result<Drive>
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]
&self,
item: impl Into<ItemLocation<'a>>,
if_none_match: Option<&Tag>,
option: CollectionOption<DriveItemField>
) -> Result<Option<ListChildrenFetcher>>
List children of a DriveItem
.
Return a collection of DriveItem
s 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
pub fn list_children<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
if_none_match: Option<&Tag>
) -> Result<Option<Vec<DriveItem>>>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
if_none_match: Option<&Tag>
) -> Result<Option<Vec<DriveItem>>>
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]
&self,
item: impl Into<ItemLocation<'a>>,
if_none_match: Option<&Tag>,
option: ObjectOption<DriveItemField>
) -> Result<Option<DriveItem>>
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
pub fn get_item<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
if_none_match: Option<&Tag>
) -> Result<Option<DriveItem>>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
if_none_match: Option<&Tag>
) -> Result<Option<DriveItem>>
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]
&self,
parent_item: impl Into<ItemLocation<'a>>,
name: &FileName
) -> Result<DriveItem>
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
pub fn upload_small<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
data: &[u8]
) -> Result<DriveItem>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
data: &[u8]
) -> Result<DriveItem>
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
pub fn new_upload_session<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
overwrite: bool,
if_match: Option<&Tag>
) -> Result<UploadSession>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
overwrite: bool,
if_match: Option<&Tag>
) -> Result<UploadSession>
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
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
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
pub fn upload_to_session(
&self,
session: &UploadSession,
data: &[u8],
remote_range: Range<usize>,
total_size: usize
) -> Result<Option<DriveItem>>
[src]
&self,
session: &UploadSession,
data: &[u8],
remote_range: Range<usize>,
total_size: usize
) -> Result<Option<DriveItem>>
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
pub fn copy<'a, 'b>(
&self,
source_item: impl Into<ItemLocation<'a>>,
dest_folder: impl Into<ItemLocation<'b>>,
dest_name: &FileName
) -> Result<()>
[src]
&self,
source_item: impl Into<ItemLocation<'a>>,
dest_folder: impl Into<ItemLocation<'b>>,
dest_name: &FileName
) -> Result<()>
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
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]
&self,
source_item: impl Into<ItemLocation<'a>>,
dest_directory: impl Into<ItemLocation<'b>>,
dest_name: Option<&FileName>,
if_match: Option<&Tag>
) -> Result<DriveItem>
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
pub fn delete<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
if_match: Option<&Tag>
) -> Result<()>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
if_match: Option<&Tag>
) -> Result<()>
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
pub fn track_changes_from_initial_with_option<'a>(
&self,
folder: impl Into<ItemLocation<'a>>,
option: CollectionOption<DriveItemField>
) -> Result<TrackChangeFetcher>
[src]
&self,
folder: impl Into<ItemLocation<'a>>,
option: CollectionOption<DriveItemField>
) -> Result<TrackChangeFetcher>
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
pub fn track_changes_from_initial<'a>(
&self,
folder: impl Into<ItemLocation<'a>>
) -> Result<(Vec<DriveItem>, String)>
[src]
&self,
folder: impl Into<ItemLocation<'a>>
) -> Result<(Vec<DriveItem>, String)>
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]
&self,
delta_url: &str
) -> Result<TrackChangeFetcher>
Track changes for a folder from snapshot (delta url) to snapshot of current states.
See also
pub fn get_latest_delta_url<'a>(
&self,
folder: impl Into<ItemLocation<'a>>
) -> Result<String>
[src]
&self,
folder: impl Into<ItemLocation<'a>>
) -> Result<String>
Trait Implementations
Auto Trait Implementations
impl Send for DriveClient
impl Sync for DriveClient
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.