ms-graph 1.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ms_graph/__init__.py +5 -0
- ms_graph/client.py +546 -0
- ms_graph/drive_items.py +296 -0
- ms_graph/drives.py +384 -0
- ms_graph/groups.py +51 -0
- ms_graph/logger/logger_setup.py +7 -0
- ms_graph/mail.py +1073 -0
- ms_graph/notes.py +276 -0
- ms_graph/personal_contacts.py +226 -0
- ms_graph/search.py +48 -0
- ms_graph/session.py +182 -0
- ms_graph/users.py +45 -0
- ms_graph/utils/range.py +331 -0
- ms_graph/workbooks_and_charts/__init__.py +23 -0
- ms_graph/workbooks_and_charts/application.py +109 -0
- ms_graph/workbooks_and_charts/comments.py +159 -0
- ms_graph/workbooks_and_charts/enums.py +252 -0
- ms_graph/workbooks_and_charts/range.py +694 -0
- ms_graph/workbooks_and_charts/table.py +467 -0
- ms_graph/workbooks_and_charts/workbook.py +253 -0
- ms_graph/workbooks_and_charts/worksheets.py +636 -0
- ms_graph-1.5.2.dist-info/METADATA +319 -0
- ms_graph-1.5.2.dist-info/RECORD +25 -0
- ms_graph-1.5.2.dist-info/WHEEL +4 -0
- ms_graph-1.5.2.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Union
|
|
3
|
+
from ms_graph.session import GraphSession
|
|
4
|
+
from ms_graph.utils.range import RangeProperties
|
|
5
|
+
from ms_graph.utils.range import RangeFormatProperties
|
|
6
|
+
|
|
7
|
+
def build_endpoint(inputs: dict) -> str:
|
|
8
|
+
"""Builds the endpoint for the Range object.
|
|
9
|
+
|
|
10
|
+
### Parameters
|
|
11
|
+
----
|
|
12
|
+
inputs : dict
|
|
13
|
+
The `locals()` of the function.
|
|
14
|
+
|
|
15
|
+
### Raises
|
|
16
|
+
----
|
|
17
|
+
ValueError:
|
|
18
|
+
If an item id or item path is not specified
|
|
19
|
+
an error will be raised.
|
|
20
|
+
|
|
21
|
+
### Returns
|
|
22
|
+
----
|
|
23
|
+
str:
|
|
24
|
+
The full URL path.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
item_id = inputs.get("item_id", None)
|
|
28
|
+
item_path = inputs.get("item_path", None)
|
|
29
|
+
worksheet_name_or_id = inputs.get("worksheet_name_or_id", None)
|
|
30
|
+
address = inputs.get("address", None)
|
|
31
|
+
name = inputs.get("name", None)
|
|
32
|
+
table_name_or_id = inputs.get("table_name_or_id", None)
|
|
33
|
+
column_name_or_id = inputs.get("column_name_or_id", None)
|
|
34
|
+
|
|
35
|
+
if item_id:
|
|
36
|
+
workbook_path = f"/me/drive/items/{item_id}/workbook/"
|
|
37
|
+
elif item_path:
|
|
38
|
+
workbook_path = f"/me/drive/root:/{item_path}:/workbook/"
|
|
39
|
+
else:
|
|
40
|
+
raise ValueError("Must specify an Item ID or Item Path.")
|
|
41
|
+
|
|
42
|
+
if (worksheet_name_or_id and address):
|
|
43
|
+
range_path = f"worksheets/{worksheet_name_or_id}/range(address='{address}')"
|
|
44
|
+
elif name:
|
|
45
|
+
range_path = f"names/{name}/range"
|
|
46
|
+
elif (table_name_or_id and column_name_or_id):
|
|
47
|
+
range_path = f"tables/{table_name_or_id}/columns/{column_name_or_id}/range"
|
|
48
|
+
|
|
49
|
+
return workbook_path + range_path
|
|
50
|
+
|
|
51
|
+
class Range:
|
|
52
|
+
|
|
53
|
+
"""
|
|
54
|
+
### Overview:
|
|
55
|
+
----
|
|
56
|
+
Range represents a set of one or more contiguous cells
|
|
57
|
+
such as a cell, a row, a column, block of cells, etc.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
def __init__(self, session: object) -> None:
|
|
61
|
+
"""Initializes the `Range` object.
|
|
62
|
+
|
|
63
|
+
# Parameters
|
|
64
|
+
----
|
|
65
|
+
session : object
|
|
66
|
+
An authenticated session for our Microsoft Graph Client.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
# Set the session.
|
|
70
|
+
self.graph_session: GraphSession = session
|
|
71
|
+
|
|
72
|
+
def get_range(
|
|
73
|
+
self,
|
|
74
|
+
address: str = None,
|
|
75
|
+
name: str = None,
|
|
76
|
+
table_name_or_id: str = None,
|
|
77
|
+
worksheet_name_or_id: str = None,
|
|
78
|
+
column_name_or_id: str = None,
|
|
79
|
+
item_id: str = None,
|
|
80
|
+
item_path: str = None,
|
|
81
|
+
) -> dict:
|
|
82
|
+
"""Retrieve the properties and relationships of range object.
|
|
83
|
+
|
|
84
|
+
### Parameters
|
|
85
|
+
----
|
|
86
|
+
address : str (optional, Default=None)
|
|
87
|
+
The range address.
|
|
88
|
+
|
|
89
|
+
name : str (optional, Default=None)
|
|
90
|
+
|
|
91
|
+
table_name_or_id : str (optional, Default=None)
|
|
92
|
+
The name of the table or the resource id.
|
|
93
|
+
|
|
94
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
95
|
+
The name of the worksheet or the resource id.
|
|
96
|
+
|
|
97
|
+
column_name_or_id : str (optional, Default=None)
|
|
98
|
+
The name of the table column or the resource id.
|
|
99
|
+
This must be specified if you are grabbing a table
|
|
100
|
+
range.
|
|
101
|
+
|
|
102
|
+
item_id : str (optional, Default=None)
|
|
103
|
+
The Drive Item Resource ID.
|
|
104
|
+
|
|
105
|
+
item_path : str (optional, Default=None)
|
|
106
|
+
The Item Path. An Example would be the following:
|
|
107
|
+
`/TestFolder/TestFile.txt`
|
|
108
|
+
|
|
109
|
+
### Returns
|
|
110
|
+
----
|
|
111
|
+
dict:
|
|
112
|
+
A Range object.
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
inputs = {
|
|
116
|
+
"address": address,
|
|
117
|
+
"name": name,
|
|
118
|
+
"table_name_or_id": table_name_or_id,
|
|
119
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
120
|
+
"column_name_or_id": column_name_or_id,
|
|
121
|
+
"item_id": item_id,
|
|
122
|
+
"item_path": item_path
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
126
|
+
|
|
127
|
+
content = self.graph_session.make_request(
|
|
128
|
+
method="get",
|
|
129
|
+
endpoint=endpoint
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
return content
|
|
133
|
+
|
|
134
|
+
def update_range(
|
|
135
|
+
self,
|
|
136
|
+
range_properties: Union[dict, RangeProperties],
|
|
137
|
+
address: str = None,
|
|
138
|
+
name: str = None,
|
|
139
|
+
table_name_or_id: str = None,
|
|
140
|
+
worksheet_name_or_id: str = None,
|
|
141
|
+
column_name_or_id: str = None,
|
|
142
|
+
item_id: str = None,
|
|
143
|
+
item_path: str = None,
|
|
144
|
+
) -> dict:
|
|
145
|
+
"""Retrieve the properties and relationships of range object.
|
|
146
|
+
|
|
147
|
+
### Parameters
|
|
148
|
+
----
|
|
149
|
+
address : str (optional, Default=None)
|
|
150
|
+
The range address.
|
|
151
|
+
|
|
152
|
+
name : str (optional, Default=None)
|
|
153
|
+
|
|
154
|
+
table_name_or_id : str (optional, Default=None)
|
|
155
|
+
The name of the table or the resource id.
|
|
156
|
+
|
|
157
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
158
|
+
The name of the worksheet or the resource id.
|
|
159
|
+
|
|
160
|
+
column_name_or_id : str (optional, Default=None)
|
|
161
|
+
The name of the table column or the resource id.
|
|
162
|
+
This must be specified if you are grabbing a table
|
|
163
|
+
range.
|
|
164
|
+
|
|
165
|
+
item_id : str (optional, Default=None)
|
|
166
|
+
The Drive Item Resource ID.
|
|
167
|
+
|
|
168
|
+
item_path : str (optional, Default=None)
|
|
169
|
+
The Item Path. An Example would be the following:
|
|
170
|
+
`/TestFolder/TestFile.txt`
|
|
171
|
+
|
|
172
|
+
### Returns
|
|
173
|
+
----
|
|
174
|
+
dict:
|
|
175
|
+
A Range object.
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
inputs = {
|
|
179
|
+
"address": address,
|
|
180
|
+
"name": name,
|
|
181
|
+
"table_name_or_id": table_name_or_id,
|
|
182
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
183
|
+
"column_name_or_id": column_name_or_id,
|
|
184
|
+
"item_id": item_id,
|
|
185
|
+
"item_path": item_path
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
189
|
+
|
|
190
|
+
if isinstance(range_properties, RangeProperties):
|
|
191
|
+
range_properties = range_properties.to_dict()
|
|
192
|
+
|
|
193
|
+
content = self.graph_session.make_request(
|
|
194
|
+
method="patch",
|
|
195
|
+
json=range_properties,
|
|
196
|
+
additional_headers={"Content-type": "application/json"},
|
|
197
|
+
endpoint=endpoint,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
return content
|
|
201
|
+
|
|
202
|
+
def insert_range(
|
|
203
|
+
self,
|
|
204
|
+
shift: Union[str, Enum],
|
|
205
|
+
address: str = None,
|
|
206
|
+
name: str = None,
|
|
207
|
+
table_name_or_id: str = None,
|
|
208
|
+
worksheet_name_or_id: str = None,
|
|
209
|
+
column_name_or_id: str = None,
|
|
210
|
+
item_id: str = None,
|
|
211
|
+
item_path: str = None,
|
|
212
|
+
) -> dict:
|
|
213
|
+
"""Retrieve the properties and relationships of range object.
|
|
214
|
+
|
|
215
|
+
### Parameters
|
|
216
|
+
----
|
|
217
|
+
shift : Union[str, Enum]
|
|
218
|
+
Specifies which way to shift the cells. The
|
|
219
|
+
possible values are: Down, Right.
|
|
220
|
+
|
|
221
|
+
address : str (optional, Default=None)
|
|
222
|
+
The range address.
|
|
223
|
+
|
|
224
|
+
name : str (optional, Default=None)
|
|
225
|
+
|
|
226
|
+
table_name_or_id : str (optional, Default=None)
|
|
227
|
+
The name of the table or the resource id.
|
|
228
|
+
|
|
229
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
230
|
+
The name of the worksheet or the resource id.
|
|
231
|
+
|
|
232
|
+
column_name_or_id : str (optional, Default=None)
|
|
233
|
+
The name of the table column or the resource id.
|
|
234
|
+
This must be specified if you are grabbing a table
|
|
235
|
+
range.
|
|
236
|
+
|
|
237
|
+
item_id : str (optional, Default=None)
|
|
238
|
+
The Drive Item Resource ID.
|
|
239
|
+
|
|
240
|
+
item_path : str (optional, Default=None)
|
|
241
|
+
The Item Path. An Example would be the following:
|
|
242
|
+
`/TestFolder/TestFile.txt`
|
|
243
|
+
|
|
244
|
+
### Returns
|
|
245
|
+
----
|
|
246
|
+
dict:
|
|
247
|
+
A Range object.
|
|
248
|
+
"""
|
|
249
|
+
|
|
250
|
+
inputs = {
|
|
251
|
+
"address": address,
|
|
252
|
+
"name": name,
|
|
253
|
+
"table_name_or_id": table_name_or_id,
|
|
254
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
255
|
+
"column_name_or_id": column_name_or_id,
|
|
256
|
+
"item_id": item_id,
|
|
257
|
+
"item_path": item_path
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
261
|
+
endpoint = endpoint + "/insert"
|
|
262
|
+
|
|
263
|
+
if isinstance(shift, Enum):
|
|
264
|
+
shift = shift.value
|
|
265
|
+
|
|
266
|
+
content = self.graph_session.make_request(
|
|
267
|
+
method="post",
|
|
268
|
+
json={"shift": shift},
|
|
269
|
+
additional_headers={"Content-type": "application/json"},
|
|
270
|
+
endpoint=endpoint,
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
return content
|
|
274
|
+
|
|
275
|
+
def get_range_format(
|
|
276
|
+
self,
|
|
277
|
+
address: str = None,
|
|
278
|
+
name: str = None,
|
|
279
|
+
table_name_or_id: str = None,
|
|
280
|
+
worksheet_name_or_id: str = None,
|
|
281
|
+
column_name_or_id: str = None,
|
|
282
|
+
item_id: str = None,
|
|
283
|
+
item_path: str = None,
|
|
284
|
+
) -> dict:
|
|
285
|
+
"""Retrieve the properties and relationships of rangeformat object.
|
|
286
|
+
|
|
287
|
+
### Parameters
|
|
288
|
+
----
|
|
289
|
+
address : str (optional, Default=None)
|
|
290
|
+
The range address.
|
|
291
|
+
|
|
292
|
+
name : str (optional, Default=None)
|
|
293
|
+
|
|
294
|
+
table_name_or_id : str (optional, Default=None)
|
|
295
|
+
The name of the table or the resource id.
|
|
296
|
+
|
|
297
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
298
|
+
The name of the worksheet or the resource id.
|
|
299
|
+
|
|
300
|
+
column_name_or_id : str (optional, Default=None)
|
|
301
|
+
The name of the table column or the resource id.
|
|
302
|
+
This must be specified if you are grabbing a table
|
|
303
|
+
range.
|
|
304
|
+
|
|
305
|
+
item_id : str (optional, Default=None)
|
|
306
|
+
The Drive Item Resource ID.
|
|
307
|
+
|
|
308
|
+
item_path : str (optional, Default=None)
|
|
309
|
+
The Item Path. An Example would be the following:
|
|
310
|
+
`/TestFolder/TestFile.txt`
|
|
311
|
+
|
|
312
|
+
### Returns
|
|
313
|
+
----
|
|
314
|
+
dict:
|
|
315
|
+
A WorkbookFormatRange object.
|
|
316
|
+
"""
|
|
317
|
+
|
|
318
|
+
inputs = {
|
|
319
|
+
"address": address,
|
|
320
|
+
"name": name,
|
|
321
|
+
"table_name_or_id": table_name_or_id,
|
|
322
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
323
|
+
"column_name_or_id": column_name_or_id,
|
|
324
|
+
"item_id": item_id,
|
|
325
|
+
"item_path": item_path
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
329
|
+
endpoint = endpoint + "/format"
|
|
330
|
+
|
|
331
|
+
content = self.graph_session.make_request(
|
|
332
|
+
method="get", endpoint=endpoint)
|
|
333
|
+
|
|
334
|
+
return content
|
|
335
|
+
|
|
336
|
+
def update_range_format(
|
|
337
|
+
self,
|
|
338
|
+
range_format_properties: Union[dict, RangeProperties],
|
|
339
|
+
address: str = None,
|
|
340
|
+
name: str = None,
|
|
341
|
+
table_name_or_id: str = None,
|
|
342
|
+
worksheet_name_or_id: str = None,
|
|
343
|
+
column_name_or_id: str = None,
|
|
344
|
+
item_id: str = None,
|
|
345
|
+
item_path: str = None,
|
|
346
|
+
) -> dict:
|
|
347
|
+
"""Retrieve the properties and relationships of range object.
|
|
348
|
+
|
|
349
|
+
### Parameters
|
|
350
|
+
----
|
|
351
|
+
range_format_properties : Union[dict, RangeProperties]
|
|
352
|
+
Supply the values for relevant fields that should be
|
|
353
|
+
updated. Existing properties that are not included in
|
|
354
|
+
the request body will maintain their previous values
|
|
355
|
+
or be recalculated based on changes to other property
|
|
356
|
+
values. For best performance you shouldn't include
|
|
357
|
+
existing values that haven't changed.
|
|
358
|
+
|
|
359
|
+
address : str (optional, Default=None)
|
|
360
|
+
The range address.
|
|
361
|
+
|
|
362
|
+
name : str (optional, Default=None)
|
|
363
|
+
|
|
364
|
+
table_name_or_id : str (optional, Default=None)
|
|
365
|
+
The name of the table or the resource id.
|
|
366
|
+
|
|
367
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
368
|
+
The name of the worksheet or the resource id.
|
|
369
|
+
|
|
370
|
+
column_name_or_id : str (optional, Default=None)
|
|
371
|
+
The name of the table column or the resource id.
|
|
372
|
+
This must be specified if you are grabbing a table
|
|
373
|
+
range.
|
|
374
|
+
|
|
375
|
+
item_id : str (optional, Default=None)
|
|
376
|
+
The Drive Item Resource ID.
|
|
377
|
+
|
|
378
|
+
item_path : str (optional, Default=None)
|
|
379
|
+
The Item Path. An Example would be the following:
|
|
380
|
+
`/TestFolder/TestFile.txt`
|
|
381
|
+
|
|
382
|
+
### Returns
|
|
383
|
+
----
|
|
384
|
+
dict:
|
|
385
|
+
A Range object.
|
|
386
|
+
"""
|
|
387
|
+
|
|
388
|
+
inputs = {
|
|
389
|
+
"address": address,
|
|
390
|
+
"name": name,
|
|
391
|
+
"table_name_or_id": table_name_or_id,
|
|
392
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
393
|
+
"column_name_or_id": column_name_or_id,
|
|
394
|
+
"item_id": item_id,
|
|
395
|
+
"item_path": item_path
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
399
|
+
endpoint = endpoint + "/format"
|
|
400
|
+
|
|
401
|
+
if isinstance(range_format_properties, RangeFormatProperties):
|
|
402
|
+
range_format_properties = range_format_properties.to_dict()
|
|
403
|
+
|
|
404
|
+
content = self.graph_session.make_request(
|
|
405
|
+
method="patch",
|
|
406
|
+
json=range_format_properties,
|
|
407
|
+
additional_headers={"Content-type": "application/json"},
|
|
408
|
+
endpoint=endpoint,
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
return content
|
|
412
|
+
|
|
413
|
+
def merge(
|
|
414
|
+
self,
|
|
415
|
+
across: bool = False,
|
|
416
|
+
address: str = None,
|
|
417
|
+
name: str = None,
|
|
418
|
+
table_name_or_id: str = None,
|
|
419
|
+
worksheet_name_or_id: str = None,
|
|
420
|
+
column_name_or_id: str = None,
|
|
421
|
+
item_id: str = None,
|
|
422
|
+
item_path: str = None,
|
|
423
|
+
) -> dict:
|
|
424
|
+
"""Merge the range cells into one region in the worksheet.
|
|
425
|
+
|
|
426
|
+
# Parameters
|
|
427
|
+
----
|
|
428
|
+
across : bool (optional, Default=False)
|
|
429
|
+
Set to `True` to merge cells in each row
|
|
430
|
+
of the specified range as separate merged
|
|
431
|
+
cells.
|
|
432
|
+
|
|
433
|
+
address : str (optional, Default=None)
|
|
434
|
+
The range address.
|
|
435
|
+
|
|
436
|
+
name : str (optional, Default=None)
|
|
437
|
+
|
|
438
|
+
table_name_or_id : str (optional, Default=None)
|
|
439
|
+
The name of the table or the resource id.
|
|
440
|
+
|
|
441
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
442
|
+
The name of the worksheet or the resource id.
|
|
443
|
+
|
|
444
|
+
column_name_or_id : str (optional, Default=None)
|
|
445
|
+
The name of the table column or the resource id.
|
|
446
|
+
This must be specified if you are grabbing a table
|
|
447
|
+
range.
|
|
448
|
+
|
|
449
|
+
item_id : str (optional, Default=None)
|
|
450
|
+
The Drive Item Resource ID.
|
|
451
|
+
|
|
452
|
+
item_path : str (optional, Default=None)
|
|
453
|
+
The Item Path. An Example would be the following:
|
|
454
|
+
`/TestFolder/TestFile.txt`
|
|
455
|
+
|
|
456
|
+
### Returns
|
|
457
|
+
----
|
|
458
|
+
dict:
|
|
459
|
+
A Response object.
|
|
460
|
+
"""
|
|
461
|
+
|
|
462
|
+
inputs = {
|
|
463
|
+
"address": address,
|
|
464
|
+
"name": name,
|
|
465
|
+
"table_name_or_id": table_name_or_id,
|
|
466
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
467
|
+
"column_name_or_id": column_name_or_id,
|
|
468
|
+
"item_id": item_id,
|
|
469
|
+
"item_path": item_path
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
473
|
+
endpoint = endpoint + "/merge"
|
|
474
|
+
|
|
475
|
+
body = {"across": across}
|
|
476
|
+
|
|
477
|
+
content = self.graph_session.make_request(
|
|
478
|
+
method="post",
|
|
479
|
+
json=body,
|
|
480
|
+
additional_headers={"Content-type": "application/json"},
|
|
481
|
+
endpoint=endpoint,
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
return content
|
|
485
|
+
|
|
486
|
+
def unmerge(
|
|
487
|
+
self,
|
|
488
|
+
address: str = None,
|
|
489
|
+
name: str = None,
|
|
490
|
+
table_name_or_id: str = None,
|
|
491
|
+
worksheet_name_or_id: str = None,
|
|
492
|
+
column_name_or_id: str = None,
|
|
493
|
+
item_id: str = None,
|
|
494
|
+
item_path: str = None,
|
|
495
|
+
) -> dict:
|
|
496
|
+
"""Unmerge the range cells into seperate regions.
|
|
497
|
+
|
|
498
|
+
### Parameters
|
|
499
|
+
----
|
|
500
|
+
address : str (optional, Default=None)
|
|
501
|
+
The range address.
|
|
502
|
+
|
|
503
|
+
name : str (optional, Default=None)
|
|
504
|
+
|
|
505
|
+
table_name_or_id : str (optional, Default=None)
|
|
506
|
+
The name of the table or the resource id.
|
|
507
|
+
|
|
508
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
509
|
+
The name of the worksheet or the resource id.
|
|
510
|
+
|
|
511
|
+
column_name_or_id : str (optional, Default=None)
|
|
512
|
+
The name of the table column or the resource id.
|
|
513
|
+
This must be specified if you are grabbing a table
|
|
514
|
+
range.
|
|
515
|
+
|
|
516
|
+
item_id : str (optional, Default=None)
|
|
517
|
+
The Drive Item Resource ID.
|
|
518
|
+
|
|
519
|
+
item_path : str (optional, Default=None)
|
|
520
|
+
The Item Path. An Example would be the following:
|
|
521
|
+
`/TestFolder/TestFile.txt`
|
|
522
|
+
|
|
523
|
+
### Returns
|
|
524
|
+
----
|
|
525
|
+
dict:
|
|
526
|
+
A Response object.
|
|
527
|
+
"""
|
|
528
|
+
|
|
529
|
+
inputs = {
|
|
530
|
+
"address": address,
|
|
531
|
+
"name": name,
|
|
532
|
+
"table_name_or_id": table_name_or_id,
|
|
533
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
534
|
+
"column_name_or_id": column_name_or_id,
|
|
535
|
+
"item_id": item_id,
|
|
536
|
+
"item_path": item_path
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
540
|
+
endpoint = endpoint + "/unmerge"
|
|
541
|
+
|
|
542
|
+
content = self.graph_session.make_request(
|
|
543
|
+
method="post",
|
|
544
|
+
additional_headers={"Content-type": "application/json"},
|
|
545
|
+
endpoint=endpoint,
|
|
546
|
+
)
|
|
547
|
+
|
|
548
|
+
return content
|
|
549
|
+
|
|
550
|
+
def clear(
|
|
551
|
+
self,
|
|
552
|
+
apply_to: Union[str, Enum] = None,
|
|
553
|
+
address: str = None,
|
|
554
|
+
name: str = None,
|
|
555
|
+
table_name_or_id: str = None,
|
|
556
|
+
worksheet_name_or_id: str = None,
|
|
557
|
+
column_name_or_id: str = None,
|
|
558
|
+
item_id: str = None,
|
|
559
|
+
item_path: str = None,
|
|
560
|
+
) -> dict:
|
|
561
|
+
"""Clear range values such as format, fill, and border.
|
|
562
|
+
|
|
563
|
+
### Parameters
|
|
564
|
+
----
|
|
565
|
+
apply_to : Union[str, Enum] (optional, Default=None)
|
|
566
|
+
Determines the type of clear action. The possible
|
|
567
|
+
values are: `All`, `Formats`, `Contents`.
|
|
568
|
+
|
|
569
|
+
address : str (optional, Default=None)
|
|
570
|
+
The range address.
|
|
571
|
+
|
|
572
|
+
name : str (optional, Default=None)
|
|
573
|
+
|
|
574
|
+
table_name_or_id : str (optional, Default=None)
|
|
575
|
+
The name of the table or the resource id.
|
|
576
|
+
|
|
577
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
578
|
+
The name of the worksheet or the resource id.
|
|
579
|
+
|
|
580
|
+
column_name_or_id : str (optional, Default=None)
|
|
581
|
+
The name of the table column or the resource id.
|
|
582
|
+
This must be specified if you are grabbing a table
|
|
583
|
+
range.
|
|
584
|
+
|
|
585
|
+
item_id : str (optional, Default=None)
|
|
586
|
+
The Drive Item Resource ID.
|
|
587
|
+
|
|
588
|
+
item_path : str (optional, Default=None)
|
|
589
|
+
The Item Path. An Example would be the following:
|
|
590
|
+
`/TestFolder/TestFile.txt`
|
|
591
|
+
|
|
592
|
+
### Returns
|
|
593
|
+
----
|
|
594
|
+
dict:
|
|
595
|
+
A Response object.
|
|
596
|
+
"""
|
|
597
|
+
|
|
598
|
+
inputs = {
|
|
599
|
+
"address": address,
|
|
600
|
+
"name": name,
|
|
601
|
+
"table_name_or_id": table_name_or_id,
|
|
602
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
603
|
+
"column_name_or_id": column_name_or_id,
|
|
604
|
+
"item_id": item_id,
|
|
605
|
+
"item_path": item_path
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
609
|
+
endpoint = endpoint + "/clear"
|
|
610
|
+
|
|
611
|
+
if isinstance(apply_to, Enum):
|
|
612
|
+
apply_to = apply_to.value
|
|
613
|
+
|
|
614
|
+
content = self.graph_session.make_request(
|
|
615
|
+
method="post",
|
|
616
|
+
json={"applyTo": apply_to},
|
|
617
|
+
additional_headers={"Content-type": "application/json"},
|
|
618
|
+
endpoint=endpoint,
|
|
619
|
+
)
|
|
620
|
+
|
|
621
|
+
return content
|
|
622
|
+
|
|
623
|
+
def delete(
|
|
624
|
+
self,
|
|
625
|
+
shift: Union[str, Enum] = None,
|
|
626
|
+
address: str = None,
|
|
627
|
+
name: str = None,
|
|
628
|
+
table_name_or_id: str = None,
|
|
629
|
+
worksheet_name_or_id: str = None,
|
|
630
|
+
column_name_or_id: str = None,
|
|
631
|
+
item_id: str = None,
|
|
632
|
+
item_path: str = None,
|
|
633
|
+
) -> dict:
|
|
634
|
+
"""Deletes the cells associated with the range.
|
|
635
|
+
|
|
636
|
+
### Parameters
|
|
637
|
+
----
|
|
638
|
+
shift : Union[str, Enum] (optional, Default=None)
|
|
639
|
+
Specifies which way to shift the cells. The possible
|
|
640
|
+
values are: `Up` and `Left`.
|
|
641
|
+
|
|
642
|
+
address : str (optional, Default=None)
|
|
643
|
+
The range address.
|
|
644
|
+
|
|
645
|
+
name : str (optional, Default=None)
|
|
646
|
+
|
|
647
|
+
table_name_or_id : str (optional, Default=None)
|
|
648
|
+
The name of the table or the resource id.
|
|
649
|
+
|
|
650
|
+
worksheet_name_or_id : str (optional, Default=None)
|
|
651
|
+
The name of the worksheet or the resource id.
|
|
652
|
+
|
|
653
|
+
column_name_or_id : str (optional, Default=None)
|
|
654
|
+
The name of the table column or the resource id.
|
|
655
|
+
This must be specified if you are grabbing a table
|
|
656
|
+
range.
|
|
657
|
+
|
|
658
|
+
item_id : str (optional, Default=None)
|
|
659
|
+
The Drive Item Resource ID.
|
|
660
|
+
|
|
661
|
+
item_path : str (optional, Default=None)
|
|
662
|
+
The Item Path. An Example would be the following:
|
|
663
|
+
`/TestFolder/TestFile.txt`
|
|
664
|
+
|
|
665
|
+
### Returns
|
|
666
|
+
----
|
|
667
|
+
dict:
|
|
668
|
+
A Response object.
|
|
669
|
+
"""
|
|
670
|
+
|
|
671
|
+
inputs = {
|
|
672
|
+
"address": address,
|
|
673
|
+
"name": name,
|
|
674
|
+
"table_name_or_id": table_name_or_id,
|
|
675
|
+
"worksheet_name_or_id":worksheet_name_or_id,
|
|
676
|
+
"column_name_or_id": column_name_or_id,
|
|
677
|
+
"item_id": item_id,
|
|
678
|
+
"item_path": item_path
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
endpoint = build_endpoint(inputs=inputs)
|
|
682
|
+
endpoint = endpoint + "/delete"
|
|
683
|
+
|
|
684
|
+
if isinstance(shift, Enum):
|
|
685
|
+
shift = shift.value
|
|
686
|
+
|
|
687
|
+
content = self.graph_session.make_request(
|
|
688
|
+
method="post",
|
|
689
|
+
json={"shift": shift},
|
|
690
|
+
additional_headers={"Content-type": "application/json"},
|
|
691
|
+
endpoint=endpoint,
|
|
692
|
+
)
|
|
693
|
+
|
|
694
|
+
return content
|