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/cells.py ADDED
@@ -0,0 +1,164 @@
1
+ # pylint: disable=C0111,R0902,R0913
2
+ # Smartsheet Python SDK.
3
+ #
4
+ # Copyright 2016 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 logging
21
+
22
+ from . import fresh_operation
23
+
24
+
25
+ class Cells:
26
+
27
+ """Class for handling Cells operations."""
28
+
29
+ def __init__(self, smartsheet_obj):
30
+ """Init Cells with base Smartsheet object."""
31
+ self._base = smartsheet_obj
32
+ self._log = logging.getLogger(__name__)
33
+
34
+ def get_cell_history(
35
+ self,
36
+ sheet_id,
37
+ row_id,
38
+ column_id,
39
+ include=None,
40
+ page_size=None,
41
+ page=None,
42
+ include_all=None,
43
+ level=None,
44
+ ):
45
+ """Get the Cell modification history.
46
+
47
+ Args:
48
+ sheet_id (int): Sheet ID
49
+ row_id (int): Row ID
50
+ column_id (int): Column ID
51
+ include (str): Valid includes for CellHistory are:
52
+ columnType, format, objectValue
53
+ page_size (int): The maximum number of items to
54
+ return per page.
55
+ page (int): Which page to return.
56
+ include_all (bool): If true, include all results
57
+ (i.e. do not paginate).
58
+ level (int): compatibility level
59
+
60
+ Returns:
61
+ IndexResult
62
+ """
63
+ if not all(val is not None for val in ["sheet_id", "row_id", "column_id"]):
64
+ raise ValueError(
65
+ ("One or more required values are missing from call to " + __name__)
66
+ )
67
+
68
+ _op = fresh_operation("get_cell_history")
69
+ _op["method"] = "GET"
70
+ _op["path"] = (
71
+ "/sheets/"
72
+ + str(sheet_id)
73
+ + "/rows/"
74
+ + str(row_id)
75
+ + "/columns/"
76
+ + str(column_id)
77
+ + "/history"
78
+ )
79
+ _op["query_params"]["include"] = include
80
+ _op["query_params"]["pageSize"] = page_size
81
+ _op["query_params"]["page"] = page
82
+ _op["query_params"]["includeAll"] = include_all
83
+ _op["query_params"]["level"] = level
84
+
85
+ expected = ["IndexResult", "CellHistory"]
86
+
87
+ prepped_request = self._base.prepare_request(_op)
88
+ response = self._base.request(prepped_request, expected, _op)
89
+
90
+ return response
91
+
92
+ def add_image_to_cell(
93
+ self,
94
+ sheet_id,
95
+ row_id,
96
+ column_id,
97
+ file,
98
+ file_type,
99
+ override_validation=False,
100
+ alt_text=None,
101
+ ):
102
+ """Uploads an image to the specified cell.
103
+
104
+ Args:
105
+ sheet_id (int): Sheet ID
106
+ row_id (int): Row ID
107
+ column_id (int): Column ID
108
+ file (string): path to image file.
109
+ file_type (string): content type of image file
110
+ override_validation: override a column's validation property
111
+ alt_text: alternate text for the image
112
+
113
+ Returns:
114
+ Result
115
+ """
116
+ if not all(
117
+ val is not None
118
+ for val in ["sheet_id", "row_id", "column_id", "file", "file_type"]
119
+ ):
120
+ raise ValueError(
121
+ ("One or more required values are missing from call to " + __name__)
122
+ )
123
+
124
+ return self._attach_file_to_cell(
125
+ sheet_id, row_id, column_id, file, file_type, override_validation, alt_text
126
+ )
127
+
128
+ def _attach_file_to_cell(
129
+ self,
130
+ sheet_id,
131
+ row_id,
132
+ column_id,
133
+ file,
134
+ file_type,
135
+ override_validation,
136
+ alt_text,
137
+ ):
138
+
139
+ _data = open(file, "rb").read()
140
+ _op = fresh_operation("attach_file_to_cell")
141
+ _op["method"] = "POST"
142
+ _op["path"] = (
143
+ "/sheets/"
144
+ + str(sheet_id)
145
+ + "/rows/"
146
+ + str(row_id)
147
+ + "/columns/"
148
+ + str(column_id)
149
+ + "/cellimages"
150
+ )
151
+ _op["headers"] = {
152
+ "content-type": file_type,
153
+ "content-disposition": 'attachment; filename="' + file + '"',
154
+ }
155
+ _op["query_params"]["altText"] = alt_text
156
+ _op["query_params"]["overrideValidation"] = override_validation
157
+ _op["form_data"] = _data
158
+
159
+ expected = ["Result", "Row"]
160
+
161
+ prepped_request = self._base.prepare_request(_op)
162
+ response = self._base.request(prepped_request, expected, _op)
163
+
164
+ return response
smartsheet/contacts.py ADDED
@@ -0,0 +1,78 @@
1
+ # pylint: disable=C0111,R0902,R0913
2
+ # Smartsheet Python SDK.
3
+ #
4
+ # Copyright 2016 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 logging
21
+
22
+ from . import fresh_operation
23
+
24
+
25
+ class Contacts:
26
+
27
+ """Class for handling Contacts operations."""
28
+
29
+ def __init__(self, smartsheet_obj):
30
+ """Init Contacts with base Smartsheet object."""
31
+ self._base = smartsheet_obj
32
+ self._log = logging.getLogger(__name__)
33
+
34
+ def get_contact(self, contact_id):
35
+ """Get the specified Contact.
36
+
37
+ Args:
38
+ contact_id (str): Contact ID
39
+
40
+ Returns:
41
+ Contact
42
+ """
43
+ _op = fresh_operation("get_contact")
44
+ _op["method"] = "GET"
45
+ _op["path"] = "/contacts/" + str(contact_id)
46
+
47
+ expected = "Contact"
48
+ prepped_request = self._base.prepare_request(_op)
49
+ response = self._base.request(prepped_request, expected, _op)
50
+
51
+ return response
52
+
53
+ def list_contacts(self, page_size=None, page=None, include_all=None):
54
+ """Get a list of the user's Smartsheet Contacts.
55
+
56
+ Args:
57
+ page_size (int): The maximum number of items to
58
+ return per page.
59
+ page (int): Which page to return.
60
+ include_all (bool): If true, include all results
61
+ (i.e. do not paginate).
62
+
63
+ Returns:
64
+ IndexResult
65
+ """
66
+ _op = fresh_operation("list_contacts")
67
+ _op["method"] = "GET"
68
+ _op["path"] = "/contacts"
69
+ _op["query_params"]["pageSize"] = page_size
70
+ _op["query_params"]["page"] = page
71
+ _op["query_params"]["includeAll"] = include_all
72
+
73
+ expected = ["IndexResult", "Contact"]
74
+
75
+ prepped_request = self._base.prepare_request(_op)
76
+ response = self._base.request(prepped_request, expected, _op)
77
+
78
+ return response
@@ -0,0 +1,411 @@
1
+ # pylint: disable=C0111,R0902,R0913,E1137
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 logging
21
+
22
+ import six
23
+
24
+ from . import fresh_operation
25
+
26
+
27
+ class Discussions:
28
+
29
+ """Class for handling Discussions operations."""
30
+
31
+ def __init__(self, smartsheet_obj):
32
+ """Init Discussions with base Smartsheet object."""
33
+ self._base = smartsheet_obj
34
+ self._log = logging.getLogger(__name__)
35
+
36
+ def add_comment_to_discussion(self, sheet_id, discussion_id, comment_obj=None):
37
+ """Add a Comment to the specified Discussion
38
+
39
+ Args:
40
+ sheet_id (int): Sheet ID
41
+ discussion_id (int): Discussion ID
42
+ comment_obj (Comment): Comment object.
43
+
44
+ Returns:
45
+ Result
46
+ """
47
+ _op = fresh_operation("add_comment_to_discussion")
48
+ _op["method"] = "POST"
49
+ _op["path"] = (
50
+ "/sheets/"
51
+ + str(sheet_id)
52
+ + "/discussions/"
53
+ + str(discussion_id)
54
+ + "/comments"
55
+ )
56
+ _op["json"] = comment_obj
57
+
58
+ expected = ["Result", "Comment"]
59
+
60
+ prepped_request = self._base.prepare_request(_op)
61
+ response = self._base.request(prepped_request, expected, _op)
62
+
63
+ return response
64
+
65
+ # pylint: disable=invalid-name
66
+ def add_comment_to_discussion_with_attachment(
67
+ self, sheet_id, discussion_id, comment, _file=None
68
+ ):
69
+ """Add a Comment with an Attachment to the specified Discussion
70
+
71
+ Args:
72
+ sheet_id (int): Sheet ID
73
+ discussion_id (int): Discussion ID
74
+ comment (file): Comment object.
75
+ _file (file): String or file stream object.
76
+
77
+ Returns:
78
+ Result
79
+ """
80
+ if not all(val is not None for val in ["sheet_id", "discussion_id", "comment"]):
81
+ raise ValueError(
82
+ ("One or more required values are missing from call to " + __name__)
83
+ )
84
+
85
+ _op = fresh_operation("add_comment_to_discussion_with_attachment")
86
+ _op["method"] = "POST"
87
+ _op["path"] = (
88
+ "/sheets/"
89
+ + str(sheet_id)
90
+ + "/discussions/"
91
+ + str(discussion_id)
92
+ + "/comments"
93
+ )
94
+ _op["files"] = {}
95
+ field_str = comment.to_json()
96
+ _op["files"]["comment"] = (None, six.StringIO(field_str), "application/json")
97
+ _op["files"]["file"] = _file
98
+
99
+ expected = ["Result", "Comment"]
100
+
101
+ prepped_request = self._base.prepare_request(_op)
102
+ response = self._base.request(prepped_request, expected, _op)
103
+
104
+ return response
105
+
106
+ # pylint: enable=invalid-name
107
+
108
+ def create_discussion_on_row(self, sheet_id, row_id, discussion_obj=None):
109
+ """Create a new Discussion on a Row.
110
+
111
+
112
+
113
+ Args:
114
+ sheet_id (int): Sheet ID
115
+ row_id (int): Row ID
116
+ discussion_obj (Discussion): Discussion object.
117
+
118
+ Returns:
119
+ Result
120
+ """
121
+ _op = fresh_operation("create_discussion_on_row")
122
+ _op["method"] = "POST"
123
+ _op["path"] = (
124
+ "/sheets/" + str(sheet_id) + "/rows/" + str(row_id) + "/discussions"
125
+ )
126
+ _op["json"] = discussion_obj
127
+
128
+ expected = ["Result", "Discussion"]
129
+
130
+ prepped_request = self._base.prepare_request(_op)
131
+ response = self._base.request(prepped_request, expected, _op)
132
+
133
+ return response
134
+
135
+ # pylint: disable=invalid-name
136
+ def create_discussion_on_row_with_attachment(
137
+ self, sheet_id, row_id, discussion, _file=None
138
+ ):
139
+ """Create a new Discussion on a Row with an attachment.
140
+
141
+ Args:
142
+ sheet_id (int): Sheet ID
143
+ row_id (int): Row ID
144
+ discussion (file): Discussion object.
145
+ _file (file): String or file stream object.
146
+
147
+ Returns:
148
+ Result
149
+ """
150
+ if not all(val is not None for val in ["sheet_id", "row_id", "discussion"]):
151
+ raise ValueError(
152
+ ("One or more required values are missing from call to " + __name__)
153
+ )
154
+
155
+ _op = fresh_operation("create_discussion_on_row_with_attachment")
156
+ _op["method"] = "POST"
157
+ _op["path"] = (
158
+ "/sheets/" + str(sheet_id) + "/rows/" + str(row_id) + "/discussions"
159
+ )
160
+ _op["files"] = {}
161
+ field_str = discussion.to_json()
162
+ _op["files"]["discussion"] = (None, six.StringIO(field_str), "application/json")
163
+ _op["files"]["file"] = _file
164
+
165
+ expected = ["Result", "Discussion"]
166
+
167
+ prepped_request = self._base.prepare_request(_op)
168
+ response = self._base.request(prepped_request, expected, _op)
169
+
170
+ return response
171
+
172
+ # pylint: enable=invalid-name
173
+
174
+ def create_discussion_on_sheet(self, sheet_id, discussion_obj=None):
175
+ """Create a new Discussion on a Sheet.
176
+
177
+ Args:
178
+ sheet_id (int): Sheet ID
179
+ discussion_obj (Discussion): Discussion object.
180
+
181
+ Returns:
182
+ Result
183
+ """
184
+ _op = fresh_operation("create_discussion_on_sheet")
185
+ _op["method"] = "POST"
186
+ _op["path"] = "/sheets/" + str(sheet_id) + "/discussions"
187
+ _op["json"] = discussion_obj
188
+
189
+ expected = ["Result", "Discussion"]
190
+
191
+ prepped_request = self._base.prepare_request(_op)
192
+ response = self._base.request(prepped_request, expected, _op)
193
+
194
+ return response
195
+
196
+ # pylint: disable=invalid-name
197
+ def create_discussion_on_sheet_with_attachment(
198
+ self, sheet_id, discussion, _file=None
199
+ ):
200
+ """Create a new Discussion on a Sheet with an attachment.
201
+
202
+ Args:
203
+ sheet_id (int): Sheet ID
204
+ discussion (file): Discussion object.
205
+ _file (file): String or file stream object.
206
+
207
+ Returns:
208
+ Result
209
+ """
210
+ _op = fresh_operation("create_discussion_on_sheet_with_attachment")
211
+ _op["method"] = "POST"
212
+ _op["path"] = "/sheets/" + str(sheet_id) + "/discussions"
213
+ _op["files"] = {}
214
+ field_str = discussion.to_json()
215
+ _op["files"]["discussion"] = (None, six.StringIO(field_str), "application/json")
216
+ _op["files"]["file"] = _file
217
+
218
+ expected = ["Result", "Discussion"]
219
+
220
+ prepped_request = self._base.prepare_request(_op)
221
+ response = self._base.request(prepped_request, expected, _op)
222
+
223
+ return response
224
+
225
+ # pylint: enable=invalid-name
226
+
227
+ def delete_discussion(self, sheet_id, discussion_id):
228
+ """Delete the specified Discussion.
229
+
230
+ Args:
231
+ sheet_id (int): Sheet ID
232
+ discussion_id (int): Discussion ID
233
+
234
+ Returns:
235
+ Result
236
+ """
237
+ _op = fresh_operation("delete_discussion")
238
+ _op["method"] = "DELETE"
239
+ _op["path"] = "/sheets/" + str(sheet_id) + "/discussions/" + str(discussion_id)
240
+
241
+ expected = ["Result", None]
242
+ prepped_request = self._base.prepare_request(_op)
243
+ response = self._base.request(prepped_request, expected, _op)
244
+
245
+ return response
246
+
247
+ def delete_discussion_comment(self, sheet_id, comment_id):
248
+ """Delete the specified Sheet Comment.
249
+
250
+ Delete the specified Comment from the specified Sheet.
251
+
252
+ Args:
253
+ sheet_id (int): Sheet ID
254
+ comment_id (int): Comment ID
255
+
256
+ Returns:
257
+ Result
258
+ """
259
+ _op = fresh_operation("delete_discussion_comment")
260
+ _op["method"] = "DELETE"
261
+ _op["path"] = "/sheets/" + str(sheet_id) + "/comments/" + str(comment_id)
262
+
263
+ expected = ["Result", None]
264
+ prepped_request = self._base.prepare_request(_op)
265
+ response = self._base.request(prepped_request, expected, _op)
266
+
267
+ return response
268
+
269
+ def get_all_discussions(
270
+ self, sheet_id, include=None, page_size=None, page=None, include_all=None
271
+ ):
272
+ """Get a list of all Discussions on the specified Sheet.
273
+
274
+ Get a list of all Discussions associated with the specified
275
+ Sheet (both sheet-level discussions and row-level discussions).
276
+
277
+ Args:
278
+ sheet_id (int): Sheet ID
279
+ include (list[str]): A comma-separated list of
280
+ optional elements to include in the response. Valid list
281
+ values: comments, attachments
282
+ page_size (int): The maximum number of items to
283
+ return per page.
284
+ page (int): Which page to return.
285
+ include_all (bool): If true, include all results
286
+ (i.e. do not paginate).
287
+
288
+ Returns:
289
+ IndexResult
290
+ """
291
+ _op = fresh_operation("get_all_discussions")
292
+ _op["method"] = "GET"
293
+ _op["path"] = "/sheets/" + str(sheet_id) + "/discussions"
294
+ _op["query_params"]["include"] = include
295
+ _op["query_params"]["pageSize"] = page_size
296
+ _op["query_params"]["page"] = page
297
+ _op["query_params"]["includeAll"] = include_all
298
+
299
+ expected = ["IndexResult", "Discussion"]
300
+
301
+ prepped_request = self._base.prepare_request(_op)
302
+ response = self._base.request(prepped_request, expected, _op)
303
+
304
+ return response
305
+
306
+ def get_discussion(self, sheet_id, discussion_id):
307
+ """Get the specified Discussion.
308
+
309
+ Args:
310
+ sheet_id (int): Sheet ID
311
+ discussion_id (int): Discussion ID
312
+
313
+ Returns:
314
+ Discussion
315
+ """
316
+ _op = fresh_operation("get_discussion")
317
+ _op["method"] = "GET"
318
+ _op["path"] = "/sheets/" + str(sheet_id) + "/discussions/" + str(discussion_id)
319
+
320
+ expected = "Discussion"
321
+ prepped_request = self._base.prepare_request(_op)
322
+ response = self._base.request(prepped_request, expected, _op)
323
+
324
+ return response
325
+
326
+ def get_discussion_comment(self, sheet_id, comment_id):
327
+ """Get the specified Comment.
328
+
329
+ Args:
330
+ sheet_id (int): Sheet ID
331
+ comment_id (int): Comment ID
332
+
333
+ Returns:
334
+ Comment
335
+ """
336
+ _op = fresh_operation("get_discussion_comment")
337
+ _op["method"] = "GET"
338
+ _op["path"] = "/sheets/" + str(sheet_id) + "/comments/" + str(comment_id)
339
+
340
+ expected = "Comment"
341
+ prepped_request = self._base.prepare_request(_op)
342
+ response = self._base.request(prepped_request, expected, _op)
343
+
344
+ return response
345
+
346
+ def get_row_discussions(
347
+ self,
348
+ sheet_id,
349
+ row_id,
350
+ include=None,
351
+ page_size=None,
352
+ page=None,
353
+ include_all=None,
354
+ ):
355
+ """Get a list of all Discussions associated with the specified Row.
356
+
357
+ Args:
358
+ sheet_id (int): Sheet ID
359
+ row_id (int): Row ID
360
+ include (list[str]): A comma-separated list of
361
+ optional elements to include in the response. Valid list
362
+ values: comments, attachments. (Attachments is effective
363
+ only if comments is present, otherwise ignored.)
364
+ page_size (int): The maximum number of items to
365
+ return per page.
366
+ page (int): Which page to return.
367
+ include_all (bool): If true, include all results
368
+ (i.e. do not paginate).
369
+
370
+ Returns:
371
+ IndexResult
372
+ """
373
+ _op = fresh_operation("get_row_discussions")
374
+ _op["method"] = "GET"
375
+ _op["path"] = (
376
+ "/sheets/" + str(sheet_id) + "/rows/" + str(row_id) + "/discussions"
377
+ )
378
+ _op["query_params"]["include"] = include
379
+ _op["query_params"]["pageSize"] = page_size
380
+ _op["query_params"]["page"] = page
381
+ _op["query_params"]["includeAll"] = include_all
382
+
383
+ expected = ["IndexResult", "Discussion"]
384
+
385
+ prepped_request = self._base.prepare_request(_op)
386
+ response = self._base.request(prepped_request, expected, _op)
387
+
388
+ return response
389
+
390
+ def update_comment(self, sheet_id, comment_id, comment_obj):
391
+ """Update the specified Comment.
392
+
393
+ Args:
394
+ sheet_id (int): Sheet ID
395
+ comment_id (int): Comment ID
396
+ comment_obj (Comment): Comment object with the following attributes:
397
+
398
+ Returns:
399
+ Result
400
+ """
401
+ _op = fresh_operation("update_comment")
402
+ _op["method"] = "PUT"
403
+ _op["path"] = "/sheets/" + str(sheet_id) + "/comments/" + str(comment_id)
404
+ _op["json"] = comment_obj
405
+
406
+ expected = ["Result", "Comment"]
407
+
408
+ prepped_request = self._base.prepare_request(_op)
409
+ response = self._base.request(prepped_request, expected, _op)
410
+
411
+ return response