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,243 @@
|
|
|
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 KeyLifecycleRule:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Key Lifecycle Rule ID
|
|
14
|
+
"key_type": None, # string - Key type for which the rule will apply (gpg or ssh).
|
|
15
|
+
"inactivity_days": None, # int64 - Number of days of inactivity before the rule applies.
|
|
16
|
+
"name": None, # string - Key Lifecycle Rule name
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
def __init__(self, attributes=None, options=None):
|
|
20
|
+
if not isinstance(attributes, dict):
|
|
21
|
+
attributes = {}
|
|
22
|
+
if not isinstance(options, dict):
|
|
23
|
+
options = {}
|
|
24
|
+
self.set_attributes(attributes)
|
|
25
|
+
self.options = options
|
|
26
|
+
|
|
27
|
+
def set_attributes(self, attributes):
|
|
28
|
+
for (
|
|
29
|
+
attribute,
|
|
30
|
+
default_value,
|
|
31
|
+
) in KeyLifecycleRule.default_attributes.items():
|
|
32
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
33
|
+
|
|
34
|
+
def get_attributes(self):
|
|
35
|
+
return {
|
|
36
|
+
k: getattr(self, k, None)
|
|
37
|
+
for k in KeyLifecycleRule.default_attributes
|
|
38
|
+
if getattr(self, k, None) is not None
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Parameters:
|
|
42
|
+
# key_type - string - Key type for which the rule will apply (gpg or ssh).
|
|
43
|
+
# inactivity_days - int64 - Number of days of inactivity before the rule applies.
|
|
44
|
+
# name - string - Key Lifecycle Rule name
|
|
45
|
+
def update(self, params=None):
|
|
46
|
+
if not isinstance(params, dict):
|
|
47
|
+
params = {}
|
|
48
|
+
|
|
49
|
+
if hasattr(self, "id") and self.id:
|
|
50
|
+
params["id"] = self.id
|
|
51
|
+
else:
|
|
52
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
53
|
+
if "id" not in params:
|
|
54
|
+
raise MissingParameterError("Parameter missing: id")
|
|
55
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
56
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
57
|
+
if "key_type" in params and not isinstance(params["key_type"], str):
|
|
58
|
+
raise InvalidParameterError(
|
|
59
|
+
"Bad parameter: key_type must be an str"
|
|
60
|
+
)
|
|
61
|
+
if "inactivity_days" in params and not isinstance(
|
|
62
|
+
params["inactivity_days"], int
|
|
63
|
+
):
|
|
64
|
+
raise InvalidParameterError(
|
|
65
|
+
"Bad parameter: inactivity_days must be an int"
|
|
66
|
+
)
|
|
67
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
68
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
69
|
+
response, _options = Api.send_request(
|
|
70
|
+
"PATCH",
|
|
71
|
+
"/key_lifecycle_rules/{id}".format(id=params["id"]),
|
|
72
|
+
params,
|
|
73
|
+
self.options,
|
|
74
|
+
)
|
|
75
|
+
return response.data
|
|
76
|
+
|
|
77
|
+
def delete(self, params=None):
|
|
78
|
+
if not isinstance(params, dict):
|
|
79
|
+
params = {}
|
|
80
|
+
|
|
81
|
+
if hasattr(self, "id") and self.id:
|
|
82
|
+
params["id"] = self.id
|
|
83
|
+
else:
|
|
84
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
85
|
+
if "id" not in params:
|
|
86
|
+
raise MissingParameterError("Parameter missing: id")
|
|
87
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
88
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
89
|
+
Api.send_request(
|
|
90
|
+
"DELETE",
|
|
91
|
+
"/key_lifecycle_rules/{id}".format(id=params["id"]),
|
|
92
|
+
params,
|
|
93
|
+
self.options,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
def destroy(self, params=None):
|
|
97
|
+
self.delete(params)
|
|
98
|
+
|
|
99
|
+
def save(self):
|
|
100
|
+
if hasattr(self, "id") and self.id:
|
|
101
|
+
new_obj = self.update(self.get_attributes())
|
|
102
|
+
self.set_attributes(new_obj.get_attributes())
|
|
103
|
+
return True
|
|
104
|
+
else:
|
|
105
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
106
|
+
self.set_attributes(new_obj.get_attributes())
|
|
107
|
+
return True
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# Parameters:
|
|
111
|
+
# 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.
|
|
112
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
113
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `key_type`.
|
|
114
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `key_type`.
|
|
115
|
+
def list(params=None, options=None):
|
|
116
|
+
if not isinstance(params, dict):
|
|
117
|
+
params = {}
|
|
118
|
+
if not isinstance(options, dict):
|
|
119
|
+
options = {}
|
|
120
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
121
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
122
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
123
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
124
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
125
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
126
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
127
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
128
|
+
return ListObj(
|
|
129
|
+
KeyLifecycleRule, "GET", "/key_lifecycle_rules", params, options
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def all(params=None, options=None):
|
|
134
|
+
list(params, options)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
# Parameters:
|
|
138
|
+
# id (required) - int64 - Key Lifecycle Rule ID.
|
|
139
|
+
def find(id, params=None, options=None):
|
|
140
|
+
if not isinstance(params, dict):
|
|
141
|
+
params = {}
|
|
142
|
+
if not isinstance(options, dict):
|
|
143
|
+
options = {}
|
|
144
|
+
params["id"] = id
|
|
145
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
146
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
147
|
+
if "id" not in params:
|
|
148
|
+
raise MissingParameterError("Parameter missing: id")
|
|
149
|
+
response, options = Api.send_request(
|
|
150
|
+
"GET",
|
|
151
|
+
"/key_lifecycle_rules/{id}".format(id=params["id"]),
|
|
152
|
+
params,
|
|
153
|
+
options,
|
|
154
|
+
)
|
|
155
|
+
return KeyLifecycleRule(response.data, options)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def get(id, params=None, options=None):
|
|
159
|
+
find(id, params, options)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# Parameters:
|
|
163
|
+
# key_type - string - Key type for which the rule will apply (gpg or ssh).
|
|
164
|
+
# inactivity_days - int64 - Number of days of inactivity before the rule applies.
|
|
165
|
+
# name - string - Key Lifecycle Rule name
|
|
166
|
+
def create(params=None, options=None):
|
|
167
|
+
if not isinstance(params, dict):
|
|
168
|
+
params = {}
|
|
169
|
+
if not isinstance(options, dict):
|
|
170
|
+
options = {}
|
|
171
|
+
if "key_type" in params and not isinstance(params["key_type"], str):
|
|
172
|
+
raise InvalidParameterError("Bad parameter: key_type must be an str")
|
|
173
|
+
if "inactivity_days" in params and not isinstance(
|
|
174
|
+
params["inactivity_days"], int
|
|
175
|
+
):
|
|
176
|
+
raise InvalidParameterError(
|
|
177
|
+
"Bad parameter: inactivity_days must be an int"
|
|
178
|
+
)
|
|
179
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
180
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
181
|
+
response, options = Api.send_request(
|
|
182
|
+
"POST", "/key_lifecycle_rules", params, options
|
|
183
|
+
)
|
|
184
|
+
return KeyLifecycleRule(response.data, options)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# Parameters:
|
|
188
|
+
# key_type - string - Key type for which the rule will apply (gpg or ssh).
|
|
189
|
+
# inactivity_days - int64 - Number of days of inactivity before the rule applies.
|
|
190
|
+
# name - string - Key Lifecycle Rule name
|
|
191
|
+
def update(id, params=None, options=None):
|
|
192
|
+
if not isinstance(params, dict):
|
|
193
|
+
params = {}
|
|
194
|
+
if not isinstance(options, dict):
|
|
195
|
+
options = {}
|
|
196
|
+
params["id"] = id
|
|
197
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
198
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
199
|
+
if "key_type" in params and not isinstance(params["key_type"], str):
|
|
200
|
+
raise InvalidParameterError("Bad parameter: key_type must be an str")
|
|
201
|
+
if "inactivity_days" in params and not isinstance(
|
|
202
|
+
params["inactivity_days"], int
|
|
203
|
+
):
|
|
204
|
+
raise InvalidParameterError(
|
|
205
|
+
"Bad parameter: inactivity_days must be an int"
|
|
206
|
+
)
|
|
207
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
208
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
209
|
+
if "id" not in params:
|
|
210
|
+
raise MissingParameterError("Parameter missing: id")
|
|
211
|
+
response, options = Api.send_request(
|
|
212
|
+
"PATCH",
|
|
213
|
+
"/key_lifecycle_rules/{id}".format(id=params["id"]),
|
|
214
|
+
params,
|
|
215
|
+
options,
|
|
216
|
+
)
|
|
217
|
+
return KeyLifecycleRule(response.data, options)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def delete(id, params=None, options=None):
|
|
221
|
+
if not isinstance(params, dict):
|
|
222
|
+
params = {}
|
|
223
|
+
if not isinstance(options, dict):
|
|
224
|
+
options = {}
|
|
225
|
+
params["id"] = id
|
|
226
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
227
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
228
|
+
if "id" not in params:
|
|
229
|
+
raise MissingParameterError("Parameter missing: id")
|
|
230
|
+
Api.send_request(
|
|
231
|
+
"DELETE",
|
|
232
|
+
"/key_lifecycle_rules/{id}".format(id=params["id"]),
|
|
233
|
+
params,
|
|
234
|
+
options,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def destroy(id, params=None, options=None):
|
|
239
|
+
delete(id, params, options)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def new(*args, **kwargs):
|
|
243
|
+
return KeyLifecycleRule(*args, **kwargs)
|
files_sdk/models/lock.py
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
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 Lock:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"path": None, # string - Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
|
14
|
+
"timeout": None, # int64 - Lock timeout in seconds
|
|
15
|
+
"depth": None, # string
|
|
16
|
+
"recursive": None, # boolean - Does lock apply to subfolders?
|
|
17
|
+
"owner": None, # string - Owner of the lock. This can be any arbitrary string.
|
|
18
|
+
"scope": None, # string
|
|
19
|
+
"exclusive": None, # boolean - Is lock exclusive?
|
|
20
|
+
"token": None, # string - Lock token. Use to release lock.
|
|
21
|
+
"type": None, # string
|
|
22
|
+
"allow_access_by_any_user": None, # boolean - Can lock be modified by users other than its creator?
|
|
23
|
+
"user_id": None, # int64 - Lock creator user ID
|
|
24
|
+
"username": None, # string - Lock creator username
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
def __init__(self, attributes=None, options=None):
|
|
28
|
+
if not isinstance(attributes, dict):
|
|
29
|
+
attributes = {}
|
|
30
|
+
if not isinstance(options, dict):
|
|
31
|
+
options = {}
|
|
32
|
+
self.set_attributes(attributes)
|
|
33
|
+
self.options = options
|
|
34
|
+
|
|
35
|
+
def set_attributes(self, attributes):
|
|
36
|
+
for attribute, default_value in Lock.default_attributes.items():
|
|
37
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
38
|
+
|
|
39
|
+
def get_attributes(self):
|
|
40
|
+
return {
|
|
41
|
+
k: getattr(self, k, None)
|
|
42
|
+
for k in Lock.default_attributes
|
|
43
|
+
if getattr(self, k, None) is not None
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Parameters:
|
|
47
|
+
# token (required) - string - Lock token
|
|
48
|
+
def delete(self, params=None):
|
|
49
|
+
if not isinstance(params, dict):
|
|
50
|
+
params = {}
|
|
51
|
+
|
|
52
|
+
if hasattr(self, "path") and self.path:
|
|
53
|
+
params["path"] = self.path
|
|
54
|
+
else:
|
|
55
|
+
raise MissingParameterError("Current object doesn't have a path")
|
|
56
|
+
if "path" not in params:
|
|
57
|
+
raise MissingParameterError("Parameter missing: path")
|
|
58
|
+
if "token" not in params:
|
|
59
|
+
raise MissingParameterError("Parameter missing: token")
|
|
60
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
61
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
62
|
+
if "token" in params and not isinstance(params["token"], str):
|
|
63
|
+
raise InvalidParameterError("Bad parameter: token must be an str")
|
|
64
|
+
Api.send_request(
|
|
65
|
+
"DELETE",
|
|
66
|
+
"/locks/{path}".format(path=params["path"]),
|
|
67
|
+
params,
|
|
68
|
+
self.options,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
def destroy(self, params=None):
|
|
72
|
+
self.delete(params)
|
|
73
|
+
|
|
74
|
+
def save(self):
|
|
75
|
+
new_obj = create(self.path, self.get_attributes(), self.options)
|
|
76
|
+
self.set_attributes(new_obj.get_attributes())
|
|
77
|
+
return True
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# Parameters:
|
|
81
|
+
# 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.
|
|
82
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
83
|
+
# path (required) - string - Path to operate on.
|
|
84
|
+
# include_children - boolean - Include locks from children objects?
|
|
85
|
+
def list_for(path, params=None, options=None):
|
|
86
|
+
if not isinstance(params, dict):
|
|
87
|
+
params = {}
|
|
88
|
+
if not isinstance(options, dict):
|
|
89
|
+
options = {}
|
|
90
|
+
params["path"] = path
|
|
91
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
92
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
93
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
94
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
95
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
96
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
97
|
+
if "include_children" in params and not isinstance(
|
|
98
|
+
params["include_children"], bool
|
|
99
|
+
):
|
|
100
|
+
raise InvalidParameterError(
|
|
101
|
+
"Bad parameter: include_children must be an bool"
|
|
102
|
+
)
|
|
103
|
+
if "path" not in params:
|
|
104
|
+
raise MissingParameterError("Parameter missing: path")
|
|
105
|
+
return ListObj(
|
|
106
|
+
Lock,
|
|
107
|
+
"GET",
|
|
108
|
+
"/locks/{path}".format(path=params["path"]),
|
|
109
|
+
params,
|
|
110
|
+
options,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# Parameters:
|
|
115
|
+
# path (required) - string - Path
|
|
116
|
+
# allow_access_by_any_user - boolean - Can lock be modified by users other than its creator?
|
|
117
|
+
# exclusive - boolean - Is lock exclusive?
|
|
118
|
+
# recursive - boolean - Does lock apply to subfolders?
|
|
119
|
+
# timeout - int64 - Lock timeout in seconds
|
|
120
|
+
def create(path, params=None, options=None):
|
|
121
|
+
if not isinstance(params, dict):
|
|
122
|
+
params = {}
|
|
123
|
+
if not isinstance(options, dict):
|
|
124
|
+
options = {}
|
|
125
|
+
params["path"] = path
|
|
126
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
127
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
128
|
+
if "allow_access_by_any_user" in params and not isinstance(
|
|
129
|
+
params["allow_access_by_any_user"], bool
|
|
130
|
+
):
|
|
131
|
+
raise InvalidParameterError(
|
|
132
|
+
"Bad parameter: allow_access_by_any_user must be an bool"
|
|
133
|
+
)
|
|
134
|
+
if "exclusive" in params and not isinstance(params["exclusive"], bool):
|
|
135
|
+
raise InvalidParameterError("Bad parameter: exclusive must be an bool")
|
|
136
|
+
if "recursive" in params and not isinstance(params["recursive"], bool):
|
|
137
|
+
raise InvalidParameterError("Bad parameter: recursive must be an bool")
|
|
138
|
+
if "timeout" in params and not isinstance(params["timeout"], int):
|
|
139
|
+
raise InvalidParameterError("Bad parameter: timeout must be an int")
|
|
140
|
+
if "path" not in params:
|
|
141
|
+
raise MissingParameterError("Parameter missing: path")
|
|
142
|
+
response, options = Api.send_request(
|
|
143
|
+
"POST", "/locks/{path}".format(path=params["path"]), params, options
|
|
144
|
+
)
|
|
145
|
+
return Lock(response.data, options)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# Parameters:
|
|
149
|
+
# token (required) - string - Lock token
|
|
150
|
+
def delete(path, params=None, options=None):
|
|
151
|
+
if not isinstance(params, dict):
|
|
152
|
+
params = {}
|
|
153
|
+
if not isinstance(options, dict):
|
|
154
|
+
options = {}
|
|
155
|
+
params["path"] = path
|
|
156
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
157
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
158
|
+
if "token" in params and not isinstance(params["token"], str):
|
|
159
|
+
raise InvalidParameterError("Bad parameter: token must be an str")
|
|
160
|
+
if "path" not in params:
|
|
161
|
+
raise MissingParameterError("Parameter missing: path")
|
|
162
|
+
if "token" not in params:
|
|
163
|
+
raise MissingParameterError("Parameter missing: token")
|
|
164
|
+
Api.send_request(
|
|
165
|
+
"DELETE", "/locks/{path}".format(path=params["path"]), params, options
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def destroy(path, params=None, options=None):
|
|
170
|
+
delete(path, params, options)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def new(*args, **kwargs):
|
|
174
|
+
return Lock(*args, **kwargs)
|
|
@@ -0,0 +1,244 @@
|
|
|
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 Message:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Message ID
|
|
14
|
+
"subject": None, # string - Message subject.
|
|
15
|
+
"body": None, # string - Message body.
|
|
16
|
+
"comments": None, # array(object) - Comments.
|
|
17
|
+
"user_id": None, # int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
18
|
+
"project_id": None, # int64 - Project to which the message should be attached.
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
def __init__(self, attributes=None, options=None):
|
|
22
|
+
if not isinstance(attributes, dict):
|
|
23
|
+
attributes = {}
|
|
24
|
+
if not isinstance(options, dict):
|
|
25
|
+
options = {}
|
|
26
|
+
self.set_attributes(attributes)
|
|
27
|
+
self.options = options
|
|
28
|
+
|
|
29
|
+
def set_attributes(self, attributes):
|
|
30
|
+
for attribute, default_value in Message.default_attributes.items():
|
|
31
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
32
|
+
|
|
33
|
+
def get_attributes(self):
|
|
34
|
+
return {
|
|
35
|
+
k: getattr(self, k, None)
|
|
36
|
+
for k in Message.default_attributes
|
|
37
|
+
if getattr(self, k, None) is not None
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Parameters:
|
|
41
|
+
# project_id (required) - int64 - Project to which the message should be attached.
|
|
42
|
+
# subject (required) - string - Message subject.
|
|
43
|
+
# body (required) - string - Message body.
|
|
44
|
+
def update(self, params=None):
|
|
45
|
+
if not isinstance(params, dict):
|
|
46
|
+
params = {}
|
|
47
|
+
|
|
48
|
+
if hasattr(self, "id") and self.id:
|
|
49
|
+
params["id"] = self.id
|
|
50
|
+
else:
|
|
51
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
52
|
+
if "id" not in params:
|
|
53
|
+
raise MissingParameterError("Parameter missing: id")
|
|
54
|
+
if "project_id" not in params:
|
|
55
|
+
raise MissingParameterError("Parameter missing: project_id")
|
|
56
|
+
if "subject" not in params:
|
|
57
|
+
raise MissingParameterError("Parameter missing: subject")
|
|
58
|
+
if "body" not in params:
|
|
59
|
+
raise MissingParameterError("Parameter missing: body")
|
|
60
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
61
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
62
|
+
if "project_id" in params and not isinstance(
|
|
63
|
+
params["project_id"], int
|
|
64
|
+
):
|
|
65
|
+
raise InvalidParameterError(
|
|
66
|
+
"Bad parameter: project_id must be an int"
|
|
67
|
+
)
|
|
68
|
+
if "subject" in params and not isinstance(params["subject"], str):
|
|
69
|
+
raise InvalidParameterError(
|
|
70
|
+
"Bad parameter: subject must be an str"
|
|
71
|
+
)
|
|
72
|
+
if "body" in params and not isinstance(params["body"], str):
|
|
73
|
+
raise InvalidParameterError("Bad parameter: body must be an str")
|
|
74
|
+
response, _options = Api.send_request(
|
|
75
|
+
"PATCH",
|
|
76
|
+
"/messages/{id}".format(id=params["id"]),
|
|
77
|
+
params,
|
|
78
|
+
self.options,
|
|
79
|
+
)
|
|
80
|
+
return response.data
|
|
81
|
+
|
|
82
|
+
def delete(self, params=None):
|
|
83
|
+
if not isinstance(params, dict):
|
|
84
|
+
params = {}
|
|
85
|
+
|
|
86
|
+
if hasattr(self, "id") and self.id:
|
|
87
|
+
params["id"] = self.id
|
|
88
|
+
else:
|
|
89
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
90
|
+
if "id" not in params:
|
|
91
|
+
raise MissingParameterError("Parameter missing: id")
|
|
92
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
93
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
94
|
+
Api.send_request(
|
|
95
|
+
"DELETE",
|
|
96
|
+
"/messages/{id}".format(id=params["id"]),
|
|
97
|
+
params,
|
|
98
|
+
self.options,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def destroy(self, params=None):
|
|
102
|
+
self.delete(params)
|
|
103
|
+
|
|
104
|
+
def save(self):
|
|
105
|
+
if hasattr(self, "id") and self.id:
|
|
106
|
+
new_obj = self.update(self.get_attributes())
|
|
107
|
+
self.set_attributes(new_obj.get_attributes())
|
|
108
|
+
return True
|
|
109
|
+
else:
|
|
110
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
111
|
+
self.set_attributes(new_obj.get_attributes())
|
|
112
|
+
return True
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# Parameters:
|
|
116
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
117
|
+
# 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.
|
|
118
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
119
|
+
# project_id (required) - int64 - Project for which to return messages.
|
|
120
|
+
def list(params=None, options=None):
|
|
121
|
+
if not isinstance(params, dict):
|
|
122
|
+
params = {}
|
|
123
|
+
if not isinstance(options, dict):
|
|
124
|
+
options = {}
|
|
125
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
126
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
127
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
128
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
129
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
130
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
131
|
+
if "project_id" in params and not isinstance(params["project_id"], int):
|
|
132
|
+
raise InvalidParameterError("Bad parameter: project_id must be an int")
|
|
133
|
+
if "project_id" not in params:
|
|
134
|
+
raise MissingParameterError("Parameter missing: project_id")
|
|
135
|
+
return ListObj(Message, "GET", "/messages", params, options)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def all(params=None, options=None):
|
|
139
|
+
list(params, options)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# Parameters:
|
|
143
|
+
# id (required) - int64 - Message ID.
|
|
144
|
+
def find(id, params=None, options=None):
|
|
145
|
+
if not isinstance(params, dict):
|
|
146
|
+
params = {}
|
|
147
|
+
if not isinstance(options, dict):
|
|
148
|
+
options = {}
|
|
149
|
+
params["id"] = id
|
|
150
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
151
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
152
|
+
if "id" not in params:
|
|
153
|
+
raise MissingParameterError("Parameter missing: id")
|
|
154
|
+
response, options = Api.send_request(
|
|
155
|
+
"GET", "/messages/{id}".format(id=params["id"]), params, options
|
|
156
|
+
)
|
|
157
|
+
return Message(response.data, options)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def get(id, params=None, options=None):
|
|
161
|
+
find(id, params, options)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
# Parameters:
|
|
165
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
166
|
+
# project_id (required) - int64 - Project to which the message should be attached.
|
|
167
|
+
# subject (required) - string - Message subject.
|
|
168
|
+
# body (required) - string - Message body.
|
|
169
|
+
def create(params=None, options=None):
|
|
170
|
+
if not isinstance(params, dict):
|
|
171
|
+
params = {}
|
|
172
|
+
if not isinstance(options, dict):
|
|
173
|
+
options = {}
|
|
174
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
175
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
176
|
+
if "project_id" in params and not isinstance(params["project_id"], int):
|
|
177
|
+
raise InvalidParameterError("Bad parameter: project_id must be an int")
|
|
178
|
+
if "subject" in params and not isinstance(params["subject"], str):
|
|
179
|
+
raise InvalidParameterError("Bad parameter: subject must be an str")
|
|
180
|
+
if "body" in params and not isinstance(params["body"], str):
|
|
181
|
+
raise InvalidParameterError("Bad parameter: body must be an str")
|
|
182
|
+
if "project_id" not in params:
|
|
183
|
+
raise MissingParameterError("Parameter missing: project_id")
|
|
184
|
+
if "subject" not in params:
|
|
185
|
+
raise MissingParameterError("Parameter missing: subject")
|
|
186
|
+
if "body" not in params:
|
|
187
|
+
raise MissingParameterError("Parameter missing: body")
|
|
188
|
+
response, options = Api.send_request("POST", "/messages", params, options)
|
|
189
|
+
return Message(response.data, options)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# Parameters:
|
|
193
|
+
# project_id (required) - int64 - Project to which the message should be attached.
|
|
194
|
+
# subject (required) - string - Message subject.
|
|
195
|
+
# body (required) - string - Message body.
|
|
196
|
+
def update(id, params=None, options=None):
|
|
197
|
+
if not isinstance(params, dict):
|
|
198
|
+
params = {}
|
|
199
|
+
if not isinstance(options, dict):
|
|
200
|
+
options = {}
|
|
201
|
+
params["id"] = id
|
|
202
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
203
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
204
|
+
if "project_id" in params and not isinstance(params["project_id"], int):
|
|
205
|
+
raise InvalidParameterError("Bad parameter: project_id must be an int")
|
|
206
|
+
if "subject" in params and not isinstance(params["subject"], str):
|
|
207
|
+
raise InvalidParameterError("Bad parameter: subject must be an str")
|
|
208
|
+
if "body" in params and not isinstance(params["body"], str):
|
|
209
|
+
raise InvalidParameterError("Bad parameter: body must be an str")
|
|
210
|
+
if "id" not in params:
|
|
211
|
+
raise MissingParameterError("Parameter missing: id")
|
|
212
|
+
if "project_id" not in params:
|
|
213
|
+
raise MissingParameterError("Parameter missing: project_id")
|
|
214
|
+
if "subject" not in params:
|
|
215
|
+
raise MissingParameterError("Parameter missing: subject")
|
|
216
|
+
if "body" not in params:
|
|
217
|
+
raise MissingParameterError("Parameter missing: body")
|
|
218
|
+
response, options = Api.send_request(
|
|
219
|
+
"PATCH", "/messages/{id}".format(id=params["id"]), params, options
|
|
220
|
+
)
|
|
221
|
+
return Message(response.data, options)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def delete(id, params=None, options=None):
|
|
225
|
+
if not isinstance(params, dict):
|
|
226
|
+
params = {}
|
|
227
|
+
if not isinstance(options, dict):
|
|
228
|
+
options = {}
|
|
229
|
+
params["id"] = id
|
|
230
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
231
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
232
|
+
if "id" not in params:
|
|
233
|
+
raise MissingParameterError("Parameter missing: id")
|
|
234
|
+
Api.send_request(
|
|
235
|
+
"DELETE", "/messages/{id}".format(id=params["id"]), params, options
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def destroy(id, params=None, options=None):
|
|
240
|
+
delete(id, params, options)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def new(*args, **kwargs):
|
|
244
|
+
return Message(*args, **kwargs)
|