[][src]Struct graph_rs_sdk::client::Graph

pub struct Graph<Client> { /* fields omitted */ }

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

impl<'a, Client> Graph<Client> where
    Client: RequestClient
[src]

pub fn v1(&'a self) -> Identify<'a, Client>[src]

Use the V1.0 api.

pub fn beta(&'a self) -> Identify<'a, Client>[src]

Use the beta API.

pub fn is_v1(&self) -> bool[src]

Check if the current host is v1.0.

pub fn is_beta(&self) -> bool[src]

Check if the current host is beta.

pub fn set_token(&self, token: &str)[src]

Set the access token used for requests.

pub fn ident(&self) -> ResourceIdentity[src]

impl<'a> Graph<BlockingHttpClient>[src]

pub fn new(token: &str) -> Graph<BlockingHttpClient>[src]

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()?;

pub fn url_ref<F>(&self, f: F) where
    F: Fn(&GraphUrl), 
[src]

impl<'a> Graph<AsyncHttpClient>[src]

pub fn new_async(token: &str) -> Graph<AsyncHttpClient>[src]

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()?;

pub fn url_ref<F>(&self, f: F) where
    F: Fn(&GraphUrl) + Sync
[src]

Trait Implementations

impl<Client> Debug for Graph<Client> where
    Client: Debug
[src]

impl From<&'_ AccessToken> for Graph<BlockingHttpClient>[src]

impl From<&'_ AccessToken> for Graph<AsyncHttpClient>[src]

impl From<&'_ str> for Graph<BlockingHttpClient>[src]

impl From<&'_ str> for Graph<AsyncHttpClient>[src]

impl From<String> for Graph<BlockingHttpClient>[src]

impl From<String> for Graph<AsyncHttpClient>[src]

impl TryFrom<&'_ OAuth> for Graph<BlockingHttpClient>[src]

type Error = GraphFailure

The type returned in the event of a conversion error.

impl TryFrom<&'_ OAuth> for Graph<AsyncHttpClient>[src]

type Error = GraphFailure

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<Client> RefUnwindSafe for Graph<Client> where
    Client: RefUnwindSafe
[src]

impl<Client> Send for Graph<Client> where
    Client: Send
[src]

impl<Client> Sync for Graph<Client> where
    Client: Sync
[src]

impl<Client> Unpin for Graph<Client> where
    Client: Unpin
[src]

impl<Client> UnwindSafe for Graph<Client> where
    Client: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.