[−][src]Struct onedrive_api::OneDrive
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]
&self,
option: ObjectOption<DriveField>
) -> impl Api<Response = Drive>
Get current Drive
.
Retrieve the properties and relationships of a resource::Drive
resource.
See also
pub fn get_drive(&self) -> impl Api<Response = Drive>
[src]
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]
&'t self,
item: impl Into<ItemLocation<'a>>,
option: CollectionOption<DriveItemField>
) -> impl Api<Response = Option<ListChildrenFetcher<'t>>>
List children of a DriveItem
.
Retrieve a collection of resource::DriveItem
s 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
pub fn list_children<'a, 's>(
&'s self,
item: impl Into<ItemLocation<'a>> + 's
) -> impl Api<Response = Vec<DriveItem>> + 's
[src]
&'s self,
item: impl Into<ItemLocation<'a>> + 's
) -> impl Api<Response = Vec<DriveItem>> + 's
Shortcut to list_children_with_option
with default params,
and fetch and collect all children.
See also
pub fn get_item_with_option<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
option: ObjectOption<DriveItemField>
) -> impl Api<Response = Option<DriveItem>>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
option: ObjectOption<DriveItemField>
) -> impl Api<Response = Option<DriveItem>>
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
pub fn get_item<'a>(
&self,
item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = DriveItem>
[src]
&self,
item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = DriveItem>
pub fn create_folder_with_option<'a>(
&self,
parent_item: impl Into<ItemLocation<'a>>,
name: &FileName,
option: DriveItemPutOption
) -> impl Api<Response = DriveItem>
[src]
&self,
parent_item: impl Into<ItemLocation<'a>>,
name: &FileName,
option: DriveItemPutOption
) -> impl Api<Response = DriveItem>
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
pub fn create_folder<'a>(
&self,
parent_item: impl Into<ItemLocation<'a>>,
name: &FileName
) -> impl Api<Response = DriveItem>
[src]
&self,
parent_item: impl Into<ItemLocation<'a>>,
name: &FileName
) -> impl Api<Response = DriveItem>
pub fn update_item_with_option<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
patch: &DriveItem,
option: ObjectOption<DriveItemField>
) -> impl Api<Response = DriveItem>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
patch: &DriveItem,
option: ObjectOption<DriveItemField>
) -> impl Api<Response = DriveItem>
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
pub fn update_item<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
patch: &DriveItem
) -> impl Api<Response = DriveItem>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
patch: &DriveItem
) -> impl Api<Response = DriveItem>
pub fn upload_small<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
data: &[u8]
) -> impl Api<Response = DriveItem>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
data: &[u8]
) -> impl Api<Response = DriveItem>
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
pub fn new_upload_session_with_option<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
option: DriveItemPutOption
) -> impl Api<Response = UploadSession>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
option: DriveItemPutOption
) -> impl Api<Response = 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 412 PRECONDITION_FAILED if if_match
is set
but does not match the item.
Note
conflict_behavior
is supported.
See also
pub fn new_upload_session<'a>(
&self,
item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = UploadSession>
[src]
&self,
item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = UploadSession>
Shortcut to new_upload_session_with_option
with ConflictBehavior::Fail
.
See also
pub fn get_upload_session(
&self,
upload_url: &str
) -> impl Api<Response = UploadSession>
[src]
&self,
upload_url: &str
) -> impl Api<Response = UploadSession>
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
) -> impl Api<Response = ()>
[src]
&self,
sess: &UploadSession
) -> impl Api<Response = ()>
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
pub fn upload_to_session(
&self,
session: &UploadSession,
data: &[u8],
remote_range: Range<usize>,
total_size: usize
) -> impl Api<Response = Option<DriveItem>>
[src]
&self,
session: &UploadSession,
data: &[u8],
remote_range: Range<usize>,
total_size: usize
) -> impl Api<Response = Option<DriveItem>>
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
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]
&self,
source_item: impl Into<ItemLocation<'a>>,
dest_folder: impl Into<ItemLocation<'b>>,
dest_name: &FileName
) -> impl Api<Response = CopyProgressMonitor>
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
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]
&self,
source_item: impl Into<ItemLocation<'a>>,
dest_folder: impl Into<ItemLocation<'b>>,
dest_name: Option<&FileName>,
option: DriveItemPutOption
) -> impl Api<Response = 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.
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
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]
&self,
source_item: impl Into<ItemLocation<'a>>,
dest_folder: impl Into<ItemLocation<'b>>,
dest_name: Option<&FileName>
) -> impl Api<Response = DriveItem>
pub fn delete_with_option<'a>(
&self,
item: impl Into<ItemLocation<'a>>,
option: DriveItemPutOption
) -> impl Api<Response = ()>
[src]
&self,
item: impl Into<ItemLocation<'a>>,
option: DriveItemPutOption
) -> impl Api<Response = ()>
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
pub fn delete<'a>(
&self,
item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = ()>
[src]
&self,
item: impl Into<ItemLocation<'a>>
) -> impl Api<Response = ()>
pub fn track_changes_from_initial_with_option<'a>(
&self,
folder: impl Into<ItemLocation<'a>>,
option: CollectionOption<DriveItemField>
) -> impl Api<Response = TrackChangeFetcher>
[src]
&self,
folder: impl Into<ItemLocation<'a>>,
option: CollectionOption<DriveItemField>
) -> impl Api<Response = 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.
Response
Respond a fetcher for fetching changes from initial state (empty) to the snapshot of
current states. See TrackChangeFetcher
for more details.
See also
pub fn track_changes_from_initial<'a>(
&self,
folder: impl Into<ItemLocation<'a>>
) -> impl Api<Response = TrackChangeFetcher>
[src]
&self,
folder: impl Into<ItemLocation<'a>>
) -> impl Api<Response = TrackChangeFetcher>
Shortcut to track_changes_from_initial_with_option
with default parameters.
See also
pub fn track_changes_from_delta_url<'t>(
&'t self,
delta_url: &str
) -> impl Api<Response = TrackChangeFetcher>
[src]
&'t self,
delta_url: &str
) -> impl Api<Response = 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>>
) -> impl Api<Response = String>
[src]
&self,
folder: impl Into<ItemLocation<'a>>
) -> impl Api<Response = String>
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
Trait Implementations
Auto Trait Implementations
impl Send for OneDrive
impl Sync for OneDrive
impl Unpin for OneDrive
impl UnwindSafe for OneDrive
impl RefUnwindSafe for OneDrive
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
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, U> TryInto<U> 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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,