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,307 @@
|
|
|
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 Partner:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"allow_bypassing_2fa_policies": None, # boolean - Allow Partner Admins to change Two-Factor Authentication requirements for Partner Users.
|
|
14
|
+
"allow_credential_changes": None, # boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
|
|
15
|
+
"allow_providing_gpg_keys": None, # boolean - Allow Partner Admins to provide GPG keys.
|
|
16
|
+
"allow_user_creation": None, # boolean - Allow Partner Admins to create users.
|
|
17
|
+
"id": None, # int64 - The unique ID of the Partner.
|
|
18
|
+
"workspace_id": None, # int64 - ID of the Workspace associated with this Partner.
|
|
19
|
+
"name": None, # string - The name of the Partner.
|
|
20
|
+
"notes": None, # string - Notes about this Partner.
|
|
21
|
+
"partner_admin_ids": None, # array(int64) - Array of User IDs that are Partner Admins for this Partner.
|
|
22
|
+
"root_folder": None, # string - The root folder path for this Partner.
|
|
23
|
+
"tags": None, # string - Comma-separated list of Tags for this Partner. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
24
|
+
"user_ids": None, # array(int64) - Array of User IDs that belong to this Partner.
|
|
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 Partner.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 Partner.default_attributes
|
|
43
|
+
if getattr(self, k, None) is not None
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Parameters:
|
|
47
|
+
# allow_bypassing_2fa_policies - boolean - Allow Partner Admins to change Two-Factor Authentication requirements for Partner Users.
|
|
48
|
+
# allow_credential_changes - boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
|
|
49
|
+
# allow_providing_gpg_keys - boolean - Allow Partner Admins to provide GPG keys.
|
|
50
|
+
# allow_user_creation - boolean - Allow Partner Admins to create users.
|
|
51
|
+
# notes - string - Notes about this Partner.
|
|
52
|
+
# root_folder - string - The root folder path for this Partner.
|
|
53
|
+
# tags - string - Comma-separated list of Tags for this Partner. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
54
|
+
# name - string - The name of the Partner.
|
|
55
|
+
def update(self, params=None):
|
|
56
|
+
if not isinstance(params, dict):
|
|
57
|
+
params = {}
|
|
58
|
+
|
|
59
|
+
if hasattr(self, "id") and self.id:
|
|
60
|
+
params["id"] = self.id
|
|
61
|
+
else:
|
|
62
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
63
|
+
if "id" not in params:
|
|
64
|
+
raise MissingParameterError("Parameter missing: id")
|
|
65
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
66
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
67
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
68
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
69
|
+
if "root_folder" in params and not isinstance(
|
|
70
|
+
params["root_folder"], str
|
|
71
|
+
):
|
|
72
|
+
raise InvalidParameterError(
|
|
73
|
+
"Bad parameter: root_folder must be an str"
|
|
74
|
+
)
|
|
75
|
+
if "tags" in params and not isinstance(params["tags"], str):
|
|
76
|
+
raise InvalidParameterError("Bad parameter: tags must be an str")
|
|
77
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
78
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
79
|
+
response, _options = Api.send_request(
|
|
80
|
+
"PATCH",
|
|
81
|
+
"/partners/{id}".format(id=params["id"]),
|
|
82
|
+
params,
|
|
83
|
+
self.options,
|
|
84
|
+
)
|
|
85
|
+
return response.data
|
|
86
|
+
|
|
87
|
+
def delete(self, params=None):
|
|
88
|
+
if not isinstance(params, dict):
|
|
89
|
+
params = {}
|
|
90
|
+
|
|
91
|
+
if hasattr(self, "id") and self.id:
|
|
92
|
+
params["id"] = self.id
|
|
93
|
+
else:
|
|
94
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
95
|
+
if "id" not in params:
|
|
96
|
+
raise MissingParameterError("Parameter missing: id")
|
|
97
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
98
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
99
|
+
Api.send_request(
|
|
100
|
+
"DELETE",
|
|
101
|
+
"/partners/{id}".format(id=params["id"]),
|
|
102
|
+
params,
|
|
103
|
+
self.options,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
def destroy(self, params=None):
|
|
107
|
+
self.delete(params)
|
|
108
|
+
|
|
109
|
+
def save(self):
|
|
110
|
+
if hasattr(self, "id") and self.id:
|
|
111
|
+
new_obj = self.update(self.get_attributes())
|
|
112
|
+
self.set_attributes(new_obj.get_attributes())
|
|
113
|
+
return True
|
|
114
|
+
else:
|
|
115
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
116
|
+
self.set_attributes(new_obj.get_attributes())
|
|
117
|
+
return True
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# Parameters:
|
|
121
|
+
# 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.
|
|
122
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
123
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id` and `name`.
|
|
124
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `workspace_id`.
|
|
125
|
+
def list(params=None, options=None):
|
|
126
|
+
if not isinstance(params, dict):
|
|
127
|
+
params = {}
|
|
128
|
+
if not isinstance(options, dict):
|
|
129
|
+
options = {}
|
|
130
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
131
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
132
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
133
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
134
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
135
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
136
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
137
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
138
|
+
return ListObj(Partner, "GET", "/partners", params, options)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def all(params=None, options=None):
|
|
142
|
+
list(params, options)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# Parameters:
|
|
146
|
+
# id (required) - int64 - Partner ID.
|
|
147
|
+
def find(id, params=None, options=None):
|
|
148
|
+
if not isinstance(params, dict):
|
|
149
|
+
params = {}
|
|
150
|
+
if not isinstance(options, dict):
|
|
151
|
+
options = {}
|
|
152
|
+
params["id"] = id
|
|
153
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
154
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
155
|
+
if "id" not in params:
|
|
156
|
+
raise MissingParameterError("Parameter missing: id")
|
|
157
|
+
response, options = Api.send_request(
|
|
158
|
+
"GET", "/partners/{id}".format(id=params["id"]), params, options
|
|
159
|
+
)
|
|
160
|
+
return Partner(response.data, options)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def get(id, params=None, options=None):
|
|
164
|
+
find(id, params, options)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
# Parameters:
|
|
168
|
+
# allow_bypassing_2fa_policies - boolean - Allow Partner Admins to change Two-Factor Authentication requirements for Partner Users.
|
|
169
|
+
# allow_credential_changes - boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
|
|
170
|
+
# allow_providing_gpg_keys - boolean - Allow Partner Admins to provide GPG keys.
|
|
171
|
+
# allow_user_creation - boolean - Allow Partner Admins to create users.
|
|
172
|
+
# notes - string - Notes about this Partner.
|
|
173
|
+
# root_folder - string - The root folder path for this Partner.
|
|
174
|
+
# tags - string - Comma-separated list of Tags for this Partner. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
175
|
+
# name (required) - string - The name of the Partner.
|
|
176
|
+
# workspace_id - int64 - ID of the Workspace associated with this Partner.
|
|
177
|
+
def create(params=None, options=None):
|
|
178
|
+
if not isinstance(params, dict):
|
|
179
|
+
params = {}
|
|
180
|
+
if not isinstance(options, dict):
|
|
181
|
+
options = {}
|
|
182
|
+
if "allow_bypassing_2fa_policies" in params and not isinstance(
|
|
183
|
+
params["allow_bypassing_2fa_policies"], bool
|
|
184
|
+
):
|
|
185
|
+
raise InvalidParameterError(
|
|
186
|
+
"Bad parameter: allow_bypassing_2fa_policies must be an bool"
|
|
187
|
+
)
|
|
188
|
+
if "allow_credential_changes" in params and not isinstance(
|
|
189
|
+
params["allow_credential_changes"], bool
|
|
190
|
+
):
|
|
191
|
+
raise InvalidParameterError(
|
|
192
|
+
"Bad parameter: allow_credential_changes must be an bool"
|
|
193
|
+
)
|
|
194
|
+
if "allow_providing_gpg_keys" in params and not isinstance(
|
|
195
|
+
params["allow_providing_gpg_keys"], bool
|
|
196
|
+
):
|
|
197
|
+
raise InvalidParameterError(
|
|
198
|
+
"Bad parameter: allow_providing_gpg_keys must be an bool"
|
|
199
|
+
)
|
|
200
|
+
if "allow_user_creation" in params and not isinstance(
|
|
201
|
+
params["allow_user_creation"], bool
|
|
202
|
+
):
|
|
203
|
+
raise InvalidParameterError(
|
|
204
|
+
"Bad parameter: allow_user_creation must be an bool"
|
|
205
|
+
)
|
|
206
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
207
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
208
|
+
if "root_folder" in params and not isinstance(params["root_folder"], str):
|
|
209
|
+
raise InvalidParameterError(
|
|
210
|
+
"Bad parameter: root_folder must be an str"
|
|
211
|
+
)
|
|
212
|
+
if "tags" in params and not isinstance(params["tags"], str):
|
|
213
|
+
raise InvalidParameterError("Bad parameter: tags must be an str")
|
|
214
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
215
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
216
|
+
if "workspace_id" in params and not isinstance(
|
|
217
|
+
params["workspace_id"], int
|
|
218
|
+
):
|
|
219
|
+
raise InvalidParameterError(
|
|
220
|
+
"Bad parameter: workspace_id must be an int"
|
|
221
|
+
)
|
|
222
|
+
if "name" not in params:
|
|
223
|
+
raise MissingParameterError("Parameter missing: name")
|
|
224
|
+
response, options = Api.send_request("POST", "/partners", params, options)
|
|
225
|
+
return Partner(response.data, options)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
# Parameters:
|
|
229
|
+
# allow_bypassing_2fa_policies - boolean - Allow Partner Admins to change Two-Factor Authentication requirements for Partner Users.
|
|
230
|
+
# allow_credential_changes - boolean - Allow Partner Admins to change or reset credentials for users belonging to this Partner.
|
|
231
|
+
# allow_providing_gpg_keys - boolean - Allow Partner Admins to provide GPG keys.
|
|
232
|
+
# allow_user_creation - boolean - Allow Partner Admins to create users.
|
|
233
|
+
# notes - string - Notes about this Partner.
|
|
234
|
+
# root_folder - string - The root folder path for this Partner.
|
|
235
|
+
# tags - string - Comma-separated list of Tags for this Partner. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.
|
|
236
|
+
# name - string - The name of the Partner.
|
|
237
|
+
def update(id, params=None, options=None):
|
|
238
|
+
if not isinstance(params, dict):
|
|
239
|
+
params = {}
|
|
240
|
+
if not isinstance(options, dict):
|
|
241
|
+
options = {}
|
|
242
|
+
params["id"] = id
|
|
243
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
244
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
245
|
+
if "allow_bypassing_2fa_policies" in params and not isinstance(
|
|
246
|
+
params["allow_bypassing_2fa_policies"], bool
|
|
247
|
+
):
|
|
248
|
+
raise InvalidParameterError(
|
|
249
|
+
"Bad parameter: allow_bypassing_2fa_policies must be an bool"
|
|
250
|
+
)
|
|
251
|
+
if "allow_credential_changes" in params and not isinstance(
|
|
252
|
+
params["allow_credential_changes"], bool
|
|
253
|
+
):
|
|
254
|
+
raise InvalidParameterError(
|
|
255
|
+
"Bad parameter: allow_credential_changes must be an bool"
|
|
256
|
+
)
|
|
257
|
+
if "allow_providing_gpg_keys" in params and not isinstance(
|
|
258
|
+
params["allow_providing_gpg_keys"], bool
|
|
259
|
+
):
|
|
260
|
+
raise InvalidParameterError(
|
|
261
|
+
"Bad parameter: allow_providing_gpg_keys must be an bool"
|
|
262
|
+
)
|
|
263
|
+
if "allow_user_creation" in params and not isinstance(
|
|
264
|
+
params["allow_user_creation"], bool
|
|
265
|
+
):
|
|
266
|
+
raise InvalidParameterError(
|
|
267
|
+
"Bad parameter: allow_user_creation must be an bool"
|
|
268
|
+
)
|
|
269
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
270
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
271
|
+
if "root_folder" in params and not isinstance(params["root_folder"], str):
|
|
272
|
+
raise InvalidParameterError(
|
|
273
|
+
"Bad parameter: root_folder must be an str"
|
|
274
|
+
)
|
|
275
|
+
if "tags" in params and not isinstance(params["tags"], str):
|
|
276
|
+
raise InvalidParameterError("Bad parameter: tags must be an str")
|
|
277
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
278
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
279
|
+
if "id" not in params:
|
|
280
|
+
raise MissingParameterError("Parameter missing: id")
|
|
281
|
+
response, options = Api.send_request(
|
|
282
|
+
"PATCH", "/partners/{id}".format(id=params["id"]), params, options
|
|
283
|
+
)
|
|
284
|
+
return Partner(response.data, options)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def delete(id, params=None, options=None):
|
|
288
|
+
if not isinstance(params, dict):
|
|
289
|
+
params = {}
|
|
290
|
+
if not isinstance(options, dict):
|
|
291
|
+
options = {}
|
|
292
|
+
params["id"] = id
|
|
293
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
294
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
295
|
+
if "id" not in params:
|
|
296
|
+
raise MissingParameterError("Parameter missing: id")
|
|
297
|
+
Api.send_request(
|
|
298
|
+
"DELETE", "/partners/{id}".format(id=params["id"]), params, options
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def destroy(id, params=None, options=None):
|
|
303
|
+
delete(id, params, options)
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def new(*args, **kwargs):
|
|
307
|
+
return Partner(*args, **kwargs)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import builtins # noqa: F401
|
|
2
|
+
from files_sdk.models.account_line_item import AccountLineItem
|
|
3
|
+
from files_sdk.api import Api # noqa: F401
|
|
4
|
+
from files_sdk.list_obj import ListObj
|
|
5
|
+
from files_sdk.error import ( # noqa: F401
|
|
6
|
+
InvalidParameterError,
|
|
7
|
+
MissingParameterError,
|
|
8
|
+
NotImplementedError,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Payment:
|
|
13
|
+
default_attributes = {
|
|
14
|
+
"id": None, # int64 - Line item Id
|
|
15
|
+
"amount": None, # double - Line item amount
|
|
16
|
+
"balance": None, # double - Line item balance
|
|
17
|
+
"created_at": None, # date-time - Line item created at
|
|
18
|
+
"currency": None, # string - Line item currency
|
|
19
|
+
"download_uri": None, # string - Line item download uri
|
|
20
|
+
"invoice_line_items": None, # array(object) - Associated invoice line items
|
|
21
|
+
"method": None, # string - Line item payment method
|
|
22
|
+
"payment_line_items": None, # array(object) - Associated payment line items
|
|
23
|
+
"payment_reversed_at": None, # date-time - Date/time payment was reversed if applicable
|
|
24
|
+
"payment_type": None, # string - Type of payment if applicable
|
|
25
|
+
"site_name": None, # string - Site name this line item is for
|
|
26
|
+
"type": None, # string - Type of line item, either payment or invoice
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
def __init__(self, attributes=None, options=None):
|
|
30
|
+
if not isinstance(attributes, dict):
|
|
31
|
+
attributes = {}
|
|
32
|
+
if not isinstance(options, dict):
|
|
33
|
+
options = {}
|
|
34
|
+
self.set_attributes(attributes)
|
|
35
|
+
self.options = options
|
|
36
|
+
|
|
37
|
+
def set_attributes(self, attributes):
|
|
38
|
+
for attribute, default_value in Payment.default_attributes.items():
|
|
39
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
40
|
+
|
|
41
|
+
def get_attributes(self):
|
|
42
|
+
return {
|
|
43
|
+
k: getattr(self, k, None)
|
|
44
|
+
for k in Payment.default_attributes
|
|
45
|
+
if getattr(self, k, None) is not None
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Parameters:
|
|
50
|
+
# 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.
|
|
51
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
52
|
+
def list(params=None, options=None):
|
|
53
|
+
if not isinstance(params, dict):
|
|
54
|
+
params = {}
|
|
55
|
+
if not isinstance(options, dict):
|
|
56
|
+
options = {}
|
|
57
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
58
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
59
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
60
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
61
|
+
return ListObj(AccountLineItem, "GET", "/payments", params, options)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def all(params=None, options=None):
|
|
65
|
+
list(params, options)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# Parameters:
|
|
69
|
+
# id (required) - int64 - Payment ID.
|
|
70
|
+
def find(id, params=None, options=None):
|
|
71
|
+
if not isinstance(params, dict):
|
|
72
|
+
params = {}
|
|
73
|
+
if not isinstance(options, dict):
|
|
74
|
+
options = {}
|
|
75
|
+
params["id"] = id
|
|
76
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
77
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
78
|
+
if "id" not in params:
|
|
79
|
+
raise MissingParameterError("Parameter missing: id")
|
|
80
|
+
response, options = Api.send_request(
|
|
81
|
+
"GET", "/payments/{id}".format(id=params["id"]), params, options
|
|
82
|
+
)
|
|
83
|
+
return AccountLineItem(response.data, options)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def get(id, params=None, options=None):
|
|
87
|
+
find(id, params, options)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def new(*args, **kwargs):
|
|
91
|
+
return Payment(*args, **kwargs)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import builtins # noqa: F401
|
|
2
|
+
from files_sdk.api import Api # noqa: F401
|
|
3
|
+
from files_sdk.error import ( # noqa: F401
|
|
4
|
+
InvalidParameterError,
|
|
5
|
+
MissingParameterError,
|
|
6
|
+
NotImplementedError,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PaymentLineItem:
|
|
11
|
+
default_attributes = {
|
|
12
|
+
"amount": None, # double - Payment line item amount
|
|
13
|
+
"created_at": None, # date-time - Payment line item created at date/time
|
|
14
|
+
"invoice_id": None, # int64 - Invoice ID
|
|
15
|
+
"payment_id": None, # int64 - Payment ID
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def __init__(self, attributes=None, options=None):
|
|
19
|
+
if not isinstance(attributes, dict):
|
|
20
|
+
attributes = {}
|
|
21
|
+
if not isinstance(options, dict):
|
|
22
|
+
options = {}
|
|
23
|
+
self.set_attributes(attributes)
|
|
24
|
+
self.options = options
|
|
25
|
+
|
|
26
|
+
def set_attributes(self, attributes):
|
|
27
|
+
for (
|
|
28
|
+
attribute,
|
|
29
|
+
default_value,
|
|
30
|
+
) in PaymentLineItem.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 PaymentLineItem.default_attributes
|
|
37
|
+
if getattr(self, k, None) is not None
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def new(*args, **kwargs):
|
|
42
|
+
return PaymentLineItem(*args, **kwargs)
|
|
@@ -0,0 +1,190 @@
|
|
|
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 Permission:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Permission ID
|
|
14
|
+
"path": None, # string - Path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
|
15
|
+
"user_id": None, # int64 - User ID
|
|
16
|
+
"username": None, # string - Username (if applicable)
|
|
17
|
+
"group_id": None, # int64 - Group ID
|
|
18
|
+
"group_name": None, # string - Group name (if applicable)
|
|
19
|
+
"partner_id": None, # int64 - Partner ID (if applicable)
|
|
20
|
+
"partner_name": None, # string - Partner name (if applicable)
|
|
21
|
+
"permission": None, # string - Permission type. See the table referenced in the documentation for an explanation of each permission.
|
|
22
|
+
"recursive": None, # boolean - Recursive: does this permission apply to subfolders?
|
|
23
|
+
"site_id": None, # int64 - Site ID
|
|
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 Permission.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 Permission.default_attributes
|
|
42
|
+
if getattr(self, k, None) is not None
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
def delete(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
|
+
Api.send_request(
|
|
58
|
+
"DELETE",
|
|
59
|
+
"/permissions/{id}".format(id=params["id"]),
|
|
60
|
+
params,
|
|
61
|
+
self.options,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
def destroy(self, params=None):
|
|
65
|
+
self.delete(params)
|
|
66
|
+
|
|
67
|
+
def save(self):
|
|
68
|
+
if hasattr(self, "id") and self.id:
|
|
69
|
+
raise NotImplementedError(
|
|
70
|
+
"The Permission object doesn't support updates."
|
|
71
|
+
)
|
|
72
|
+
else:
|
|
73
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
74
|
+
self.set_attributes(new_obj.get_attributes())
|
|
75
|
+
return True
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# Parameters:
|
|
79
|
+
# 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.
|
|
80
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
81
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `group_id`, `path`, `user_id`, `partner_id` or `id`.
|
|
82
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `path`, `group_id`, `partner_id` or `user_id`. Valid field combinations are `[ group_id, path ]`, `[ partner_id, path ]`, `[ user_id, path ]`, `[ user_id, group_id ]`, `[ user_id, group_id, path ]`, `[ user_id, group_id, partner_id ]` or `[ user_id, group_id, partner_id, path ]`.
|
|
83
|
+
# filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`.
|
|
84
|
+
# path - string - Permission path. If provided, will scope all permissions(including upward) to this path.
|
|
85
|
+
# include_groups - boolean - If searching by user or group, also include user's permissions that are inherited from its groups?
|
|
86
|
+
# group_id - string
|
|
87
|
+
# partner_id - string
|
|
88
|
+
# user_id - string
|
|
89
|
+
def list(params=None, options=None):
|
|
90
|
+
if not isinstance(params, dict):
|
|
91
|
+
params = {}
|
|
92
|
+
if not isinstance(options, dict):
|
|
93
|
+
options = {}
|
|
94
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
95
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
96
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
97
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
98
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
99
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
100
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
101
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
102
|
+
if "filter_prefix" in params and not isinstance(
|
|
103
|
+
params["filter_prefix"], dict
|
|
104
|
+
):
|
|
105
|
+
raise InvalidParameterError(
|
|
106
|
+
"Bad parameter: filter_prefix must be an dict"
|
|
107
|
+
)
|
|
108
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
109
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
110
|
+
if "include_groups" in params and not isinstance(
|
|
111
|
+
params["include_groups"], bool
|
|
112
|
+
):
|
|
113
|
+
raise InvalidParameterError(
|
|
114
|
+
"Bad parameter: include_groups must be an bool"
|
|
115
|
+
)
|
|
116
|
+
if "group_id" in params and not isinstance(params["group_id"], str):
|
|
117
|
+
raise InvalidParameterError("Bad parameter: group_id must be an str")
|
|
118
|
+
if "partner_id" in params and not isinstance(params["partner_id"], str):
|
|
119
|
+
raise InvalidParameterError("Bad parameter: partner_id must be an str")
|
|
120
|
+
if "user_id" in params and not isinstance(params["user_id"], str):
|
|
121
|
+
raise InvalidParameterError("Bad parameter: user_id must be an str")
|
|
122
|
+
return ListObj(Permission, "GET", "/permissions", params, options)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def all(params=None, options=None):
|
|
126
|
+
list(params, options)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
# Parameters:
|
|
130
|
+
# path (required) - string - Folder path
|
|
131
|
+
# group_id - int64 - Group ID. Provide `group_name` or `group_id`
|
|
132
|
+
# permission - string - Permission type. Can be `admin`, `full`, `readonly`, `writeonly`, `list`, or `history`
|
|
133
|
+
# recursive - boolean - Apply to subfolders recursively?
|
|
134
|
+
# partner_id - int64 - Partner ID if this Permission belongs to a partner.
|
|
135
|
+
# user_id - int64 - User ID. Provide `username` or `user_id`
|
|
136
|
+
# username - string - User username. Provide `username` or `user_id`
|
|
137
|
+
# group_name - string - Group name. Provide `group_name` or `group_id`
|
|
138
|
+
# site_id - int64 - Site ID. If not provided, will default to current site. Used when creating a permission for a child site.
|
|
139
|
+
def create(params=None, options=None):
|
|
140
|
+
if not isinstance(params, dict):
|
|
141
|
+
params = {}
|
|
142
|
+
if not isinstance(options, dict):
|
|
143
|
+
options = {}
|
|
144
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
145
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
146
|
+
if "group_id" in params and not isinstance(params["group_id"], int):
|
|
147
|
+
raise InvalidParameterError("Bad parameter: group_id must be an int")
|
|
148
|
+
if "permission" in params and not isinstance(params["permission"], str):
|
|
149
|
+
raise InvalidParameterError("Bad parameter: permission must be an str")
|
|
150
|
+
if "recursive" in params and not isinstance(params["recursive"], bool):
|
|
151
|
+
raise InvalidParameterError("Bad parameter: recursive must be an bool")
|
|
152
|
+
if "partner_id" in params and not isinstance(params["partner_id"], int):
|
|
153
|
+
raise InvalidParameterError("Bad parameter: partner_id must be an int")
|
|
154
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
155
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
156
|
+
if "username" in params and not isinstance(params["username"], str):
|
|
157
|
+
raise InvalidParameterError("Bad parameter: username must be an str")
|
|
158
|
+
if "group_name" in params and not isinstance(params["group_name"], str):
|
|
159
|
+
raise InvalidParameterError("Bad parameter: group_name must be an str")
|
|
160
|
+
if "site_id" in params and not isinstance(params["site_id"], int):
|
|
161
|
+
raise InvalidParameterError("Bad parameter: site_id must be an int")
|
|
162
|
+
if "path" not in params:
|
|
163
|
+
raise MissingParameterError("Parameter missing: path")
|
|
164
|
+
response, options = Api.send_request(
|
|
165
|
+
"POST", "/permissions", params, options
|
|
166
|
+
)
|
|
167
|
+
return Permission(response.data, options)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def delete(id, params=None, options=None):
|
|
171
|
+
if not isinstance(params, dict):
|
|
172
|
+
params = {}
|
|
173
|
+
if not isinstance(options, dict):
|
|
174
|
+
options = {}
|
|
175
|
+
params["id"] = id
|
|
176
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
177
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
178
|
+
if "id" not in params:
|
|
179
|
+
raise MissingParameterError("Parameter missing: id")
|
|
180
|
+
Api.send_request(
|
|
181
|
+
"DELETE", "/permissions/{id}".format(id=params["id"]), params, options
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def destroy(id, params=None, options=None):
|
|
186
|
+
delete(id, params, options)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def new(*args, **kwargs):
|
|
190
|
+
return Permission(*args, **kwargs)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import builtins # noqa: F401
|
|
2
|
+
from files_sdk.api import Api # noqa: F401
|
|
3
|
+
from files_sdk.error import ( # noqa: F401
|
|
4
|
+
InvalidParameterError,
|
|
5
|
+
MissingParameterError,
|
|
6
|
+
NotImplementedError,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Preview:
|
|
11
|
+
default_attributes = {
|
|
12
|
+
"id": None, # int64 - Preview ID
|
|
13
|
+
"status": None, # string - Preview status. Can be invalid, not_generated, generating, complete, or file_too_large
|
|
14
|
+
"download_uri": None, # string - Link to download preview
|
|
15
|
+
"type": None, # string - Preview type. Can be image, pdf, pdf_native, video, or audio
|
|
16
|
+
"size": None, # string - Preview size
|
|
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 attribute, default_value in Preview.default_attributes.items():
|
|
29
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
30
|
+
|
|
31
|
+
def get_attributes(self):
|
|
32
|
+
return {
|
|
33
|
+
k: getattr(self, k, None)
|
|
34
|
+
for k in Preview.default_attributes
|
|
35
|
+
if getattr(self, k, None) is not None
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def new(*args, **kwargs):
|
|
40
|
+
return Preview(*args, **kwargs)
|