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,215 @@
|
|
|
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 SftpHostKey:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - SFTP Host Key ID
|
|
14
|
+
"name": None, # string - The friendly name of this SFTP Host Key.
|
|
15
|
+
"fingerprint_md5": None, # string - MD5 Fingerprint of the public key
|
|
16
|
+
"fingerprint_sha256": None, # string - SHA256 Fingerprint of the public key
|
|
17
|
+
"private_key": None, # string - The private key data.
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
def __init__(self, attributes=None, options=None):
|
|
21
|
+
if not isinstance(attributes, dict):
|
|
22
|
+
attributes = {}
|
|
23
|
+
if not isinstance(options, dict):
|
|
24
|
+
options = {}
|
|
25
|
+
self.set_attributes(attributes)
|
|
26
|
+
self.options = options
|
|
27
|
+
|
|
28
|
+
def set_attributes(self, attributes):
|
|
29
|
+
for attribute, default_value in SftpHostKey.default_attributes.items():
|
|
30
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
31
|
+
|
|
32
|
+
def get_attributes(self):
|
|
33
|
+
return {
|
|
34
|
+
k: getattr(self, k, None)
|
|
35
|
+
for k in SftpHostKey.default_attributes
|
|
36
|
+
if getattr(self, k, None) is not None
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Parameters:
|
|
40
|
+
# name - string - The friendly name of this SFTP Host Key.
|
|
41
|
+
# private_key - string - The private key data.
|
|
42
|
+
def update(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
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
55
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
56
|
+
if "private_key" in params and not isinstance(
|
|
57
|
+
params["private_key"], str
|
|
58
|
+
):
|
|
59
|
+
raise InvalidParameterError(
|
|
60
|
+
"Bad parameter: private_key must be an str"
|
|
61
|
+
)
|
|
62
|
+
response, _options = Api.send_request(
|
|
63
|
+
"PATCH",
|
|
64
|
+
"/sftp_host_keys/{id}".format(id=params["id"]),
|
|
65
|
+
params,
|
|
66
|
+
self.options,
|
|
67
|
+
)
|
|
68
|
+
return response.data
|
|
69
|
+
|
|
70
|
+
def delete(self, params=None):
|
|
71
|
+
if not isinstance(params, dict):
|
|
72
|
+
params = {}
|
|
73
|
+
|
|
74
|
+
if hasattr(self, "id") and self.id:
|
|
75
|
+
params["id"] = self.id
|
|
76
|
+
else:
|
|
77
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
78
|
+
if "id" not in params:
|
|
79
|
+
raise MissingParameterError("Parameter missing: id")
|
|
80
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
81
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
82
|
+
Api.send_request(
|
|
83
|
+
"DELETE",
|
|
84
|
+
"/sftp_host_keys/{id}".format(id=params["id"]),
|
|
85
|
+
params,
|
|
86
|
+
self.options,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def destroy(self, params=None):
|
|
90
|
+
self.delete(params)
|
|
91
|
+
|
|
92
|
+
def save(self):
|
|
93
|
+
if hasattr(self, "id") and self.id:
|
|
94
|
+
new_obj = self.update(self.get_attributes())
|
|
95
|
+
self.set_attributes(new_obj.get_attributes())
|
|
96
|
+
return True
|
|
97
|
+
else:
|
|
98
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
99
|
+
self.set_attributes(new_obj.get_attributes())
|
|
100
|
+
return True
|
|
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
|
+
def list(params=None, options=None):
|
|
107
|
+
if not isinstance(params, dict):
|
|
108
|
+
params = {}
|
|
109
|
+
if not isinstance(options, dict):
|
|
110
|
+
options = {}
|
|
111
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
112
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
113
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
114
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
115
|
+
return ListObj(SftpHostKey, "GET", "/sftp_host_keys", params, options)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def all(params=None, options=None):
|
|
119
|
+
list(params, options)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# Parameters:
|
|
123
|
+
# id (required) - int64 - Sftp Host Key ID.
|
|
124
|
+
def find(id, params=None, options=None):
|
|
125
|
+
if not isinstance(params, dict):
|
|
126
|
+
params = {}
|
|
127
|
+
if not isinstance(options, dict):
|
|
128
|
+
options = {}
|
|
129
|
+
params["id"] = id
|
|
130
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
131
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
132
|
+
if "id" not in params:
|
|
133
|
+
raise MissingParameterError("Parameter missing: id")
|
|
134
|
+
response, options = Api.send_request(
|
|
135
|
+
"GET", "/sftp_host_keys/{id}".format(id=params["id"]), params, options
|
|
136
|
+
)
|
|
137
|
+
return SftpHostKey(response.data, options)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def get(id, params=None, options=None):
|
|
141
|
+
find(id, params, options)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
# Parameters:
|
|
145
|
+
# name - string - The friendly name of this SFTP Host Key.
|
|
146
|
+
# private_key - string - The private key data.
|
|
147
|
+
def create(params=None, options=None):
|
|
148
|
+
if not isinstance(params, dict):
|
|
149
|
+
params = {}
|
|
150
|
+
if not isinstance(options, dict):
|
|
151
|
+
options = {}
|
|
152
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
153
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
154
|
+
if "private_key" in params and not isinstance(params["private_key"], str):
|
|
155
|
+
raise InvalidParameterError(
|
|
156
|
+
"Bad parameter: private_key must be an str"
|
|
157
|
+
)
|
|
158
|
+
response, options = Api.send_request(
|
|
159
|
+
"POST", "/sftp_host_keys", params, options
|
|
160
|
+
)
|
|
161
|
+
return SftpHostKey(response.data, options)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
# Parameters:
|
|
165
|
+
# name - string - The friendly name of this SFTP Host Key.
|
|
166
|
+
# private_key - string - The private key data.
|
|
167
|
+
def update(id, params=None, options=None):
|
|
168
|
+
if not isinstance(params, dict):
|
|
169
|
+
params = {}
|
|
170
|
+
if not isinstance(options, dict):
|
|
171
|
+
options = {}
|
|
172
|
+
params["id"] = id
|
|
173
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
174
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
175
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
176
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
177
|
+
if "private_key" in params and not isinstance(params["private_key"], str):
|
|
178
|
+
raise InvalidParameterError(
|
|
179
|
+
"Bad parameter: private_key must be an str"
|
|
180
|
+
)
|
|
181
|
+
if "id" not in params:
|
|
182
|
+
raise MissingParameterError("Parameter missing: id")
|
|
183
|
+
response, options = Api.send_request(
|
|
184
|
+
"PATCH",
|
|
185
|
+
"/sftp_host_keys/{id}".format(id=params["id"]),
|
|
186
|
+
params,
|
|
187
|
+
options,
|
|
188
|
+
)
|
|
189
|
+
return SftpHostKey(response.data, options)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def delete(id, params=None, options=None):
|
|
193
|
+
if not isinstance(params, dict):
|
|
194
|
+
params = {}
|
|
195
|
+
if not isinstance(options, dict):
|
|
196
|
+
options = {}
|
|
197
|
+
params["id"] = id
|
|
198
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
199
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
200
|
+
if "id" not in params:
|
|
201
|
+
raise MissingParameterError("Parameter missing: id")
|
|
202
|
+
Api.send_request(
|
|
203
|
+
"DELETE",
|
|
204
|
+
"/sftp_host_keys/{id}".format(id=params["id"]),
|
|
205
|
+
params,
|
|
206
|
+
options,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def destroy(id, params=None, options=None):
|
|
211
|
+
delete(id, params, options)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def new(*args, **kwargs):
|
|
215
|
+
return SftpHostKey(*args, **kwargs)
|
|
@@ -0,0 +1,228 @@
|
|
|
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 ShareGroup:
|
|
12
|
+
default_attributes = {
|
|
13
|
+
"id": None, # int64 - Share Group ID
|
|
14
|
+
"name": None, # string - Name of the share group
|
|
15
|
+
"notes": None, # string - Additional notes of the share group
|
|
16
|
+
"user_id": None, # int64 - Owner User ID
|
|
17
|
+
"members": None, # array(object) - A list of share group members
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
def __init__(self, attributes=None, options=None):
|
|
21
|
+
if not isinstance(attributes, dict):
|
|
22
|
+
attributes = {}
|
|
23
|
+
if not isinstance(options, dict):
|
|
24
|
+
options = {}
|
|
25
|
+
self.set_attributes(attributes)
|
|
26
|
+
self.options = options
|
|
27
|
+
|
|
28
|
+
def set_attributes(self, attributes):
|
|
29
|
+
for attribute, default_value in ShareGroup.default_attributes.items():
|
|
30
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
31
|
+
|
|
32
|
+
def get_attributes(self):
|
|
33
|
+
return {
|
|
34
|
+
k: getattr(self, k, None)
|
|
35
|
+
for k in ShareGroup.default_attributes
|
|
36
|
+
if getattr(self, k, None) is not None
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Parameters:
|
|
40
|
+
# notes - string - Additional notes of the share group
|
|
41
|
+
# name - string - Name of the share group
|
|
42
|
+
# members - array(object) - A list of share group members.
|
|
43
|
+
def update(self, params=None):
|
|
44
|
+
if not isinstance(params, dict):
|
|
45
|
+
params = {}
|
|
46
|
+
|
|
47
|
+
if hasattr(self, "id") and self.id:
|
|
48
|
+
params["id"] = self.id
|
|
49
|
+
else:
|
|
50
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
51
|
+
if "id" not in params:
|
|
52
|
+
raise MissingParameterError("Parameter missing: id")
|
|
53
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
54
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
55
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
56
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
57
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
58
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
59
|
+
if "members" in params and not isinstance(
|
|
60
|
+
params["members"], builtins.list
|
|
61
|
+
):
|
|
62
|
+
raise InvalidParameterError(
|
|
63
|
+
"Bad parameter: members must be an list"
|
|
64
|
+
)
|
|
65
|
+
response, _options = Api.send_request(
|
|
66
|
+
"PATCH",
|
|
67
|
+
"/share_groups/{id}".format(id=params["id"]),
|
|
68
|
+
params,
|
|
69
|
+
self.options,
|
|
70
|
+
)
|
|
71
|
+
return response.data
|
|
72
|
+
|
|
73
|
+
def delete(self, params=None):
|
|
74
|
+
if not isinstance(params, dict):
|
|
75
|
+
params = {}
|
|
76
|
+
|
|
77
|
+
if hasattr(self, "id") and self.id:
|
|
78
|
+
params["id"] = self.id
|
|
79
|
+
else:
|
|
80
|
+
raise MissingParameterError("Current object doesn't have a id")
|
|
81
|
+
if "id" not in params:
|
|
82
|
+
raise MissingParameterError("Parameter missing: id")
|
|
83
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
84
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
85
|
+
Api.send_request(
|
|
86
|
+
"DELETE",
|
|
87
|
+
"/share_groups/{id}".format(id=params["id"]),
|
|
88
|
+
params,
|
|
89
|
+
self.options,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
def destroy(self, params=None):
|
|
93
|
+
self.delete(params)
|
|
94
|
+
|
|
95
|
+
def save(self):
|
|
96
|
+
if hasattr(self, "id") and self.id:
|
|
97
|
+
new_obj = self.update(self.get_attributes())
|
|
98
|
+
self.set_attributes(new_obj.get_attributes())
|
|
99
|
+
return True
|
|
100
|
+
else:
|
|
101
|
+
new_obj = create(self.get_attributes(), self.options)
|
|
102
|
+
self.set_attributes(new_obj.get_attributes())
|
|
103
|
+
return True
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# Parameters:
|
|
107
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
108
|
+
# 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.
|
|
109
|
+
# per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
110
|
+
def list(params=None, options=None):
|
|
111
|
+
if not isinstance(params, dict):
|
|
112
|
+
params = {}
|
|
113
|
+
if not isinstance(options, dict):
|
|
114
|
+
options = {}
|
|
115
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
116
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
117
|
+
if "cursor" in params and not isinstance(params["cursor"], str):
|
|
118
|
+
raise InvalidParameterError("Bad parameter: cursor must be an str")
|
|
119
|
+
if "per_page" in params and not isinstance(params["per_page"], int):
|
|
120
|
+
raise InvalidParameterError("Bad parameter: per_page must be an int")
|
|
121
|
+
return ListObj(ShareGroup, "GET", "/share_groups", params, options)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def all(params=None, options=None):
|
|
125
|
+
list(params, options)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# Parameters:
|
|
129
|
+
# id (required) - int64 - Share Group ID.
|
|
130
|
+
def find(id, params=None, options=None):
|
|
131
|
+
if not isinstance(params, dict):
|
|
132
|
+
params = {}
|
|
133
|
+
if not isinstance(options, dict):
|
|
134
|
+
options = {}
|
|
135
|
+
params["id"] = id
|
|
136
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
137
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
138
|
+
if "id" not in params:
|
|
139
|
+
raise MissingParameterError("Parameter missing: id")
|
|
140
|
+
response, options = Api.send_request(
|
|
141
|
+
"GET", "/share_groups/{id}".format(id=params["id"]), params, options
|
|
142
|
+
)
|
|
143
|
+
return ShareGroup(response.data, options)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def get(id, params=None, options=None):
|
|
147
|
+
find(id, params, options)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# Parameters:
|
|
151
|
+
# user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
152
|
+
# notes - string - Additional notes of the share group
|
|
153
|
+
# name (required) - string - Name of the share group
|
|
154
|
+
# members (required) - array(object) - A list of share group members.
|
|
155
|
+
def create(params=None, options=None):
|
|
156
|
+
if not isinstance(params, dict):
|
|
157
|
+
params = {}
|
|
158
|
+
if not isinstance(options, dict):
|
|
159
|
+
options = {}
|
|
160
|
+
if "user_id" in params and not isinstance(params["user_id"], int):
|
|
161
|
+
raise InvalidParameterError("Bad parameter: user_id must be an int")
|
|
162
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
163
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
164
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
165
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
166
|
+
if "members" in params and not isinstance(
|
|
167
|
+
params["members"], builtins.list
|
|
168
|
+
):
|
|
169
|
+
raise InvalidParameterError("Bad parameter: members must be an list")
|
|
170
|
+
if "name" not in params:
|
|
171
|
+
raise MissingParameterError("Parameter missing: name")
|
|
172
|
+
if "members" not in params:
|
|
173
|
+
raise MissingParameterError("Parameter missing: members")
|
|
174
|
+
response, options = Api.send_request(
|
|
175
|
+
"POST", "/share_groups", params, options
|
|
176
|
+
)
|
|
177
|
+
return ShareGroup(response.data, options)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
# Parameters:
|
|
181
|
+
# notes - string - Additional notes of the share group
|
|
182
|
+
# name - string - Name of the share group
|
|
183
|
+
# members - array(object) - A list of share group members.
|
|
184
|
+
def update(id, params=None, options=None):
|
|
185
|
+
if not isinstance(params, dict):
|
|
186
|
+
params = {}
|
|
187
|
+
if not isinstance(options, dict):
|
|
188
|
+
options = {}
|
|
189
|
+
params["id"] = id
|
|
190
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
191
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
192
|
+
if "notes" in params and not isinstance(params["notes"], str):
|
|
193
|
+
raise InvalidParameterError("Bad parameter: notes must be an str")
|
|
194
|
+
if "name" in params and not isinstance(params["name"], str):
|
|
195
|
+
raise InvalidParameterError("Bad parameter: name must be an str")
|
|
196
|
+
if "members" in params and not isinstance(
|
|
197
|
+
params["members"], builtins.list
|
|
198
|
+
):
|
|
199
|
+
raise InvalidParameterError("Bad parameter: members must be an list")
|
|
200
|
+
if "id" not in params:
|
|
201
|
+
raise MissingParameterError("Parameter missing: id")
|
|
202
|
+
response, options = Api.send_request(
|
|
203
|
+
"PATCH", "/share_groups/{id}".format(id=params["id"]), params, options
|
|
204
|
+
)
|
|
205
|
+
return ShareGroup(response.data, options)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def delete(id, params=None, options=None):
|
|
209
|
+
if not isinstance(params, dict):
|
|
210
|
+
params = {}
|
|
211
|
+
if not isinstance(options, dict):
|
|
212
|
+
options = {}
|
|
213
|
+
params["id"] = id
|
|
214
|
+
if "id" in params and not isinstance(params["id"], int):
|
|
215
|
+
raise InvalidParameterError("Bad parameter: id must be an int")
|
|
216
|
+
if "id" not in params:
|
|
217
|
+
raise MissingParameterError("Parameter missing: id")
|
|
218
|
+
Api.send_request(
|
|
219
|
+
"DELETE", "/share_groups/{id}".format(id=params["id"]), params, options
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def destroy(id, params=None, options=None):
|
|
224
|
+
delete(id, params, options)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def new(*args, **kwargs):
|
|
228
|
+
return ShareGroup(*args, **kwargs)
|
|
@@ -0,0 +1,41 @@
|
|
|
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 ShareGroupMember:
|
|
11
|
+
default_attributes = {
|
|
12
|
+
"name": None, # string - Name of the share group member
|
|
13
|
+
"company": None, # string - Company of the share group member
|
|
14
|
+
"email": None, # string - Email of the share group member
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def __init__(self, attributes=None, options=None):
|
|
18
|
+
if not isinstance(attributes, dict):
|
|
19
|
+
attributes = {}
|
|
20
|
+
if not isinstance(options, dict):
|
|
21
|
+
options = {}
|
|
22
|
+
self.set_attributes(attributes)
|
|
23
|
+
self.options = options
|
|
24
|
+
|
|
25
|
+
def set_attributes(self, attributes):
|
|
26
|
+
for (
|
|
27
|
+
attribute,
|
|
28
|
+
default_value,
|
|
29
|
+
) in ShareGroupMember.default_attributes.items():
|
|
30
|
+
setattr(self, attribute, attributes.get(attribute, default_value))
|
|
31
|
+
|
|
32
|
+
def get_attributes(self):
|
|
33
|
+
return {
|
|
34
|
+
k: getattr(self, k, None)
|
|
35
|
+
for k in ShareGroupMember.default_attributes
|
|
36
|
+
if getattr(self, k, None) is not None
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def new(*args, **kwargs):
|
|
41
|
+
return ShareGroupMember(*args, **kwargs)
|