Struct graph_rs_sdk::client::Graph
source · [−]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
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
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl<Client> RefUnwindSafe for Graph<Client> where
Client: RefUnwindSafe,
impl<Client> UnwindSafe for Graph<Client> where
Client: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
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