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,118 @@
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 Number, TypedList, importlib, json, String
21
+ from ..util import deserialize, serialize
22
+
23
+
24
+ class IndexResult:
25
+
26
+ """Smartsheet IndexResult data model."""
27
+
28
+ def __init__(self, props=None, dynamic_data_type=None, base_obj=None):
29
+ """Initialize the IndexResult model."""
30
+ self._base = None
31
+ if base_obj is not None:
32
+ self._base = base_obj
33
+
34
+ self._dynamic_data_type = None
35
+ if dynamic_data_type is not None:
36
+ self._dynamic_data_type = dynamic_data_type
37
+
38
+ self._data = TypedList(object)
39
+ self._page_number = Number()
40
+ self._page_size = Number()
41
+ self._total_count = Number()
42
+ self._total_pages = Number()
43
+ self._last_key = String()
44
+
45
+ if props:
46
+ deserialize(self, props)
47
+ # account for alternate variable names from raw API response
48
+
49
+ # requests package Response object
50
+ self.request_response = None
51
+
52
+ @property
53
+ def data(self):
54
+ return self._data
55
+
56
+ @data.setter
57
+ def data(self, value):
58
+ class_ = getattr(
59
+ importlib.import_module("smartsheet.models"), self._dynamic_data_type
60
+ )
61
+ if isinstance(value, list):
62
+ self._data = [class_(x, self._base) for x in value]
63
+ else:
64
+ self._data = class_(value, self._base)
65
+
66
+ @property
67
+ def page_number(self):
68
+ return self._page_number.value
69
+
70
+ @page_number.setter
71
+ def page_number(self, value):
72
+ self._page_number.value = value
73
+
74
+ @property
75
+ def page_size(self):
76
+ return self._page_size.value
77
+
78
+ @page_size.setter
79
+ def page_size(self, value):
80
+ self._page_size.value = value
81
+
82
+ @property
83
+ def total_count(self):
84
+ return self._total_count.value
85
+
86
+ @total_count.setter
87
+ def total_count(self, value):
88
+ self._total_count.value = value
89
+
90
+ @property
91
+ def total_pages(self):
92
+ return self._total_pages.value
93
+
94
+ @total_pages.setter
95
+ def total_pages(self, value):
96
+ self._total_pages.value = value
97
+
98
+ @property
99
+ def last_key(self):
100
+ return self._last_key.value
101
+
102
+ @last_key.setter
103
+ def last_key(self, value):
104
+ self._last_key.value = value
105
+
106
+ @property
107
+ def result(self):
108
+ """Simplify difference between Result and IndexResult"""
109
+ return self._data
110
+
111
+ def to_dict(self):
112
+ return serialize(self)
113
+
114
+ def to_json(self):
115
+ return json.dumps(self.to_dict())
116
+
117
+ def __str__(self):
118
+ return self.to_json()
@@ -0,0 +1,59 @@
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
+ import json
21
+
22
+ import six
23
+
24
+
25
+ class JSONObject:
26
+
27
+ """Smartsheet JSONObject data model."""
28
+
29
+ def __init__(self, payload=None, base_obj=None):
30
+ """Initialize the JSONObject model."""
31
+ self._base = None
32
+ self._data = None
33
+ if base_obj is not None:
34
+ self._base = base_obj
35
+ if payload is not None:
36
+ self.data = payload
37
+
38
+ @property
39
+ def data(self):
40
+ return self._data
41
+
42
+ @data.setter
43
+ def data(self, value):
44
+ if isinstance(value, dict):
45
+ self._data = value
46
+ elif isinstance(value, six.string_types):
47
+ self._data = json.loads(value)
48
+
49
+ def serialize(self):
50
+ return self._data
51
+
52
+ def to_dict(self):
53
+ return self._data
54
+
55
+ def to_json(self):
56
+ return json.dumps(self.to_dict())
57
+
58
+ def __str__(self):
59
+ return self.to_json()
@@ -0,0 +1,49 @@
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 TypedList
21
+ from ..util import deserialize
22
+ from .contact_object_value import ContactObjectValue
23
+ from .object_value import MULTI_CONTACT, ObjectValue
24
+
25
+
26
+ class MultiContactObjectValue(ObjectValue):
27
+ """Smartsheet MultiContactObjectValue data model."""
28
+
29
+ def __init__(self, props=None, base_obj=None):
30
+ """Initialize the MultiContactObjectValue model."""
31
+ ObjectValue.__init__(self, MULTI_CONTACT, base_obj)
32
+ self._base = None
33
+ if base_obj is not None:
34
+ self._base = base_obj
35
+
36
+ self._values = TypedList(ContactObjectValue)
37
+
38
+ if props:
39
+ deserialize(self, props)
40
+
41
+ self.__initialized = True
42
+
43
+ @property
44
+ def values(self):
45
+ return self._values
46
+
47
+ @values.setter
48
+ def values(self, value):
49
+ self._values.load(value)
@@ -0,0 +1,48 @@
1
+ # pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
2
+ # Smartsheet Python SDK.
3
+ #
4
+ # Copyright 2019 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
21
+ from ..util import deserialize
22
+ from .object_value import MULTI_PICKLIST, ObjectValue
23
+
24
+
25
+ class MultiPicklistObjectValue(ObjectValue):
26
+ """Smartsheet MultiPicklistObjectValue data model."""
27
+
28
+ def __init__(self, props=None, base_obj=None):
29
+ """Initialize the MultiPicklistObjectValue model."""
30
+ ObjectValue.__init__(self, MULTI_PICKLIST, base_obj)
31
+ self._base = None
32
+ if base_obj is not None:
33
+ self._base = base_obj
34
+
35
+ self._values = TypedList(str)
36
+
37
+ if props:
38
+ deserialize(self, props)
39
+
40
+ self.__initialized = True
41
+
42
+ @property
43
+ def values(self):
44
+ return self._values
45
+
46
+ @values.setter
47
+ def values(self, value):
48
+ self._values.load(value)
@@ -0,0 +1,60 @@
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
+ import json
21
+
22
+ import six
23
+
24
+ from ..types import TypedList
25
+ from ..util import deserialize, serialize
26
+ from .row_email import RowEmail
27
+
28
+
29
+ class MultiRowEmail(RowEmail):
30
+
31
+ """Smartsheet MultiRowEmail data model."""
32
+
33
+ def __init__(self, props=None, base_obj=None):
34
+ """Initialize the MultiRowEmail model."""
35
+ super().__init__(None, base_obj)
36
+ self._base = None
37
+ if base_obj is not None:
38
+ self._base = base_obj
39
+
40
+ self._row_ids = TypedList(six.integer_types)
41
+
42
+ if props:
43
+ deserialize(self, props)
44
+
45
+ @property
46
+ def row_ids(self):
47
+ return self._row_ids
48
+
49
+ @row_ids.setter
50
+ def row_ids(self, value):
51
+ self._row_ids.load(value)
52
+
53
+ def to_dict(self):
54
+ return serialize(self)
55
+
56
+ def to_json(self):
57
+ return json.dumps(self.to_dict())
58
+
59
+ def __str__(self):
60
+ return self.to_json()
@@ -0,0 +1,38 @@
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 .object_value import NUMBER
21
+ from .primitive_object_value import PrimitiveObjectValue
22
+
23
+
24
+ class NumberObjectValue(PrimitiveObjectValue):
25
+ """Smartsheet NumberObjectValue data model."""
26
+
27
+ def __init__(self, value=None, base_obj=None):
28
+ """Initialize the NumberObjectValue model."""
29
+ super().__init__(value, base_obj)
30
+ self._base = None
31
+ if base_obj is not None:
32
+ self._base = base_obj
33
+
34
+ self.__initialized = True
35
+
36
+ @property
37
+ def object_type(self):
38
+ return NUMBER
@@ -0,0 +1,86 @@
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 Number, String, json
21
+ from ..util import deserialize, serialize
22
+
23
+
24
+ class OAuthError:
25
+
26
+ """Smartsheet OAuthError data model."""
27
+
28
+ def __init__(self, props=None, base_obj=None):
29
+ """Initialize the OAuthError model."""
30
+ self._base = None
31
+ if base_obj is not None:
32
+ self._base = base_obj
33
+
34
+ self.allowed_values = {
35
+ "error": [
36
+ "invalid_request",
37
+ "invalid_client",
38
+ "invalid_grant",
39
+ "unauthorized_client",
40
+ "unsupported_grant_type",
41
+ "invalid_scope",
42
+ ]
43
+ }
44
+
45
+ self._error = String(accept=self.allowed_values["error"])
46
+ self._error_code = Number()
47
+ self._error_description = String()
48
+
49
+ if props:
50
+ deserialize(self, props)
51
+
52
+ # requests package Response object
53
+ self.request_response = None
54
+
55
+ @property
56
+ def error(self):
57
+ return self._error.value
58
+
59
+ @error.setter
60
+ def error(self, value):
61
+ self._error.value = value
62
+
63
+ @property
64
+ def error_code(self):
65
+ return self._error_code.value
66
+
67
+ @error_code.setter
68
+ def error_code(self, value):
69
+ self._error_code.value = value
70
+
71
+ @property
72
+ def error_description(self):
73
+ return self._error_description.value
74
+
75
+ @error_description.setter
76
+ def error_description(self, value):
77
+ self._error_description.value = value
78
+
79
+ def to_dict(self):
80
+ return serialize(self)
81
+
82
+ def to_json(self):
83
+ return json.dumps(self.to_dict())
84
+
85
+ def __str__(self):
86
+ return self.to_json()
@@ -0,0 +1,130 @@
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
+ import json
21
+
22
+ import six
23
+
24
+ from ..util import get_child_properties, serialize
25
+ from .explicit_null import ExplicitNull
26
+
27
+ DATE = 1
28
+ DATETIME = 2
29
+ ABSTRACT_DATETIME = 3
30
+ CONTACT = 4
31
+ DURATION = 5
32
+ PREDECESSOR_LIST = 6
33
+ MULTI_CONTACT = 7
34
+ MULTI_PICKLIST = 8
35
+ NUMBER = 9
36
+ BOOLEAN = 10
37
+ STRING = 11
38
+
39
+ OBJECT_VALUE = {
40
+ "object_type": [
41
+ "DATE",
42
+ "DATETIME",
43
+ "ABSTRACT_DATETIME",
44
+ "CONTACT",
45
+ "DURATION",
46
+ "PREDECESSOR_LIST",
47
+ "MULTI_CONTACT",
48
+ "MULTI_PICKLIST",
49
+ ]
50
+ }
51
+
52
+ _TYPE_TO_NAME = {
53
+ DATE: "DATE",
54
+ DATETIME: "DATETIME",
55
+ ABSTRACT_DATETIME: "ABSTRACT_DATETIME",
56
+ CONTACT: "CONTACT",
57
+ DURATION: "DURATION",
58
+ PREDECESSOR_LIST: "PREDECESSOR_LIST",
59
+ MULTI_CONTACT: "MULTI_CONTACT",
60
+ MULTI_PICKLIST: "MULTI_PICKLIST",
61
+ }
62
+
63
+ _NAME_TO_TYPE = {
64
+ "DATE": DATE,
65
+ "DATETIME": DATETIME,
66
+ "ABSTRACT_DATETIME": ABSTRACT_DATETIME,
67
+ "CONTACT": CONTACT,
68
+ "DURATION": DURATION,
69
+ "PREDECESSOR_LIST": PREDECESSOR_LIST,
70
+ "MULTI_CONTACT": MULTI_CONTACT,
71
+ "MULTI_PICKLIST": MULTI_PICKLIST,
72
+ }
73
+
74
+
75
+ def enum_object_value_type(object_type=None):
76
+ return _NAME_TO_TYPE.get(object_type)
77
+
78
+
79
+ class ObjectValue:
80
+ """Smartsheet ObjectValue data model."""
81
+
82
+ def __init__(self, object_type=None, base_obj=None):
83
+ """Initialize the ObjectValue model."""
84
+ self._base = None
85
+ if base_obj is not None:
86
+ self._base = base_obj
87
+
88
+ self._object_type = object_type
89
+
90
+ self.__initialized = True
91
+
92
+ @property
93
+ def object_type(self):
94
+ return self._object_type
95
+
96
+ @object_type.setter
97
+ def object_type(self, value):
98
+ if isinstance(value, six.string_types):
99
+ self._object_type = _NAME_TO_TYPE.get(value)
100
+ else:
101
+ self._object_type = value
102
+
103
+ def serialize(self):
104
+ # when serializing an objectValue object, change objectType to a string value
105
+ retval = {}
106
+ prop_list = get_child_properties(self)
107
+ for prop in prop_list:
108
+ prop_name = prop[0]
109
+ camel_case = prop[1]
110
+ prop_value = getattr(self, prop_name)
111
+ if prop_value is not None:
112
+ serialized = serialize(prop_value)
113
+ if isinstance(
114
+ serialized, ExplicitNull
115
+ ): # object forcing serialization of a null
116
+ retval[camel_case] = None
117
+ elif serialized is not None:
118
+ retval[camel_case] = serialized
119
+
120
+ retval["objectType"] = _TYPE_TO_NAME.get(self._object_type)
121
+ return retval
122
+
123
+ def to_dict(self):
124
+ return serialize(self)
125
+
126
+ def to_json(self):
127
+ return json.dumps(self.to_dict())
128
+
129
+ def __str__(self):
130
+ return self.to_json()
@@ -0,0 +1,80 @@
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 typing import Union
21
+ from ..util import deserialize
22
+ from .token_paginated_result import TokenPaginatedResult
23
+ from .folder import Folder
24
+ from .sheet import Sheet
25
+ from .sight import Sight
26
+ from .report import Report
27
+
28
+ # Type alias for children that can be any of these types
29
+ ChildType = Union[Folder, Sheet, Sight, Report]
30
+
31
+
32
+ class PaginatedChildrenResult(TokenPaginatedResult[ChildType]):
33
+ """Smartsheet PaginatedChildrenResult that deserializes mixed children based on resourceType."""
34
+
35
+ def __init__(self, props=None, base_obj=None):
36
+ """Initialize the PaginatedChildrenResult model."""
37
+ super().__init__(props=None, base_obj=base_obj)
38
+
39
+ if props:
40
+ self._deserialize_data(props)
41
+ deserialize(self, props)
42
+
43
+ def _deserialize_data(self, props):
44
+ """Custom deserialization for data array based on resourceType."""
45
+ if 'data' in props:
46
+ self._data = []
47
+ for item in props['data']:
48
+ self.append_data(item)
49
+
50
+ def append_data(self, item):
51
+ """Append data item, converting to appropriate model based on resourceType."""
52
+ # Get resource type from either dict or object
53
+ if isinstance(item, dict):
54
+ resource_type = item.get('resourceType', '').lower()
55
+ else:
56
+ resource_type = getattr(item, 'resourceType', '').lower()
57
+
58
+ # Convert to appropriate model object based on resource type
59
+ if resource_type == 'folder':
60
+ self._data.append(Folder(item, self._base))
61
+ elif resource_type == 'sheet':
62
+ self._data.append(Sheet(item, self._base))
63
+ elif resource_type == 'sight':
64
+ self._data.append(Sight(item, self._base))
65
+ elif resource_type == 'report':
66
+ self._data.append(Report(item, self._base))
67
+ else:
68
+ # If no resource type or unknown type, append as-is
69
+ self._data.append(item)
70
+
71
+ @property
72
+ def data(self):
73
+ return self._data
74
+
75
+ @data.setter
76
+ def data(self, value):
77
+ """Custom setter that handles deserialization of mixed resource types."""
78
+ self._data = []
79
+ for item in value:
80
+ self.append_data(item)