smartsheet-python-sdk 3.5.5__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.
Files changed (195) hide show
  1. smartsheet/__init__.py +37 -0
  2. smartsheet/attachments.py +565 -0
  3. smartsheet/cells.py +164 -0
  4. smartsheet/contacts.py +78 -0
  5. smartsheet/discussions.py +411 -0
  6. smartsheet/events.py +79 -0
  7. smartsheet/exceptions.py +130 -0
  8. smartsheet/favorites.py +116 -0
  9. smartsheet/folders.py +438 -0
  10. smartsheet/groups.py +186 -0
  11. smartsheet/home.py +180 -0
  12. smartsheet/images.py +61 -0
  13. smartsheet/models/__init__.py +126 -0
  14. smartsheet/models/access_token.py +95 -0
  15. smartsheet/models/account.py +77 -0
  16. smartsheet/models/alternate_email.py +88 -0
  17. smartsheet/models/asset_share.py +165 -0
  18. smartsheet/models/asset_shares_paginated_result.py +84 -0
  19. smartsheet/models/attachment.py +181 -0
  20. smartsheet/models/auto_number_format.py +81 -0
  21. smartsheet/models/automation_action.py +162 -0
  22. smartsheet/models/automation_rule.py +164 -0
  23. smartsheet/models/boolean_object_value.py +38 -0
  24. smartsheet/models/bulk_item_failure.py +77 -0
  25. smartsheet/models/bulk_item_result.py +111 -0
  26. smartsheet/models/cell.py +193 -0
  27. smartsheet/models/cell_data_item.py +152 -0
  28. smartsheet/models/cell_history.py +67 -0
  29. smartsheet/models/cell_link.py +91 -0
  30. smartsheet/models/cell_link_widget_content.py +101 -0
  31. smartsheet/models/chart_widget_content.py +124 -0
  32. smartsheet/models/column.py +253 -0
  33. smartsheet/models/comment.py +126 -0
  34. smartsheet/models/contact.py +88 -0
  35. smartsheet/models/contact_object_value.py +59 -0
  36. smartsheet/models/container_destination.py +74 -0
  37. smartsheet/models/copy_or_move_row_destination.py +54 -0
  38. smartsheet/models/copy_or_move_row_directive.py +64 -0
  39. smartsheet/models/copy_or_move_row_result.py +67 -0
  40. smartsheet/models/criteria.py +82 -0
  41. smartsheet/models/cross_sheet_reference.py +134 -0
  42. smartsheet/models/currency.py +64 -0
  43. smartsheet/models/date_object_value.py +56 -0
  44. smartsheet/models/datetime_object_value.py +56 -0
  45. smartsheet/models/discussion.py +183 -0
  46. smartsheet/models/downloaded_file.py +106 -0
  47. smartsheet/models/duration.py +112 -0
  48. smartsheet/models/email.py +82 -0
  49. smartsheet/models/enums/__init__.py +56 -0
  50. smartsheet/models/enums/access_level.py +26 -0
  51. smartsheet/models/enums/asset_type.py +10 -0
  52. smartsheet/models/enums/attachment_parent_type.py +23 -0
  53. smartsheet/models/enums/attachment_sub_type.py +26 -0
  54. smartsheet/models/enums/attachment_type.py +29 -0
  55. smartsheet/models/enums/automation_action_frequency.py +24 -0
  56. smartsheet/models/enums/automation_action_type.py +23 -0
  57. smartsheet/models/enums/automation_rule_disabled_reason.py +27 -0
  58. smartsheet/models/enums/cell_link_status.py +28 -0
  59. smartsheet/models/enums/column_type.py +31 -0
  60. smartsheet/models/enums/criteria_target.py +21 -0
  61. smartsheet/models/enums/cross_sheet_reference_status.py +28 -0
  62. smartsheet/models/enums/currency_code.py +43 -0
  63. smartsheet/models/enums/day_descriptors.py +30 -0
  64. smartsheet/models/enums/day_ordinal.py +25 -0
  65. smartsheet/models/enums/event_action.py +76 -0
  66. smartsheet/models/enums/event_obejct_type.py +34 -0
  67. smartsheet/models/enums/event_source.py +27 -0
  68. smartsheet/models/enums/global_template.py +23 -0
  69. smartsheet/models/enums/operator.py +62 -0
  70. smartsheet/models/enums/paper_type.py +29 -0
  71. smartsheet/models/enums/predecessor_type.py +24 -0
  72. smartsheet/models/enums/publish_accessible_by.py +22 -0
  73. smartsheet/models/enums/schedule_type.py +25 -0
  74. smartsheet/models/enums/seat_type.py +17 -0
  75. smartsheet/models/enums/share_scope.py +22 -0
  76. smartsheet/models/enums/share_type.py +22 -0
  77. smartsheet/models/enums/sheet_email_format.py +23 -0
  78. smartsheet/models/enums/sheet_filter_operator.py +22 -0
  79. smartsheet/models/enums/sheet_filter_type.py +23 -0
  80. smartsheet/models/enums/sort_direction.py +22 -0
  81. smartsheet/models/enums/symbol.py +45 -0
  82. smartsheet/models/enums/system_column_type.py +25 -0
  83. smartsheet/models/enums/update_request_status.py +23 -0
  84. smartsheet/models/enums/user_status.py +23 -0
  85. smartsheet/models/enums/widget_type.py +32 -0
  86. smartsheet/models/error.py +74 -0
  87. smartsheet/models/error_result.py +117 -0
  88. smartsheet/models/event.py +153 -0
  89. smartsheet/models/event_result.py +86 -0
  90. smartsheet/models/explicit_null.py +24 -0
  91. smartsheet/models/favorite.py +81 -0
  92. smartsheet/models/folder.py +177 -0
  93. smartsheet/models/font_family.py +63 -0
  94. smartsheet/models/format_details.py +55 -0
  95. smartsheet/models/format_tables.py +191 -0
  96. smartsheet/models/group.py +134 -0
  97. smartsheet/models/group_member.py +104 -0
  98. smartsheet/models/home.py +110 -0
  99. smartsheet/models/hyperlink.py +81 -0
  100. smartsheet/models/image.py +101 -0
  101. smartsheet/models/image_url.py +91 -0
  102. smartsheet/models/image_url_map.py +68 -0
  103. smartsheet/models/image_widget_content.py +117 -0
  104. smartsheet/models/index_result.py +118 -0
  105. smartsheet/models/json_object.py +59 -0
  106. smartsheet/models/multi_contact_object_value.py +49 -0
  107. smartsheet/models/multi_picklist_object_value.py +48 -0
  108. smartsheet/models/multi_row_email.py +60 -0
  109. smartsheet/models/number_object_value.py +38 -0
  110. smartsheet/models/o_auth_error.py +86 -0
  111. smartsheet/models/object_value.py +130 -0
  112. smartsheet/models/paginated_children_result.py +80 -0
  113. smartsheet/models/predecessor.py +102 -0
  114. smartsheet/models/predecessor_list.py +49 -0
  115. smartsheet/models/primitive_object_value.py +59 -0
  116. smartsheet/models/profile_image.py +72 -0
  117. smartsheet/models/project_settings.py +89 -0
  118. smartsheet/models/recipient.py +63 -0
  119. smartsheet/models/report.py +90 -0
  120. smartsheet/models/report_cell.py +59 -0
  121. smartsheet/models/report_column.py +67 -0
  122. smartsheet/models/report_publish.py +95 -0
  123. smartsheet/models/report_row.py +68 -0
  124. smartsheet/models/report_widget_content.py +78 -0
  125. smartsheet/models/result.py +105 -0
  126. smartsheet/models/row.py +336 -0
  127. smartsheet/models/row_email.py +83 -0
  128. smartsheet/models/row_mapping.py +77 -0
  129. smartsheet/models/schedule.py +140 -0
  130. smartsheet/models/scope.py +70 -0
  131. smartsheet/models/search_result.py +67 -0
  132. smartsheet/models/search_result_item.py +150 -0
  133. smartsheet/models/selection_range.py +86 -0
  134. smartsheet/models/sent_update_request.py +172 -0
  135. smartsheet/models/server_info.py +67 -0
  136. smartsheet/models/share.py +183 -0
  137. smartsheet/models/sheet.py +462 -0
  138. smartsheet/models/sheet_email.py +81 -0
  139. smartsheet/models/sheet_filter.py +106 -0
  140. smartsheet/models/sheet_filter_details.py +76 -0
  141. smartsheet/models/sheet_publish.py +184 -0
  142. smartsheet/models/sheet_summary.py +59 -0
  143. smartsheet/models/sheet_user_permissions.py +58 -0
  144. smartsheet/models/sheet_user_settings.py +72 -0
  145. smartsheet/models/shortcut_data_item.py +102 -0
  146. smartsheet/models/shortcut_widget_content.py +61 -0
  147. smartsheet/models/sight.py +175 -0
  148. smartsheet/models/sight_publish.py +77 -0
  149. smartsheet/models/sort_criterion.py +64 -0
  150. smartsheet/models/sort_specifier.py +55 -0
  151. smartsheet/models/source.py +83 -0
  152. smartsheet/models/string_object_value.py +38 -0
  153. smartsheet/models/summary_field.py +256 -0
  154. smartsheet/models/template.py +171 -0
  155. smartsheet/models/title_rich_text_widget_content.py +68 -0
  156. smartsheet/models/token_paginated_result.py +79 -0
  157. smartsheet/models/update_request.py +110 -0
  158. smartsheet/models/user.py +58 -0
  159. smartsheet/models/user_model.py +280 -0
  160. smartsheet/models/user_plan.py +77 -0
  161. smartsheet/models/user_profile.py +89 -0
  162. smartsheet/models/version.py +57 -0
  163. smartsheet/models/web_content_widget_content.py +60 -0
  164. smartsheet/models/webhook.py +219 -0
  165. smartsheet/models/webhook_secret.py +58 -0
  166. smartsheet/models/webhook_stats.py +76 -0
  167. smartsheet/models/webhook_subscope.py +50 -0
  168. smartsheet/models/widget.py +211 -0
  169. smartsheet/models/widget_content.py +52 -0
  170. smartsheet/models/widget_hyperlink.py +74 -0
  171. smartsheet/models/workspace.py +185 -0
  172. smartsheet/object_value.py +72 -0
  173. smartsheet/passthrough.py +127 -0
  174. smartsheet/reports.py +382 -0
  175. smartsheet/search.py +100 -0
  176. smartsheet/server.py +48 -0
  177. smartsheet/session.py +70 -0
  178. smartsheet/sharing.py +163 -0
  179. smartsheet/sheets.py +2062 -0
  180. smartsheet/sights.py +370 -0
  181. smartsheet/smartsheet.py +684 -0
  182. smartsheet/templates.py +87 -0
  183. smartsheet/token.py +128 -0
  184. smartsheet/types.py +323 -0
  185. smartsheet/users.py +490 -0
  186. smartsheet/util.py +199 -0
  187. smartsheet/version.py +34 -0
  188. smartsheet/webhooks.py +161 -0
  189. smartsheet/workspaces.py +647 -0
  190. smartsheet_python_sdk-3.5.5.dist-info/METADATA +120 -0
  191. smartsheet_python_sdk-3.5.5.dist-info/RECORD +195 -0
  192. smartsheet_python_sdk-3.5.5.dist-info/WHEEL +5 -0
  193. smartsheet_python_sdk-3.5.5.dist-info/licenses/LICENSE.md +201 -0
  194. smartsheet_python_sdk-3.5.5.dist-info/licenses/NOTICE +10 -0
  195. smartsheet_python_sdk-3.5.5.dist-info/top_level.txt +1 -0
