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/events.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# pylint: disable=C0111,R0902,R0913
|
|
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
|
+
import logging
|
|
21
|
+
from datetime import datetime
|
|
22
|
+
|
|
23
|
+
from . import fresh_operation
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Events:
|
|
27
|
+
def __init__(self, smartsheet_obj):
|
|
28
|
+
"""Init Events with base Smartsheet object."""
|
|
29
|
+
self._base = smartsheet_obj
|
|
30
|
+
self._log = logging.getLogger(__name__)
|
|
31
|
+
|
|
32
|
+
def list_events(
|
|
33
|
+
self, since=None, to=None, stream_position=None, max_count=None, numeric_dates=None # pylint: disable=invalid-name
|
|
34
|
+
):
|
|
35
|
+
"""Get the list of all Events.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
since (str or long): Starting time for events to return.
|
|
39
|
+
You must pass in a value for either since or streamPosition and never both.
|
|
40
|
+
to (str or long): Ending time for events to return.
|
|
41
|
+
This parameter specifies the endpoint in time for the events to be fetched.
|
|
42
|
+
Similar to the `since` parameter, `to` can be passed in either as a datetime string in
|
|
43
|
+
ISO 8601 format or as a UNIX epoch time in milliseconds. This allows for defining a
|
|
44
|
+
precise time range for the events query. Note that `to` is optional and can be used in
|
|
45
|
+
conjunction with `since` to specify both the start and end times for the event retrieval window.
|
|
46
|
+
stream_position (str): Indicates next set of events to return.
|
|
47
|
+
Use value of nextStreamPosition returned from the previous call.
|
|
48
|
+
You must pass in a value for either since or streamPosition and never both.
|
|
49
|
+
max_count (int): Maximum number of events to return as response to this call.
|
|
50
|
+
Must be between 1 through 10,000 (inclusive).
|
|
51
|
+
numeric_dates (bool): If true, dates are accepted and returned in Unix epoch time
|
|
52
|
+
(milliseconds since midnight on January 1, 1970 in UTC time).
|
|
53
|
+
Default is false, which means ISO-8601 format
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
EventResult containing Event array as data[]
|
|
57
|
+
"""
|
|
58
|
+
_op = fresh_operation("list_events")
|
|
59
|
+
_op["method"] = "GET"
|
|
60
|
+
_op["path"] = "/events"
|
|
61
|
+
if isinstance(since, datetime):
|
|
62
|
+
_op["query_params"]["since"] = since.isoformat()
|
|
63
|
+
else:
|
|
64
|
+
_op["query_params"]["since"] = since
|
|
65
|
+
|
|
66
|
+
if isinstance(to, datetime):
|
|
67
|
+
_op["query_params"]["to"] = to.isoformat()
|
|
68
|
+
else:
|
|
69
|
+
_op["query_params"]["to"] = to
|
|
70
|
+
_op["query_params"]["streamPosition"] = stream_position
|
|
71
|
+
_op["query_params"]["maxCount"] = max_count
|
|
72
|
+
_op["query_params"]["numericDates"] = numeric_dates
|
|
73
|
+
|
|
74
|
+
expected = ["EventResult", "Event"]
|
|
75
|
+
|
|
76
|
+
prepped_request = self._base.prepare_request(_op)
|
|
77
|
+
response = self._base.request(prepped_request, expected, _op)
|
|
78
|
+
|
|
79
|
+
return response
|
smartsheet/exceptions.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# pylint: disable=C0302,C0111, E1121
|
|
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
|
+
|
|
19
|
+
|
|
20
|
+
class SmartsheetException(Exception):
|
|
21
|
+
"""Root for SmartsheetErrors, never raised directly."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ApiError(SmartsheetException):
|
|
25
|
+
"""Errors produced by the Smartsheet API."""
|
|
26
|
+
|
|
27
|
+
def __init__(self, error, message=None, should_retry=False):
|
|
28
|
+
"""
|
|
29
|
+
An error produced by the API.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
error: An instance of the Error data type.
|
|
33
|
+
message (str): A human-readable message that can be
|
|
34
|
+
displayed to the end user. Is None, if unavailable.
|
|
35
|
+
"""
|
|
36
|
+
super().__init__(error)
|
|
37
|
+
self.error = error
|
|
38
|
+
self.message = message
|
|
39
|
+
self.should_retry = should_retry
|
|
40
|
+
|
|
41
|
+
def __repr__(self):
|
|
42
|
+
return f"ApiError({self.error})"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class HttpError(SmartsheetException):
|
|
46
|
+
"""Errors produced at the HTTP layer."""
|
|
47
|
+
|
|
48
|
+
def __init__(self, status_code, body):
|
|
49
|
+
super().__init__(status_code, body)
|
|
50
|
+
self.status_code = status_code
|
|
51
|
+
self.body = body
|
|
52
|
+
|
|
53
|
+
def __repr__(self):
|
|
54
|
+
return f"HttpError({self.status_code}, {self.body!r})"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class InternalServerError(HttpError):
|
|
58
|
+
"""Errors due to a problem on Smartsheet."""
|
|
59
|
+
|
|
60
|
+
def __init__(self, status_code, message):
|
|
61
|
+
super().__init__(status_code, status_code, message)
|
|
62
|
+
self.status_code = status_code
|
|
63
|
+
self.message = message
|
|
64
|
+
|
|
65
|
+
def __repr__(self):
|
|
66
|
+
return f"InternalServerError({self.status_code}, {self.message!r})"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class UnexpectedRequestError(SmartsheetException):
|
|
70
|
+
"""Error originating from Requests API."""
|
|
71
|
+
|
|
72
|
+
def __init__(self, request, response):
|
|
73
|
+
super().__init__(request, response)
|
|
74
|
+
self.request = request
|
|
75
|
+
self.response = response
|
|
76
|
+
|
|
77
|
+
def __repr__(self):
|
|
78
|
+
return f"UnexpectedRequestError({self.request!r}, {self.response!r})"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class SystemMaintenanceError(ApiError):
|
|
82
|
+
"""Smartsheet.com is currently offline for system maintenance. ..."""
|
|
83
|
+
|
|
84
|
+
def __init__(self, error, message):
|
|
85
|
+
super().__init__(error, message, True)
|
|
86
|
+
self.error = error
|
|
87
|
+
self.message = message
|
|
88
|
+
self.should_retry = True
|
|
89
|
+
|
|
90
|
+
def __repr__(self):
|
|
91
|
+
return f"SystemMaintenanceError({self.message!r})"
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ServerTimeoutExceededError(ApiError):
|
|
95
|
+
"""Server timeout exceeded. Request has failed."""
|
|
96
|
+
|
|
97
|
+
def __init__(self, error, message):
|
|
98
|
+
super().__init__(error, message, True)
|
|
99
|
+
self.error = error
|
|
100
|
+
self.message = message
|
|
101
|
+
self.should_retry = True
|
|
102
|
+
|
|
103
|
+
def __repr__(self):
|
|
104
|
+
return f"ServerTimeoutExceededError({self.message!r})"
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class RateLimitExceededError(ApiError):
|
|
108
|
+
"""Rate limit exceeded."""
|
|
109
|
+
|
|
110
|
+
def __init__(self, error, message):
|
|
111
|
+
super().__init__(error, message, True)
|
|
112
|
+
self.error = error
|
|
113
|
+
self.message = message
|
|
114
|
+
self.should_retry = True
|
|
115
|
+
|
|
116
|
+
def __repr__(self):
|
|
117
|
+
return f"RateLimitExceededError({self.message!r})"
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class UnexpectedErrorShouldRetryError(ApiError):
|
|
121
|
+
"""An unexpected error has occurred. Please retry your request. If ..."""
|
|
122
|
+
|
|
123
|
+
def __init__(self, error, message):
|
|
124
|
+
super().__init__(error, message, True)
|
|
125
|
+
self.error = error
|
|
126
|
+
self.message = message
|
|
127
|
+
self.should_retry = True
|
|
128
|
+
|
|
129
|
+
def __repr__(self):
|
|
130
|
+
return f"UnexpectedErrorShouldRetryError({self.message!r})"
|
smartsheet/favorites.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
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 Favorites:
|
|
26
|
+
|
|
27
|
+
"""Class for handling Favorites operations."""
|
|
28
|
+
|
|
29
|
+
def __init__(self, smartsheet_obj):
|
|
30
|
+
"""Init Favorites with base Smartsheet object."""
|
|
31
|
+
self._base = smartsheet_obj
|
|
32
|
+
self._log = logging.getLogger(__name__)
|
|
33
|
+
|
|
34
|
+
def add_favorites(self, favorite_obj):
|
|
35
|
+
"""Add one or more items to the user's list of Favorite items.
|
|
36
|
+
|
|
37
|
+
Adds one or more items to the user's list of Favorite
|
|
38
|
+
items. This operation supports both single-object and bulk
|
|
39
|
+
semantics. If called with a single Favorite object, and that
|
|
40
|
+
favorite already exists, error code 1129 will be returned. If
|
|
41
|
+
called with an array of Favorite objects, any objects specified in
|
|
42
|
+
the array that are already marked as favorites will be ignored and
|
|
43
|
+
ommitted from the response.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
favorite_obj (list[Favorite]): Array of one or
|
|
47
|
+
more Favorite objects
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
Result
|
|
51
|
+
"""
|
|
52
|
+
_op = fresh_operation("add_favorites")
|
|
53
|
+
_op["method"] = "POST"
|
|
54
|
+
_op["path"] = "/favorites"
|
|
55
|
+
_op["json"] = favorite_obj
|
|
56
|
+
|
|
57
|
+
expected = ["Result", "Favorite"]
|
|
58
|
+
|
|
59
|
+
prepped_request = self._base.prepare_request(_op)
|
|
60
|
+
response = self._base.request(prepped_request, expected, _op)
|
|
61
|
+
|
|
62
|
+
return response
|
|
63
|
+
|
|
64
|
+
def list_favorites(self, page_size=None, page=None, include_all=None):
|
|
65
|
+
"""Get a list of all the user's Favorite items.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
page_size (int): The maximum number of items to
|
|
69
|
+
return per page.
|
|
70
|
+
page (int): Which page to return.
|
|
71
|
+
include_all (bool): If true, include all results
|
|
72
|
+
(i.e. do not paginate).
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
IndexResult
|
|
76
|
+
"""
|
|
77
|
+
_op = fresh_operation("list_favorites")
|
|
78
|
+
_op["method"] = "GET"
|
|
79
|
+
_op["path"] = "/favorites"
|
|
80
|
+
_op["query_params"]["pageSize"] = page_size
|
|
81
|
+
_op["query_params"]["page"] = page
|
|
82
|
+
_op["query_params"]["includeAll"] = include_all
|
|
83
|
+
|
|
84
|
+
expected = ["IndexResult", "Favorite"]
|
|
85
|
+
|
|
86
|
+
prepped_request = self._base.prepare_request(_op)
|
|
87
|
+
response = self._base.request(prepped_request, expected, _op)
|
|
88
|
+
|
|
89
|
+
return response
|
|
90
|
+
|
|
91
|
+
def remove_favorites(self, favorite_type, object_ids):
|
|
92
|
+
"""Delete one or more of Favorite objects of the specified type.
|
|
93
|
+
|
|
94
|
+
Specify a favorite type of: folder, report, sheet,
|
|
95
|
+
template, workspace. The object IDs passed in will be deleted in a
|
|
96
|
+
batch operation.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
favorite_type (str): Name of favorite type to
|
|
100
|
+
manipulate.
|
|
101
|
+
object_ids (list[int]): a comma-separated list
|
|
102
|
+
of object IDs representing the items to work on.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Result
|
|
106
|
+
"""
|
|
107
|
+
_op = fresh_operation("remove_favorites")
|
|
108
|
+
_op["method"] = "DELETE"
|
|
109
|
+
_op["path"] = "/favorites/" + str(favorite_type)
|
|
110
|
+
_op["query_params"]["objectIds"] = object_ids
|
|
111
|
+
|
|
112
|
+
expected = ["Result", None]
|
|
113
|
+
prepped_request = self._base.prepare_request(_op)
|
|
114
|
+
response = self._base.request(prepped_request, expected, _op)
|
|
115
|
+
|
|
116
|
+
return response
|