[][src]Crate onedrive_api

onedrive-api

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

HTTP APIs are provided by methods returning type impl Api, which can be executed on any HTTP backends implementing trait Client. You can implement the trait on any custom HTTP backends to execute APIs, or simply enable feature flags to get support to work with famous HTTP crates. We currently support:

Async support is TODO.

Example

This example is not tested
// With feature `reqwest` enabled.
use onedrive_api::{OneDrive, Api as _, FileName, DriveLocation, ItemLocation};
use reqwest;

let client = reqwest::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(),
    )
    .execute(&client)?;

drive
    .upload_small(
        folder_item.id.as_ref().unwrap(),
        b"Hello, world",
    )
    .execute(&client)?;

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

Authentication

Authentication to Microsoft Graph API

CopyProgress

The progress of a asynchronous copy operation.

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.

Token

Access tokens

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.

Traits

Api

An abstract API request, conbining constructed HTTP request and response parser.

Client

Abstract synchronous HTTP client

Type Definitions

Result

An alias to Result of Error.