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)
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.
/// Activities request client.
/// App catalogs request client.
/// Audit logs request client.
/// Planner buckets request client.
// Applications request client.
// Attachments request client.
/// Calendar request client.
/// Calendar groups client.
/// Calendar view client.
/// Communication call records request client.
/// Communication calls request client.
/// Certificate based auth configuration client.
/// Mail folders child folders request client.
/// Communications client.
/// Contact folders client (me, users, etc.).
/// Contacts request client.
/// Content types request client.
/// Contracts request client.
/// Groups conversations request client.
/// Data policy operations request client.
/// Device app management request client.
/// Device management request client.
/// Directory request client.
/// Domain dns records request client.
/// Domains request client.
/// OneDrive request client.
/// Education request client.
/// Events request client (Calendars).
/// Extended properties request client.
/// Group lifecycle policies request client.
/// Groups request client.
/// Identity request client.
/// Inference classification client (me, users, etc.).
/// Insights client (me, users, etc.).
/// Instances request client (events and calendarView).
/// Invitations request client.
/// Items request client.
/// Lists request client.
/// Mail folders request client.
/// Managed devices client.
/// Me request client.
/// Messages request client.
/// Notebooks request client.
/// OneNote request client.
/// Contacts/Org Contacts request client.
/// Outlook request client.
/// Onenote pages request client.
/// Onenote parent notebook request client.
/// Onenote parent section request client.
/// Onenote parent section group request client.
/// Places request client.
/// Planner request client.
/// Planner plans request client.
/// Policies request client.
/// Groups threads posts request client.
/// Schema extensions request client.
/// Onenote section group request client.
/// Onenote section request client.
/// Service principles request client.
/// Communications call record sessions request client.
/// Settings request client (me, users, etc.).
/// Sites request client.
/// Subscribed skus request client.
/// Subscriptions request client.
/// Planner tasks request client.
/// Teams request client.
/// Teamwork request client.
/// Groups thread request client.
/// Users request client.
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.
/// Reexport of graph-oauth crate.
/// Reexport of graph-error crate.
/// Reexport of reqwest headers for use with API requests.
/// Types used across multiple crates.