1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
//! ### 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](https://github.com/sreeise/graph-rs)
//! 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
//!```rust
//! use graph_rs_sdk::prelude::*;
//!
//! let client =  Graph::new("ACCESS_TOKEN");
//!```
//!
//! ### Async Client
//!
//! To use the async client
//!```rust
//! 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:
//! ```rust,ignore
//! 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
//!
//! ```rust,ignore
//! 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.
//!
//! ```rust,ignore
//! 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](https://github.com/sreeise/graph-rs)
//! - If you run into issues related to graph-rs specifically please
//! file an issue on [GitHub](https://github.com/sreeise/graph-rs)

#![feature(type_alias_impl_trait)]
#![feature(async_closure)]

extern crate graph_core;
extern crate graph_error;
extern crate graph_oauth;
extern crate handlebars;
extern crate reqwest;
pub extern crate serde;
pub extern crate serde_json;
pub extern crate serde_yaml;
extern crate strum;
extern crate strum_macros;

// mod client needs to stay on top of all other
// client mod declarations for macro use.
/// Main Graph client.
#[macro_use]
pub mod client;
/// Activities request client.
pub mod activities;
/// App catalogs request client.
pub mod app_catalogs;
/// Audit logs request client.
pub mod audit_logs;
/// Planner buckets request client.
pub mod buckets;
// Applications request client.
pub mod applications;
// Attachments request client.
pub mod attachments;
/// Calendar request client.
pub mod calendar;
/// Calendar groups client.
pub mod calendar_groups;
/// Calendar view client.
pub mod calendar_view;
/// Communication call records request client.
pub mod call_records;
/// Communication calls request client.
pub mod calls;
/// Certificate based auth configuration client.
pub mod certificate_based_auth_configuration;
/// Mail folders child folders request client.
pub mod child_folders;
/// Communications client.
pub mod communications;
/// Contact folders client (me, users, etc.).
pub mod contact_folders;
/// Contacts request client.
pub mod contacts;
/// Content types request client.
pub mod content_types;
/// Contracts request client.
pub mod contracts;
/// Groups conversations request client.
pub mod conversations;
/// Data policy operations request client.
pub mod data_policy_operations;
/// Device app management request client.
pub mod device_app_management;
/// Device management request client.
pub mod device_management;
/// Directory request client.
pub mod directory;
/// Domain dns records request client.
pub mod domain_dns_records;
/// Domains request client.
pub mod domains;
/// OneDrive request client.
pub mod drive;
/// Education request client.
pub mod education;
/// Events request client (Calendars).
pub mod events;
/// Extended properties request client.
pub mod extended_properties;
/// Group lifecycle policies request client.
pub mod group_lifecycle_policies;
/// Groups request client.
pub mod groups;
/// Identity request client.
pub mod identity;
/// Inference classification client (me, users, etc.).
pub mod inference_classification;
/// Insights client (me, users, etc.).
pub mod insights;
/// Instances request client (events and calendarView).
pub mod instances;
/// Invitations request client.
pub mod invitations;
/// Items request client.
pub mod items;
/// Lists request client.
pub mod lists;
/// Mail folders request client.
pub mod mail_folders;
/// Managed devices client.
pub mod managed_devices;
/// Me request client.
pub mod me;
/// Messages request client.
pub mod messages;
/// Notebooks request client.
pub mod notebooks;
/// OneNote request client.
pub mod onenote;
/// Contacts/Org Contacts request client.
pub mod org_contact;
/// Outlook request client.
pub mod outlook;
/// Onenote pages request client.
pub mod pages;
/// Onenote parent notebook request client.
pub mod parent_notebook;
/// Onenote parent section request client.
pub mod parent_section;
/// Onenote parent section group request client.
pub mod parent_section_group;
/// Places request client.
pub mod places;
/// Planner request client.
pub mod planner;
/// Planner plans request client.
pub mod plans;
/// Policies request client.
pub mod policies;
/// Groups threads posts request client.
pub mod posts;
/// Schema extensions request client.
pub mod schema_extensions;
/// Onenote section group request client.
pub mod section_groups;
/// Onenote section request client.
pub mod sections;
/// Service principles request client.
pub mod service_principals;
/// Communications call record sessions request client.
pub mod sessions;
/// Settings request client (me, users, etc.).
pub mod settings;
/// Sites request client.
pub mod sites;
/// Subscribed skus request client.
pub mod subscribed_skus;
/// Subscriptions request client.
pub mod subscriptions;
/// Planner tasks request client.
pub mod tasks;
/// Teams request client.
pub mod teams;
/// Teamwork request client.
pub mod teamwork;
/// Groups thread request client.
pub mod threads;
/// Users request client.
pub mod users;

pub static GRAPH_URL: &str = "https://graph.microsoft.com/v1.0";
pub static GRAPH_URL_BETA: &str = "https://graph.microsoft.com/beta";

/// Common structs and traits.
pub mod prelude {
    pub use crate::client::*;
    pub use graph_http::types::{Collection, Delta};
    pub use graph_http::GraphResponse;
}

/// Reexport of graph-oauth crate.
pub mod oauth {
    pub use graph_oauth::jwt;
    pub use graph_oauth::oauth::*;
}

/// Reexport of graph-error crate.
pub mod error {
    pub use graph_error::*;
}

/// Reexport of reqwest headers for use with API requests.
pub mod header {
    pub use reqwest::header::*;
}

/// Types used across multiple crates.
pub mod core {
    pub use graph_core::resource::*;
}