[][src]Crate onedrive_api

onedrive-api

onedrive-api crate provides middle-level HTTP APIs OneDrive to the OneDrive API through Microsoft Graph, and also Auth with utilities for OAuth2.

Example

use onedrive_api::{OneDrive, FileName, DriveLocation, ItemLocation};
use reqwest::Client;

let client = Client::new();
let drive = OneDrive::new(
    "<...TOKEN...>".to_owned(), // Login token to Microsoft Graph.
    DriveLocation::me(),
);

let folder_item = drive
    .create_folder(
        ItemLocation::root(),
        FileName::new("test_folder").unwrap(),
    )
    .await?;

drive
    .upload_small(
        folder_item.id.as_ref().unwrap(),
        &b"Hello, world"[..],
    )
    .await?;

Features

  • beta

    Most of Microsoft APIs used in this crate are stable. But there are also some beta APIs, which are subject to change and is not suggested to be used in production application. Microsoft references of beta APIs usually contain a (beta) suffix in title.

    To avoid breakage, we put beta APIs and related resources under feature gate beta. They may change to follow Microsoft API references ANYTIME, and do NOT follow the semantic version of this crate.

    Be carefully using it and do NOT use it in production.

Re-exports

pub use self::resource::DriveId;
pub use self::resource::ItemId;
pub use self::resource::Tag;

Modules

option

Configurable options which can be used to customize API behaviors or responses.

resource

Resource Objects defined in the OneDrive API.

Structs

Auth

OAuth2 authentication and authorization basics for Microsoft Graph.

CopyProgress

The progress of a asynchronous copy operation. (Beta)

CopyProgressMonitor

The monitor for checking the progress of a asynchronous copy operation.

DriveLocation

Specify the location of a Drive resource.

Error

Error of API request

ExpectRange

A half-open byte range start..end or start...

FileName

An valid file name str (unsized).

ItemLocation

Reference to a DriveItem in a drive. It does not contains the drive information.

ListChildrenFetcher

The page fetcher for listing children

OneDrive

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

Permission

A list of the Microsoft Graph permissions that you want the user to consent to.

TokenResponse

Tokens and some additional data returned by a successful authorization.

TrackChangeFetcher

The page fetcher for tracking operations with Iterator interface.

UploadSession

An upload session for resumable file uploading process.

Enums

ConflictBehavior

The conflict resolution behavior for actions that create a new item.

CopyStatus

The status of a copy operation. (Beta)

Type Definitions

Result

An alias to Result of Error.