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
|
@@ -0,0 +1,74 @@
|
|
|
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 Number, String, json
|
|
21
|
+
from ..util import deserialize, serialize
|
|
22
|
+
from .hyperlink import Hyperlink
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class WidgetHyperlink(Hyperlink):
|
|
26
|
+
|
|
27
|
+
"""Smartsheet WidgetHyperlink data model."""
|
|
28
|
+
|
|
29
|
+
def __init__(self, props=None, base_obj=None):
|
|
30
|
+
"""Initialize the WidgetHyperlink model."""
|
|
31
|
+
super().__init__(None, base_obj)
|
|
32
|
+
self._base = None
|
|
33
|
+
if base_obj is not None:
|
|
34
|
+
self._base = base_obj
|
|
35
|
+
|
|
36
|
+
self._interaction_type = String()
|
|
37
|
+
self._folder_id = Number()
|
|
38
|
+
self._workspace_id = Number()
|
|
39
|
+
|
|
40
|
+
if props:
|
|
41
|
+
deserialize(self, props)
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def interaction_type(self):
|
|
45
|
+
return self._interaction_type.value
|
|
46
|
+
|
|
47
|
+
@interaction_type.setter
|
|
48
|
+
def interaction_type(self, value):
|
|
49
|
+
self._interaction_type.value = value
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def folder_id(self):
|
|
53
|
+
return self._folder_id.value
|
|
54
|
+
|
|
55
|
+
@folder_id.setter
|
|
56
|
+
def folder_id(self, value):
|
|
57
|
+
self._folder_id.value = value
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def workspace_id(self):
|
|
61
|
+
return self._workspace_id.value
|
|
62
|
+
|
|
63
|
+
@workspace_id.setter
|
|
64
|
+
def workspace_id(self, value):
|
|
65
|
+
self._worksspace_id.value = value
|
|
66
|
+
|
|
67
|
+
def to_dict(self):
|
|
68
|
+
return serialize(self)
|
|
69
|
+
|
|
70
|
+
def to_json(self):
|
|
71
|
+
return json.dumps(self.to_dict())
|
|
72
|
+
|
|
73
|
+
def __str__(self):
|
|
74
|
+
return self.to_json()
|
|
@@ -0,0 +1,185 @@
|
|
|
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 Boolean, EnumeratedValue, Number, String, Timestamp, TypedList, TypedObject, json
|
|
21
|
+
from ..util import deserialize, serialize
|
|
22
|
+
from .enums import AccessLevel
|
|
23
|
+
from .folder import Folder
|
|
24
|
+
from .report import Report
|
|
25
|
+
from .sheet import Sheet
|
|
26
|
+
from .sight import Sight
|
|
27
|
+
from .source import Source
|
|
28
|
+
from .template import Template
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Workspace:
|
|
32
|
+
|
|
33
|
+
"""Smartsheet Workspace data model."""
|
|
34
|
+
|
|
35
|
+
def __init__(self, props=None, base_obj=None):
|
|
36
|
+
"""Initialize the Workspace model."""
|
|
37
|
+
self._base = None
|
|
38
|
+
if base_obj is not None:
|
|
39
|
+
self._base = base_obj
|
|
40
|
+
|
|
41
|
+
self._access_level = EnumeratedValue(AccessLevel)
|
|
42
|
+
self._created_at = Timestamp()
|
|
43
|
+
self._favorite = Boolean()
|
|
44
|
+
self._folders = TypedList(Folder)
|
|
45
|
+
self._id_ = Number()
|
|
46
|
+
self._modified_at = Timestamp()
|
|
47
|
+
self._name = String()
|
|
48
|
+
self._permalink = String()
|
|
49
|
+
self._reports = TypedList(Report)
|
|
50
|
+
self._sheets = TypedList(Sheet)
|
|
51
|
+
self._sights = TypedList(Sight)
|
|
52
|
+
self._source = TypedObject(Source)
|
|
53
|
+
self._templates = TypedList(Template)
|
|
54
|
+
|
|
55
|
+
if props:
|
|
56
|
+
deserialize(self, props)
|
|
57
|
+
|
|
58
|
+
# requests package Response object
|
|
59
|
+
self.request_response = None
|
|
60
|
+
self.__initialized = True
|
|
61
|
+
|
|
62
|
+
def __getattr__(self, key):
|
|
63
|
+
if key == "id":
|
|
64
|
+
return self.id_
|
|
65
|
+
else:
|
|
66
|
+
raise AttributeError(key)
|
|
67
|
+
|
|
68
|
+
def __setattr__(self, key, value):
|
|
69
|
+
if key == "id":
|
|
70
|
+
self.id_ = value
|
|
71
|
+
else:
|
|
72
|
+
super().__setattr__(key, value)
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def access_level(self):
|
|
76
|
+
return self._access_level
|
|
77
|
+
|
|
78
|
+
@access_level.setter
|
|
79
|
+
def access_level(self, value):
|
|
80
|
+
self._access_level.set(value)
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def created_at(self):
|
|
84
|
+
return self._created_at.value
|
|
85
|
+
|
|
86
|
+
@created_at.setter
|
|
87
|
+
def created_at(self, value):
|
|
88
|
+
self._created_at.value = value
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def favorite(self):
|
|
92
|
+
return self._favorite.value
|
|
93
|
+
|
|
94
|
+
@favorite.setter
|
|
95
|
+
def favorite(self, value):
|
|
96
|
+
self._favorite.value = value
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def folders(self):
|
|
100
|
+
return self._folders
|
|
101
|
+
|
|
102
|
+
@folders.setter
|
|
103
|
+
def folders(self, value):
|
|
104
|
+
self._folders.load(value)
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def id_(self):
|
|
108
|
+
return self._id_.value
|
|
109
|
+
|
|
110
|
+
@id_.setter
|
|
111
|
+
def id_(self, value):
|
|
112
|
+
self._id_.value = value
|
|
113
|
+
|
|
114
|
+
@property
|
|
115
|
+
def modified_at(self):
|
|
116
|
+
return self._modified_at.value
|
|
117
|
+
|
|
118
|
+
@modified_at.setter
|
|
119
|
+
def modified_at(self, value):
|
|
120
|
+
self._modified_at.value = value
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def name(self):
|
|
124
|
+
return self._name.value
|
|
125
|
+
|
|
126
|
+
@name.setter
|
|
127
|
+
def name(self, value):
|
|
128
|
+
self._name.value = value
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def permalink(self):
|
|
132
|
+
return self._permalink.value
|
|
133
|
+
|
|
134
|
+
@permalink.setter
|
|
135
|
+
def permalink(self, value):
|
|
136
|
+
self._permalink.value = value
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def reports(self):
|
|
140
|
+
return self._reports
|
|
141
|
+
|
|
142
|
+
@reports.setter
|
|
143
|
+
def reports(self, value):
|
|
144
|
+
self._reports.load(value)
|
|
145
|
+
|
|
146
|
+
@property
|
|
147
|
+
def sheets(self):
|
|
148
|
+
return self._sheets
|
|
149
|
+
|
|
150
|
+
@sheets.setter
|
|
151
|
+
def sheets(self, value):
|
|
152
|
+
self._sheets.load(value)
|
|
153
|
+
|
|
154
|
+
@property
|
|
155
|
+
def sights(self):
|
|
156
|
+
return self._sights
|
|
157
|
+
|
|
158
|
+
@sights.setter
|
|
159
|
+
def sights(self, value):
|
|
160
|
+
self._sights.load(value)
|
|
161
|
+
|
|
162
|
+
@property
|
|
163
|
+
def source(self):
|
|
164
|
+
return self._source.value
|
|
165
|
+
|
|
166
|
+
@source.setter
|
|
167
|
+
def source(self, value):
|
|
168
|
+
self._source.value = value
|
|
169
|
+
|
|
170
|
+
@property
|
|
171
|
+
def templates(self):
|
|
172
|
+
return self._templates
|
|
173
|
+
|
|
174
|
+
@templates.setter
|
|
175
|
+
def templates(self, value):
|
|
176
|
+
self._templates.load(value)
|
|
177
|
+
|
|
178
|
+
def to_dict(self):
|
|
179
|
+
return serialize(self)
|
|
180
|
+
|
|
181
|
+
def to_json(self):
|
|
182
|
+
return json.dumps(self.to_dict())
|
|
183
|
+
|
|
184
|
+
def __str__(self):
|
|
185
|
+
return self.to_json()
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# pylint: disable=R0911,R0912
|
|
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 .models.boolean_object_value import BooleanObjectValue
|
|
19
|
+
from .models.contact_object_value import ContactObjectValue
|
|
20
|
+
from .models.date_object_value import DateObjectValue
|
|
21
|
+
from .models.datetime_object_value import DatetimeObjectValue
|
|
22
|
+
from .models.duration import Duration
|
|
23
|
+
from .models.multi_contact_object_value import MultiContactObjectValue
|
|
24
|
+
from .models.multi_picklist_object_value import MultiPicklistObjectValue
|
|
25
|
+
from .models.number_object_value import NumberObjectValue
|
|
26
|
+
from .models.object_value import (ABSTRACT_DATETIME, CONTACT, DATE, DATETIME,
|
|
27
|
+
DURATION, MULTI_CONTACT, MULTI_PICKLIST,
|
|
28
|
+
OBJECT_VALUE, PREDECESSOR_LIST, ObjectValue,
|
|
29
|
+
enum_object_value_type, six)
|
|
30
|
+
from .models.predecessor_list import PredecessorList
|
|
31
|
+
from .models.string_object_value import StringObjectValue
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def assign_to_object_value(value):
|
|
35
|
+
|
|
36
|
+
if isinstance(value, ObjectValue):
|
|
37
|
+
return value
|
|
38
|
+
elif isinstance(value, dict):
|
|
39
|
+
object_type = value["objectType"]
|
|
40
|
+
if object_type in OBJECT_VALUE["object_type"]:
|
|
41
|
+
enum_object_type = enum_object_value_type(object_type)
|
|
42
|
+
if enum_object_type == DURATION:
|
|
43
|
+
return Duration(value)
|
|
44
|
+
elif enum_object_type == PREDECESSOR_LIST:
|
|
45
|
+
return PredecessorList(value)
|
|
46
|
+
elif enum_object_type == CONTACT:
|
|
47
|
+
return ContactObjectValue(value)
|
|
48
|
+
elif enum_object_type == DATE:
|
|
49
|
+
return DateObjectValue(value)
|
|
50
|
+
elif enum_object_type in (DATETIME, ABSTRACT_DATETIME):
|
|
51
|
+
return DatetimeObjectValue(value, enum_object_value_type)
|
|
52
|
+
elif enum_object_type == MULTI_CONTACT:
|
|
53
|
+
return MultiContactObjectValue(value)
|
|
54
|
+
elif enum_object_type == MULTI_PICKLIST:
|
|
55
|
+
return MultiPicklistObjectValue(value)
|
|
56
|
+
else:
|
|
57
|
+
return None
|
|
58
|
+
else:
|
|
59
|
+
raise ValueError(
|
|
60
|
+
(
|
|
61
|
+
f"`{object_type}` is an invalid value for ObjectValue`object_type`,"
|
|
62
|
+
f" must be one of {OBJECT_VALUE['object_type']}"
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
elif isinstance(value, six.string_types):
|
|
66
|
+
return StringObjectValue(value)
|
|
67
|
+
elif isinstance(value, bool):
|
|
68
|
+
return BooleanObjectValue(value)
|
|
69
|
+
elif isinstance(value, (six.integer_types, float)):
|
|
70
|
+
return NumberObjectValue(value)
|
|
71
|
+
else:
|
|
72
|
+
return None
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
from __future__ import absolute_import
|
|
19
|
+
|
|
20
|
+
import logging
|
|
21
|
+
|
|
22
|
+
from . import fresh_operation
|
|
23
|
+
from .models import JSONObject
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Passthrough:
|
|
27
|
+
|
|
28
|
+
"""Class for handling Sheets operations."""
|
|
29
|
+
|
|
30
|
+
def __init__(self, smartsheet_obj):
|
|
31
|
+
"""Init Sheets with base Smartsheet object."""
|
|
32
|
+
self._base = smartsheet_obj
|
|
33
|
+
self._log = logging.getLogger(__name__)
|
|
34
|
+
|
|
35
|
+
def get(self, endpoint, query_params=None):
|
|
36
|
+
"""Issue a GET request on the specified URL.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
endpoint (str): Endpoint URL (relative to base), e.g. '/sheets'
|
|
40
|
+
query_params (dict): Optional dictionary of additional query parameters
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
JSONObject
|
|
44
|
+
"""
|
|
45
|
+
_op = fresh_operation("get_passthrough")
|
|
46
|
+
_op["method"] = "GET"
|
|
47
|
+
_op["path"] = endpoint
|
|
48
|
+
_op["query_params"] = query_params
|
|
49
|
+
|
|
50
|
+
expected = "JSONObject"
|
|
51
|
+
|
|
52
|
+
prepped_request = self._base.prepare_request(_op)
|
|
53
|
+
response = self._base.request(prepped_request, expected, _op)
|
|
54
|
+
|
|
55
|
+
return response
|
|
56
|
+
|
|
57
|
+
def post(self, endpoint, payload, query_params=None):
|
|
58
|
+
"""Issue a POST request on the specified URL.
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
endpoint (str): Endpoint URL (relative to base), e.g. '/sheets'
|
|
62
|
+
payload (str, dict, or JSONObject): JSON payload
|
|
63
|
+
query_params (dict): Optional dictionary of additional query parameters
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
JSONObject
|
|
67
|
+
"""
|
|
68
|
+
_op = fresh_operation("post_passthrough")
|
|
69
|
+
_op["method"] = "POST"
|
|
70
|
+
_op["path"] = endpoint
|
|
71
|
+
if not isinstance(payload, JSONObject):
|
|
72
|
+
payload = JSONObject(payload)
|
|
73
|
+
_op["json"] = payload
|
|
74
|
+
_op["query_params"] = query_params
|
|
75
|
+
|
|
76
|
+
expected = "JSONObject"
|
|
77
|
+
|
|
78
|
+
prepped_request = self._base.prepare_request(_op)
|
|
79
|
+
response = self._base.request(prepped_request, expected, _op)
|
|
80
|
+
|
|
81
|
+
return response
|
|
82
|
+
|
|
83
|
+
def put(self, endpoint, payload, query_params=None):
|
|
84
|
+
"""Issue a PUT request on the specified URL.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
endpoint (str): Endpoint URL (relative to base), e.g. '/sheets/{id}'
|
|
88
|
+
payload (str, dict or JSONObject): JSON payload
|
|
89
|
+
query_params (dict): Optional dictionary of additional query parameters
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
JSONObject
|
|
93
|
+
"""
|
|
94
|
+
_op = fresh_operation("put_passthrough")
|
|
95
|
+
_op["method"] = "PUT"
|
|
96
|
+
_op["path"] = endpoint
|
|
97
|
+
if not isinstance(payload, JSONObject):
|
|
98
|
+
payload = JSONObject(payload)
|
|
99
|
+
_op["json"] = payload
|
|
100
|
+
_op["query_params"] = query_params
|
|
101
|
+
|
|
102
|
+
expected = "JSONObject"
|
|
103
|
+
|
|
104
|
+
prepped_request = self._base.prepare_request(_op)
|
|
105
|
+
response = self._base.request(prepped_request, expected, _op)
|
|
106
|
+
|
|
107
|
+
return response
|
|
108
|
+
|
|
109
|
+
def delete(self, endpoint):
|
|
110
|
+
"""Issue a DELETE request on the specified URL.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
endpoint (str): Endpoint URL (relative to base), e.g. '/sheets/{id}'
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
JSONObject
|
|
117
|
+
"""
|
|
118
|
+
_op = fresh_operation("get_passthrough")
|
|
119
|
+
_op["method"] = "DELETE"
|
|
120
|
+
_op["path"] = endpoint
|
|
121
|
+
|
|
122
|
+
expected = "JSONObject"
|
|
123
|
+
|
|
124
|
+
prepped_request = self._base.prepare_request(_op)
|
|
125
|
+
response = self._base.request(prepped_request, expected, _op)
|
|
126
|
+
|
|
127
|
+
return response
|