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,184 @@
|
|
|
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 Request:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Request ID
|
|
14
|
+
"path": None, # string - Folder path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
|
15
|
+
"source": None, # string - Source filename, if applicable
|
|
16
|
+
"destination": None, # string - Destination filename
|
|
17
|
+
"automation_id": None, # int64 - ID of automation that created request
|
|
18
|
+
"user_display_name": None, # string - User making the request (if applicable)
|
|
19
|
+
"user_ids": None, # string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
|
|
20
|
+
"group_ids": None, # string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
def __init__(self, attributes=None, options=None):
|
|
24
|
+
if not isinstance(attributes, dict):
|
|
25
|
+
attributes = {}
|
|
26
|
+
if not isinstance(options, dict):
|
|
27
|
+
options = {}
|
|
28
|
+
self.set_attributes(attributes)
|
|
29
|
+
self.options = options
|
|
30
|
+
|
|
31
|
+
def set_attributes(self, attributes):
|
|
32
|
+
for attribute, default_value in Request.default_attributes.items():
|
|
33
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
34
|
+
|
|
35
|
+
def get_attributes(self):
|
|
36
|
+
return {
|
|
37
|
+
k: getattr(self, k, None)
|
|
38
|
+
for k in Request.default_attributes
|
|
39
|
+
if getattr(self, k, None) is not None
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
def delete(self, params=None):
|
|
43
|
+
if not isinstance(params, dict):
|
|
44
|
+
params = {}
|
|
45
|
+
|
|
46
|
+
if hasattr(self, "id") and self.id:
|
|
47
|
+
params["id"] = self.id
|
|
48
|
+
else:
|
|
49
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
50
|
+
if "id" not in params:
|
|
51
|
+
raise MissingParameterError("Parameter missing: id")
|
|
52
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
53
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
54
|
+
Api.send_request(
|
|
55
|
+
"DELETE",
|
|
56
|
+
"/requests/{id}".format(id=params["id"]),
|
|
57
|
+
params,
|
|
58
|
+
self.options,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def destroy(self, params=None):
|
|
62
|
+
self.delete(params)
|
|
63
|
+
|
|
64
|
+
def save(self):
|
|
65
|
+
if hasattr(self, "id") and self.id:
|
|
66
|
+
raise NotImplementedError(
|
|
67
|
+
"The Request object doesn't support updates."
|
|
68
|
+
)
|
|
69
|
+
else:
|
|
70
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
71
|
+
self.set_attributes(new_obj.get_attributes())
|
|
72
|
+
return True
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# Parameters:
|
|
76
|
+
# 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.
|
|
77
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
78
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
|
|
79
|
+
# mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
|
|
80
|
+
# path - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
|
|
81
|
+
def list(params=None, options=None):
|
|
82
|
+
if not isinstance(params, dict):
|
|
83
|
+
params = {}
|
|
84
|
+
if not isinstance(options, dict):
|
|
85
|
+
options = {}
|
|
86
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
87
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
88
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
89
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
90
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
91
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
92
|
+
if "mine" in params and not isinstance(params["mine"], bool):
|
|
93
|
+
raise InvalidParameterError("Bad parameter: mine must be an bool")
|
|
94
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
95
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
96
|
+
return ListObj(Request, "GET", "/requests", params, options)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def all(params=None, options=None):
|
|
100
|
+
list(params, options)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# Parameters:
|
|
104
|
+
# 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.
|
|
105
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
106
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
|
|
107
|
+
# mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
|
|
108
|
+
# path (required) - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
|
|
109
|
+
def get_folder(path, params=None, options=None):
|
|
110
|
+
if not isinstance(params, dict):
|
|
111
|
+
params = {}
|
|
112
|
+
if not isinstance(options, dict):
|
|
113
|
+
options = {}
|
|
114
|
+
params["path"] = path
|
|
115
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
116
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
117
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
118
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
119
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
120
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
121
|
+
if "mine" in params and not isinstance(params["mine"], bool):
|
|
122
|
+
raise InvalidParameterError("Bad parameter: mine must be an bool")
|
|
123
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
124
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
125
|
+
if "path" not in params:
|
|
126
|
+
raise MissingParameterError("Parameter missing: path")
|
|
127
|
+
return ListObj(
|
|
128
|
+
Request,
|
|
129
|
+
"GET",
|
|
130
|
+
"/requests/folders/{path}".format(path=params["path"]),
|
|
131
|
+
params,
|
|
132
|
+
options,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# Parameters:
|
|
137
|
+
# path (required) - string - Folder path on which to request the file.
|
|
138
|
+
# destination (required) - string - Destination filename (without extension) to request.
|
|
139
|
+
# user_ids - string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
|
|
140
|
+
# group_ids - string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
|
|
141
|
+
def create(params=None, options=None):
|
|
142
|
+
if not isinstance(params, dict):
|
|
143
|
+
params = {}
|
|
144
|
+
if not isinstance(options, dict):
|
|
145
|
+
options = {}
|
|
146
|
+
if "path" in params and not isinstance(params["path"], str):
|
|
147
|
+
raise InvalidParameterError("Bad parameter: path must be an str")
|
|
148
|
+
if "destination" in params and not isinstance(params["destination"], str):
|
|
149
|
+
raise InvalidParameterError(
|
|
150
|
+
"Bad parameter: destination must be an str"
|
|
151
|
+
)
|
|
152
|
+
if "user_ids" in params and not isinstance(params["user_ids"], str):
|
|
153
|
+
raise InvalidParameterError("Bad parameter: user_ids must be an str")
|
|
154
|
+
if "group_ids" in params and not isinstance(params["group_ids"], str):
|
|
155
|
+
raise InvalidParameterError("Bad parameter: group_ids must be an str")
|
|
156
|
+
if "path" not in params:
|
|
157
|
+
raise MissingParameterError("Parameter missing: path")
|
|
158
|
+
if "destination" not in params:
|
|
159
|
+
raise MissingParameterError("Parameter missing: destination")
|
|
160
|
+
response, options = Api.send_request("POST", "/requests", params, options)
|
|
161
|
+
return Request(response.data, options)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def delete(id, params=None, options=None):
|
|
165
|
+
if not isinstance(params, dict):
|
|
166
|
+
params = {}
|
|
167
|
+
if not isinstance(options, dict):
|
|
168
|
+
options = {}
|
|
169
|
+
params["id"] = id
|
|
170
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
171
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
172
|
+
if "id" not in params:
|
|
173
|
+
raise MissingParameterError("Parameter missing: id")
|
|
174
|
+
Api.send_request(
|
|
175
|
+
"DELETE", "/requests/{id}".format(id=params["id"]), params, options
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def destroy(id, params=None, options=None):
|
|
180
|
+
delete(id, params, options)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def new(*args, **kwargs):
|
|
184
|
+
return Request(*args, **kwargs)
|
|
@@ -0,0 +1,142 @@
|
|
|
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 Restore:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"earliest_date": None, # date-time - Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365 days prior to the restore request.
|
|
14
|
+
"id": None, # int64 - Restore Record ID.
|
|
15
|
+
"dirs_restored": None, # int64 - Number of directories that were successfully restored.
|
|
16
|
+
"dirs_errored": None, # int64 - Number of directories that were not able to be restored.
|
|
17
|
+
"dirs_total": None, # int64 - Total number of directories processed.
|
|
18
|
+
"files_restored": None, # int64 - Number of files successfully restored.
|
|
19
|
+
"files_errored": None, # int64 - Number of files that were not able to be restored.
|
|
20
|
+
"files_total": None, # int64 - Total number of files processed.
|
|
21
|
+
"prefix": None, # string - Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash. To restore all deleted items, specify an empty string (`''`) in the prefix field or omit the field from the request.
|
|
22
|
+
"restoration_type": None, # string - Type of restoration to perform. `files` restores deleted filesystem items. `users` restores deleted users and associated access/authentication records.
|
|
23
|
+
"restore_in_place": None, # boolean - If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
|
|
24
|
+
"restore_deleted_permissions": None, # boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
|
|
25
|
+
"users_restored": None, # int64 - Number of users successfully restored (only present for `restoration_type=users`).
|
|
26
|
+
"users_errored": None, # int64 - Number of users that failed to restore (only present for `restoration_type=users`).
|
|
27
|
+
"users_total": None, # int64 - Total number of users processed (only present for `restoration_type=users`).
|
|
28
|
+
"api_keys_restored": None, # int64 - Number of API keys restored (only present for `restoration_type=users`).
|
|
29
|
+
"public_keys_restored": None, # int64 - Number of public keys restored (only present for `restoration_type=users`).
|
|
30
|
+
"two_factor_authentication_methods_restored": None, # int64 - Number of two factor authentication methods restored (only present for `restoration_type=users`).
|
|
31
|
+
"status": None, # string - Status of the restoration process.
|
|
32
|
+
"update_timestamps": None, # boolean - If true, we will update the last modified timestamp of restored files to today's date. If false, we might trigger File Expiration to delete the file again.
|
|
33
|
+
"error_messages": None, # array(string) - Error messages received while restoring files and/or directories. Only present if there were errors.
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def __init__(self, attributes=None, options=None):
|
|
37
|
+
if not isinstance(attributes, dict):
|
|
38
|
+
attributes = {}
|
|
39
|
+
if not isinstance(options, dict):
|
|
40
|
+
options = {}
|
|
41
|
+
self.set_attributes(attributes)
|
|
42
|
+
self.options = options
|
|
43
|
+
|
|
44
|
+
def set_attributes(self, attributes):
|
|
45
|
+
for attribute, default_value in Restore.default_attributes.items():
|
|
46
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
47
|
+
|
|
48
|
+
def get_attributes(self):
|
|
49
|
+
return {
|
|
50
|
+
k: getattr(self, k, None)
|
|
51
|
+
for k in Restore.default_attributes
|
|
52
|
+
if getattr(self, k, None) is not None
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
def save(self):
|
|
56
|
+
if hasattr(self, "id") and self.id:
|
|
57
|
+
raise NotImplementedError(
|
|
58
|
+
"The Restore object doesn't support updates."
|
|
59
|
+
)
|
|
60
|
+
else:
|
|
61
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
62
|
+
self.set_attributes(new_obj.get_attributes())
|
|
63
|
+
return True
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# Parameters:
|
|
67
|
+
# 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.
|
|
68
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
69
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
|
|
70
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `restoration_type`.
|
|
71
|
+
def list(params=None, options=None):
|
|
72
|
+
if not isinstance(params, dict):
|
|
73
|
+
params = {}
|
|
74
|
+
if not isinstance(options, dict):
|
|
75
|
+
options = {}
|
|
76
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
77
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
78
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
79
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
80
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
81
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
82
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
83
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
84
|
+
return ListObj(Restore, "GET", "/restores", params, options)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def all(params=None, options=None):
|
|
88
|
+
list(params, options)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# Parameters:
|
|
92
|
+
# earliest_date (required) - string - Restore all files deleted after this date/time. Don't set this earlier than you need. Can not be greater than 365 days prior to the restore request.
|
|
93
|
+
# prefix - string - Prefix of the files/folders to restore. To restore a folder, add a trailing slash to the folder name. Do not use a leading slash. To restore all deleted items, specify an empty string (`''`) in the prefix field or omit the field from the request.
|
|
94
|
+
# restoration_type - string - Type of restoration to perform. `files` restores deleted filesystem items. `users` restores deleted users and associated access/authentication records.
|
|
95
|
+
# restore_deleted_permissions - boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
|
|
96
|
+
# restore_in_place - boolean - If true, we will restore the files in place (into their original paths). If false, we will create a new restoration folder in the root and restore files there.
|
|
97
|
+
# update_timestamps - boolean - If true, we will update the last modified timestamp of restored files to today's date. If false, we might trigger File Expiration to delete the file again.
|
|
98
|
+
def create(params=None, options=None):
|
|
99
|
+
if not isinstance(params, dict):
|
|
100
|
+
params = {}
|
|
101
|
+
if not isinstance(options, dict):
|
|
102
|
+
options = {}
|
|
103
|
+
if "earliest_date" in params and not isinstance(
|
|
104
|
+
params["earliest_date"], str
|
|
105
|
+
):
|
|
106
|
+
raise InvalidParameterError(
|
|
107
|
+
"Bad parameter: earliest_date must be an str"
|
|
108
|
+
)
|
|
109
|
+
if "prefix" in params and not isinstance(params["prefix"], str):
|
|
110
|
+
raise InvalidParameterError("Bad parameter: prefix must be an str")
|
|
111
|
+
if "restoration_type" in params and not isinstance(
|
|
112
|
+
params["restoration_type"], str
|
|
113
|
+
):
|
|
114
|
+
raise InvalidParameterError(
|
|
115
|
+
"Bad parameter: restoration_type must be an str"
|
|
116
|
+
)
|
|
117
|
+
if "restore_deleted_permissions" in params and not isinstance(
|
|
118
|
+
params["restore_deleted_permissions"], bool
|
|
119
|
+
):
|
|
120
|
+
raise InvalidParameterError(
|
|
121
|
+
"Bad parameter: restore_deleted_permissions must be an bool"
|
|
122
|
+
)
|
|
123
|
+
if "restore_in_place" in params and not isinstance(
|
|
124
|
+
params["restore_in_place"], bool
|
|
125
|
+
):
|
|
126
|
+
raise InvalidParameterError(
|
|
127
|
+
"Bad parameter: restore_in_place must be an bool"
|
|
128
|
+
)
|
|
129
|
+
if "update_timestamps" in params and not isinstance(
|
|
130
|
+
params["update_timestamps"], bool
|
|
131
|
+
):
|
|
132
|
+
raise InvalidParameterError(
|
|
133
|
+
"Bad parameter: update_timestamps must be an bool"
|
|
134
|
+
)
|
|
135
|
+
if "earliest_date" not in params:
|
|
136
|
+
raise MissingParameterError("Parameter missing: earliest_date")
|
|
137
|
+
response, options = Api.send_request("POST", "/restores", params, options)
|
|
138
|
+
return Restore(response.data, options)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def new(*args, **kwargs):
|
|
142
|
+
return Restore(*args, **kwargs)
|
|
@@ -0,0 +1,88 @@
|
|
|
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 ScimLog:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - The unique ID of this SCIM request.
|
|
14
|
+
"created_at": None, # string - The date and time when this SCIM request occurred.
|
|
15
|
+
"request_path": None, # string - The path portion of the URL requested.
|
|
16
|
+
"request_method": None, # string - The HTTP method used for this request.
|
|
17
|
+
"http_response_code": None, # string - The HTTP response code returned for this request.
|
|
18
|
+
"user_agent": None, # string - The User-Agent header sent with the request.
|
|
19
|
+
"request_json": None, # string - The JSON payload sent with the request.
|
|
20
|
+
"response_json": None, # string - The JSON payload returned in the response.
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
def __init__(self, attributes=None, options=None):
|
|
24
|
+
if not isinstance(attributes, dict):
|
|
25
|
+
attributes = {}
|
|
26
|
+
if not isinstance(options, dict):
|
|
27
|
+
options = {}
|
|
28
|
+
self.set_attributes(attributes)
|
|
29
|
+
self.options = options
|
|
30
|
+
|
|
31
|
+
def set_attributes(self, attributes):
|
|
32
|
+
for attribute, default_value in ScimLog.default_attributes.items():
|
|
33
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
34
|
+
|
|
35
|
+
def get_attributes(self):
|
|
36
|
+
return {
|
|
37
|
+
k: getattr(self, k, None)
|
|
38
|
+
for k in ScimLog.default_attributes
|
|
39
|
+
if getattr(self, k, None) is not None
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Parameters:
|
|
44
|
+
# 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.
|
|
45
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
46
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`.
|
|
47
|
+
def list(params=None, options=None):
|
|
48
|
+
if not isinstance(params, dict):
|
|
49
|
+
params = {}
|
|
50
|
+
if not isinstance(options, dict):
|
|
51
|
+
options = {}
|
|
52
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
53
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
54
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
55
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
56
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
57
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
58
|
+
return ListObj(ScimLog, "GET", "/scim_logs", params, options)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def all(params=None, options=None):
|
|
62
|
+
list(params, options)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# Parameters:
|
|
66
|
+
# id (required) - int64 - Scim Log ID.
|
|
67
|
+
def find(id, params=None, options=None):
|
|
68
|
+
if not isinstance(params, dict):
|
|
69
|
+
params = {}
|
|
70
|
+
if not isinstance(options, dict):
|
|
71
|
+
options = {}
|
|
72
|
+
params["id"] = id
|
|
73
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
74
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
75
|
+
if "id" not in params:
|
|
76
|
+
raise MissingParameterError("Parameter missing: id")
|
|
77
|
+
response, options = Api.send_request(
|
|
78
|
+
"GET", "/scim_logs/{id}".format(id=params["id"]), params, options
|
|
79
|
+
)
|
|
80
|
+
return ScimLog(response.data, options)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def get(id, params=None, options=None):
|
|
84
|
+
find(id, params, options)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def new(*args, **kwargs):
|
|
88
|
+
return ScimLog(*args, **kwargs)
|
|
@@ -0,0 +1,100 @@
|
|
|
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 Session:
|
|
11
|
+
default_attributes = {
|
|
12
|
+
"id": None, # string - Session ID
|
|
13
|
+
"language": None, # string - Session language
|
|
14
|
+
"read_only": None, # boolean - Is this session read only?
|
|
15
|
+
"sftp_insecure_ciphers": None, # boolean - Are insecure SFTP ciphers allowed for this user? (If this is set to true, the site administrator has signaled that it is ok to use less secure SSH ciphers for this user.)
|
|
16
|
+
"username": None, # string - Username to sign in as
|
|
17
|
+
"password": None, # string - Password for sign in
|
|
18
|
+
"otp": None, # string - If this user has a 2FA device, provide its OTP or code here.
|
|
19
|
+
"partial_session_id": None, # string - Identifier for a partially-completed login
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def __init__(self, attributes=None, options=None):
|
|
23
|
+
if not isinstance(attributes, dict):
|
|
24
|
+
attributes = {}
|
|
25
|
+
if not isinstance(options, dict):
|
|
26
|
+
options = {}
|
|
27
|
+
self.set_attributes(attributes)
|
|
28
|
+
self.options = options
|
|
29
|
+
|
|
30
|
+
def set_attributes(self, attributes):
|
|
31
|
+
for attribute, default_value in Session.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 Session.default_attributes
|
|
38
|
+
if getattr(self, k, None) is not None
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def destroy(self, params=None, options=None):
|
|
42
|
+
if not isinstance(params, dict):
|
|
43
|
+
params = {}
|
|
44
|
+
if not isinstance(options, dict):
|
|
45
|
+
options = {}
|
|
46
|
+
options.pop("session_id", None)
|
|
47
|
+
options["session"] = self
|
|
48
|
+
Session.destroy(params, options)
|
|
49
|
+
|
|
50
|
+
def save(self):
|
|
51
|
+
if hasattr(self, "id") and self.id:
|
|
52
|
+
raise NotImplementedError(
|
|
53
|
+
"The Session object doesn't support updates."
|
|
54
|
+
)
|
|
55
|
+
else:
|
|
56
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
57
|
+
self.set_attributes(new_obj.get_attributes())
|
|
58
|
+
return True
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# Parameters:
|
|
62
|
+
# username - string - Username to sign in as
|
|
63
|
+
# password - string - Password for sign in
|
|
64
|
+
# otp - string - If this user has a 2FA device, provide its OTP or code here.
|
|
65
|
+
# partial_session_id - string - Identifier for a partially-completed login
|
|
66
|
+
def create(params=None, options=None):
|
|
67
|
+
if not isinstance(params, dict):
|
|
68
|
+
params = {}
|
|
69
|
+
if not isinstance(options, dict):
|
|
70
|
+
options = {}
|
|
71
|
+
if "username" in params and not isinstance(params["username"], str):
|
|
72
|
+
raise InvalidParameterError("Bad parameter: username must be an str")
|
|
73
|
+
if "password" in params and not isinstance(params["password"], str):
|
|
74
|
+
raise InvalidParameterError("Bad parameter: password must be an str")
|
|
75
|
+
if "otp" in params and not isinstance(params["otp"], str):
|
|
76
|
+
raise InvalidParameterError("Bad parameter: otp must be an str")
|
|
77
|
+
if "partial_session_id" in params and not isinstance(
|
|
78
|
+
params["partial_session_id"], str
|
|
79
|
+
):
|
|
80
|
+
raise InvalidParameterError(
|
|
81
|
+
"Bad parameter: partial_session_id must be an str"
|
|
82
|
+
)
|
|
83
|
+
response, options = Api.send_request("POST", "/sessions", params, options)
|
|
84
|
+
return Session(response.data, options)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def delete(params=None, options=None):
|
|
88
|
+
if not isinstance(params, dict):
|
|
89
|
+
params = {}
|
|
90
|
+
if not isinstance(options, dict):
|
|
91
|
+
options = {}
|
|
92
|
+
Api.send_request("DELETE", "/sessions", params, options)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def destroy(params=None, options=None):
|
|
96
|
+
delete(params, options)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def new(*args, **kwargs):
|
|
100
|
+
return Session(*args, **kwargs)
|
|
@@ -0,0 +1,71 @@
|
|
|
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 SettingsChange:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"api_key_id": None, # int64 - The API key id responsible for this change.
|
|
14
|
+
"changes": None, # array(string) - Markdown-formatted change messages.
|
|
15
|
+
"created_at": None, # date-time - The time this change was made.
|
|
16
|
+
"user_id": None, # int64 - The user id responsible for this change.
|
|
17
|
+
"user_is_files_support": None, # boolean - true if this change was performed by Files.com support.
|
|
18
|
+
"user_is_from_parent_site": None, # boolean - true if this change was performed by a user on a parent site.
|
|
19
|
+
"username": None, # string - The username of the user responsible for this change.
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def __init__(self, attributes=None, options=None):
|
|
23
|
+
if not isinstance(attributes, dict):
|
|
24
|
+
attributes = {}
|
|
25
|
+
if not isinstance(options, dict):
|
|
26
|
+
options = {}
|
|
27
|
+
self.set_attributes(attributes)
|
|
28
|
+
self.options = options
|
|
29
|
+
|
|
30
|
+
def set_attributes(self, attributes):
|
|
31
|
+
for (
|
|
32
|
+
attribute,
|
|
33
|
+
default_value,
|
|
34
|
+
) in SettingsChange.default_attributes.items():
|
|
35
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
36
|
+
|
|
37
|
+
def get_attributes(self):
|
|
38
|
+
return {
|
|
39
|
+
k: getattr(self, k, None)
|
|
40
|
+
for k in SettingsChange.default_attributes
|
|
41
|
+
if getattr(self, k, None) is not None
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# Parameters:
|
|
46
|
+
# 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.
|
|
47
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
48
|
+
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `created_at`, `api_key_id` or `user_id`.
|
|
49
|
+
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `api_key_id` and `user_id`.
|
|
50
|
+
def list(params=None, options=None):
|
|
51
|
+
if not isinstance(params, dict):
|
|
52
|
+
params = {}
|
|
53
|
+
if not isinstance(options, dict):
|
|
54
|
+
options = {}
|
|
55
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
56
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
57
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
58
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
59
|
+
if "sort_by" in params and not isinstance(params["sort_by"], dict):
|
|
60
|
+
raise InvalidParameterError("Bad parameter: sort_by must be an dict")
|
|
61
|
+
if "filter" in params and not isinstance(params["filter"], dict):
|
|
62
|
+
raise InvalidParameterError("Bad parameter: filter must be an dict")
|
|
63
|
+
return ListObj(SettingsChange, "GET", "/settings_changes", params, options)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def all(params=None, options=None):
|
|
67
|
+
list(params, options)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def new(*args, **kwargs):
|
|
71
|
+
return SettingsChange(*args, **kwargs)
|