files-com 1.6.208__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.
Potentially problematic release.
This version of files-com might be problematic. Click here for more details.
- README.md +758 -0
- _VERSION +1 -0
- files_com-1.6.208.dist-info/METADATA +770 -0
- files_com-1.6.208.dist-info/RECORD +126 -0
- files_com-1.6.208.dist-info/WHEEL +5 -0
- files_com-1.6.208.dist-info/licenses/LICENSE +21 -0
- files_com-1.6.208.dist-info/top_level.txt +1 -0
- files_sdk/__init__.py +309 -0
- files_sdk/api.py +63 -0
- files_sdk/api_client.py +336 -0
- files_sdk/error.py +2981 -0
- files_sdk/list_obj.py +42 -0
- files_sdk/models/__init__.py +119 -0
- files_sdk/models/account_line_item.py +51 -0
- files_sdk/models/action.py +49 -0
- files_sdk/models/action_notification_export.py +153 -0
- files_sdk/models/action_notification_export_result.py +88 -0
- files_sdk/models/agent_push_update.py +44 -0
- files_sdk/models/api_key.py +318 -0
- files_sdk/models/api_request_log.py +105 -0
- files_sdk/models/app.py +89 -0
- files_sdk/models/as2_incoming_message.py +117 -0
- files_sdk/models/as2_outgoing_message.py +113 -0
- files_sdk/models/as2_partner.py +415 -0
- files_sdk/models/as2_station.py +282 -0
- files_sdk/models/auto.py +36 -0
- files_sdk/models/automation.py +823 -0
- files_sdk/models/automation_log.py +94 -0
- files_sdk/models/automation_run.py +112 -0
- files_sdk/models/bandwidth_snapshot.py +91 -0
- files_sdk/models/behavior.py +340 -0
- files_sdk/models/bundle.py +686 -0
- files_sdk/models/bundle_action.py +93 -0
- files_sdk/models/bundle_download.py +94 -0
- files_sdk/models/bundle_notification.py +252 -0
- files_sdk/models/bundle_path.py +37 -0
- files_sdk/models/bundle_recipient.py +133 -0
- files_sdk/models/bundle_registration.py +82 -0
- files_sdk/models/child_site_management_policy.py +278 -0
- files_sdk/models/clickwrap.py +268 -0
- files_sdk/models/dns_record.py +59 -0
- files_sdk/models/email_incoming_message.py +102 -0
- files_sdk/models/email_log.py +84 -0
- files_sdk/models/errors.py +37 -0
- files_sdk/models/exavault_api_request_log.py +102 -0
- files_sdk/models/external_event.py +148 -0
- files_sdk/models/file.py +851 -0
- files_sdk/models/file_action.py +39 -0
- files_sdk/models/file_comment.py +191 -0
- files_sdk/models/file_comment_reaction.py +125 -0
- files_sdk/models/file_migration.py +69 -0
- files_sdk/models/file_migration_log.py +88 -0
- files_sdk/models/file_upload_part.py +54 -0
- files_sdk/models/folder.py +186 -0
- files_sdk/models/form_field.py +43 -0
- files_sdk/models/form_field_set.py +265 -0
- files_sdk/models/ftp_action_log.py +104 -0
- files_sdk/models/gpg_key.py +333 -0
- files_sdk/models/group.py +338 -0
- files_sdk/models/group_user.py +235 -0
- files_sdk/models/history.py +236 -0
- files_sdk/models/history_export.py +238 -0
- files_sdk/models/history_export_result.py +98 -0
- files_sdk/models/holiday_region.py +58 -0
- files_sdk/models/image.py +37 -0
- files_sdk/models/inbound_s3_log.py +95 -0
- files_sdk/models/inbox_recipient.py +124 -0
- files_sdk/models/inbox_registration.py +79 -0
- files_sdk/models/inbox_upload.py +80 -0
- files_sdk/models/invoice.py +91 -0
- files_sdk/models/invoice_line_item.py +51 -0
- files_sdk/models/ip_address.py +119 -0
- files_sdk/models/key_lifecycle_rule.py +243 -0
- files_sdk/models/lock.py +174 -0
- files_sdk/models/message.py +244 -0
- files_sdk/models/message_comment.py +223 -0
- files_sdk/models/message_comment_reaction.py +181 -0
- files_sdk/models/message_reaction.py +170 -0
- files_sdk/models/notification.py +451 -0
- files_sdk/models/outbound_connection_log.py +105 -0
- files_sdk/models/partner.py +307 -0
- files_sdk/models/payment.py +91 -0
- files_sdk/models/payment_line_item.py +42 -0
- files_sdk/models/permission.py +190 -0
- files_sdk/models/preview.py +40 -0
- files_sdk/models/priority.py +63 -0
- files_sdk/models/project.py +205 -0
- files_sdk/models/public_hosting_request_log.py +101 -0
- files_sdk/models/public_ip_address.py +42 -0
- files_sdk/models/public_key.py +269 -0
- files_sdk/models/remote_bandwidth_snapshot.py +91 -0
- files_sdk/models/remote_mount_backend.py +438 -0
- files_sdk/models/remote_server.py +1854 -0
- files_sdk/models/remote_server_configuration_file.py +73 -0
- files_sdk/models/remote_server_credential.py +855 -0
- files_sdk/models/request.py +184 -0
- files_sdk/models/restore.py +142 -0
- files_sdk/models/scim_log.py +88 -0
- files_sdk/models/session.py +100 -0
- files_sdk/models/settings_change.py +71 -0
- files_sdk/models/sftp_action_log.py +108 -0
- files_sdk/models/sftp_host_key.py +215 -0
- files_sdk/models/share_group.py +228 -0
- files_sdk/models/share_group_member.py +41 -0
- files_sdk/models/siem_http_destination.py +1074 -0
- files_sdk/models/site.py +1289 -0
- files_sdk/models/snapshot.py +255 -0
- files_sdk/models/sso_strategy.py +168 -0
- files_sdk/models/status.py +42 -0
- files_sdk/models/style.py +152 -0
- files_sdk/models/sync.py +588 -0
- files_sdk/models/sync_log.py +86 -0
- files_sdk/models/sync_run.py +124 -0
- files_sdk/models/usage_by_top_level_dir.py +41 -0
- files_sdk/models/usage_daily_snapshot.py +93 -0
- files_sdk/models/usage_snapshot.py +73 -0
- files_sdk/models/user.py +1232 -0
- files_sdk/models/user_cipher_use.py +91 -0
- files_sdk/models/user_lifecycle_rule.py +355 -0
- files_sdk/models/user_request.py +166 -0
- files_sdk/models/user_sftp_client_use.py +68 -0
- files_sdk/models/web_dav_action_log.py +104 -0
- files_sdk/models/webhook_test.py +116 -0
- files_sdk/models/workspace.py +202 -0
- files_sdk/path_util.py +42 -0
- files_sdk/util.py +34 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import builtins # noqa: F401
|
|
2
|
+
from files_sdk.api import Api # noqa: F401
|
|
3
|
+
from files_sdk.list_obj import ListObj
|
|
4
|
+
from files_sdk.error import ( # noqa: F401
|
|
5
|
+
InvalidParameterError,
|
|
6
|
+
MissingParameterError,
|
|
7
|
+
NotImplementedError,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Behavior:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Folder behavior ID
|
|
14
|
+
"path": None, # string - Folder path. Note that Behavior paths cannot be updated once initially set. You will need to remove and re-create the behavior on the new path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
|
15
|
+
"attachment_url": None, # string - URL for attached file
|
|
16
|
+
"behavior": None, # string - Behavior type.
|
|
17
|
+
"name": None, # string - Name for this behavior.
|
|
18
|
+
"description": None, # string - Description for this behavior.
|
|
19
|
+
"value": None, # object - Settings for this behavior. See the section above for an example value to provide here. Formatting is different for each Behavior type. May be sent as nested JSON or a single JSON-encoded string. If using XML encoding for the API call, this data must be sent as a JSON-encoded string.
|
|
20
|
+
"disable_parent_folder_behavior": None, # boolean - If true, the parent folder's behavior will be disabled for this folder and its children.
|
|
21
|
+
"recursive": None, # boolean - Is behavior recursive?
|
|
22
|
+
"attachment_file": None, # file - Certain behaviors may require a file, for instance, the `watermark` behavior requires a watermark image. Attach that file here.
|
|
23
|
+
"attachment_delete": None, # boolean - If `true`, delete the file stored in `attachment`.
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
def __init__(self, attributes=None, options=None):
|
|
27
|
+
if not isinstance(attributes, dict):
|
|
28
|
+
attributes = {}
|
|
29
|
+
if not isinstance(options, dict):
|
|
30
|
+
options = {}
|
|
31
|
+
self.set_attributes(attributes)
|
|
32
|
+
self.options = options
|
|
33
|
+
|
|
34
|
+
def set_attributes(self, attributes):
|
|
35
|
+
for attribute, default_value in Behavior.default_attributes.items():
|
|
36
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
37
|
+
|
|
38
|
+
def get_attributes(self):
|
|
39
|
+
return {
|
|
40
|
+
k: getattr(self, k, None)
|
|
41
|
+
for k in Behavior.default_attributes
|
|
42
|
+
if getattr(self, k, None) is not None
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# Parameters:
|
|
46
|
+
# value - object - This field stores a hash of data specific to the type of behavior. See The Behavior Types section for example values for each type of behavior.
|
|
47
|
+
# attachment_file - file - Certain behaviors may require a file, for instance, the `watermark` behavior requires a watermark image. Attach that file here.
|
|
48
|
+
# disable_parent_folder_behavior - boolean - If `true`, the parent folder's behavior will be disabled for this folder and its children. This is the main mechanism for canceling out a `recursive` behavior higher in the folder tree.
|
|
49
|
+
# recursive - boolean - If `true`, behavior is treated as recursive, meaning that it impacts child folders as well.
|
|
50
|
+
# name - string - Name for this behavior.
|
|
51
|
+
# description - string - Description for this behavior.
|
|
52
|
+
# attachment_delete - boolean - If `true`, delete the file stored in `attachment`.
|
|
53
|
+
def update(self, params=None):
|
|
54
|
+
if not isinstance(params, dict):
|
|
55
|
+
params = {}
|
|
56
|
+
|
|
57
|
+
if hasattr(self, "id") and self.id:
|
|
58
|
+
params["id"] = self.id
|
|
59
|
+
else:
|
|
60
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
61
|
+
if "id" not in params:
|
|
62
|
+
raise MissingParameterError("Parameter missing: id")
|
|
63
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
64
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
65
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
66
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
67
|
+
if "description" in params and not isinstance(
|
|
68
|
+
params["description"], str
|
|
69
|
+
):
|
|
70
|
+
raise InvalidParameterError(
|
|
71
|
+
"Bad parameter: description must be an str"
|
|
72
|
+
)
|
|
73
|
+
response, _options = Api.send_request(
|
|
74
|
+
"PATCH",
|
|
75
|
+
"/behaviors/{id}".format(id=params["id"]),
|
|
76
|
+
params,
|
|
77
|
+
self.options,
|
|
78
|
+
)
|
|
79
|
+
return response.data
|
|
80
|
+
|
|
81
|
+
def delete(self, params=None):
|
|
82
|
+
if not isinstance(params, dict):
|
|
83
|
+
params = {}
|
|
84
|
+
|
|
85
|
+
if hasattr(self, "id") and self.id:
|
|
86
|
+
params["id"] = self.id
|
|
87
|
+
else:
|
|
88
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
89
|
+
if "id" not in params:
|
|
90
|
+
raise MissingParameterError("Parameter missing: id")
|
|
91
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
92
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
93
|
+
Api.send_request(
|
|
94
|
+
"DELETE",
|
|
95
|
+
"/behaviors/{id}".format(id=params["id"]),
|
|
96
|
+
params,
|
|
97
|
+
self.options,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
def destroy(self, params=None):
|
|
101
|
+
self.delete(params)
|
|
102
|
+
|
|
103
|
+
def save(self):
|
|
104
|
+
if hasattr(self, "id") and self.id:
|
|
105
|
+
new_obj = self.update(self.get_attributes())
|
|
106
|
+
self.set_attributes(new_obj.get_attributes())
|
|
107
|
+
return True
|
|
108
|
+
else:
|
|
109
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
110
|
+
self.set_attributes(new_obj.get_attributes())
|
|
111
|
+
return True
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# Parameters:
|
|
115
|
+
# cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
116
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
117
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `behavior`.
|
|
118
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `clickwrap_id`, `form_field_set_id`, `impacts_ui`, `remote_server_id` or `behavior`. Valid field combinations are `[ impacts_ui, behavior ]`.
|
|
119
|
+
def list(params=None, options=None):
|
|
120
|
+
if not isinstance(params, dict):
|
|
121
|
+
params = {}
|
|
122
|
+
if not isinstance(options, dict):
|
|
123
|
+
options = {}
|
|
124
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
125
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
126
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
127
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
128
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
129
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
130
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
131
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
132
|
+
return ListObj(Behavior, "GET", "/behaviors", params, options)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def all(params=None, options=None):
|
|
136
|
+
list(params, options)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# Parameters:
|
|
140
|
+
# id (required) - int64 - Behavior ID.
|
|
141
|
+
def find(id, params=None, options=None):
|
|
142
|
+
if not isinstance(params, dict):
|
|
143
|
+
params = {}
|
|
144
|
+
if not isinstance(options, dict):
|
|
145
|
+
options = {}
|
|
146
|
+
params["id"] = id
|
|
147
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
148
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
149
|
+
if "id" not in params:
|
|
150
|
+
raise MissingParameterError("Parameter missing: id")
|
|
151
|
+
response, options = Api.send_request(
|
|
152
|
+
"GET", "/behaviors/{id}".format(id=params["id"]), params, options
|
|
153
|
+
)
|
|
154
|
+
return Behavior(response.data, options)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def get(id, params=None, options=None):
|
|
158
|
+
find(id, params, options)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
# Parameters:
|
|
162
|
+
# cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
163
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
164
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `behavior`.
|
|
165
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `impacts_ui` and `behavior`. Valid field combinations are `[ impacts_ui, behavior ]`.
|
|
166
|
+
# path (required) - string - Path to operate on.
|
|
167
|
+
# ancestor_behaviors - boolean - If `true`, behaviors above this path are shown.
|
|
168
|
+
def list_for(path, params=None, options=None):
|
|
169
|
+
if not isinstance(params, dict):
|
|
170
|
+
params = {}
|
|
171
|
+
if not isinstance(options, dict):
|
|
172
|
+
options = {}
|
|
173
|
+
params["path"] = path
|
|
174
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
175
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
176
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
177
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
178
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
179
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
180
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
181
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
182
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
183
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
184
|
+
if "ancestor_behaviors" in params and not isinstance(
|
|
185
|
+
params["ancestor_behaviors"], bool
|
|
186
|
+
):
|
|
187
|
+
raise InvalidParameterError(
|
|
188
|
+
"Bad parameter: ancestor_behaviors must be an bool"
|
|
189
|
+
)
|
|
190
|
+
if "path" not in params:
|
|
191
|
+
raise MissingParameterError("Parameter missing: path")
|
|
192
|
+
return ListObj(
|
|
193
|
+
Behavior,
|
|
194
|
+
"GET",
|
|
195
|
+
"/behaviors/folders/{path}".format(path=params["path"]),
|
|
196
|
+
params,
|
|
197
|
+
options,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
# Parameters:
|
|
202
|
+
# value - object - This field stores a hash of data specific to the type of behavior. See The Behavior Types section for example values for each type of behavior.
|
|
203
|
+
# attachment_file - file - Certain behaviors may require a file, for instance, the `watermark` behavior requires a watermark image. Attach that file here.
|
|
204
|
+
# disable_parent_folder_behavior - boolean - If `true`, the parent folder's behavior will be disabled for this folder and its children. This is the main mechanism for canceling out a `recursive` behavior higher in the folder tree.
|
|
205
|
+
# recursive - boolean - If `true`, behavior is treated as recursive, meaning that it impacts child folders as well.
|
|
206
|
+
# name - string - Name for this behavior.
|
|
207
|
+
# description - string - Description for this behavior.
|
|
208
|
+
# path (required) - string - Path where this behavior should apply.
|
|
209
|
+
# behavior (required) - string - Behavior type.
|
|
210
|
+
def create(params=None, options=None):
|
|
211
|
+
if not isinstance(params, dict):
|
|
212
|
+
params = {}
|
|
213
|
+
if not isinstance(options, dict):
|
|
214
|
+
options = {}
|
|
215
|
+
if "value" in params and not isinstance(params["value"], dict):
|
|
216
|
+
raise InvalidParameterError("Bad parameter: value must be an dict")
|
|
217
|
+
if "disable_parent_folder_behavior" in params and not isinstance(
|
|
218
|
+
params["disable_parent_folder_behavior"], bool
|
|
219
|
+
):
|
|
220
|
+
raise InvalidParameterError(
|
|
221
|
+
"Bad parameter: disable_parent_folder_behavior must be an bool"
|
|
222
|
+
)
|
|
223
|
+
if "recursive" in params and not isinstance(params["recursive"], bool):
|
|
224
|
+
raise InvalidParameterError("Bad parameter: recursive must be an bool")
|
|
225
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
226
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
227
|
+
if "description" in params and not isinstance(params["description"], str):
|
|
228
|
+
raise InvalidParameterError(
|
|
229
|
+
"Bad parameter: description must be an str"
|
|
230
|
+
)
|
|
231
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
232
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
233
|
+
if "behavior" in params and not isinstance(params["behavior"], str):
|
|
234
|
+
raise InvalidParameterError("Bad parameter: behavior must be an str")
|
|
235
|
+
if "path" not in params:
|
|
236
|
+
raise MissingParameterError("Parameter missing: path")
|
|
237
|
+
if "behavior" not in params:
|
|
238
|
+
raise MissingParameterError("Parameter missing: behavior")
|
|
239
|
+
response, options = Api.send_request("POST", "/behaviors", params, options)
|
|
240
|
+
return Behavior(response.data, options)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
# Parameters:
|
|
244
|
+
# url (required) - string - URL for testing the webhook.
|
|
245
|
+
# method - string - HTTP request method (GET or POST).
|
|
246
|
+
# encoding - string - Encoding type for the webhook payload. Can be JSON, XML, or RAW (form data).
|
|
247
|
+
# headers - object - Additional request headers to send via HTTP.
|
|
248
|
+
# body - object - Additional body parameters to include in the webhook payload.
|
|
249
|
+
# action - string - Action for test body.
|
|
250
|
+
def webhook_test(params=None, options=None):
|
|
251
|
+
if not isinstance(params, dict):
|
|
252
|
+
params = {}
|
|
253
|
+
if not isinstance(options, dict):
|
|
254
|
+
options = {}
|
|
255
|
+
if "url" in params and not isinstance(params["url"], str):
|
|
256
|
+
raise InvalidParameterError("Bad parameter: url must be an str")
|
|
257
|
+
if "method" in params and not isinstance(params["method"], str):
|
|
258
|
+
raise InvalidParameterError("Bad parameter: method must be an str")
|
|
259
|
+
if "encoding" in params and not isinstance(params["encoding"], str):
|
|
260
|
+
raise InvalidParameterError("Bad parameter: encoding must be an str")
|
|
261
|
+
if "headers" in params and not isinstance(params["headers"], dict):
|
|
262
|
+
raise InvalidParameterError("Bad parameter: headers must be an dict")
|
|
263
|
+
if "body" in params and not isinstance(params["body"], dict):
|
|
264
|
+
raise InvalidParameterError("Bad parameter: body must be an dict")
|
|
265
|
+
if "action" in params and not isinstance(params["action"], str):
|
|
266
|
+
raise InvalidParameterError("Bad parameter: action must be an str")
|
|
267
|
+
if "url" not in params:
|
|
268
|
+
raise MissingParameterError("Parameter missing: url")
|
|
269
|
+
Api.send_request("POST", "/behaviors/webhook/test", params, options)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
# Parameters:
|
|
273
|
+
# value - object - This field stores a hash of data specific to the type of behavior. See The Behavior Types section for example values for each type of behavior.
|
|
274
|
+
# attachment_file - file - Certain behaviors may require a file, for instance, the `watermark` behavior requires a watermark image. Attach that file here.
|
|
275
|
+
# disable_parent_folder_behavior - boolean - If `true`, the parent folder's behavior will be disabled for this folder and its children. This is the main mechanism for canceling out a `recursive` behavior higher in the folder tree.
|
|
276
|
+
# recursive - boolean - If `true`, behavior is treated as recursive, meaning that it impacts child folders as well.
|
|
277
|
+
# name - string - Name for this behavior.
|
|
278
|
+
# description - string - Description for this behavior.
|
|
279
|
+
# attachment_delete - boolean - If `true`, delete the file stored in `attachment`.
|
|
280
|
+
def update(id, params=None, options=None):
|
|
281
|
+
if not isinstance(params, dict):
|
|
282
|
+
params = {}
|
|
283
|
+
if not isinstance(options, dict):
|
|
284
|
+
options = {}
|
|
285
|
+
params["id"] = id
|
|
286
|
+
if "id" in params and not isinstance(params["id"], (dict, str, int)):
|
|
287
|
+
raise InvalidParameterError(
|
|
288
|
+
"Bad parameter: id must be one of dict, str, int"
|
|
289
|
+
)
|
|
290
|
+
if "value" in params and not isinstance(params["value"], dict):
|
|
291
|
+
raise InvalidParameterError("Bad parameter: value must be an dict")
|
|
292
|
+
if "disable_parent_folder_behavior" in params and not isinstance(
|
|
293
|
+
params["disable_parent_folder_behavior"], bool
|
|
294
|
+
):
|
|
295
|
+
raise InvalidParameterError(
|
|
296
|
+
"Bad parameter: disable_parent_folder_behavior must be an bool"
|
|
297
|
+
)
|
|
298
|
+
if "recursive" in params and not isinstance(params["recursive"], bool):
|
|
299
|
+
raise InvalidParameterError("Bad parameter: recursive must be an bool")
|
|
300
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
301
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
302
|
+
if "description" in params and not isinstance(params["description"], str):
|
|
303
|
+
raise InvalidParameterError(
|
|
304
|
+
"Bad parameter: description must be an str"
|
|
305
|
+
)
|
|
306
|
+
if "attachment_delete" in params and not isinstance(
|
|
307
|
+
params["attachment_delete"], (dict, str, int)
|
|
308
|
+
):
|
|
309
|
+
raise InvalidParameterError(
|
|
310
|
+
"Bad parameter: attachment_delete must be one of dict, str, int"
|
|
311
|
+
)
|
|
312
|
+
if "id" not in params:
|
|
313
|
+
raise MissingParameterError("Parameter missing: id")
|
|
314
|
+
response, options = Api.send_request(
|
|
315
|
+
"PATCH", "/behaviors/{id}".format(id=params["id"]), params, options
|
|
316
|
+
)
|
|
317
|
+
return Behavior(response.data, options)
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def delete(id, params=None, options=None):
|
|
321
|
+
if not isinstance(params, dict):
|
|
322
|
+
params = {}
|
|
323
|
+
if not isinstance(options, dict):
|
|
324
|
+
options = {}
|
|
325
|
+
params["id"] = id
|
|
326
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
327
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
328
|
+
if "id" not in params:
|
|
329
|
+
raise MissingParameterError("Parameter missing: id")
|
|
330
|
+
Api.send_request(
|
|
331
|
+
"DELETE", "/behaviors/{id}".format(id=params["id"]), params, options
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def destroy(id, params=None, options=None):
|
|
336
|
+
delete(id, params, options)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def new(*args, **kwargs):
|
|
340
|
+
return Behavior(*args, **kwargs)
|