[−][src]Struct onedrive_api::UploadSession
An upload session for resumable file uploading process.
See also
Implementations
impl UploadSession
[src]
pub fn upload_url(&self) -> &str
[src]
The URL endpoint accepting PUT requests.
Directly PUT to this URL is NOT encouraged.
It is preferred to use OneDrive::get_upload_session
to get
the upload session and then OneDrive::upload_to_session
to
perform upload.
See also
pub fn next_expected_ranges(&self) -> &[ExpectRange]
[src]
Get a collection of byte ranges that the server is missing for the file.
Used for determine what to upload when resuming a session.
See also
pub fn expiration_date_time(&self) -> &TimestampString
[src]
Get the date and time in UTC that the upload session will expire.
The complete file must be uploaded before this expiration time is reached.
See also
pub fn file_size(&self) -> u64
[src]
Get the size of the file which you want to upload.
This is just file_size
that you provided
in new_upload_session_with_option
or get_upload_session
.
pub async fn delete(&self, onedrive: &OneDrive) -> 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 async fn upload_part(
&self,
onedrive: &OneDrive,
data: impl Into<Bytes>,
remote_range: Range<u64>
) -> Result<Option<DriveItem>>
[src]
&self,
onedrive: &OneDrive,
data: impl Into<Bytes>,
remote_range: Range<u64>
) -> Result<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
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for UploadSession
[src]
impl Send for UploadSession
[src]
impl Sync for UploadSession
[src]
impl Unpin for UploadSession
[src]
impl UnwindSafe for UploadSession
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub 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>,