pub struct Graph<Client> { /* private fields */ }
Expand description

The graph client.

The graph client supports blocking and asynchronous requests but you must declare which type of client you want to use beforehand.

Blocking - Most simple and easy to use

let _client = Graph::new("ACCESS_TOKEN");

Async

let _client = Graph::new_async("ACCESS_TOKEN");

Implementations

Use the V1.0 api.

Use the beta API.

Check if the current host is v1.0.

Check if the current host is beta.

Set the access token used for requests.

Create a new client with an access token.

Example
use graph_rs_sdk::client::Graph;

let client = Graph::new("ACCESS_TOKEN");
// Use the v1.0 API

// Returns a response object with the body
// converted to serde_json::Value.
let response = client
    .v1()
    .me()
    .drive()
    .root_children()
    .send()?;

println!("{:#?}", response.body());

// Use a custom data structure. The json method
// will convert anything that implements serde deserialize.
let drive_items: serde_json::Value = client
    .v1()
    .me()
    .drive()
    .root_children()
    .json()?;

Create a new client with an access token.

Example
use graph_rs_sdk::client::Graph;

let client = Graph::new_async("ACCESS_TOKEN");
// Use the v1.0 API

// Returns a response object with the body
// converted to serde_json::Value.
let response = client
    .v1()
    .me()
    .drive()
    .root_children()
    .await
    .send()?;

println!("{:#?}", response.body());

// Use a custom data structure. The json method
// will convert anything that implements serde deserialize.
let drive_items: serde_json::Value = client
    .v1()
    .me()
    .drive()
    .root_children()
    .await
    .json()?;

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more