Struct onedrive_api::UploadSession [−][src]
pub struct UploadSession { /* fields omitted */ }An upload session for resumable file uploading process.
See also
Implementations
impl UploadSession[src]
impl UploadSession[src]pub const MAX_PART_SIZE: usize[src]
The upload size limit of a single upload_part call.
The value is from Microsoft Docs and may not be accurate or stable.
pub fn from_upload_url(upload_url: String) -> Self[src]
Construct back the upload session from upload URL.
pub async fn get_meta(&self, client: &Client) -> Result<UploadSessionMeta>[src]
Query the metadata of the upload to find out which byte ranges have been received previously.
See also
pub fn upload_url(&self) -> &str[src]
The URL endpoint accepting PUT requests.
It is exactly what you passed in UploadSession::from_upload_url.
pub async fn delete(&self, client: &Client) -> 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,
data: impl Into<Bytes>,
remote_range: Range<u64>,
file_size: u64,
client: &Client
) -> Result<Option<DriveItem>>[src]
&self,
data: impl Into<Bytes>,
remote_range: Range<u64>,
file_size: u64,
client: &Client
) -> 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.
The file_size of all part upload requests should be identical.
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
impl RefUnwindSafe for UploadSessionimpl Send for UploadSession
impl Send for UploadSessionimpl Sync for UploadSession
impl Sync for UploadSessionimpl Unpin for UploadSession
impl Unpin for UploadSessionimpl UnwindSafe for UploadSession
impl UnwindSafe for UploadSessionBlanket Implementations
impl<T> Instrument for T[src]
impl<T> Instrument for T[src]