@@ -30,4 +30,319 @@ def __init__(self, session: object) -> None:
30
30
31
31
# Set the endpoint.
32
32
self .endpoint = 'drive'
33
- self .collections_endpoint = 'drives'
33
+ self .collections_endpoint = 'drives/'
34
+
35
+
36
+ def get_drive_item (self , drive_id : str , item_id : str ) -> Dict :
37
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
38
+
39
+ ### Parameters
40
+ ----
41
+ drive_id : str
42
+ The Drive ID in which the resource exist.
43
+
44
+ item_id : str
45
+ The item ID of the object you want to
46
+ return.
47
+
48
+ ### Returns
49
+ ----
50
+ Dict:
51
+ A DriveItem resource object.
52
+ """
53
+
54
+ content = self .graph_session .make_request (
55
+ method = 'get' ,
56
+ endpoint = self .collections_endpoint + "/{drive_id}/items/{item_id}" .format (
57
+ drive_id = drive_id ,
58
+ item_id = item_id
59
+ )
60
+ )
61
+
62
+ return content
63
+
64
+ def get_drive_item_by_path (self , drive_id : str , item_path : str ) -> Dict :
65
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
66
+
67
+ ### Parameters
68
+ ----
69
+ drive_id : str
70
+ The Drive ID in which the resource exist.
71
+
72
+ item_path : str
73
+ The path to the Item.
74
+
75
+ ### Returns
76
+ ----
77
+ Dict:
78
+ A DriveItem resource object.
79
+ """
80
+
81
+ content = self .graph_session .make_request (
82
+ method = 'get' ,
83
+ endpoint = self .collections_endpoint + "/{drive_id}/root:/{path}" .format (
84
+ drive_id = drive_id ,
85
+ path = item_path
86
+ )
87
+ )
88
+
89
+ return content
90
+
91
+ def get_group_drive_item (self , group_id : str , item_id : str ) -> Dict :
92
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
93
+
94
+ ### Parameters
95
+ ----
96
+ group_id : str
97
+ The Group ID in which the resource exist.
98
+
99
+ item_id : str
100
+ The item ID of the object you want to
101
+ return.
102
+
103
+ ### Returns
104
+ ----
105
+ Dict:
106
+ A DriveItem resource object.
107
+ """
108
+
109
+ content = self .graph_session .make_request (
110
+ method = 'get' ,
111
+ endpoint = "/groups/{group_id}/drive/items/{item_id}" .format (
112
+ group_id = group_id ,
113
+ item_id = item_id
114
+ )
115
+ )
116
+
117
+ return content
118
+
119
+ def get_group_drive_item_by_path (self , group_id : str , item_path : str ) -> Dict :
120
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
121
+
122
+ ### Parameters
123
+ ----
124
+ drive_id : str
125
+ The Drive ID in which the resource exist.
126
+
127
+ item_path : str
128
+ The path to the Item.
129
+
130
+ ### Returns
131
+ ----
132
+ Dict:
133
+ A DriveItem resource object.
134
+ """
135
+
136
+ content = self .graph_session .make_request (
137
+ method = 'get' ,
138
+ endpoint = "/groups/{group_id}/drive/root:/{item_path}" .format (
139
+ group_id = group_id ,
140
+ item_path = item_path
141
+ )
142
+ )
143
+
144
+ return content
145
+
146
+ def get_my_drive_item (self , item_id : str ) -> Dict :
147
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
148
+
149
+ ### Parameters
150
+ ----
151
+ item_id : str
152
+ The item ID of the object you want to
153
+ return.
154
+
155
+ ### Returns
156
+ ----
157
+ Dict:
158
+ A DriveItem resource object.
159
+ """
160
+
161
+ content = self .graph_session .make_request (
162
+ method = 'get' ,
163
+ endpoint = "/me/drive/items/{item_id}" .format (
164
+ item_id = item_id
165
+ )
166
+ )
167
+
168
+ return content
169
+
170
+ def get_my_drive_item_by_path (self , item_path : str ) -> Dict :
171
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
172
+
173
+ ### Parameters
174
+ ----
175
+ item_path : str
176
+ The path to the Item.
177
+
178
+ ### Returns
179
+ ----
180
+ Dict:
181
+ A DriveItem resource object.
182
+ """
183
+
184
+ content = self .graph_session .make_request (
185
+ method = 'get' ,
186
+ endpoint = "/me/drive/root:/{item_path}" .format (
187
+ item_path = item_path
188
+ )
189
+ )
190
+
191
+ return content
192
+
193
+ def get_site_drive_item (self , site_id : str , item_id : str ) -> Dict :
194
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
195
+
196
+ ### Parameters
197
+ ----
198
+ site_id : str
199
+ The site ID which to query the item from.
200
+
201
+ item_id : str
202
+ The item ID of the object you want to
203
+ return.
204
+
205
+ ### Returns
206
+ ----
207
+ Dict:
208
+ A DriveItem resource object.
209
+ """
210
+
211
+ content = self .graph_session .make_request (
212
+ method = 'get' ,
213
+ endpoint = "/sites/{site_id}/drive/items/{item_id}" .format (
214
+ site_id = site_id ,
215
+ item_id = item_id
216
+ )
217
+ )
218
+
219
+ return content
220
+
221
+ def get_site_drive_item_by_path (self , site_id : str , item_path : str ) -> Dict :
222
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
223
+
224
+ ### Parameters
225
+ ----
226
+ site_id : str
227
+ The site ID which to query the item from.
228
+
229
+ item_path : str
230
+ The path to the Item.
231
+
232
+ ### Returns
233
+ ----
234
+ Dict:
235
+ A DriveItem resource object.
236
+ """
237
+
238
+ content = self .graph_session .make_request (
239
+ method = 'get' ,
240
+ endpoint = "/sites/{site_id}/drive/root:/{item_path}" .format (
241
+ site_id = site_id ,
242
+ item_path = item_path
243
+ )
244
+ )
245
+
246
+ return content
247
+
248
+ def get_site_drive_item_from_list (self , site_id : str , list_id : str , item_id : str ) -> Dict :
249
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
250
+
251
+ ### Parameters
252
+ ----
253
+ site_id : str
254
+ The site ID which to query the item from.
255
+
256
+ list_id : str
257
+ The list ID which to query the item from.
258
+
259
+ item_id : str
260
+ The item ID of the object you want to
261
+ return.
262
+
263
+ ### Returns
264
+ ----
265
+ Dict:
266
+ A DriveItem resource object.
267
+ """
268
+
269
+ content = self .graph_session .make_request (
270
+ method = 'get' ,
271
+ endpoint = "/sites/{site_id}/lists/{list_id}/items/{item_id}/driveItem" .format (
272
+ site_id = site_id ,
273
+ list_id = list_id ,
274
+ item_id = item_id
275
+ )
276
+ )
277
+
278
+ return content
279
+
280
+ def get_user_drive_item (self , user_id : str , item_id : str ) -> Dict :
281
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
282
+
283
+ ### Parameters
284
+ ----
285
+ user_id : str
286
+ The User ID which to query the item from.
287
+
288
+ item_id : str
289
+ The item ID of the object you want to
290
+ return.
291
+
292
+ ### Returns
293
+ ----
294
+ Dict:
295
+ A DriveItem resource object.
296
+ """
297
+
298
+ content = self .graph_session .make_request (
299
+ method = 'get' ,
300
+ endpoint = "/users/{user_id}/drive/items/{item_id}" .format (
301
+ user_id = user_id ,
302
+ item_id = item_id
303
+ )
304
+ )
305
+
306
+ return content
307
+
308
+ def get_user_drive_item_by_path (self , user_id : str , item_path : str ) -> Dict :
309
+ """Grab's a DriveItem Resource using the Item ID and Drive ID.
310
+
311
+ ### Parameters
312
+ ----
313
+ site_id : str
314
+ The User ID which to query the item from.
315
+
316
+ item_path : str
317
+ The path to the Item.
318
+
319
+ ### Returns
320
+ ----
321
+ Dict:
322
+ A DriveItem resource object.
323
+ """
324
+
325
+ content = self .graph_session .make_request (
326
+ method = 'get' ,
327
+ endpoint = "/users/{user_id}/drive/root:/{item_path}" .format (
328
+ user_id = user_id ,
329
+ item_path = item_path
330
+ )
331
+ )
332
+
333
+ return content
334
+
335
+
336
+ # GET /drives/{drive-id}/items/{item-id}
337
+ # GET /drives/{drive-id}/root:/{item-path}
338
+ # GET /groups/{group-id}/drive/items/{item-id}
339
+ # GET /groups/{group-id}/drive/root:/{item-path}
340
+ # GET /me/drive/items/{item-id}
341
+ # GET /me/drive/root:/{item-path}
342
+
343
+ # GET /sites/{site-id}/drive/items/{item-id}
344
+ # GET /sites/{site-id}/drive/root:/{item-path}
345
+ # GET /sites/{site-id}/lists/{list-id}/items/{item-id}/driveItem
346
+
347
+ # GET /users/{user-id}/drive/items/{item-id}
348
+ # GET /users/{user-id}/drive/root:/{item-path}
0 commit comments