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,893 @@
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 User:
12
+ default_attributes = {
13
+ "id": None, # int64 - User ID
14
+ "username": None, # string - User's username
15
+ "admin_group_ids": None, # array(int64) - List of group IDs of which this user is an administrator
16
+ "allowed_ips": None, # string - A list of allowed IPs if applicable. Newline delimited
17
+ "attachments_permission": None, # boolean - If `true`, the user can user create Bundles (aka Share Links). Use the bundle permission instead.
18
+ "api_keys_count": None, # int64 - Number of API keys associated with this user
19
+ "authenticate_until": None, # date-time - Scheduled Date/Time at which user will be deactivated
20
+ "authentication_method": None, # string - How is this user authenticated?
21
+ "avatar_url": None, # string - URL holding the user's avatar
22
+ "billable": None, # boolean - Is this a billable user record?
23
+ "billing_permission": None, # boolean - Allow this user to perform operations on the account, payments, and invoices?
24
+ "bypass_site_allowed_ips": None, # boolean - Allow this user to skip site-wide IP blacklists?
25
+ "bypass_inactive_disable": None, # boolean - Exempt this user from being disabled based on inactivity?
26
+ "created_at": None, # date-time - When this user was created
27
+ "dav_permission": None, # boolean - Can the user connect with WebDAV?
28
+ "disabled": None, # boolean - Is user disabled? Disabled users cannot log in, and do not count for billing purposes. Users can be automatically disabled after an inactivity period via a Site setting or schedule to be deactivated after specific date.
29
+ "disabled_expired_or_inactive": None, # boolean - Computed property that returns true if user disabled or expired or inactive.
30
+ "email": None, # email - User email address
31
+ "first_login_at": None, # date-time - User's first login time
32
+ "ftp_permission": None, # boolean - Can the user access with FTP/FTPS?
33
+ "group_ids": None, # string - Comma-separated list of group IDs of which this user is a member
34
+ "header_text": None, # string - Text to display to the user in the header of the UI
35
+ "language": None, # string - Preferred language
36
+ "last_login_at": None, # date-time - User's most recent login time via any protocol
37
+ "last_web_login_at": None, # date-time - User's most recent login time via web
38
+ "last_ftp_login_at": None, # date-time - User's most recent login time via FTP
39
+ "last_sftp_login_at": None, # date-time - User's most recent login time via SFTP
40
+ "last_dav_login_at": None, # date-time - User's most recent login time via WebDAV
41
+ "last_desktop_login_at": None, # date-time - User's most recent login time via Desktop app
42
+ "last_restapi_login_at": None, # date-time - User's most recent login time via Rest API
43
+ "last_api_use_at": None, # date-time - User's most recent API use time
44
+ "last_active_at": None, # date-time - User's most recent activity time, which is the latest of most recent login, most recent API use, enablement, or creation
45
+ "last_protocol_cipher": None, # string - The most recent protocol and cipher used
46
+ "lockout_expires": None, # date-time - Time in the future that the user will no longer be locked out if applicable
47
+ "name": None, # string - User's full name
48
+ "company": None, # string - User's company
49
+ "notes": None, # string - Any internal notes on the user
50
+ "notification_daily_send_time": None, # int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
51
+ "office_integration_enabled": None, # boolean - Enable integration with Office for the web?
52
+ "password_set_at": None, # date-time - Last time the user's password was set
53
+ "password_validity_days": None, # int64 - Number of days to allow user to use the same password
54
+ "public_keys_count": None, # int64 - Number of public keys associated with this user
55
+ "receive_admin_alerts": None, # boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
56
+ "require_2fa": None, # string - 2FA required setting
57
+ "require_login_by": None, # date-time - Require user to login by specified date otherwise it will be disabled.
58
+ "active_2fa": None, # boolean - Is 2fa active for the user?
59
+ "require_password_change": None, # boolean - Is a password change required upon next user login?
60
+ "password_expired": None, # boolean - Is user's password expired?
61
+ "readonly_site_admin": None, # boolean - Is the user an allowed to view all (non-billing) site configuration for this site?
62
+ "restapi_permission": None, # boolean - Can this user access the Web app, Desktop app, SDKs, or REST API? (All of these tools use the API internally, so this is one unified permission set.)
63
+ "self_managed": None, # boolean - Does this user manage it's own credentials or is it a shared/bot user?
64
+ "sftp_permission": None, # boolean - Can the user access with SFTP?
65
+ "site_admin": None, # boolean - Is the user an administrator for this site?
66
+ "site_id": None, # int64 - Site ID
67
+ "skip_welcome_screen": None, # boolean - Skip Welcome page in the UI?
68
+ "ssl_required": None, # string - SSL required setting
69
+ "sso_strategy_id": None, # int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
70
+ "subscribe_to_newsletter": None, # boolean - Is the user subscribed to the newsletter?
71
+ "externally_managed": None, # boolean - Is this user managed by a SsoStrategy?
72
+ "time_zone": None, # string - User time zone
73
+ "type_of_2fa": None, # string - Type(s) of 2FA methods in use, for programmatic use. Will be either `sms`, `totp`, `webauthn`, `yubi`, `email`, or multiple values sorted alphabetically and joined by an underscore. Does not specify whether user has more than one of a given method.
74
+ "type_of_2fa_for_display": None, # string - Type(s) of 2FA methods in use, formatted for displaying in the UI. Unlike `type_of_2fa`, this value will make clear when a user has more than 1 of the same type of method.
75
+ "user_root": None, # string - Root folder for FTP (and optionally SFTP if the appropriate site-wide setting is set). Note that this is not used for API, Desktop, or Web interface.
76
+ "user_home": None, # string - Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
77
+ "days_remaining_until_password_expire": None, # int64 - Number of days remaining until password expires
78
+ "password_expire_at": None, # date-time - Password expiration datetime
79
+ "avatar_file": None, # file - An image file for your user avatar.
80
+ "avatar_delete": None, # boolean - If true, the avatar will be deleted.
81
+ "change_password": None, # string - Used for changing a password on an existing user.
82
+ "change_password_confirmation": None, # string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
83
+ "grant_permission": None, # string - Permission to grant on the User Root upon user creation. Can be blank or `full`, `read`, `write`, `list`, `read+write`, or `list+write`
84
+ "group_id": None, # int64 - Group ID to associate this user with.
85
+ "imported_password_hash": None, # string - Pre-calculated hash of the user's password. If supplied, this will be used to authenticate the user on first login. Supported hash methods are MD5, SHA1, and SHA256.
86
+ "password": None, # string - User password.
87
+ "password_confirmation": None, # string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
88
+ "announcements_read": None, # boolean - Signifies that the user has read all the announcements in the UI.
89
+ }
90
+
91
+ def __init__(self, attributes=None, options=None):
92
+ if not isinstance(attributes, dict):
93
+ attributes = {}
94
+ if not isinstance(options, dict):
95
+ options = {}
96
+ self.set_attributes(attributes)
97
+ self.options = options
98
+
99
+ def set_attributes(self, attributes):
100
+ for attribute, default_value in User.default_attributes.items():
101
+ setattr(self, attribute, attributes.get(attribute, default_value))
102
+
103
+ def get_attributes(self):
104
+ return {
105
+ k: getattr(self, k, None)
106
+ for k in User.default_attributes
107
+ if getattr(self, k, None) is not None
108
+ }
109
+
110
+ # Unlock user who has been locked out due to failed logins
111
+ def unlock(self, params=None):
112
+ if not isinstance(params, dict):
113
+ params = {}
114
+
115
+ if hasattr(self, "id") and self.id:
116
+ params["id"] = self.id
117
+ else:
118
+ raise MissingParameterError("Current object doesn't have a id")
119
+ if "id" not in params:
120
+ raise MissingParameterError("Parameter missing: id")
121
+ if "id" in params and not isinstance(params["id"], int):
122
+ raise InvalidParameterError("Bad parameter: id must be an int")
123
+ Api.send_request(
124
+ "POST",
125
+ "/users/{id}/unlock".format(id=params["id"]),
126
+ params,
127
+ self.options,
128
+ )
129
+
130
+ # Resend user welcome email
131
+ def resend_welcome_email(self, params=None):
132
+ if not isinstance(params, dict):
133
+ params = {}
134
+
135
+ if hasattr(self, "id") and self.id:
136
+ params["id"] = self.id
137
+ else:
138
+ raise MissingParameterError("Current object doesn't have a id")
139
+ if "id" not in params:
140
+ raise MissingParameterError("Parameter missing: id")
141
+ if "id" in params and not isinstance(params["id"], int):
142
+ raise InvalidParameterError("Bad parameter: id must be an int")
143
+ Api.send_request(
144
+ "POST",
145
+ "/users/{id}/resend_welcome_email".format(id=params["id"]),
146
+ params,
147
+ self.options,
148
+ )
149
+
150
+ # Trigger 2FA Reset process for user who has lost access to their existing 2FA methods
151
+ def user_2fa_reset(self, params=None):
152
+ if not isinstance(params, dict):
153
+ params = {}
154
+
155
+ if hasattr(self, "id") and self.id:
156
+ params["id"] = self.id
157
+ else:
158
+ raise MissingParameterError("Current object doesn't have a id")
159
+ if "id" not in params:
160
+ raise MissingParameterError("Parameter missing: id")
161
+ if "id" in params and not isinstance(params["id"], int):
162
+ raise InvalidParameterError("Bad parameter: id must be an int")
163
+ Api.send_request(
164
+ "POST",
165
+ "/users/{id}/2fa/reset".format(id=params["id"]),
166
+ params,
167
+ self.options,
168
+ )
169
+
170
+ # Parameters:
171
+ # avatar_file - file - An image file for your user avatar.
172
+ # avatar_delete - boolean - If true, the avatar will be deleted.
173
+ # change_password - string - Used for changing a password on an existing user.
174
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
175
+ # email - string - User's email.
176
+ # grant_permission - string - Permission to grant on the User Root upon user creation. Can be blank or `full`, `read`, `write`, `list`, `read+write`, or `list+write`
177
+ # group_id - int64 - Group ID to associate this user with.
178
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
179
+ # imported_password_hash - string - Pre-calculated hash of the user's password. If supplied, this will be used to authenticate the user on first login. Supported hash methods are MD5, SHA1, and SHA256.
180
+ # password - string - User password.
181
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
182
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
183
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
184
+ # attachments_permission - boolean - DEPRECATED: If `true`, the user can user create Bundles (aka Share Links). Use the bundle permission instead.
185
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
186
+ # authentication_method - string - How is this user authenticated?
187
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
188
+ # bypass_inactive_disable - boolean - Exempt this user from being disabled based on inactivity?
189
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
190
+ # dav_permission - boolean - Can the user connect with WebDAV?
191
+ # disabled - boolean - Is user disabled? Disabled users cannot log in, and do not count for billing purposes. Users can be automatically disabled after an inactivity period via a Site setting or schedule to be deactivated after specific date.
192
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
193
+ # header_text - string - Text to display to the user in the header of the UI
194
+ # language - string - Preferred language
195
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
196
+ # name - string - User's full name
197
+ # company - string - User's company
198
+ # notes - string - Any internal notes on the user
199
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
200
+ # password_validity_days - int64 - Number of days to allow user to use the same password
201
+ # readonly_site_admin - boolean - Is the user an allowed to view all (non-billing) site configuration for this site?
202
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
203
+ # require_login_by - string - Require user to login by specified date otherwise it will be disabled.
204
+ # require_password_change - boolean - Is a password change required upon next user login?
205
+ # restapi_permission - boolean - Can this user access the Web app, Desktop app, SDKs, or REST API? (All of these tools use the API internally, so this is one unified permission set.)
206
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
207
+ # sftp_permission - boolean - Can the user access with SFTP?
208
+ # site_admin - boolean - Is the user an administrator for this site?
209
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
210
+ # ssl_required - string - SSL required setting
211
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
212
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
213
+ # require_2fa - string - 2FA required setting
214
+ # time_zone - string - User time zone
215
+ # user_root - string - Root folder for FTP (and optionally SFTP if the appropriate site-wide setting is set). Note that this is not used for API, Desktop, or Web interface.
216
+ # user_home - string - Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
217
+ # username - string - User's username
218
+ def update(self, params=None):
219
+ if not isinstance(params, dict):
220
+ params = {}
221
+
222
+ if hasattr(self, "id") and self.id:
223
+ params["id"] = self.id
224
+ else:
225
+ raise MissingParameterError("Current object doesn't have a id")
226
+ if "id" not in params:
227
+ raise MissingParameterError("Parameter missing: id")
228
+ if "id" in params and not isinstance(params["id"], int):
229
+ raise InvalidParameterError("Bad parameter: id must be an int")
230
+ if "change_password" in params and not isinstance(
231
+ params["change_password"], str
232
+ ):
233
+ raise InvalidParameterError(
234
+ "Bad parameter: change_password must be an str"
235
+ )
236
+ if "change_password_confirmation" in params and not isinstance(
237
+ params["change_password_confirmation"], str
238
+ ):
239
+ raise InvalidParameterError(
240
+ "Bad parameter: change_password_confirmation must be an str"
241
+ )
242
+ if "email" in params and not isinstance(params["email"], str):
243
+ raise InvalidParameterError("Bad parameter: email must be an str")
244
+ if "grant_permission" in params and not isinstance(
245
+ params["grant_permission"], str
246
+ ):
247
+ raise InvalidParameterError(
248
+ "Bad parameter: grant_permission must be an str"
249
+ )
250
+ if "group_id" in params and not isinstance(params["group_id"], int):
251
+ raise InvalidParameterError(
252
+ "Bad parameter: group_id must be an int"
253
+ )
254
+ if "group_ids" in params and not isinstance(params["group_ids"], str):
255
+ raise InvalidParameterError(
256
+ "Bad parameter: group_ids must be an str"
257
+ )
258
+ if "imported_password_hash" in params and not isinstance(
259
+ params["imported_password_hash"], str
260
+ ):
261
+ raise InvalidParameterError(
262
+ "Bad parameter: imported_password_hash must be an str"
263
+ )
264
+ if "password" in params and not isinstance(params["password"], str):
265
+ raise InvalidParameterError(
266
+ "Bad parameter: password must be an str"
267
+ )
268
+ if "password_confirmation" in params and not isinstance(
269
+ params["password_confirmation"], str
270
+ ):
271
+ raise InvalidParameterError(
272
+ "Bad parameter: password_confirmation must be an str"
273
+ )
274
+ if "allowed_ips" in params and not isinstance(
275
+ params["allowed_ips"], str
276
+ ):
277
+ raise InvalidParameterError(
278
+ "Bad parameter: allowed_ips must be an str"
279
+ )
280
+ if "authenticate_until" in params and not isinstance(
281
+ params["authenticate_until"], str
282
+ ):
283
+ raise InvalidParameterError(
284
+ "Bad parameter: authenticate_until must be an str"
285
+ )
286
+ if "authentication_method" in params and not isinstance(
287
+ params["authentication_method"], str
288
+ ):
289
+ raise InvalidParameterError(
290
+ "Bad parameter: authentication_method must be an str"
291
+ )
292
+ if "header_text" in params and not isinstance(
293
+ params["header_text"], str
294
+ ):
295
+ raise InvalidParameterError(
296
+ "Bad parameter: header_text must be an str"
297
+ )
298
+ if "language" in params and not isinstance(params["language"], str):
299
+ raise InvalidParameterError(
300
+ "Bad parameter: language must be an str"
301
+ )
302
+ if "notification_daily_send_time" in params and not isinstance(
303
+ params["notification_daily_send_time"], int
304
+ ):
305
+ raise InvalidParameterError(
306
+ "Bad parameter: notification_daily_send_time must be an int"
307
+ )
308
+ if "name" in params and not isinstance(params["name"], str):
309
+ raise InvalidParameterError("Bad parameter: name must be an str")
310
+ if "company" in params and not isinstance(params["company"], str):
311
+ raise InvalidParameterError(
312
+ "Bad parameter: company must be an str"
313
+ )
314
+ if "notes" in params and not isinstance(params["notes"], str):
315
+ raise InvalidParameterError("Bad parameter: notes must be an str")
316
+ if "password_validity_days" in params and not isinstance(
317
+ params["password_validity_days"], int
318
+ ):
319
+ raise InvalidParameterError(
320
+ "Bad parameter: password_validity_days must be an int"
321
+ )
322
+ if "require_login_by" in params and not isinstance(
323
+ params["require_login_by"], str
324
+ ):
325
+ raise InvalidParameterError(
326
+ "Bad parameter: require_login_by must be an str"
327
+ )
328
+ if "ssl_required" in params and not isinstance(
329
+ params["ssl_required"], str
330
+ ):
331
+ raise InvalidParameterError(
332
+ "Bad parameter: ssl_required must be an str"
333
+ )
334
+ if "sso_strategy_id" in params and not isinstance(
335
+ params["sso_strategy_id"], int
336
+ ):
337
+ raise InvalidParameterError(
338
+ "Bad parameter: sso_strategy_id must be an int"
339
+ )
340
+ if "require_2fa" in params and not isinstance(
341
+ params["require_2fa"], str
342
+ ):
343
+ raise InvalidParameterError(
344
+ "Bad parameter: require_2fa must be an str"
345
+ )
346
+ if "time_zone" in params and not isinstance(params["time_zone"], str):
347
+ raise InvalidParameterError(
348
+ "Bad parameter: time_zone must be an str"
349
+ )
350
+ if "user_root" in params and not isinstance(params["user_root"], str):
351
+ raise InvalidParameterError(
352
+ "Bad parameter: user_root must be an str"
353
+ )
354
+ if "user_home" in params and not isinstance(params["user_home"], str):
355
+ raise InvalidParameterError(
356
+ "Bad parameter: user_home must be an str"
357
+ )
358
+ if "username" in params and not isinstance(params["username"], str):
359
+ raise InvalidParameterError(
360
+ "Bad parameter: username must be an str"
361
+ )
362
+ response, _options = Api.send_request(
363
+ "PATCH",
364
+ "/users/{id}".format(id=params["id"]),
365
+ params,
366
+ self.options,
367
+ )
368
+ return response.data
369
+
370
+ def delete(self, params=None):
371
+ if not isinstance(params, dict):
372
+ params = {}
373
+
374
+ if hasattr(self, "id") and self.id:
375
+ params["id"] = self.id
376
+ else:
377
+ raise MissingParameterError("Current object doesn't have a id")
378
+ if "id" not in params:
379
+ raise MissingParameterError("Parameter missing: id")
380
+ if "id" in params and not isinstance(params["id"], int):
381
+ raise InvalidParameterError("Bad parameter: id must be an int")
382
+ Api.send_request(
383
+ "DELETE",
384
+ "/users/{id}".format(id=params["id"]),
385
+ params,
386
+ self.options,
387
+ )
388
+
389
+ def destroy(self, params=None):
390
+ self.delete(params)
391
+
392
+ def save(self):
393
+ if hasattr(self, "id") and self.id:
394
+ new_obj = self.update(self.get_attributes())
395
+ self.set_attributes(new_obj.get_attributes())
396
+ return True
397
+ else:
398
+ new_obj = create(self.get_attributes(), self.options)
399
+ self.set_attributes(new_obj.get_attributes())
400
+ return True
401
+
402
+
403
+ # Parameters:
404
+ # 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.
405
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
406
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `authenticate_until`, `email`, `last_desktop_login_at`, `last_login_at`, `name`, `company`, `password_validity_days`, `ssl_required`, `username` or `site_admin`.
407
+ # filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `username`, `name`, `email`, `company`, `site_admin`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`. Valid field combinations are `[ site_admin, username ]`, `[ not_site_admin, username ]` or `[ company, name ]`.
408
+ # filter_gt - object - If set, return records where the specified field is greater than the supplied value. Valid fields are `password_validity_days`, `last_login_at` or `authenticate_until`.
409
+ # filter_gteq - object - If set, return records where the specified field is greater than or equal the supplied value. Valid fields are `password_validity_days`, `last_login_at` or `authenticate_until`.
410
+ # filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `username`, `name`, `email` or `company`. Valid field combinations are `[ company, name ]`.
411
+ # filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `password_validity_days`, `last_login_at` or `authenticate_until`.
412
+ # filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `password_validity_days`, `last_login_at` or `authenticate_until`.
413
+ # ids - string - comma-separated list of User IDs
414
+ # include_parent_site_users - boolean - Include users from the parent site.
415
+ # search - string - Searches for partial matches of name, username, or email.
416
+ def list(params=None, options=None):
417
+ if not isinstance(params, dict):
418
+ params = {}
419
+ if not isinstance(options, dict):
420
+ options = {}
421
+ if "cursor" in params and not isinstance(params["cursor"], str):
422
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
423
+ if "per_page" in params and not isinstance(params["per_page"], int):
424
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
425
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
426
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
427
+ if "filter" in params and not isinstance(params["filter"], dict):
428
+ raise InvalidParameterError("Bad parameter: filter must be an dict")
429
+ if "filter_gt" in params and not isinstance(params["filter_gt"], dict):
430
+ raise InvalidParameterError("Bad parameter: filter_gt must be an dict")
431
+ if "filter_gteq" in params and not isinstance(params["filter_gteq"], dict):
432
+ raise InvalidParameterError(
433
+ "Bad parameter: filter_gteq must be an dict"
434
+ )
435
+ if "filter_prefix" in params and not isinstance(
436
+ params["filter_prefix"], dict
437
+ ):
438
+ raise InvalidParameterError(
439
+ "Bad parameter: filter_prefix must be an dict"
440
+ )
441
+ if "filter_lt" in params and not isinstance(params["filter_lt"], dict):
442
+ raise InvalidParameterError("Bad parameter: filter_lt must be an dict")
443
+ if "filter_lteq" in params and not isinstance(params["filter_lteq"], dict):
444
+ raise InvalidParameterError(
445
+ "Bad parameter: filter_lteq must be an dict"
446
+ )
447
+ if "ids" in params and not isinstance(params["ids"], str):
448
+ raise InvalidParameterError("Bad parameter: ids must be an str")
449
+ if "search" in params and not isinstance(params["search"], str):
450
+ raise InvalidParameterError("Bad parameter: search must be an str")
451
+ return ListObj(User, "GET", "/users", params, options)
452
+
453
+
454
+ def all(params=None, options=None):
455
+ list(params, options)
456
+
457
+
458
+ # Parameters:
459
+ # id (required) - int64 - User ID.
460
+ def find(id, params=None, options=None):
461
+ if not isinstance(params, dict):
462
+ params = {}
463
+ if not isinstance(options, dict):
464
+ options = {}
465
+ params["id"] = id
466
+ if "id" in params and not isinstance(params["id"], int):
467
+ raise InvalidParameterError("Bad parameter: id must be an int")
468
+ if "id" not in params:
469
+ raise MissingParameterError("Parameter missing: id")
470
+ response, options = Api.send_request(
471
+ "GET", "/users/{id}".format(id=params["id"]), params, options
472
+ )
473
+ return User(response.data, options)
474
+
475
+
476
+ def get(id, params=None, options=None):
477
+ find(id, params, options)
478
+
479
+
480
+ # Parameters:
481
+ # avatar_file - file - An image file for your user avatar.
482
+ # avatar_delete - boolean - If true, the avatar will be deleted.
483
+ # change_password - string - Used for changing a password on an existing user.
484
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
485
+ # email - string - User's email.
486
+ # grant_permission - string - Permission to grant on the User Root upon user creation. Can be blank or `full`, `read`, `write`, `list`, `read+write`, or `list+write`
487
+ # group_id - int64 - Group ID to associate this user with.
488
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
489
+ # imported_password_hash - string - Pre-calculated hash of the user's password. If supplied, this will be used to authenticate the user on first login. Supported hash methods are MD5, SHA1, and SHA256.
490
+ # password - string - User password.
491
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
492
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
493
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
494
+ # attachments_permission - boolean - DEPRECATED: If `true`, the user can user create Bundles (aka Share Links). Use the bundle permission instead.
495
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
496
+ # authentication_method - string - How is this user authenticated?
497
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
498
+ # bypass_inactive_disable - boolean - Exempt this user from being disabled based on inactivity?
499
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
500
+ # dav_permission - boolean - Can the user connect with WebDAV?
501
+ # disabled - boolean - Is user disabled? Disabled users cannot log in, and do not count for billing purposes. Users can be automatically disabled after an inactivity period via a Site setting or schedule to be deactivated after specific date.
502
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
503
+ # header_text - string - Text to display to the user in the header of the UI
504
+ # language - string - Preferred language
505
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
506
+ # name - string - User's full name
507
+ # company - string - User's company
508
+ # notes - string - Any internal notes on the user
509
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
510
+ # password_validity_days - int64 - Number of days to allow user to use the same password
511
+ # readonly_site_admin - boolean - Is the user an allowed to view all (non-billing) site configuration for this site?
512
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
513
+ # require_login_by - string - Require user to login by specified date otherwise it will be disabled.
514
+ # require_password_change - boolean - Is a password change required upon next user login?
515
+ # restapi_permission - boolean - Can this user access the Web app, Desktop app, SDKs, or REST API? (All of these tools use the API internally, so this is one unified permission set.)
516
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
517
+ # sftp_permission - boolean - Can the user access with SFTP?
518
+ # site_admin - boolean - Is the user an administrator for this site?
519
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
520
+ # ssl_required - string - SSL required setting
521
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
522
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
523
+ # require_2fa - string - 2FA required setting
524
+ # time_zone - string - User time zone
525
+ # user_root - string - Root folder for FTP (and optionally SFTP if the appropriate site-wide setting is set). Note that this is not used for API, Desktop, or Web interface.
526
+ # user_home - string - Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
527
+ # username (required) - string - User's username
528
+ def create(params=None, options=None):
529
+ if not isinstance(params, dict):
530
+ params = {}
531
+ if not isinstance(options, dict):
532
+ options = {}
533
+ if "change_password" in params and not isinstance(
534
+ params["change_password"], str
535
+ ):
536
+ raise InvalidParameterError(
537
+ "Bad parameter: change_password must be an str"
538
+ )
539
+ if "change_password_confirmation" in params and not isinstance(
540
+ params["change_password_confirmation"], str
541
+ ):
542
+ raise InvalidParameterError(
543
+ "Bad parameter: change_password_confirmation must be an str"
544
+ )
545
+ if "email" in params and not isinstance(params["email"], str):
546
+ raise InvalidParameterError("Bad parameter: email must be an str")
547
+ if "grant_permission" in params and not isinstance(
548
+ params["grant_permission"], str
549
+ ):
550
+ raise InvalidParameterError(
551
+ "Bad parameter: grant_permission must be an str"
552
+ )
553
+ if "group_id" in params and not isinstance(params["group_id"], int):
554
+ raise InvalidParameterError("Bad parameter: group_id must be an int")
555
+ if "group_ids" in params and not isinstance(params["group_ids"], str):
556
+ raise InvalidParameterError("Bad parameter: group_ids must be an str")
557
+ if "imported_password_hash" in params and not isinstance(
558
+ params["imported_password_hash"], str
559
+ ):
560
+ raise InvalidParameterError(
561
+ "Bad parameter: imported_password_hash must be an str"
562
+ )
563
+ if "password" in params and not isinstance(params["password"], str):
564
+ raise InvalidParameterError("Bad parameter: password must be an str")
565
+ if "password_confirmation" in params and not isinstance(
566
+ params["password_confirmation"], str
567
+ ):
568
+ raise InvalidParameterError(
569
+ "Bad parameter: password_confirmation must be an str"
570
+ )
571
+ if "allowed_ips" in params and not isinstance(params["allowed_ips"], str):
572
+ raise InvalidParameterError(
573
+ "Bad parameter: allowed_ips must be an str"
574
+ )
575
+ if "authenticate_until" in params and not isinstance(
576
+ params["authenticate_until"], str
577
+ ):
578
+ raise InvalidParameterError(
579
+ "Bad parameter: authenticate_until must be an str"
580
+ )
581
+ if "authentication_method" in params and not isinstance(
582
+ params["authentication_method"], str
583
+ ):
584
+ raise InvalidParameterError(
585
+ "Bad parameter: authentication_method must be an str"
586
+ )
587
+ if "header_text" in params and not isinstance(params["header_text"], str):
588
+ raise InvalidParameterError(
589
+ "Bad parameter: header_text must be an str"
590
+ )
591
+ if "language" in params and not isinstance(params["language"], str):
592
+ raise InvalidParameterError("Bad parameter: language must be an str")
593
+ if "notification_daily_send_time" in params and not isinstance(
594
+ params["notification_daily_send_time"], int
595
+ ):
596
+ raise InvalidParameterError(
597
+ "Bad parameter: notification_daily_send_time must be an int"
598
+ )
599
+ if "name" in params and not isinstance(params["name"], str):
600
+ raise InvalidParameterError("Bad parameter: name must be an str")
601
+ if "company" in params and not isinstance(params["company"], str):
602
+ raise InvalidParameterError("Bad parameter: company must be an str")
603
+ if "notes" in params and not isinstance(params["notes"], str):
604
+ raise InvalidParameterError("Bad parameter: notes must be an str")
605
+ if "password_validity_days" in params and not isinstance(
606
+ params["password_validity_days"], int
607
+ ):
608
+ raise InvalidParameterError(
609
+ "Bad parameter: password_validity_days must be an int"
610
+ )
611
+ if "require_login_by" in params and not isinstance(
612
+ params["require_login_by"], str
613
+ ):
614
+ raise InvalidParameterError(
615
+ "Bad parameter: require_login_by must be an str"
616
+ )
617
+ if "ssl_required" in params and not isinstance(
618
+ params["ssl_required"], str
619
+ ):
620
+ raise InvalidParameterError(
621
+ "Bad parameter: ssl_required must be an str"
622
+ )
623
+ if "sso_strategy_id" in params and not isinstance(
624
+ params["sso_strategy_id"], int
625
+ ):
626
+ raise InvalidParameterError(
627
+ "Bad parameter: sso_strategy_id must be an int"
628
+ )
629
+ if "require_2fa" in params and not isinstance(params["require_2fa"], str):
630
+ raise InvalidParameterError(
631
+ "Bad parameter: require_2fa must be an str"
632
+ )
633
+ if "time_zone" in params and not isinstance(params["time_zone"], str):
634
+ raise InvalidParameterError("Bad parameter: time_zone must be an str")
635
+ if "user_root" in params and not isinstance(params["user_root"], str):
636
+ raise InvalidParameterError("Bad parameter: user_root must be an str")
637
+ if "user_home" in params and not isinstance(params["user_home"], str):
638
+ raise InvalidParameterError("Bad parameter: user_home must be an str")
639
+ if "username" in params and not isinstance(params["username"], str):
640
+ raise InvalidParameterError("Bad parameter: username must be an str")
641
+ if "username" not in params:
642
+ raise MissingParameterError("Parameter missing: username")
643
+ response, options = Api.send_request("POST", "/users", params, options)
644
+ return User(response.data, options)
645
+
646
+
647
+ # Unlock user who has been locked out due to failed logins
648
+ def unlock(id, params=None, options=None):
649
+ if not isinstance(params, dict):
650
+ params = {}
651
+ if not isinstance(options, dict):
652
+ options = {}
653
+ params["id"] = id
654
+ if "id" in params and not isinstance(params["id"], int):
655
+ raise InvalidParameterError("Bad parameter: id must be an int")
656
+ if "id" not in params:
657
+ raise MissingParameterError("Parameter missing: id")
658
+ Api.send_request(
659
+ "POST", "/users/{id}/unlock".format(id=params["id"]), params, options
660
+ )
661
+
662
+
663
+ # Resend user welcome email
664
+ def resend_welcome_email(id, params=None, options=None):
665
+ if not isinstance(params, dict):
666
+ params = {}
667
+ if not isinstance(options, dict):
668
+ options = {}
669
+ params["id"] = id
670
+ if "id" in params and not isinstance(params["id"], int):
671
+ raise InvalidParameterError("Bad parameter: id must be an int")
672
+ if "id" not in params:
673
+ raise MissingParameterError("Parameter missing: id")
674
+ Api.send_request(
675
+ "POST",
676
+ "/users/{id}/resend_welcome_email".format(id=params["id"]),
677
+ params,
678
+ options,
679
+ )
680
+
681
+
682
+ # Trigger 2FA Reset process for user who has lost access to their existing 2FA methods
683
+ def user_2fa_reset(id, params=None, options=None):
684
+ if not isinstance(params, dict):
685
+ params = {}
686
+ if not isinstance(options, dict):
687
+ options = {}
688
+ params["id"] = id
689
+ if "id" in params and not isinstance(params["id"], int):
690
+ raise InvalidParameterError("Bad parameter: id must be an int")
691
+ if "id" not in params:
692
+ raise MissingParameterError("Parameter missing: id")
693
+ Api.send_request(
694
+ "POST",
695
+ "/users/{id}/2fa/reset".format(id=params["id"]),
696
+ params,
697
+ options,
698
+ )
699
+
700
+
701
+ # Parameters:
702
+ # avatar_file - file - An image file for your user avatar.
703
+ # avatar_delete - boolean - If true, the avatar will be deleted.
704
+ # change_password - string - Used for changing a password on an existing user.
705
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
706
+ # email - string - User's email.
707
+ # grant_permission - string - Permission to grant on the User Root upon user creation. Can be blank or `full`, `read`, `write`, `list`, `read+write`, or `list+write`
708
+ # group_id - int64 - Group ID to associate this user with.
709
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
710
+ # imported_password_hash - string - Pre-calculated hash of the user's password. If supplied, this will be used to authenticate the user on first login. Supported hash methods are MD5, SHA1, and SHA256.
711
+ # password - string - User password.
712
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
713
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
714
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
715
+ # attachments_permission - boolean - DEPRECATED: If `true`, the user can user create Bundles (aka Share Links). Use the bundle permission instead.
716
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
717
+ # authentication_method - string - How is this user authenticated?
718
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
719
+ # bypass_inactive_disable - boolean - Exempt this user from being disabled based on inactivity?
720
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
721
+ # dav_permission - boolean - Can the user connect with WebDAV?
722
+ # disabled - boolean - Is user disabled? Disabled users cannot log in, and do not count for billing purposes. Users can be automatically disabled after an inactivity period via a Site setting or schedule to be deactivated after specific date.
723
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
724
+ # header_text - string - Text to display to the user in the header of the UI
725
+ # language - string - Preferred language
726
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
727
+ # name - string - User's full name
728
+ # company - string - User's company
729
+ # notes - string - Any internal notes on the user
730
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
731
+ # password_validity_days - int64 - Number of days to allow user to use the same password
732
+ # readonly_site_admin - boolean - Is the user an allowed to view all (non-billing) site configuration for this site?
733
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
734
+ # require_login_by - string - Require user to login by specified date otherwise it will be disabled.
735
+ # require_password_change - boolean - Is a password change required upon next user login?
736
+ # restapi_permission - boolean - Can this user access the Web app, Desktop app, SDKs, or REST API? (All of these tools use the API internally, so this is one unified permission set.)
737
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
738
+ # sftp_permission - boolean - Can the user access with SFTP?
739
+ # site_admin - boolean - Is the user an administrator for this site?
740
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
741
+ # ssl_required - string - SSL required setting
742
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
743
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
744
+ # require_2fa - string - 2FA required setting
745
+ # time_zone - string - User time zone
746
+ # user_root - string - Root folder for FTP (and optionally SFTP if the appropriate site-wide setting is set). Note that this is not used for API, Desktop, or Web interface.
747
+ # user_home - string - Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
748
+ # username - string - User's username
749
+ def update(id, params=None, options=None):
750
+ if not isinstance(params, dict):
751
+ params = {}
752
+ if not isinstance(options, dict):
753
+ options = {}
754
+ params["id"] = id
755
+ if "id" in params and not isinstance(params["id"], int):
756
+ raise InvalidParameterError("Bad parameter: id must be an int")
757
+ if "change_password" in params and not isinstance(
758
+ params["change_password"], str
759
+ ):
760
+ raise InvalidParameterError(
761
+ "Bad parameter: change_password must be an str"
762
+ )
763
+ if "change_password_confirmation" in params and not isinstance(
764
+ params["change_password_confirmation"], str
765
+ ):
766
+ raise InvalidParameterError(
767
+ "Bad parameter: change_password_confirmation must be an str"
768
+ )
769
+ if "email" in params and not isinstance(params["email"], str):
770
+ raise InvalidParameterError("Bad parameter: email must be an str")
771
+ if "grant_permission" in params and not isinstance(
772
+ params["grant_permission"], str
773
+ ):
774
+ raise InvalidParameterError(
775
+ "Bad parameter: grant_permission must be an str"
776
+ )
777
+ if "group_id" in params and not isinstance(params["group_id"], int):
778
+ raise InvalidParameterError("Bad parameter: group_id must be an int")
779
+ if "group_ids" in params and not isinstance(params["group_ids"], str):
780
+ raise InvalidParameterError("Bad parameter: group_ids must be an str")
781
+ if "imported_password_hash" in params and not isinstance(
782
+ params["imported_password_hash"], str
783
+ ):
784
+ raise InvalidParameterError(
785
+ "Bad parameter: imported_password_hash must be an str"
786
+ )
787
+ if "password" in params and not isinstance(params["password"], str):
788
+ raise InvalidParameterError("Bad parameter: password must be an str")
789
+ if "password_confirmation" in params and not isinstance(
790
+ params["password_confirmation"], str
791
+ ):
792
+ raise InvalidParameterError(
793
+ "Bad parameter: password_confirmation must be an str"
794
+ )
795
+ if "allowed_ips" in params and not isinstance(params["allowed_ips"], str):
796
+ raise InvalidParameterError(
797
+ "Bad parameter: allowed_ips must be an str"
798
+ )
799
+ if "authenticate_until" in params and not isinstance(
800
+ params["authenticate_until"], str
801
+ ):
802
+ raise InvalidParameterError(
803
+ "Bad parameter: authenticate_until must be an str"
804
+ )
805
+ if "authentication_method" in params and not isinstance(
806
+ params["authentication_method"], str
807
+ ):
808
+ raise InvalidParameterError(
809
+ "Bad parameter: authentication_method must be an str"
810
+ )
811
+ if "header_text" in params and not isinstance(params["header_text"], str):
812
+ raise InvalidParameterError(
813
+ "Bad parameter: header_text must be an str"
814
+ )
815
+ if "language" in params and not isinstance(params["language"], str):
816
+ raise InvalidParameterError("Bad parameter: language must be an str")
817
+ if "notification_daily_send_time" in params and not isinstance(
818
+ params["notification_daily_send_time"], int
819
+ ):
820
+ raise InvalidParameterError(
821
+ "Bad parameter: notification_daily_send_time must be an int"
822
+ )
823
+ if "name" in params and not isinstance(params["name"], str):
824
+ raise InvalidParameterError("Bad parameter: name must be an str")
825
+ if "company" in params and not isinstance(params["company"], str):
826
+ raise InvalidParameterError("Bad parameter: company must be an str")
827
+ if "notes" in params and not isinstance(params["notes"], str):
828
+ raise InvalidParameterError("Bad parameter: notes must be an str")
829
+ if "password_validity_days" in params and not isinstance(
830
+ params["password_validity_days"], int
831
+ ):
832
+ raise InvalidParameterError(
833
+ "Bad parameter: password_validity_days must be an int"
834
+ )
835
+ if "require_login_by" in params and not isinstance(
836
+ params["require_login_by"], str
837
+ ):
838
+ raise InvalidParameterError(
839
+ "Bad parameter: require_login_by must be an str"
840
+ )
841
+ if "ssl_required" in params and not isinstance(
842
+ params["ssl_required"], str
843
+ ):
844
+ raise InvalidParameterError(
845
+ "Bad parameter: ssl_required must be an str"
846
+ )
847
+ if "sso_strategy_id" in params and not isinstance(
848
+ params["sso_strategy_id"], int
849
+ ):
850
+ raise InvalidParameterError(
851
+ "Bad parameter: sso_strategy_id must be an int"
852
+ )
853
+ if "require_2fa" in params and not isinstance(params["require_2fa"], str):
854
+ raise InvalidParameterError(
855
+ "Bad parameter: require_2fa must be an str"
856
+ )
857
+ if "time_zone" in params and not isinstance(params["time_zone"], str):
858
+ raise InvalidParameterError("Bad parameter: time_zone must be an str")
859
+ if "user_root" in params and not isinstance(params["user_root"], str):
860
+ raise InvalidParameterError("Bad parameter: user_root must be an str")
861
+ if "user_home" in params and not isinstance(params["user_home"], str):
862
+ raise InvalidParameterError("Bad parameter: user_home must be an str")
863
+ if "username" in params and not isinstance(params["username"], str):
864
+ raise InvalidParameterError("Bad parameter: username must be an str")
865
+ if "id" not in params:
866
+ raise MissingParameterError("Parameter missing: id")
867
+ response, options = Api.send_request(
868
+ "PATCH", "/users/{id}".format(id=params["id"]), params, options
869
+ )
870
+ return User(response.data, options)
871
+
872
+
873
+ def delete(id, params=None, options=None):
874
+ if not isinstance(params, dict):
875
+ params = {}
876
+ if not isinstance(options, dict):
877
+ options = {}
878
+ params["id"] = id
879
+ if "id" in params and not isinstance(params["id"], int):
880
+ raise InvalidParameterError("Bad parameter: id must be an int")
881
+ if "id" not in params:
882
+ raise MissingParameterError("Parameter missing: id")
883
+ Api.send_request(
884
+ "DELETE", "/users/{id}".format(id=params["id"]), params, options
885
+ )
886
+
887
+
888
+ def destroy(id, params=None, options=None):
889
+ delete(id, params, options)
890
+
891
+
892
+ def new(*args, **kwargs):
893
+ return User(*args, **kwargs)