smartsheet/sights.py ADDED
@@ -0,0 +1,370 @@
1
+ # pylint: disable=C0111,R0902,R0913
2
+ # Smartsheet Python SDK.
3
+ #
4
+ # Copyright 2017 Smartsheet.com, Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License"): you may
7
+ # not use this file except in compliance with the License. You may obtain
8
+ # a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ import logging
19
+ from datetime import datetime
20
+
21
+ from . import fresh_operation
22
+
23
+
24
+ class Sights:
25
+
26
+ """Class for handling Sights operations."""
27
+
28
+ def __init__(self, smartsheet_obj):
29
+ """Init Sights with base Smartsheet object."""
30
+ self._base = smartsheet_obj
31
+ self._log = logging.getLogger(__name__)
32
+
33
+ def list_sights(
34
+ self, page_size=None, page=None, include_all=None, modified_since=None
35
+ ):
36
+ """Get the list of all Sights the User has access to, in alphabetical
37
+ order, by name.
38
+
39
+ Args:
40
+ page_size (int): The maximum number of items to
41
+ return per page.
42
+ page (int): Which page to return.
43
+ include_all (bool): If true, include all results
44
+ (i.e. do not paginate).
45
+ modified_since(datetime): return sights modified since datetime
46
+
47
+ Returns:
48
+ IndexResult
49
+ """
50
+ _op = fresh_operation("list_sights")
51
+ _op["method"] = "GET"
52
+ _op["path"] = "/sights"
53
+ _op["query_params"]["pageSize"] = page_size
54
+ _op["query_params"]["page"] = page
55
+ _op["query_params"]["includeAll"] = include_all
56
+ if isinstance(modified_since, datetime):
57
+ _op["query_params"]["modifiedSince"] = modified_since.isoformat()
58
+
59
+ expected = ["IndexResult", "Sight"]
60
+
61
+ prepped_request = self._base.prepare_request(_op)
62
+ response = self._base.request(prepped_request, expected, _op)
63
+
64
+ return response
65
+
66
+ def get_sight(self, sight_id, level=None, include=None):
67
+ """Get the specified Sight.
68
+
69
+ Args:
70
+ sight_id (int): Sight ID
71
+ level (int): compatibility level
72
+ include (list[str]): optional include parameters
73
+
74
+ Returns:
75
+ Sight
76
+ """
77
+ _op = fresh_operation("get_sight")
78
+ _op["method"] = "GET"
79
+ _op["path"] = "/sights/" + str(sight_id)
80
+ _op["query_params"]["include"] = include
81
+ _op["query_params"]["level"] = level
82
+
83
+ expected = "Sight"
84
+ prepped_request = self._base.prepare_request(_op)
85
+ response = self._base.request(prepped_request, expected, _op)
86
+
87
+ return response
88
+
89
+ def update_sight(self, sight_id, sight_obj):
90
+ """Updates the specified Sight.
91
+
92
+ Args:
93
+ sight_id (int): Sight ID
94
+ sight_obj (Sight): Sight object.
95
+
96
+ Returns:
97
+ Result
98
+ """
99
+ _op = fresh_operation("update_sight")
100
+ _op["method"] = "PUT"
101
+ _op["path"] = "/sights/" + str(sight_id)
102
+ _op["json"] = sight_obj
103
+
104
+ expected = ["Result", "Sight"]
105
+
106
+ prepped_request = self._base.prepare_request(_op)
107
+ response = self._base.request(prepped_request, expected, _op)
108
+
109
+ return response
110
+
111
+ def delete_sight(self, sight_id):
112
+ """Delete the specified Sight.
113
+
114
+ Args:
115
+ sight_id (int): Sight ID
116
+
117
+ Returns:
118
+ Result
119
+ """
120
+ _op = fresh_operation("delete_sight")
121
+ _op["method"] = "DELETE"
122
+ _op["path"] = "/sights/" + str(sight_id)
123
+
124
+ expected = ["Result", None]
125
+ prepped_request = self._base.prepare_request(_op)
126
+ response = self._base.request(prepped_request, expected, _op)
127
+
128
+ return response
129
+
130
+ def copy_sight(self, sight_id, container_destination_obj):
131
+ """Creates a copy of the specified Sight
132
+
133
+ Args:
134
+ sight_id (int): Sight ID
135
+ container_destination_obj
136
+ (ContainerDestination): Container Destination object.
137
+
138
+ Returns:
139
+ Result
140
+ """
141
+ _op = fresh_operation("copy_sight")
142
+ _op["method"] = "POST"
143
+ _op["path"] = "/sights/" + str(sight_id) + "/copy"
144
+ _op["json"] = container_destination_obj
145
+
146
+ expected = ["Result", "Sight"]
147
+
148
+ prepped_request = self._base.prepare_request(_op)
149
+ response = self._base.request(prepped_request, expected, _op)
150
+
151
+ return response
152
+
153
+ def move_sight(self, sight_id, container_destination_obj):
154
+ """Creates a copy of the specified Sight
155
+
156
+ Args:
157
+ sight_id (int): Sight ID
158
+ container_destination_obj
159
+ (ContainerDestination): Container Destination object.
160
+
161
+ Returns:
162
+ Result
163
+ """
164
+ _op = fresh_operation("move_sight")
165
+ _op["method"] = "POST"
166
+ _op["path"] = "/sights/" + str(sight_id) + "/move"
167
+ _op["json"] = container_destination_obj
168
+
169
+ expected = ["Result", "Sight"]
170
+
171
+ prepped_request = self._base.prepare_request(_op)
172
+ response = self._base.request(prepped_request, expected, _op)
173
+
174
+ return response
175
+
176
+ def list_shares(
177
+ self,
178
+ sight_id,
179
+ page_size=None,
180
+ page=None,
181
+ include_all=None,
182
+ include_workspace_shares=False,
183
+ ):
184
+ """Get the list of all Users and Groups to whom the specified Sight is
185
+ shared, and their access level.
186
+
187
+ Args:
188
+ sight_id (int): Sight ID
189
+ page_size (int): The maximum number of items to
190
+ return per page.
191
+ page (int): Which page to return.
192
+ include_all (bool): If true, include all results
193
+ (i.e. do not paginate).
194
+ include_workspace_shares(bool): Include Workspace shares
195
+
196
+ Returns:
197
+ IndexResult
198
+ """
199
+ _op = fresh_operation("list_shares")
200
+ _op["method"] = "GET"
201
+ _op["path"] = "/sights/" + str(sight_id) + "/shares"
202
+ _op["query_params"]["pageSize"] = page_size
203
+ _op["query_params"]["page"] = page
204
+ _op["query_params"]["includeAll"] = include_all
205
+ if include_workspace_shares:
206
+ _op["query_params"]["include"] = "workspaceShares"
207
+
208
+ expected = ["IndexResult", "Share"]
209
+
210
+ prepped_request = self._base.prepare_request(_op)
211
+ response = self._base.request(prepped_request, expected, _op)
212
+
213
+ return response
214
+
215
+ def get_share(self, sight_id, share_id):
216
+ """Get the specified Share.
217
+
218
+ Args:
219
+ sight_id (int): Sight ID
220
+ share_id (str): Share ID
221
+
222
+ Returns:
223
+ Share
224
+ """
225
+ _op = fresh_operation("get_share")
226
+ _op["method"] = "GET"
227
+ _op["path"] = "/sights/" + str(sight_id) + "/shares/" + str(share_id)
228
+
229
+ expected = "Share"
230
+ prepped_request = self._base.prepare_request(_op)
231
+ response = self._base.request(prepped_request, expected, _op)
232
+
233
+ return response
234
+
235
+ def share_sight(self, sight_id, share_obj, send_email=False):
236
+ """Share the specified Sight.
237
+
238
+ Share the specified Sight with the specified Users and
239
+ Groups.
240
+
241
+ Args:
242
+ sight_id (int): Sight ID
243
+ share_obj (Share): Share object.
244
+ send_email (bool): Either true or false to
245
+ indicate whether or not to notify the user by email. Default
246
+ is false.
247
+
248
+ Returns:
249
+ Result
250
+ """
251
+ _op = fresh_operation("share_sight")
252
+ _op["method"] = "POST"
253
+ _op["path"] = "/sights/" + str(sight_id) + "/shares"
254
+ _op["query_params"]["sendEmail"] = send_email
255
+ _op["json"] = share_obj
256
+
257
+ expected = ["Result", "Share"]
258
+
259
+ prepped_request = self._base.prepare_request(_op)
260
+ response = self._base.request(prepped_request, expected, _op)
261
+
262
+ return response
263
+
264
+ def update_share(self, sight_id, share_id, share_obj):
265
+ """Update the access level of a User or Group for the specified Sight.
266
+
267
+ Args:
268
+ sight_id (int): Sight ID
269
+ share_id (str): Share ID
270
+ share_obj (Share): Share object.
271
+
272
+ Returns:
273
+ Result
274
+ """
275
+ if not all(val is not None for val in ["sight_id", "share_id", "share_obj"]):
276
+ raise ValueError(
277
+ ("One or more required values are missing from call to " + __name__)
278
+ )
279
+
280
+ _op = fresh_operation("update_share")
281
+ _op["method"] = "PUT"
282
+ _op["path"] = "/sights/" + str(sight_id) + "/shares/" + str(share_id)
283
+ _op["json"] = share_obj
284
+
285
+ expected = ["Result", "Share"]
286
+
287
+ prepped_request = self._base.prepare_request(_op)
288
+ response = self._base.request(prepped_request, expected, _op)
289
+
290
+ return response
291
+
292
+ def delete_share(self, sight_id, share_id):
293
+ """Delete the specified Share.
294
+
295
+ Args:
296
+ sight_id (int): Sight ID
297
+ share_id (str): Share ID
298
+
299
+ Returns:
300
+ Result
301
+ """
302
+ _op = fresh_operation("delete_share")
303
+ _op["method"] = "DELETE"
304
+ _op["path"] = "/sights/" + str(sight_id) + "/shares/" + str(share_id)
305
+
306
+ expected = ["Result", None]
307
+ prepped_request = self._base.prepare_request(_op)
308
+ response = self._base.request(prepped_request, expected, _op)
309
+
310
+ return response
311
+
312
+ def get_publish_status(self, sight_id):
313
+ """Get the Publish status of the Sight.
314
+
315
+ Get the status of the Publish settings of the Sight,
316
+ including URLs of any enabled publishings.
317
+
318
+ Args:
319
+ sight_id (int): Sight ID
320
+
321
+ Returns:
322
+ SightPublish
323
+ """
324
+ _op = fresh_operation("get_publish_status")
325
+ _op["method"] = "GET"
326
+ _op["path"] = "/sights/" + str(sight_id) + "/publish"
327
+
328
+ expected = "SightPublish"
329
+ prepped_request = self._base.prepare_request(_op)
330
+ response = self._base.request(prepped_request, expected, _op)
331
+
332
+ return response
333
+
334
+ def set_publish_status(self, sight_id, sight_publish_obj):
335
+ """Set the publish status of the Sight and returns the new status,
336
+ including the URLs of any enabled publishings.
337
+
338
+ Args:
339
+ sight_id (int): Sight ID
340
+ sight_publish_obj (SightPublish): SightPublish object.
341
+
342
+ Returns:
343
+ Result
344
+ """
345
+ attributes = ["read_only_full_enabled", "read_only_full_accessible_by"]
346
+
347
+ fetch_first = False
348
+ # check for incompleteness, fill in from current status if necessary
349
+ for attribute in attributes:
350
+ val = getattr(sight_publish_obj, attribute, None)
351
+ if val is None:
352
+ fetch_first = True
353
+ break
354
+
355
+ if fetch_first:
356
+ current_status = self.get_publish_status(sight_id).to_dict()
357
+ current_status.update(sight_publish_obj.to_dict())
358
+ sight_publish_obj = self._base.models.SightPublish(current_status)
359
+
360
+ _op = fresh_operation("set_publish_status")
361
+ _op["method"] = "PUT"
362
+ _op["path"] = "/sights/" + str(sight_id) + "/publish"
363
+ _op["json"] = sight_publish_obj
364
+
365
+ expected = ["Result", "SightPublish"]
366
+
367
+ prepped_request = self._base.prepare_request(_op)
368
+ response = self._base.request(prepped_request, expected, _op)
369
+
370
+ return response