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.
- smartsheet/__init__.py +37 -0
- smartsheet/attachments.py +565 -0
- smartsheet/cells.py +164 -0
- smartsheet/contacts.py +78 -0
- smartsheet/discussions.py +411 -0
- smartsheet/events.py +79 -0
- smartsheet/exceptions.py +130 -0
- smartsheet/favorites.py +116 -0
- smartsheet/folders.py +438 -0
- smartsheet/groups.py +186 -0
- smartsheet/home.py +180 -0
- smartsheet/images.py +61 -0
- smartsheet/models/__init__.py +126 -0
- smartsheet/models/access_token.py +95 -0
- smartsheet/models/account.py +77 -0
- smartsheet/models/alternate_email.py +88 -0
- smartsheet/models/asset_share.py +165 -0
- smartsheet/models/asset_shares_paginated_result.py +84 -0
- smartsheet/models/attachment.py +181 -0
- smartsheet/models/auto_number_format.py +81 -0
- smartsheet/models/automation_action.py +162 -0
- smartsheet/models/automation_rule.py +164 -0
- smartsheet/models/boolean_object_value.py +38 -0
- smartsheet/models/bulk_item_failure.py +77 -0
- smartsheet/models/bulk_item_result.py +111 -0
- smartsheet/models/cell.py +193 -0
- smartsheet/models/cell_data_item.py +152 -0
- smartsheet/models/cell_history.py +67 -0
- smartsheet/models/cell_link.py +91 -0
- smartsheet/models/cell_link_widget_content.py +101 -0
- smartsheet/models/chart_widget_content.py +124 -0
- smartsheet/models/column.py +253 -0
- smartsheet/models/comment.py +126 -0
- smartsheet/models/contact.py +88 -0
- smartsheet/models/contact_object_value.py +59 -0
- smartsheet/models/container_destination.py +74 -0
- smartsheet/models/copy_or_move_row_destination.py +54 -0
- smartsheet/models/copy_or_move_row_directive.py +64 -0
- smartsheet/models/copy_or_move_row_result.py +67 -0
- smartsheet/models/criteria.py +82 -0
- smartsheet/models/cross_sheet_reference.py +134 -0
- smartsheet/models/currency.py +64 -0
- smartsheet/models/date_object_value.py +56 -0
- smartsheet/models/datetime_object_value.py +56 -0
- smartsheet/models/discussion.py +183 -0
- smartsheet/models/downloaded_file.py +106 -0
- smartsheet/models/duration.py +112 -0
- smartsheet/models/email.py +82 -0
- smartsheet/models/enums/__init__.py +56 -0
- smartsheet/models/enums/access_level.py +26 -0
- smartsheet/models/enums/asset_type.py +10 -0
- smartsheet/models/enums/attachment_parent_type.py +23 -0
- smartsheet/models/enums/attachment_sub_type.py +26 -0
- smartsheet/models/enums/attachment_type.py +29 -0
- smartsheet/models/enums/automation_action_frequency.py +24 -0
- smartsheet/models/enums/automation_action_type.py +23 -0
- smartsheet/models/enums/automation_rule_disabled_reason.py +27 -0
- smartsheet/models/enums/cell_link_status.py +28 -0
- smartsheet/models/enums/column_type.py +31 -0
- smartsheet/models/enums/criteria_target.py +21 -0
- smartsheet/models/enums/cross_sheet_reference_status.py +28 -0
- smartsheet/models/enums/currency_code.py +43 -0
- smartsheet/models/enums/day_descriptors.py +30 -0
- smartsheet/models/enums/day_ordinal.py +25 -0
- smartsheet/models/enums/event_action.py +76 -0
- smartsheet/models/enums/event_obejct_type.py +34 -0
- smartsheet/models/enums/event_source.py +27 -0
- smartsheet/models/enums/global_template.py +23 -0
- smartsheet/models/enums/operator.py +62 -0
- smartsheet/models/enums/paper_type.py +29 -0
- smartsheet/models/enums/predecessor_type.py +24 -0
- smartsheet/models/enums/publish_accessible_by.py +22 -0
- smartsheet/models/enums/schedule_type.py +25 -0
- smartsheet/models/enums/seat_type.py +17 -0
- smartsheet/models/enums/share_scope.py +22 -0
- smartsheet/models/enums/share_type.py +22 -0
- smartsheet/models/enums/sheet_email_format.py +23 -0
- smartsheet/models/enums/sheet_filter_operator.py +22 -0
- smartsheet/models/enums/sheet_filter_type.py +23 -0
- smartsheet/models/enums/sort_direction.py +22 -0
- smartsheet/models/enums/symbol.py +45 -0
- smartsheet/models/enums/system_column_type.py +25 -0
- smartsheet/models/enums/update_request_status.py +23 -0
- smartsheet/models/enums/user_status.py +23 -0
- smartsheet/models/enums/widget_type.py +32 -0
- smartsheet/models/error.py +74 -0
- smartsheet/models/error_result.py +117 -0
- smartsheet/models/event.py +153 -0
- smartsheet/models/event_result.py +86 -0
- smartsheet/models/explicit_null.py +24 -0
- smartsheet/models/favorite.py +81 -0
- smartsheet/models/folder.py +177 -0
- smartsheet/models/font_family.py +63 -0
- smartsheet/models/format_details.py +55 -0
- smartsheet/models/format_tables.py +191 -0
- smartsheet/models/group.py +134 -0
- smartsheet/models/group_member.py +104 -0
- smartsheet/models/home.py +110 -0
- smartsheet/models/hyperlink.py +81 -0
- smartsheet/models/image.py +101 -0
- smartsheet/models/image_url.py +91 -0
- smartsheet/models/image_url_map.py +68 -0
- smartsheet/models/image_widget_content.py +117 -0
- smartsheet/models/index_result.py +118 -0
- smartsheet/models/json_object.py +59 -0
- smartsheet/models/multi_contact_object_value.py +49 -0
- smartsheet/models/multi_picklist_object_value.py +48 -0
- smartsheet/models/multi_row_email.py +60 -0
- smartsheet/models/number_object_value.py +38 -0
- smartsheet/models/o_auth_error.py +86 -0
- smartsheet/models/object_value.py +130 -0
- smartsheet/models/paginated_children_result.py +80 -0
- smartsheet/models/predecessor.py +102 -0
- smartsheet/models/predecessor_list.py +49 -0
- smartsheet/models/primitive_object_value.py +59 -0
- smartsheet/models/profile_image.py +72 -0
- smartsheet/models/project_settings.py +89 -0
- smartsheet/models/recipient.py +63 -0
- smartsheet/models/report.py +90 -0
- smartsheet/models/report_cell.py +59 -0
- smartsheet/models/report_column.py +67 -0
- smartsheet/models/report_publish.py +95 -0
- smartsheet/models/report_row.py +68 -0
- smartsheet/models/report_widget_content.py +78 -0
- smartsheet/models/result.py +105 -0
- smartsheet/models/row.py +336 -0
- smartsheet/models/row_email.py +83 -0
- smartsheet/models/row_mapping.py +77 -0
- smartsheet/models/schedule.py +140 -0
- smartsheet/models/scope.py +70 -0
- smartsheet/models/search_result.py +67 -0
- smartsheet/models/search_result_item.py +150 -0
- smartsheet/models/selection_range.py +86 -0
- smartsheet/models/sent_update_request.py +172 -0
- smartsheet/models/server_info.py +67 -0
- smartsheet/models/share.py +183 -0
- smartsheet/models/sheet.py +462 -0
- smartsheet/models/sheet_email.py +81 -0
- smartsheet/models/sheet_filter.py +106 -0
- smartsheet/models/sheet_filter_details.py +76 -0
- smartsheet/models/sheet_publish.py +184 -0
- smartsheet/models/sheet_summary.py +59 -0
- smartsheet/models/sheet_user_permissions.py +58 -0
- smartsheet/models/sheet_user_settings.py +72 -0
- smartsheet/models/shortcut_data_item.py +102 -0
- smartsheet/models/shortcut_widget_content.py +61 -0
- smartsheet/models/sight.py +175 -0
- smartsheet/models/sight_publish.py +77 -0
- smartsheet/models/sort_criterion.py +64 -0
- smartsheet/models/sort_specifier.py +55 -0
- smartsheet/models/source.py +83 -0
- smartsheet/models/string_object_value.py +38 -0
- smartsheet/models/summary_field.py +256 -0
- smartsheet/models/template.py +171 -0
- smartsheet/models/title_rich_text_widget_content.py +68 -0
- smartsheet/models/token_paginated_result.py +79 -0
- smartsheet/models/update_request.py +110 -0
- smartsheet/models/user.py +58 -0
- smartsheet/models/user_model.py +280 -0
- smartsheet/models/user_plan.py +77 -0
- smartsheet/models/user_profile.py +89 -0
- smartsheet/models/version.py +57 -0
- smartsheet/models/web_content_widget_content.py +60 -0
- smartsheet/models/webhook.py +219 -0
- smartsheet/models/webhook_secret.py +58 -0
- smartsheet/models/webhook_stats.py +76 -0
- smartsheet/models/webhook_subscope.py +50 -0
- smartsheet/models/widget.py +211 -0
- smartsheet/models/widget_content.py +52 -0
- smartsheet/models/widget_hyperlink.py +74 -0
- smartsheet/models/workspace.py +185 -0
- smartsheet/object_value.py +72 -0
- smartsheet/passthrough.py +127 -0
- smartsheet/reports.py +382 -0
- smartsheet/search.py +100 -0
- smartsheet/server.py +48 -0
- smartsheet/session.py +70 -0
- smartsheet/sharing.py +163 -0
- smartsheet/sheets.py +2062 -0
- smartsheet/sights.py +370 -0
- smartsheet/smartsheet.py +684 -0
- smartsheet/templates.py +87 -0
- smartsheet/token.py +128 -0
- smartsheet/types.py +323 -0
- smartsheet/users.py +490 -0
- smartsheet/util.py +199 -0
- smartsheet/version.py +34 -0
- smartsheet/webhooks.py +161 -0
- smartsheet/workspaces.py +647 -0
- smartsheet_python_sdk-3.5.5.dist-info/METADATA +120 -0
- smartsheet_python_sdk-3.5.5.dist-info/RECORD +195 -0
- smartsheet_python_sdk-3.5.5.dist-info/WHEEL +5 -0
- smartsheet_python_sdk-3.5.5.dist-info/licenses/LICENSE.md +201 -0
- smartsheet_python_sdk-3.5.5.dist-info/licenses/NOTICE +10 -0
- 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
|