files-com 1.5.0__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.

Files changed (113) hide show
  1. README.md +682 -0
  2. _VERSION +1 -0
  3. files_com-1.5.0.dist-info/METADATA +694 -0
  4. files_com-1.5.0.dist-info/RECORD +113 -0
  5. files_com-1.5.0.dist-info/WHEEL +5 -0
  6. files_com-1.5.0.dist-info/licenses/LICENSE +21 -0
  7. files_com-1.5.0.dist-info/top_level.txt +1 -0
  8. files_sdk/__init__.py +270 -0
  9. files_sdk/api.py +57 -0
  10. files_sdk/api_client.py +327 -0
  11. files_sdk/error.py +2891 -0
  12. files_sdk/list_obj.py +42 -0
  13. files_sdk/models/__init__.py +104 -0
  14. files_sdk/models/account_line_item.py +51 -0
  15. files_sdk/models/action.py +49 -0
  16. files_sdk/models/action_notification_export.py +147 -0
  17. files_sdk/models/action_notification_export_result.py +88 -0
  18. files_sdk/models/api_key.py +322 -0
  19. files_sdk/models/api_request_log.py +87 -0
  20. files_sdk/models/app.py +89 -0
  21. files_sdk/models/as2_incoming_message.py +123 -0
  22. files_sdk/models/as2_outgoing_message.py +119 -0
  23. files_sdk/models/as2_partner.py +374 -0
  24. files_sdk/models/as2_station.py +271 -0
  25. files_sdk/models/auto.py +36 -0
  26. files_sdk/models/automation.py +691 -0
  27. files_sdk/models/automation_log.py +77 -0
  28. files_sdk/models/automation_run.py +108 -0
  29. files_sdk/models/bandwidth_snapshot.py +91 -0
  30. files_sdk/models/behavior.py +334 -0
  31. files_sdk/models/bundle.py +550 -0
  32. files_sdk/models/bundle_action.py +86 -0
  33. files_sdk/models/bundle_download.py +94 -0
  34. files_sdk/models/bundle_notification.py +217 -0
  35. files_sdk/models/bundle_path.py +37 -0
  36. files_sdk/models/bundle_recipient.py +120 -0
  37. files_sdk/models/bundle_registration.py +79 -0
  38. files_sdk/models/clickwrap.py +268 -0
  39. files_sdk/models/dns_record.py +59 -0
  40. files_sdk/models/email_incoming_message.py +102 -0
  41. files_sdk/models/email_log.py +74 -0
  42. files_sdk/models/errors.py +37 -0
  43. files_sdk/models/exavault_api_request_log.py +85 -0
  44. files_sdk/models/external_event.py +148 -0
  45. files_sdk/models/file.py +791 -0
  46. files_sdk/models/file_action.py +39 -0
  47. files_sdk/models/file_comment.py +191 -0
  48. files_sdk/models/file_comment_reaction.py +125 -0
  49. files_sdk/models/file_migration.py +69 -0
  50. files_sdk/models/file_migration_log.py +78 -0
  51. files_sdk/models/file_upload_part.py +54 -0
  52. files_sdk/models/folder.py +154 -0
  53. files_sdk/models/form_field.py +43 -0
  54. files_sdk/models/form_field_set.py +240 -0
  55. files_sdk/models/ftp_action_log.py +87 -0
  56. files_sdk/models/gpg_key.py +254 -0
  57. files_sdk/models/group.py +276 -0
  58. files_sdk/models/group_user.py +231 -0
  59. files_sdk/models/history.py +236 -0
  60. files_sdk/models/history_export.py +238 -0
  61. files_sdk/models/history_export_result.py +98 -0
  62. files_sdk/models/image.py +37 -0
  63. files_sdk/models/inbox_recipient.py +118 -0
  64. files_sdk/models/inbox_registration.py +79 -0
  65. files_sdk/models/inbox_upload.py +80 -0
  66. files_sdk/models/invoice.py +91 -0
  67. files_sdk/models/invoice_line_item.py +46 -0
  68. files_sdk/models/ip_address.py +119 -0
  69. files_sdk/models/lock.py +158 -0
  70. files_sdk/models/message.py +244 -0
  71. files_sdk/models/message_comment.py +223 -0
  72. files_sdk/models/message_comment_reaction.py +181 -0
  73. files_sdk/models/message_reaction.py +170 -0
  74. files_sdk/models/notification.py +357 -0
  75. files_sdk/models/outbound_connection_log.py +88 -0
  76. files_sdk/models/payment.py +91 -0
  77. files_sdk/models/payment_line_item.py +42 -0
  78. files_sdk/models/permission.py +174 -0
  79. files_sdk/models/preview.py +40 -0
  80. files_sdk/models/priority.py +63 -0
  81. files_sdk/models/project.py +205 -0
  82. files_sdk/models/public_hosting_request_log.py +82 -0
  83. files_sdk/models/public_ip_address.py +42 -0
  84. files_sdk/models/public_key.py +212 -0
  85. files_sdk/models/remote_bandwidth_snapshot.py +91 -0
  86. files_sdk/models/remote_server.py +1677 -0
  87. files_sdk/models/remote_server_configuration_file.py +72 -0
  88. files_sdk/models/request.py +180 -0
  89. files_sdk/models/restore.py +104 -0
  90. files_sdk/models/session.py +100 -0
  91. files_sdk/models/settings_change.py +71 -0
  92. files_sdk/models/sftp_action_log.py +91 -0
  93. files_sdk/models/sftp_host_key.py +215 -0
  94. files_sdk/models/share_group.py +228 -0
  95. files_sdk/models/share_group_member.py +41 -0
  96. files_sdk/models/siem_http_destination.py +773 -0
  97. files_sdk/models/site.py +767 -0
  98. files_sdk/models/snapshot.py +255 -0
  99. files_sdk/models/sso_strategy.py +167 -0
  100. files_sdk/models/status.py +42 -0
  101. files_sdk/models/style.py +152 -0
  102. files_sdk/models/sync_log.py +75 -0
  103. files_sdk/models/usage_by_top_level_dir.py +41 -0
  104. files_sdk/models/usage_daily_snapshot.py +93 -0
  105. files_sdk/models/usage_snapshot.py +73 -0
  106. files_sdk/models/user.py +893 -0
  107. files_sdk/models/user_cipher_use.py +68 -0
  108. files_sdk/models/user_request.py +166 -0
  109. files_sdk/models/user_sftp_client_use.py +68 -0
  110. files_sdk/models/web_dav_action_log.py +87 -0
  111. files_sdk/models/webhook_test.py +104 -0
  112. files_sdk/path_util.py +42 -0
  113. files_sdk/util.py +34 -0
