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
@@ -0,0 +1,219 @@
1
+ # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
2
+ # Smartsheet Python SDK.
3
+ #
4
+ # Copyright 2017 - 2020 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
+ from __future__ import absolute_import
19
+
20
+ from ..types import (Boolean, Number, String, Timestamp, TypedList,
21
+ TypedObject, json, six)
22
+ from ..util import deserialize, serialize
23
+ from .webhook_stats import WebhookStats
24
+ from .webhook_subscope import WebhookSubscope
25
+
26
+
27
+ class Webhook:
28
+
29
+ """Smartsheet Webhook data model."""
30
+
31
+ def __init__(self, props=None, base_obj=None):
32
+ """Initialize the Webhook model."""
33
+ self._base = None
34
+ if base_obj is not None:
35
+ self._base = base_obj
36
+
37
+ self.allowed_values = {"scope": ["sheet"]}
38
+
39
+ self._api_client_id = String()
40
+ self._api_client_name = String()
41
+ self._callback_url = String()
42
+ self._created_at = Timestamp()
43
+ self._disabled_details = String()
44
+ self._enabled = Boolean()
45
+ self._events = TypedList(six.string_types)
46
+ self._id_ = Number()
47
+ self._modified_at = Timestamp()
48
+ self._name = String()
49
+ self._scope = String(accept=self.allowed_values["scope"])
50
+ self._scope_object_id = Number()
51
+ self._shared_secret = String()
52
+ self._stats = TypedObject(WebhookStats)
53
+ self._status = String()
54
+ self._version = Number()
55
+ self._subscope = TypedObject(WebhookSubscope)
56
+
57
+ if props:
58
+ deserialize(self, props)
59
+
60
+ # requests package Response object
61
+ self.request_response = None
62
+ self.__initialized = True
63
+
64
+ def __getattr__(self, key):
65
+ if key == "id":
66
+ return self.id_
67
+ else:
68
+ raise AttributeError(key)
69
+
70
+ def __setattr__(self, key, value):
71
+ if key == "id":
72
+ self.id_ = value
73
+ else:
74
+ super().__setattr__(key, value)
75
+
76
+ @property
77
+ def api_client_id(self):
78
+ return self._api_client_id.value
79
+
80
+ @api_client_id.setter
81
+ def api_client_id(self, value):
82
+ self._api_client_id.value = value
83
+
84
+ @property
85
+ def api_client_name(self):
86
+ return self._api_client_name.value
87
+
88
+ @api_client_name.setter
89
+ def api_client_name(self, value):
90
+ self._api_client_name.value = value
91
+
92
+ @property
93
+ def callback_url(self):
94
+ return self._callback_url.value
95
+
96
+ @callback_url.setter
97
+ def callback_url(self, value):
98
+ self._callback_url.value = value
99
+
100
+ @property
101
+ def created_at(self):
102
+ return self._created_at.value
103
+
104
+ @created_at.setter
105
+ def created_at(self, value):
106
+ self._created_at.value = value
107
+
108
+ @property
109
+ def disabled_details(self):
110
+ return self._disabled_details.value
111
+
112
+ @disabled_details.setter
113
+ def disabled_details(self, value):
114
+ self._disabled_details.value = value
115
+
116
+ @property
117
+ def enabled(self):
118
+ return self._enabled.value
119
+
120
+ @enabled.setter
121
+ def enabled(self, value):
122
+ self._enabled.value = value
123
+
124
+ @property
125
+ def events(self):
126
+ return self._events
127
+
128
+ @events.setter
129
+ def events(self, value):
130
+ self._events.load(value)
131
+
132
+ @property
133
+ def id_(self):
134
+ return self._id_.value
135
+
136
+ @id_.setter
137
+ def id_(self, value):
138
+ self._id_.value = value
139
+
140
+ @property
141
+ def modified_at(self):
142
+ return self._modified_at.value
143
+
144
+ @modified_at.setter
145
+ def modified_at(self, value):
146
+ self._modified_at.value = value
147
+
148
+ @property
149
+ def name(self):
150
+ return self._name.value
151
+
152
+ @name.setter
153
+ def name(self, value):
154
+ self._name.value = value
155
+
156
+ @property
157
+ def scope(self):
158
+ return self._scope.value
159
+
160
+ @scope.setter
161
+ def scope(self, value):
162
+ self._scope.value = value
163
+
164
+ @property
165
+ def scope_object_id(self):
166
+ return self._scope_object_id.value
167
+
168
+ @scope_object_id.setter
169
+ def scope_object_id(self, value):
170
+ self._scope_object_id.value = value
171
+
172
+ @property
173
+ def shared_secret(self):
174
+ return self._shared_secret.value
175
+
176
+ @shared_secret.setter
177
+ def shared_secret(self, value):
178
+ self._shared_secret.value = value
179
+
180
+ @property
181
+ def stats(self):
182
+ return self._stats.value
183
+
184
+ @stats.setter
185
+ def stats(self, value):
186
+ self._stats.value = value
187
+
188
+ @property
189
+ def status(self):
190
+ return self._status.value
191
+
192
+ @status.setter
193
+ def status(self, value):
194
+ self._status.value = value
195
+
196
+ @property
197
+ def subscope(self):
198
+ return self._subscope.value
199
+
200
+ @subscope.setter
201
+ def subscope(self, value):
202
+ self._subscope.value = value
203
+
204
+ @property
205
+ def version(self):
206
+ return self._version.value
207
+
208
+ @version.setter
209
+ def version(self, value):
210
+ self._version.value = value
211
+
212
+ def to_dict(self):
213
+ return serialize(self)
214
+
215
+ def to_json(self):
216
+ return json.dumps(self.to_dict())
217
+
218
+ def __str__(self):
219
+ return self.to_json()
@@ -0,0 +1,58 @@
1
+ # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
2
+ # Smartsheet Python SDK.
3
+ #
4
+ # Copyright 2018 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
+ from __future__ import absolute_import
19
+
20
+ from ..types import String, json
21
+ from ..util import deserialize, serialize
22
+
23
+
24
+ class WebhookSecret:
25
+
26
+ """Smartsheet WebhookSecret data model."""
27
+
28
+ def __init__(self, props=None, base_obj=None):
29
+ """Initialize the WebhookSecret model."""
30
+ self._base = None
31
+ if base_obj is not None:
32
+ self._base = base_obj
33
+
34
+ self._shared_secret = String()
35
+
36
+ if props:
37
+ deserialize(self, props)
38
+
39
+ # requests package Response object
40
+ self.request_response = None
41
+ self.__initialized = True
42
+
43
+ @property
44
+ def shared_secret(self):
45
+ return self._shared_secret.value
46
+
47
+ @shared_secret.setter
48
+ def shared_secret(self, value):
49
+ self._shared_secret.value = value
50
+
51
+ def to_dict(self):
52
+ return serialize(self)
53
+
54
+ def to_json(self):
55
+ return json.dumps(self.to_dict())
56
+
57
+ def __str__(self):
58
+ return self.to_json()
@@ -0,0 +1,76 @@
1
+ # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
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
+ from __future__ import absolute_import
19
+
20
+ from ..types import Number, Timestamp, json
21
+ from ..util import deserialize, serialize
22
+
23
+
24
+ class WebhookStats:
25
+
26
+ """Smartsheet WebhookStats data model."""
27
+
28
+ def __init__(self, props=None, base_obj=None):
29
+ """Initialize the WebhookStats model."""
30
+ self._base = None
31
+ if base_obj is not None:
32
+ self._base = base_obj
33
+
34
+ self._last_callback_attempt = Timestamp()
35
+ self._last_callback_attempt_retry_count = Number()
36
+ self._last_successful_callback = Timestamp()
37
+
38
+ if props:
39
+ deserialize(self, props)
40
+
41
+ # requests package Response object
42
+ self.request_response = None
43
+ self.__initialized = True
44
+
45
+ @property
46
+ def last_callback_attempt(self):
47
+ return self._last_callback_attempt.value
48
+
49
+ @last_callback_attempt.setter
50
+ def last_callback_attempt(self, value):
51
+ self._last_callback_attempt.value = value
52
+
53
+ @property
54
+ def last_callback_attempt_retry_count(self):
55
+ return self._last_callback_attempt_retry_count.value
56
+
57
+ @last_callback_attempt_retry_count.setter
58
+ def last_callback_attempt_retry_count(self, value):
59
+ self._last_callback_attempt_retry_count.value = value
60
+
61
+ @property
62
+ def last_successful_callback(self):
63
+ return self._last_successful_callback.value
64
+
65
+ @last_successful_callback.setter
66
+ def last_successful_callback(self, value):
67
+ self._last_successful_callback.value = value
68
+
69
+ def to_dict(self):
70
+ return serialize(self)
71
+
72
+ def to_json(self):
73
+ return json.dumps(self.to_dict())
74
+
75
+ def __str__(self):
76
+ return self.to_json()
@@ -0,0 +1,50 @@
1
+ # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
2
+ # Smartsheet Python SDK.
3
+ #
4
+ # Copyright 2020 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
+ from __future__ import absolute_import
19
+
20
+ from ..types import TypedList, json, six
21
+ from ..util import deserialize, serialize
22
+
23
+
24
+ class WebhookSubscope:
25
+
26
+ """Represents the webhook subscope object."""
27
+
28
+ def __init__(self, props=None):
29
+ """Initialize the Webhook Subscope model."""
30
+ self._column_ids = TypedList(six.integer_types)
31
+
32
+ if props:
33
+ deserialize(self, props)
34
+
35
+ @property
36
+ def column_ids(self):
37
+ return self._column_ids
38
+
39
+ @column_ids.setter
40
+ def column_ids(self, value):
41
+ self._column_ids.load(value)
42
+
43
+ def to_dict(self):
44
+ return serialize(self)
45
+
46
+ def to_json(self):
47
+ return json.dumps(self.to_dict())
48
+
49
+ def __str__(self):
50
+ return self.to_json()
@@ -0,0 +1,211 @@
1
+ # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
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
+ from __future__ import absolute_import
19
+
20
+ from ..types import Boolean, EnumeratedValue, Number, String, TypedObject, json
21
+ from ..util import deserialize, serialize
22
+ from .cell_link_widget_content import CellLinkWidgetContent
23
+ from .chart_widget_content import ChartWidgetContent
24
+ from .enums.widget_type import WidgetType
25
+ from .error_result import ErrorResult
26
+ from .image_widget_content import ImageWidgetContent
27
+ from .report_widget_content import ReportWidgetContent
28
+ from .shortcut_widget_content import ShortcutWidgetContent
29
+ from .title_rich_text_widget_content import TitleRichTextWidgetContent
30
+ from .web_content_widget_content import WebContentWidgetContent
31
+ from .widget_content import WidgetContent
32
+
33
+
34
+ class Widget:
35
+ """Smartsheet Widget data model."""
36
+
37
+ def __init__(self, props=None, base_obj=None):
38
+ """Initialize the Widget model."""
39
+ self._base = None
40
+ if base_obj is not None:
41
+ self._base = base_obj
42
+
43
+ self._contents = None
44
+ self._error = TypedObject(ErrorResult)
45
+ self._height = Number()
46
+ self._id_ = Number()
47
+ self._show_title = Boolean()
48
+ self._show_title_icon = Boolean()
49
+ self._title = String()
50
+ self._title_format = String()
51
+ self._type = EnumeratedValue(WidgetType)
52
+ self._version = Number()
53
+ self._width = Number()
54
+ self._x_position = Number()
55
+ self._y_position = Number()
56
+
57
+ if props:
58
+ deserialize(self, props)
59
+
60
+ self.__initialized = True
61
+
62
+ def __getattr__(self, key):
63
+ if key == "id":
64
+ return self.id_
65
+ else:
66
+ raise AttributeError(key)
67
+
68
+ def __setattr__(self, key, value):
69
+ if key == "id":
70
+ self.id_ = value
71
+ else:
72
+ super().__setattr__(key, value)
73
+
74
+ @property
75
+ def contents(self):
76
+ return self._contents
77
+
78
+ @contents.setter
79
+ def contents(self, value):
80
+ if isinstance(value, WidgetContent):
81
+ self._contents = value
82
+ elif isinstance(value, dict):
83
+ widget_type = value["type"]
84
+ try:
85
+ widget_type = WidgetType[widget_type]
86
+ except KeyError:
87
+ if widget_type == "WidgetWebContent":
88
+ widget_type = WidgetType.WEBCONTENT
89
+ else:
90
+ widget_type = None
91
+ if widget_type == WidgetType.CHART:
92
+ self._contents = ChartWidgetContent(value, self._base)
93
+ elif widget_type == WidgetType.IMAGE:
94
+ self._contents = ImageWidgetContent(value, self._base)
95
+ elif widget_type == WidgetType.METRIC:
96
+ self._contents = CellLinkWidgetContent(value, self._base)
97
+ elif widget_type == WidgetType.GRIDGANTT:
98
+ self._contents = ReportWidgetContent(value, self._base)
99
+ elif widget_type in (WidgetType.RICHTEXT, WidgetType.TITLE):
100
+ self._contents = TitleRichTextWidgetContent(value, self._base)
101
+ elif widget_type == WidgetType.SHORTCUT:
102
+ self._contents = ShortcutWidgetContent(value, self._base)
103
+ elif widget_type == WidgetType.WEBCONTENT:
104
+ self._contents = WebContentWidgetContent(value, self._base)
105
+ else:
106
+ self._contents = None
107
+
108
+ @property
109
+ def error(self):
110
+ return self._error.value
111
+
112
+ @error.setter
113
+ def error(self, value):
114
+ self._error.value = value
115
+
116
+ @property
117
+ def height(self):
118
+ return self._height.value
119
+
120
+ @height.setter
121
+ def height(self, value):
122
+ self._height.value = value
123
+
124
+ @property
125
+ def id_(self):
126
+ return self._id_.value
127
+
128
+ @id_.setter
129
+ def id_(self, value):
130
+ self._id_.value = value
131
+
132
+ @property
133
+ def show_title(self):
134
+ return self._show_title.value
135
+
136
+ @show_title.setter
137
+ def show_title(self, value):
138
+ self._show_title.value = value
139
+
140
+ @property
141
+ def show_title_icon(self):
142
+ return self._show_title_icon.value
143
+
144
+ @show_title_icon.setter
145
+ def show_title_icon(self, value):
146
+ self._show_title_icon.value = value
147
+
148
+ @property
149
+ def title(self):
150
+ return self._title.value
151
+
152
+ @title.setter
153
+ def title(self, value):
154
+ self._title.value = value
155
+
156
+ @property
157
+ def title_format(self):
158
+ return self._title_format.value
159
+
160
+ @title_format.setter
161
+ def title_format(self, value):
162
+ self._title_format.value = value
163
+
164
+ @property
165
+ def type(self):
166
+ return self._type
167
+
168
+ @type.setter
169
+ def type(self, value):
170
+ self._type.set(value)
171
+
172
+ @property
173
+ def version(self):
174
+ return self._version.value
175
+
176
+ @version.setter
177
+ def version(self, value):
178
+ self._version.value = value
179
+
180
+ @property
181
+ def width(self):
182
+ return self._width.value
183
+
184
+ @width.setter
185
+ def width(self, value):
186
+ self._width.value = value
187
+
188
+ @property
189
+ def x_position(self):
190
+ return self._x_position.value
191
+
192
+ @x_position.setter
193
+ def x_position(self, value):
194
+ self._x_position.value = value
195
+
196
+ @property
197
+ def y_position(self):
198
+ return self._y_position.value
199
+
200
+ @y_position.setter
201
+ def y_position(self, value):
202
+ self._y_position.value = value
203
+
204
+ def to_dict(self):
205
+ return serialize(self)
206
+
207
+ def to_json(self):
208
+ return json.dumps(self.to_dict())
209
+
210
+ def __str__(self):
211
+ return self.to_json()
@@ -0,0 +1,52 @@
1
+ # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
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
+ from __future__ import absolute_import
19
+
20
+ from ..types import json
21
+ from ..util import deserialize, serialize
22
+ from .cell_data_item import CellDataItem
23
+ from .column import Column
24
+ from .hyperlink import Hyperlink
25
+ from .shortcut_data_item import ShortcutDataItem
26
+
27
+
28
+ class WidgetContent:
29
+ """Smartsheet WidgetContent data model."""
30
+
31
+ def __init__(self, widget_type=None, base_obj=None):
32
+ """Initialize the WidgetContent model."""
33
+ self._base = None
34
+ if base_obj is not None:
35
+ self._base = base_obj
36
+
37
+ self._widget_type = widget_type
38
+
39
+ self.__initialized = True
40
+
41
+ @property
42
+ def widget_type(self):
43
+ return self._widget_type
44
+
45
+ def to_dict(self):
46
+ return serialize(self)
47
+
48
+ def to_json(self):
49
+ return json.dumps(self.to_dict())
50
+
51
+ def __str__(self):
52
+ return self.to_json()