[][src]Crate graph_rs_sdk

Microsoft Graph API Client in Rust

graph-rs is an API client for Microsoft Graph V1.0 and Graph Beta.

Installation and basic usage can be found below and there are extensive examples in the example's directory on GitHub](https://github.com/sreeise/graph-rs).

What Api's are available

The Api's available are generated from Microsoft's msgraph-metadata repository which stores OpenApi configs for the Graph Api. There may be some requests and/or Api's not yet included in this project but in general most of them are implemented.

Feature requests or Bug reports.

For both feature requests and bug reports please file an issue on GitHub and a response or fix will be done as soon as possible.

Use

The client supports both blocking and async requests.

Blocking Client

To use the blocking client

 use graph_rs_sdk::prelude::*;

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

Async Client

To use the async client

 use graph_rs_sdk::prelude::*;

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

The send method and Graph types

The send() method is the main method for sending a request. The return value will be wrapped in a response object and the body will be one of:

  1. serde_json::Value

  2. Collection<serde_json::Value>

  3. Content (204 responses that return a content field)

Basic Use:

use graph_rs_sdk::prelude::*;

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

let response = client.v1()
    .me()
    .drive()
    .get_drive()
    .send()
    .unwrap();

// Print the value returned in the body of the response
println!("{:#?}", response.body());

Using the Async Client

use graph_rs_sdk::prelude::*;

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

let response = client.v1()
    .me()
    .drive()
    .get_drive()
    .send()
    .await
    .unwrap();

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

Use the Graph version one or beta Api

v1() refers to the endpoint for version 1 of the Microsoft graph Api. You can also use the beta() method which uses the Microsoft graph beta Api endpoint.

use graph_rs_sdk::prelude::*;

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

let _response = client.beta()
    .me()
    .get_user()
    .send()?;
  • For more information and examples please see the repository on GitHub
  • If you run into issues related to graph-rs specifically please file an issue on GitHub

Re-exports

pub extern crate serde;
pub extern crate serde_json;
pub extern crate serde_yaml;

Modules

activities

Activities request client.

app_catalogs

App catalogs request client.

applications
attachments
audit_logs

Audit logs request client.

buckets

Planner buckets request client.

calendar

Calendar request client.

calendar_groups

Calendar groups client.

calendar_view

Calendar view client.

call_records

Communication call records request client.

calls

Communication calls request client.

certificate_based_auth_configuration

Certificate based auth configuration client.

child_folders

Mail folders child folders request client.

client

Main Graph client.

communications

Communications client.

contact_folders

Contact folders client (me, users, etc.).

contacts

Contacts request client.

content_types

Content types request client.

contracts

Contracts request client.

conversations

Groups conversations request client.

core

Types used across multiple crates.

data_policy_operations

Data policy operations request client.

device_app_management

Device app management request client.

device_management

Device management request client.

directory

Directory request client.

domain_dns_records

Domain dns records request client.

domains

Domains request client.

drive

OneDrive request client.

education

Education request client.

error

Reexport of graph-error crate.

events

Events request client (Calendars).

extended_properties

Extended properties request client.

group_lifecycle_policies

Group lifecycle policies request client.

groups

Groups request client.

header

Reexport of reqwest headers for use with API requests.

identity

Identity request client.

inference_classification

Inference classification client (me, users, etc.).

insights

Insights client (me, users, etc.).

instances

Instances request client (events and calendarView).

invitations

Invitations request client.

items

Items request client.

lists

Lists request client.

mail_folders

Mail folders request client.

managed_devices

Managed devices client.

me

Me request client.

messages

Messages request client.

notebooks

Notebooks request client.

oauth

Reexport of graph-oauth crate.

onenote

OneNote request client.

org_contact

Contacts/Org Contacts request client.

outlook

Outlook request client.

pages

Onenote pages request client.

parent_notebook

Onenote parent notebook request client.

parent_section

Onenote parent section request client.

parent_section_group

Onenote parent section group request client.

places

Places request client.

planner

Planner request client.

plans

Planner plans request client.

policies

Policies request client.

posts

Groups threads posts request client.

prelude

Common structs and traits.

schema_extensions

Schema extensions request client.

section_groups

Onenote section group request client.

sections

Onenote section request client.

service_principals

Service principles request client.

sessions

Communications call record sessions request client.

settings

Settings request client (me, users, etc.).

sites

Sites request client.

subscribed_skus

Subscribed skus request client.

subscriptions

Subscriptions request client.

tasks

Planner tasks request client.

teams

Teams request client.

teamwork

Teamwork request client.

threads

Groups thread request client.

users

Users request client.

Statics

GRAPH_URL
GRAPH_URL_BETA