@@ -0,0 +1,72 @@
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 RemoteServerConfigurationFile:
11
+ default_attributes = {
12
+ "id": None, # int64 - The remote server ID of the agent
13
+ "permission_set": None, # string - The permission set for the agent ['read_write', 'read_only', 'write_only']
14
+ "private_key": None, # string - The private key for the agent
15
+ "subdomain": None, # string - Files.com subdomain site name
16
+ "root": None, # string - The root directory for the agent
17
+ "follow_links": None, # boolean - Follow symlinks when traversing directories
18
+ "prefer_protocol": None, # string - Preferred network protocol ['udp', 'tcp'] (default udp)
19
+ "dns": None, # string - DNS lookup method ['auto','doh','system'] (default auto)
20
+ "proxy_all_outbound": None, # boolean - Proxy all outbound traffic through files.com proxy server
21
+ "endpoint_override": None, # string - Custom site endpoint URL
22
+ "log_file": None, # string - Log file name and location
23
+ "log_level": None, # string - Log level for the agent logs ['debug', 'info', 'warn', 'error', 'fatal'] (default info)
24
+ "log_rotate_num": None, # int64 - Log route for agent logs. (default 5)
25
+ "log_rotate_size": None, # int64 - Log route size in MB for agent logs. (default 20)
26
+ "override_max_concurrent_jobs": None, # int64 - Maximum number of concurrent jobs (default 500)
27
+ "graceful_shutdown_timeout": None, # int64 - Graceful shutdown timeout in seconds (default 15)
28
+ "transfer_rate_limit": None, # string - File transfer (upload/download) rate limit
29
+ # `<limit>-<period>`, with the given periods:
30
+ # * 'S': second
31
+ # * 'M': minute
32
+ # * 'H': hour
33
+ # * 'D': day
34
+ # Examples:
35
+ # * 5 requests/second: '5-S'
36
+ # * 10 requests/minute: '10-M'
37
+ # * 1000 requests/hour: '1000-H'
38
+ # * 2000 requests/day: '2000-D'
39
+ "api_token": None, # string - Files Agent API Token
40
+ "port": None, # int64 - Incoming port for files agent connections
41
+ "hostname": None, # string
42
+ "public_key": None, # string - public key
43
+ "status": None, # string - either running or shutdown
44
+ "server_host_key": None, # string
45
+ "config_version": None, # string - agent config version
46
+ }
47
+
48
+ def __init__(self, attributes=None, options=None):
49
+ if not isinstance(attributes, dict):
50
+ attributes = {}
51
+ if not isinstance(options, dict):
52
+ options = {}
53
+ self.set_attributes(attributes)
54
+ self.options = options
55
+
56
+ def set_attributes(self, attributes):
57
+ for (
58
+ attribute,
59
+ default_value,
60
+ ) in RemoteServerConfigurationFile.default_attributes.items():
61
+ setattr(self, attribute, attributes.get(attribute, default_value))
62
+
63
+ def get_attributes(self):
64
+ return {
65
+ k: getattr(self, k, None)
66
+ for k in RemoteServerConfigurationFile.default_attributes
67
+ if getattr(self, k, None) is not None
68
+ }
69
+
70
+
71
+ def new(*args, **kwargs):
72
+ return RemoteServerConfigurationFile(*args, **kwargs)
@@ -0,0 +1,180 @@
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 "path" in params and not isinstance(params["path"], str):
93
+ raise InvalidParameterError("Bad parameter: path must be an str")
94
+ return ListObj(Request, "GET", "/requests", params, options)
95
+
96
+
97
+ def all(params=None, options=None):
98
+ list(params, options)
99
+
100
+
101
+ # Parameters:
102
+ # 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.
103
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
104
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are .
105
+ # mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
106
+ # path (required) - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
107
+ def get_folder(path, params=None, options=None):
108
+ if not isinstance(params, dict):
109
+ params = {}
110
+ if not isinstance(options, dict):
111
+ options = {}
112
+ params["path"] = path
113
+ if "cursor" in params and not isinstance(params["cursor"], str):
114
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
115
+ if "per_page" in params and not isinstance(params["per_page"], int):
116
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
117
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
118
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
119
+ if "path" in params and not isinstance(params["path"], str):
120
+ raise InvalidParameterError("Bad parameter: path must be an str")
121
+ if "path" not in params:
122
+ raise MissingParameterError("Parameter missing: path")
123
+ return ListObj(
124
+ Request,
125
+ "GET",
126
+ "/requests/folders/{path}".format(path=params["path"]),
127
+ params,
128
+ options,
129
+ )
130
+
131
+
132
+ # Parameters:
133
+ # path (required) - string - Folder path on which to request the file.
134
+ # destination (required) - string - Destination filename (without extension) to request.
135
+ # user_ids - string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
136
+ # group_ids - string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
137
+ def create(params=None, options=None):
138
+ if not isinstance(params, dict):
139
+ params = {}
140
+ if not isinstance(options, dict):
141
+ options = {}
142
+ if "path" in params and not isinstance(params["path"], str):
143
+ raise InvalidParameterError("Bad parameter: path must be an str")
144
+ if "destination" in params and not isinstance(params["destination"], str):
145
+ raise InvalidParameterError(
146
+ "Bad parameter: destination must be an str"
147
+ )
148
+ if "user_ids" in params and not isinstance(params["user_ids"], str):
149
+ raise InvalidParameterError("Bad parameter: user_ids must be an str")
150
+ if "group_ids" in params and not isinstance(params["group_ids"], str):
151
+ raise InvalidParameterError("Bad parameter: group_ids must be an str")
152
+ if "path" not in params:
153
+ raise MissingParameterError("Parameter missing: path")
154
+ if "destination" not in params:
155
+ raise MissingParameterError("Parameter missing: destination")
156
+ response, options = Api.send_request("POST", "/requests", params, options)
157
+ return Request(response.data, options)
158
+
159
+
160
+ def delete(id, params=None, options=None):
161
+ if not isinstance(params, dict):
162
+ params = {}
163
+ if not isinstance(options, dict):
164
+ options = {}
165
+ params["id"] = id
166
+ if "id" in params and not isinstance(params["id"], int):
167
+ raise InvalidParameterError("Bad parameter: id must be an int")
168
+ if "id" not in params:
169
+ raise MissingParameterError("Parameter missing: id")
170
+ Api.send_request(
171
+ "DELETE", "/requests/{id}".format(id=params["id"]), params, options
172
+ )
173
+
174
+
175
+ def destroy(id, params=None, options=None):
176
+ delete(id, params, options)
177
+
178
+
179
+ def new(*args, **kwargs):
180
+ return Request(*args, **kwargs)
@@ -0,0 +1,104 @@
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
+ "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.
23
+ "restore_deleted_permissions": None, # boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
24
+ "status": None, # string - Status of the restoration process.
25
+ "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.
26
+ "error_messages": None, # array(string) - Error messages received while restoring files and/or directories. Only present if there were errors.
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 Restore.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 Restore.default_attributes
45
+ if getattr(self, k, None) is not None
46
+ }
47
+
48
+ def save(self):
49
+ if hasattr(self, "id") and self.id:
50
+ raise NotImplementedError(
51
+ "The Restore object doesn't support updates."
52
+ )
53
+ else:
54
+ new_obj = create(self.get_attributes(), self.options)
55
+ self.set_attributes(new_obj.get_attributes())
56
+ return True
57
+
58
+
59
+ # Parameters:
60
+ # 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.
61
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
62
+ def list(params=None, options=None):
63
+ if not isinstance(params, dict):
64
+ params = {}
65
+ if not isinstance(options, dict):
66
+ options = {}
67
+ if "cursor" in params and not isinstance(params["cursor"], str):
68
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
69
+ if "per_page" in params and not isinstance(params["per_page"], int):
70
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
71
+ return ListObj(Restore, "GET", "/restores", params, options)
72
+
73
+
74
+ def all(params=None, options=None):
75
+ list(params, options)
76
+
77
+
78
+ # Parameters:
79
+ # 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.
80
+ # 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.
81
+ # restore_deleted_permissions - boolean - If true, we will also restore any Permissions that match the same path prefix from the same dates.
82
+ # 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.
83
+ # 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.
84
+ def create(params=None, options=None):
85
+ if not isinstance(params, dict):
86
+ params = {}
87
+ if not isinstance(options, dict):
88
+ options = {}
89
+ if "earliest_date" in params and not isinstance(
90
+ params["earliest_date"], str
91
+ ):
92
+ raise InvalidParameterError(
93
+ "Bad parameter: earliest_date must be an str"
94
+ )
95
+ if "prefix" in params and not isinstance(params["prefix"], str):
96
+ raise InvalidParameterError("Bad parameter: prefix must be an str")
97
+ if "earliest_date" not in params:
98
+ raise MissingParameterError("Parameter missing: earliest_date")
99
+ response, options = Api.send_request("POST", "/restores", params, options)
100
+ return Restore(response.data, options)
101
+
102
+
103
+ def new(*args, **kwargs):
104
+ return Restore(*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
+ "changes": None, # array(string) - Markdown-formatted change messages.
14
+ "created_at": None, # date-time - The time this change was made
15
+ "user_id": None, # int64 - The user id responsible for this change
16
+ "api_key_id": None, # int64 - The API key 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)