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.

Files changed (126) hide show
  1. README.md +758 -0
  2. _VERSION +1 -0
  3. files_com-1.6.208.dist-info/METADATA +770 -0
  4. files_com-1.6.208.dist-info/RECORD +126 -0
  5. files_com-1.6.208.dist-info/WHEEL +5 -0
  6. files_com-1.6.208.dist-info/licenses/LICENSE +21 -0
  7. files_com-1.6.208.dist-info/top_level.txt +1 -0
  8. files_sdk/__init__.py +309 -0
  9. files_sdk/api.py +63 -0
  10. files_sdk/api_client.py +336 -0
  11. files_sdk/error.py +2981 -0
  12. files_sdk/list_obj.py +42 -0
  13. files_sdk/models/__init__.py +119 -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 +153 -0
  17. files_sdk/models/action_notification_export_result.py +88 -0
  18. files_sdk/models/agent_push_update.py +44 -0
  19. files_sdk/models/api_key.py +318 -0
  20. files_sdk/models/api_request_log.py +105 -0
  21. files_sdk/models/app.py +89 -0
  22. files_sdk/models/as2_incoming_message.py +117 -0
  23. files_sdk/models/as2_outgoing_message.py +113 -0
  24. files_sdk/models/as2_partner.py +415 -0
  25. files_sdk/models/as2_station.py +282 -0
  26. files_sdk/models/auto.py +36 -0
  27. files_sdk/models/automation.py +823 -0
  28. files_sdk/models/automation_log.py +94 -0
  29. files_sdk/models/automation_run.py +112 -0
  30. files_sdk/models/bandwidth_snapshot.py +91 -0
  31. files_sdk/models/behavior.py +340 -0
  32. files_sdk/models/bundle.py +686 -0
  33. files_sdk/models/bundle_action.py +93 -0
  34. files_sdk/models/bundle_download.py +94 -0
  35. files_sdk/models/bundle_notification.py +252 -0
  36. files_sdk/models/bundle_path.py +37 -0
  37. files_sdk/models/bundle_recipient.py +133 -0
  38. files_sdk/models/bundle_registration.py +82 -0
  39. files_sdk/models/child_site_management_policy.py +278 -0
  40. files_sdk/models/clickwrap.py +268 -0
  41. files_sdk/models/dns_record.py +59 -0
  42. files_sdk/models/email_incoming_message.py +102 -0
  43. files_sdk/models/email_log.py +84 -0
  44. files_sdk/models/errors.py +37 -0
  45. files_sdk/models/exavault_api_request_log.py +102 -0
  46. files_sdk/models/external_event.py +148 -0
  47. files_sdk/models/file.py +851 -0
  48. files_sdk/models/file_action.py +39 -0
  49. files_sdk/models/file_comment.py +191 -0
  50. files_sdk/models/file_comment_reaction.py +125 -0
  51. files_sdk/models/file_migration.py +69 -0
  52. files_sdk/models/file_migration_log.py +88 -0
  53. files_sdk/models/file_upload_part.py +54 -0
  54. files_sdk/models/folder.py +186 -0
  55. files_sdk/models/form_field.py +43 -0
  56. files_sdk/models/form_field_set.py +265 -0
  57. files_sdk/models/ftp_action_log.py +104 -0
  58. files_sdk/models/gpg_key.py +333 -0
  59. files_sdk/models/group.py +338 -0
  60. files_sdk/models/group_user.py +235 -0
  61. files_sdk/models/history.py +236 -0
  62. files_sdk/models/history_export.py +238 -0
  63. files_sdk/models/history_export_result.py +98 -0
  64. files_sdk/models/holiday_region.py +58 -0
  65. files_sdk/models/image.py +37 -0
  66. files_sdk/models/inbound_s3_log.py +95 -0
  67. files_sdk/models/inbox_recipient.py +124 -0
  68. files_sdk/models/inbox_registration.py +79 -0
  69. files_sdk/models/inbox_upload.py +80 -0
  70. files_sdk/models/invoice.py +91 -0
  71. files_sdk/models/invoice_line_item.py +51 -0
  72. files_sdk/models/ip_address.py +119 -0
  73. files_sdk/models/key_lifecycle_rule.py +243 -0
  74. files_sdk/models/lock.py +174 -0
  75. files_sdk/models/message.py +244 -0
  76. files_sdk/models/message_comment.py +223 -0
  77. files_sdk/models/message_comment_reaction.py +181 -0
  78. files_sdk/models/message_reaction.py +170 -0
  79. files_sdk/models/notification.py +451 -0
  80. files_sdk/models/outbound_connection_log.py +105 -0
  81. files_sdk/models/partner.py +307 -0
  82. files_sdk/models/payment.py +91 -0
  83. files_sdk/models/payment_line_item.py +42 -0
  84. files_sdk/models/permission.py +190 -0
  85. files_sdk/models/preview.py +40 -0
  86. files_sdk/models/priority.py +63 -0
  87. files_sdk/models/project.py +205 -0
  88. files_sdk/models/public_hosting_request_log.py +101 -0
  89. files_sdk/models/public_ip_address.py +42 -0
  90. files_sdk/models/public_key.py +269 -0
  91. files_sdk/models/remote_bandwidth_snapshot.py +91 -0
  92. files_sdk/models/remote_mount_backend.py +438 -0
  93. files_sdk/models/remote_server.py +1854 -0
  94. files_sdk/models/remote_server_configuration_file.py +73 -0
  95. files_sdk/models/remote_server_credential.py +855 -0
  96. files_sdk/models/request.py +184 -0
  97. files_sdk/models/restore.py +142 -0
  98. files_sdk/models/scim_log.py +88 -0
  99. files_sdk/models/session.py +100 -0
  100. files_sdk/models/settings_change.py +71 -0
  101. files_sdk/models/sftp_action_log.py +108 -0
  102. files_sdk/models/sftp_host_key.py +215 -0
  103. files_sdk/models/share_group.py +228 -0
  104. files_sdk/models/share_group_member.py +41 -0
  105. files_sdk/models/siem_http_destination.py +1074 -0
  106. files_sdk/models/site.py +1289 -0
  107. files_sdk/models/snapshot.py +255 -0
  108. files_sdk/models/sso_strategy.py +168 -0
  109. files_sdk/models/status.py +42 -0
  110. files_sdk/models/style.py +152 -0
  111. files_sdk/models/sync.py +588 -0
  112. files_sdk/models/sync_log.py +86 -0
  113. files_sdk/models/sync_run.py +124 -0
  114. files_sdk/models/usage_by_top_level_dir.py +41 -0
  115. files_sdk/models/usage_daily_snapshot.py +93 -0
  116. files_sdk/models/usage_snapshot.py +73 -0
  117. files_sdk/models/user.py +1232 -0
  118. files_sdk/models/user_cipher_use.py +91 -0
  119. files_sdk/models/user_lifecycle_rule.py +355 -0
  120. files_sdk/models/user_request.py +166 -0
  121. files_sdk/models/user_sftp_client_use.py +68 -0
  122. files_sdk/models/web_dav_action_log.py +104 -0
  123. files_sdk/models/webhook_test.py +116 -0
  124. files_sdk/models/workspace.py +202 -0
  125. files_sdk/path_util.py +42 -0
  126. files_sdk/util.py +34 -0
@@ -0,0 +1,1232 @@
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_user_lifecycle_rules": None, # boolean - Exempt this user from user lifecycle rules?
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
+ "filesystem_layout": None, # string - File system layout
32
+ "first_login_at": None, # date-time - User's first login time
33
+ "ftp_permission": None, # boolean - Can the user access with FTP/FTPS?
34
+ "group_ids": None, # string - Comma-separated list of group IDs of which this user is a member
35
+ "header_text": None, # string - Text to display to the user in the header of the UI
36
+ "language": None, # string - Preferred language
37
+ "last_login_at": None, # date-time - User's most recent login time via any protocol
38
+ "last_web_login_at": None, # date-time - User's most recent login time via web
39
+ "last_ftp_login_at": None, # date-time - User's most recent login time via FTP
40
+ "last_sftp_login_at": None, # date-time - User's most recent login time via SFTP
41
+ "last_dav_login_at": None, # date-time - User's most recent login time via WebDAV
42
+ "last_desktop_login_at": None, # date-time - User's most recent login time via Desktop app
43
+ "last_restapi_login_at": None, # date-time - User's most recent login time via Rest API
44
+ "last_api_use_at": None, # date-time - User's most recent API use time
45
+ "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
46
+ "last_protocol_cipher": None, # string - The most recent protocol and cipher used
47
+ "lockout_expires": None, # date-time - Time in the future that the user will no longer be locked out if applicable
48
+ "name": None, # string - User's full name
49
+ "company": None, # string - User's company
50
+ "notes": None, # string - Any internal notes on the user
51
+ "notification_daily_send_time": None, # int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
52
+ "office_integration_enabled": None, # boolean - Enable integration with Office for the web?
53
+ "partner_admin": None, # boolean - Is this user a Partner administrator?
54
+ "partner_id": None, # int64 - Partner ID if this user belongs to a Partner
55
+ "partner_name": None, # string - Name of the Partner if this user belongs to a Partner
56
+ "password_set_at": None, # date-time - Last time the user's password was set
57
+ "password_validity_days": None, # int64 - Number of days to allow user to use the same password
58
+ "public_keys_count": None, # int64 - Number of public keys associated with this user
59
+ "receive_admin_alerts": None, # boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
60
+ "require_2fa": None, # string - 2FA required setting
61
+ "require_login_by": None, # date-time - Require user to login by specified date otherwise it will be disabled.
62
+ "active_2fa": None, # boolean - Is 2fa active for the user?
63
+ "require_password_change": None, # boolean - Is a password change required upon next user login?
64
+ "password_expired": None, # boolean - Is user's password expired?
65
+ "readonly_site_admin": None, # boolean - Is the user an allowed to view all (non-billing) site configuration for this site?
66
+ "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.)
67
+ "self_managed": None, # boolean - Does this user manage it's own credentials or is it a shared/bot user?
68
+ "sftp_permission": None, # boolean - Can the user access with SFTP?
69
+ "site_admin": None, # boolean - Is the user an administrator for this site?
70
+ "workspace_admin": None, # boolean - Is the user a Workspace administrator? Applicable only to the workspace ID related to this user, if one is set.
71
+ "site_id": None, # int64 - Site ID
72
+ "workspace_id": None, # int64 - Workspace ID
73
+ "skip_welcome_screen": None, # boolean - Skip Welcome page in the UI?
74
+ "ssl_required": None, # string - SSL required setting
75
+ "sso_strategy_id": None, # int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
76
+ "subscribe_to_newsletter": None, # boolean - Is the user subscribed to the newsletter?
77
+ "externally_managed": None, # boolean - Is this user managed by a SsoStrategy?
78
+ "tags": None, # string - Comma-separated list of Tags for this user. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.
79
+ "time_zone": None, # string - User time zone
80
+ "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.
81
+ "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.
82
+ "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.
83
+ "user_home": None, # string - Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
84
+ "days_remaining_until_password_expire": None, # int64 - Number of days remaining until password expires
85
+ "password_expire_at": None, # date-time - Password expiration datetime
86
+ "avatar_file": None, # file - An image file for your user avatar.
87
+ "avatar_delete": None, # boolean - If true, the avatar will be deleted.
88
+ "change_password": None, # string - Used for changing a password on an existing user.
89
+ "change_password_confirmation": None, # string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
90
+ "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`
91
+ "group_id": None, # int64 - Group ID to associate this user with.
92
+ "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.
93
+ "password": None, # string - User password.
94
+ "password_confirmation": None, # string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
95
+ "announcements_read": None, # boolean - Signifies that the user has read all the announcements in the UI.
96
+ "clear_2fa": None, # boolean - If true when changing authentication_method from `password` to `sso`, remove all two-factor methods. Ignored in all other cases.
97
+ "convert_to_partner_user": None, # boolean - If true, convert this user to a partner user by assigning the partner_id provided.
98
+ }
99
+
100
+ def __init__(self, attributes=None, options=None):
101
+ if not isinstance(attributes, dict):
102
+ attributes = {}
103
+ if not isinstance(options, dict):
104
+ options = {}
105
+ self.set_attributes(attributes)
106
+ self.options = options
107
+
108
+ def set_attributes(self, attributes):
109
+ for attribute, default_value in User.default_attributes.items():
110
+ setattr(self, attribute, attributes.get(attribute, default_value))
111
+
112
+ def get_attributes(self):
113
+ return {
114
+ k: getattr(self, k, None)
115
+ for k in User.default_attributes
116
+ if getattr(self, k, None) is not None
117
+ }
118
+
119
+ # Unlock user who has been locked out due to failed logins
120
+ def unlock(self, params=None):
121
+ if not isinstance(params, dict):
122
+ params = {}
123
+
124
+ if hasattr(self, "id") and self.id:
125
+ params["id"] = self.id
126
+ else:
127
+ raise MissingParameterError("Current object doesn't have a id")
128
+ if "id" not in params:
129
+ raise MissingParameterError("Parameter missing: id")
130
+ if "id" in params and not isinstance(params["id"], int):
131
+ raise InvalidParameterError("Bad parameter: id must be an int")
132
+ Api.send_request(
133
+ "POST",
134
+ "/users/{id}/unlock".format(id=params["id"]),
135
+ params,
136
+ self.options,
137
+ )
138
+
139
+ # Resend user welcome email
140
+ def resend_welcome_email(self, params=None):
141
+ if not isinstance(params, dict):
142
+ params = {}
143
+
144
+ if hasattr(self, "id") and self.id:
145
+ params["id"] = self.id
146
+ else:
147
+ raise MissingParameterError("Current object doesn't have a id")
148
+ if "id" not in params:
149
+ raise MissingParameterError("Parameter missing: id")
150
+ if "id" in params and not isinstance(params["id"], int):
151
+ raise InvalidParameterError("Bad parameter: id must be an int")
152
+ Api.send_request(
153
+ "POST",
154
+ "/users/{id}/resend_welcome_email".format(id=params["id"]),
155
+ params,
156
+ self.options,
157
+ )
158
+
159
+ # Trigger 2FA Reset process for user who has lost access to their existing 2FA methods
160
+ def user_2fa_reset(self, params=None):
161
+ if not isinstance(params, dict):
162
+ params = {}
163
+
164
+ if hasattr(self, "id") and self.id:
165
+ params["id"] = self.id
166
+ else:
167
+ raise MissingParameterError("Current object doesn't have a id")
168
+ if "id" not in params:
169
+ raise MissingParameterError("Parameter missing: id")
170
+ if "id" in params and not isinstance(params["id"], int):
171
+ raise InvalidParameterError("Bad parameter: id must be an int")
172
+ Api.send_request(
173
+ "POST",
174
+ "/users/{id}/2fa/reset".format(id=params["id"]),
175
+ params,
176
+ self.options,
177
+ )
178
+
179
+ # Parameters:
180
+ # avatar_file - file - An image file for your user avatar.
181
+ # avatar_delete - boolean - If true, the avatar will be deleted.
182
+ # change_password - string - Used for changing a password on an existing user.
183
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
184
+ # email - string - User's email.
185
+ # 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`
186
+ # group_id - int64 - Group ID to associate this user with.
187
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
188
+ # 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.
189
+ # password - string - User password.
190
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
191
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
192
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
193
+ # attachments_permission - boolean - DEPRECATED: If `true`, the user can user create Bundles (aka Share Links). Use the bundle permission instead.
194
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
195
+ # authentication_method - string - How is this user authenticated?
196
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
197
+ # bypass_user_lifecycle_rules - boolean - Exempt this user from user lifecycle rules?
198
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
199
+ # dav_permission - boolean - Can the user connect with WebDAV?
200
+ # 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.
201
+ # filesystem_layout - string - File system layout
202
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
203
+ # header_text - string - Text to display to the user in the header of the UI
204
+ # language - string - Preferred language
205
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
206
+ # name - string - User's full name
207
+ # company - string - User's company
208
+ # notes - string - Any internal notes on the user
209
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
210
+ # partner_admin - boolean - Is this user a Partner administrator?
211
+ # partner_id - int64 - Partner ID if this user belongs to a Partner
212
+ # password_validity_days - int64 - Number of days to allow user to use the same password
213
+ # readonly_site_admin - boolean - Is the user an allowed to view all (non-billing) site configuration for this site?
214
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
215
+ # require_login_by - string - Require user to login by specified date otherwise it will be disabled.
216
+ # require_password_change - boolean - Is a password change required upon next user login?
217
+ # 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.)
218
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
219
+ # sftp_permission - boolean - Can the user access with SFTP?
220
+ # site_admin - boolean - Is the user an administrator for this site?
221
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
222
+ # ssl_required - string - SSL required setting
223
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
224
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
225
+ # require_2fa - string - 2FA required setting
226
+ # tags - string - Comma-separated list of Tags for this user. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.
227
+ # time_zone - string - User time zone
228
+ # 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.
229
+ # user_home - string - Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
230
+ # workspace_admin - boolean - Is the user a Workspace administrator? Applicable only to the workspace ID related to this user, if one is set.
231
+ # username - string - User's username
232
+ # clear_2fa - boolean - If true when changing authentication_method from `password` to `sso`, remove all two-factor methods. Ignored in all other cases.
233
+ # convert_to_partner_user - boolean - If true, convert this user to a partner user by assigning the partner_id provided.
234
+ def update(self, params=None):
235
+ if not isinstance(params, dict):
236
+ params = {}
237
+
238
+ if hasattr(self, "id") and self.id:
239
+ params["id"] = self.id
240
+ else:
241
+ raise MissingParameterError("Current object doesn't have a id")
242
+ if "id" not in params:
243
+ raise MissingParameterError("Parameter missing: id")
244
+ if "id" in params and not isinstance(params["id"], int):
245
+ raise InvalidParameterError("Bad parameter: id must be an int")
246
+ if "change_password" in params and not isinstance(
247
+ params["change_password"], str
248
+ ):
249
+ raise InvalidParameterError(
250
+ "Bad parameter: change_password must be an str"
251
+ )
252
+ if "change_password_confirmation" in params and not isinstance(
253
+ params["change_password_confirmation"], str
254
+ ):
255
+ raise InvalidParameterError(
256
+ "Bad parameter: change_password_confirmation must be an str"
257
+ )
258
+ if "email" in params and not isinstance(params["email"], str):
259
+ raise InvalidParameterError("Bad parameter: email must be an str")
260
+ if "grant_permission" in params and not isinstance(
261
+ params["grant_permission"], str
262
+ ):
263
+ raise InvalidParameterError(
264
+ "Bad parameter: grant_permission must be an str"
265
+ )
266
+ if "group_id" in params and not isinstance(params["group_id"], int):
267
+ raise InvalidParameterError(
268
+ "Bad parameter: group_id must be an int"
269
+ )
270
+ if "group_ids" in params and not isinstance(params["group_ids"], str):
271
+ raise InvalidParameterError(
272
+ "Bad parameter: group_ids must be an str"
273
+ )
274
+ if "imported_password_hash" in params and not isinstance(
275
+ params["imported_password_hash"], str
276
+ ):
277
+ raise InvalidParameterError(
278
+ "Bad parameter: imported_password_hash must be an str"
279
+ )
280
+ if "password" in params and not isinstance(params["password"], str):
281
+ raise InvalidParameterError(
282
+ "Bad parameter: password must be an str"
283
+ )
284
+ if "password_confirmation" in params and not isinstance(
285
+ params["password_confirmation"], str
286
+ ):
287
+ raise InvalidParameterError(
288
+ "Bad parameter: password_confirmation must be an str"
289
+ )
290
+ if "allowed_ips" in params and not isinstance(
291
+ params["allowed_ips"], str
292
+ ):
293
+ raise InvalidParameterError(
294
+ "Bad parameter: allowed_ips must be an str"
295
+ )
296
+ if "authenticate_until" in params and not isinstance(
297
+ params["authenticate_until"], str
298
+ ):
299
+ raise InvalidParameterError(
300
+ "Bad parameter: authenticate_until must be an str"
301
+ )
302
+ if "authentication_method" in params and not isinstance(
303
+ params["authentication_method"], str
304
+ ):
305
+ raise InvalidParameterError(
306
+ "Bad parameter: authentication_method must be an str"
307
+ )
308
+ if "filesystem_layout" in params and not isinstance(
309
+ params["filesystem_layout"], str
310
+ ):
311
+ raise InvalidParameterError(
312
+ "Bad parameter: filesystem_layout must be an str"
313
+ )
314
+ if "header_text" in params and not isinstance(
315
+ params["header_text"], str
316
+ ):
317
+ raise InvalidParameterError(
318
+ "Bad parameter: header_text must be an str"
319
+ )
320
+ if "language" in params and not isinstance(params["language"], str):
321
+ raise InvalidParameterError(
322
+ "Bad parameter: language must be an str"
323
+ )
324
+ if "notification_daily_send_time" in params and not isinstance(
325
+ params["notification_daily_send_time"], int
326
+ ):
327
+ raise InvalidParameterError(
328
+ "Bad parameter: notification_daily_send_time must be an int"
329
+ )
330
+ if "name" in params and not isinstance(params["name"], str):
331
+ raise InvalidParameterError("Bad parameter: name must be an str")
332
+ if "company" in params and not isinstance(params["company"], str):
333
+ raise InvalidParameterError(
334
+ "Bad parameter: company must be an str"
335
+ )
336
+ if "notes" in params and not isinstance(params["notes"], str):
337
+ raise InvalidParameterError("Bad parameter: notes must be an str")
338
+ if "partner_id" in params and not isinstance(
339
+ params["partner_id"], int
340
+ ):
341
+ raise InvalidParameterError(
342
+ "Bad parameter: partner_id must be an int"
343
+ )
344
+ if "password_validity_days" in params and not isinstance(
345
+ params["password_validity_days"], int
346
+ ):
347
+ raise InvalidParameterError(
348
+ "Bad parameter: password_validity_days must be an int"
349
+ )
350
+ if "require_login_by" in params and not isinstance(
351
+ params["require_login_by"], str
352
+ ):
353
+ raise InvalidParameterError(
354
+ "Bad parameter: require_login_by must be an str"
355
+ )
356
+ if "ssl_required" in params and not isinstance(
357
+ params["ssl_required"], str
358
+ ):
359
+ raise InvalidParameterError(
360
+ "Bad parameter: ssl_required must be an str"
361
+ )
362
+ if "sso_strategy_id" in params and not isinstance(
363
+ params["sso_strategy_id"], int
364
+ ):
365
+ raise InvalidParameterError(
366
+ "Bad parameter: sso_strategy_id must be an int"
367
+ )
368
+ if "require_2fa" in params and not isinstance(
369
+ params["require_2fa"], str
370
+ ):
371
+ raise InvalidParameterError(
372
+ "Bad parameter: require_2fa must be an str"
373
+ )
374
+ if "tags" in params and not isinstance(params["tags"], str):
375
+ raise InvalidParameterError("Bad parameter: tags must be an str")
376
+ if "time_zone" in params and not isinstance(params["time_zone"], str):
377
+ raise InvalidParameterError(
378
+ "Bad parameter: time_zone must be an str"
379
+ )
380
+ if "user_root" in params and not isinstance(params["user_root"], str):
381
+ raise InvalidParameterError(
382
+ "Bad parameter: user_root must be an str"
383
+ )
384
+ if "user_home" in params and not isinstance(params["user_home"], str):
385
+ raise InvalidParameterError(
386
+ "Bad parameter: user_home must be an str"
387
+ )
388
+ if "username" in params and not isinstance(params["username"], str):
389
+ raise InvalidParameterError(
390
+ "Bad parameter: username must be an str"
391
+ )
392
+ response, _options = Api.send_request(
393
+ "PATCH",
394
+ "/users/{id}".format(id=params["id"]),
395
+ params,
396
+ self.options,
397
+ )
398
+ return response.data
399
+
400
+ # Parameters:
401
+ # new_owner_id - int64 - Provide a User ID here to transfer ownership of certain resources such as Automations and Share Links (Bundles) to that new user.
402
+ def delete(self, params=None):
403
+ if not isinstance(params, dict):
404
+ params = {}
405
+
406
+ if hasattr(self, "id") and self.id:
407
+ params["id"] = self.id
408
+ else:
409
+ raise MissingParameterError("Current object doesn't have a id")
410
+ if "id" not in params:
411
+ raise MissingParameterError("Parameter missing: id")
412
+ if "id" in params and not isinstance(params["id"], int):
413
+ raise InvalidParameterError("Bad parameter: id must be an int")
414
+ if "new_owner_id" in params and not isinstance(
415
+ params["new_owner_id"], int
416
+ ):
417
+ raise InvalidParameterError(
418
+ "Bad parameter: new_owner_id must be an int"
419
+ )
420
+ Api.send_request(
421
+ "DELETE",
422
+ "/users/{id}".format(id=params["id"]),
423
+ params,
424
+ self.options,
425
+ )
426
+
427
+ def destroy(self, params=None):
428
+ self.delete(params)
429
+
430
+ def save(self):
431
+ if hasattr(self, "id") and self.id:
432
+ new_obj = self.update(self.get_attributes())
433
+ self.set_attributes(new_obj.get_attributes())
434
+ return True
435
+ else:
436
+ new_obj = create(self.get_attributes(), self.options)
437
+ self.set_attributes(new_obj.get_attributes())
438
+ return True
439
+
440
+
441
+ # Parameters:
442
+ # 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.
443
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
444
+ # sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `site_id`, `workspace_id`, `company`, `name`, `disabled`, `authenticate_until`, `username`, `email`, `last_desktop_login_at`, `last_login_at`, `site_admin`, `password_validity_days` or `ssl_required`.
445
+ # 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`, `not_site_admin`, `disabled`, `partner_id` or `workspace_id`. Valid field combinations are `[ site_admin, username ]`.
446
+ # 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`.
447
+ # 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`.
448
+ # 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`.
449
+ # 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`.
450
+ # 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`.
451
+ # ids - string - comma-separated list of User IDs
452
+ # include_parent_site_users - boolean - Include users from the parent site.
453
+ # search - string - Searches for partial matches of name, username, or email.
454
+ def list(params=None, options=None):
455
+ if not isinstance(params, dict):
456
+ params = {}
457
+ if not isinstance(options, dict):
458
+ options = {}
459
+ if "cursor" in params and not isinstance(params["cursor"], str):
460
+ raise InvalidParameterError("Bad parameter: cursor must be an str")
461
+ if "per_page" in params and not isinstance(params["per_page"], int):
462
+ raise InvalidParameterError("Bad parameter: per_page must be an int")
463
+ if "sort_by" in params and not isinstance(params["sort_by"], dict):
464
+ raise InvalidParameterError("Bad parameter: sort_by must be an dict")
465
+ if "filter" in params and not isinstance(params["filter"], dict):
466
+ raise InvalidParameterError("Bad parameter: filter must be an dict")
467
+ if "filter_gt" in params and not isinstance(params["filter_gt"], dict):
468
+ raise InvalidParameterError("Bad parameter: filter_gt must be an dict")
469
+ if "filter_gteq" in params and not isinstance(params["filter_gteq"], dict):
470
+ raise InvalidParameterError(
471
+ "Bad parameter: filter_gteq must be an dict"
472
+ )
473
+ if "filter_prefix" in params and not isinstance(
474
+ params["filter_prefix"], dict
475
+ ):
476
+ raise InvalidParameterError(
477
+ "Bad parameter: filter_prefix must be an dict"
478
+ )
479
+ if "filter_lt" in params and not isinstance(params["filter_lt"], dict):
480
+ raise InvalidParameterError("Bad parameter: filter_lt must be an dict")
481
+ if "filter_lteq" in params and not isinstance(params["filter_lteq"], dict):
482
+ raise InvalidParameterError(
483
+ "Bad parameter: filter_lteq must be an dict"
484
+ )
485
+ if "ids" in params and not isinstance(params["ids"], str):
486
+ raise InvalidParameterError("Bad parameter: ids must be an str")
487
+ if "include_parent_site_users" in params and not isinstance(
488
+ params["include_parent_site_users"], bool
489
+ ):
490
+ raise InvalidParameterError(
491
+ "Bad parameter: include_parent_site_users must be an bool"
492
+ )
493
+ if "search" in params and not isinstance(params["search"], str):
494
+ raise InvalidParameterError("Bad parameter: search must be an str")
495
+ return ListObj(User, "GET", "/users", params, options)
496
+
497
+
498
+ def all(params=None, options=None):
499
+ list(params, options)
500
+
501
+
502
+ # Parameters:
503
+ # id (required) - int64 - User ID.
504
+ def find(id, params=None, options=None):
505
+ if not isinstance(params, dict):
506
+ params = {}
507
+ if not isinstance(options, dict):
508
+ options = {}
509
+ params["id"] = id
510
+ if "id" in params and not isinstance(params["id"], int):
511
+ raise InvalidParameterError("Bad parameter: id must be an int")
512
+ if "id" not in params:
513
+ raise MissingParameterError("Parameter missing: id")
514
+ response, options = Api.send_request(
515
+ "GET", "/users/{id}".format(id=params["id"]), params, options
516
+ )
517
+ return User(response.data, options)
518
+
519
+
520
+ def get(id, params=None, options=None):
521
+ find(id, params, options)
522
+
523
+
524
+ # Parameters:
525
+ # avatar_file - file - An image file for your user avatar.
526
+ # avatar_delete - boolean - If true, the avatar will be deleted.
527
+ # change_password - string - Used for changing a password on an existing user.
528
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
529
+ # email - string - User's email.
530
+ # 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`
531
+ # group_id - int64 - Group ID to associate this user with.
532
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
533
+ # 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.
534
+ # password - string - User password.
535
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
536
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
537
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
538
+ # attachments_permission - boolean - DEPRECATED: If `true`, the user can user create Bundles (aka Share Links). Use the bundle permission instead.
539
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
540
+ # authentication_method - string - How is this user authenticated?
541
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
542
+ # bypass_user_lifecycle_rules - boolean - Exempt this user from user lifecycle rules?
543
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
544
+ # dav_permission - boolean - Can the user connect with WebDAV?
545
+ # 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.
546
+ # filesystem_layout - string - File system layout
547
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
548
+ # header_text - string - Text to display to the user in the header of the UI
549
+ # language - string - Preferred language
550
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
551
+ # name - string - User's full name
552
+ # company - string - User's company
553
+ # notes - string - Any internal notes on the user
554
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
555
+ # partner_admin - boolean - Is this user a Partner administrator?
556
+ # partner_id - int64 - Partner ID if this user belongs to a Partner
557
+ # password_validity_days - int64 - Number of days to allow user to use the same password
558
+ # readonly_site_admin - boolean - Is the user an allowed to view all (non-billing) site configuration for this site?
559
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
560
+ # require_login_by - string - Require user to login by specified date otherwise it will be disabled.
561
+ # require_password_change - boolean - Is a password change required upon next user login?
562
+ # 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.)
563
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
564
+ # sftp_permission - boolean - Can the user access with SFTP?
565
+ # site_admin - boolean - Is the user an administrator for this site?
566
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
567
+ # ssl_required - string - SSL required setting
568
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
569
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
570
+ # require_2fa - string - 2FA required setting
571
+ # tags - string - Comma-separated list of Tags for this user. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.
572
+ # time_zone - string - User time zone
573
+ # 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.
574
+ # user_home - string - Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
575
+ # workspace_admin - boolean - Is the user a Workspace administrator? Applicable only to the workspace ID related to this user, if one is set.
576
+ # username (required) - string - User's username
577
+ # workspace_id - int64 - Workspace ID
578
+ def create(params=None, options=None):
579
+ if not isinstance(params, dict):
580
+ params = {}
581
+ if not isinstance(options, dict):
582
+ options = {}
583
+ if "avatar_delete" in params and not isinstance(
584
+ params["avatar_delete"], bool
585
+ ):
586
+ raise InvalidParameterError(
587
+ "Bad parameter: avatar_delete must be an bool"
588
+ )
589
+ if "change_password" in params and not isinstance(
590
+ params["change_password"], str
591
+ ):
592
+ raise InvalidParameterError(
593
+ "Bad parameter: change_password must be an str"
594
+ )
595
+ if "change_password_confirmation" in params and not isinstance(
596
+ params["change_password_confirmation"], str
597
+ ):
598
+ raise InvalidParameterError(
599
+ "Bad parameter: change_password_confirmation must be an str"
600
+ )
601
+ if "email" in params and not isinstance(params["email"], str):
602
+ raise InvalidParameterError("Bad parameter: email must be an str")
603
+ if "grant_permission" in params and not isinstance(
604
+ params["grant_permission"], str
605
+ ):
606
+ raise InvalidParameterError(
607
+ "Bad parameter: grant_permission must be an str"
608
+ )
609
+ if "group_id" in params and not isinstance(params["group_id"], int):
610
+ raise InvalidParameterError("Bad parameter: group_id must be an int")
611
+ if "group_ids" in params and not isinstance(params["group_ids"], str):
612
+ raise InvalidParameterError("Bad parameter: group_ids must be an str")
613
+ if "imported_password_hash" in params and not isinstance(
614
+ params["imported_password_hash"], str
615
+ ):
616
+ raise InvalidParameterError(
617
+ "Bad parameter: imported_password_hash must be an str"
618
+ )
619
+ if "password" in params and not isinstance(params["password"], str):
620
+ raise InvalidParameterError("Bad parameter: password must be an str")
621
+ if "password_confirmation" in params and not isinstance(
622
+ params["password_confirmation"], str
623
+ ):
624
+ raise InvalidParameterError(
625
+ "Bad parameter: password_confirmation must be an str"
626
+ )
627
+ if "announcements_read" in params and not isinstance(
628
+ params["announcements_read"], bool
629
+ ):
630
+ raise InvalidParameterError(
631
+ "Bad parameter: announcements_read must be an bool"
632
+ )
633
+ if "allowed_ips" in params and not isinstance(params["allowed_ips"], str):
634
+ raise InvalidParameterError(
635
+ "Bad parameter: allowed_ips must be an str"
636
+ )
637
+ if "attachments_permission" in params and not isinstance(
638
+ params["attachments_permission"], bool
639
+ ):
640
+ raise InvalidParameterError(
641
+ "Bad parameter: attachments_permission must be an bool"
642
+ )
643
+ if "authenticate_until" in params and not isinstance(
644
+ params["authenticate_until"], str
645
+ ):
646
+ raise InvalidParameterError(
647
+ "Bad parameter: authenticate_until must be an str"
648
+ )
649
+ if "authentication_method" in params and not isinstance(
650
+ params["authentication_method"], str
651
+ ):
652
+ raise InvalidParameterError(
653
+ "Bad parameter: authentication_method must be an str"
654
+ )
655
+ if "billing_permission" in params and not isinstance(
656
+ params["billing_permission"], bool
657
+ ):
658
+ raise InvalidParameterError(
659
+ "Bad parameter: billing_permission must be an bool"
660
+ )
661
+ if "bypass_user_lifecycle_rules" in params and not isinstance(
662
+ params["bypass_user_lifecycle_rules"], bool
663
+ ):
664
+ raise InvalidParameterError(
665
+ "Bad parameter: bypass_user_lifecycle_rules must be an bool"
666
+ )
667
+ if "bypass_site_allowed_ips" in params and not isinstance(
668
+ params["bypass_site_allowed_ips"], bool
669
+ ):
670
+ raise InvalidParameterError(
671
+ "Bad parameter: bypass_site_allowed_ips must be an bool"
672
+ )
673
+ if "dav_permission" in params and not isinstance(
674
+ params["dav_permission"], bool
675
+ ):
676
+ raise InvalidParameterError(
677
+ "Bad parameter: dav_permission must be an bool"
678
+ )
679
+ if "disabled" in params and not isinstance(params["disabled"], bool):
680
+ raise InvalidParameterError("Bad parameter: disabled must be an bool")
681
+ if "filesystem_layout" in params and not isinstance(
682
+ params["filesystem_layout"], str
683
+ ):
684
+ raise InvalidParameterError(
685
+ "Bad parameter: filesystem_layout must be an str"
686
+ )
687
+ if "ftp_permission" in params and not isinstance(
688
+ params["ftp_permission"], bool
689
+ ):
690
+ raise InvalidParameterError(
691
+ "Bad parameter: ftp_permission must be an bool"
692
+ )
693
+ if "header_text" in params and not isinstance(params["header_text"], str):
694
+ raise InvalidParameterError(
695
+ "Bad parameter: header_text must be an str"
696
+ )
697
+ if "language" in params and not isinstance(params["language"], str):
698
+ raise InvalidParameterError("Bad parameter: language must be an str")
699
+ if "notification_daily_send_time" in params and not isinstance(
700
+ params["notification_daily_send_time"], int
701
+ ):
702
+ raise InvalidParameterError(
703
+ "Bad parameter: notification_daily_send_time must be an int"
704
+ )
705
+ if "name" in params and not isinstance(params["name"], str):
706
+ raise InvalidParameterError("Bad parameter: name must be an str")
707
+ if "company" in params and not isinstance(params["company"], str):
708
+ raise InvalidParameterError("Bad parameter: company must be an str")
709
+ if "notes" in params and not isinstance(params["notes"], str):
710
+ raise InvalidParameterError("Bad parameter: notes must be an str")
711
+ if "office_integration_enabled" in params and not isinstance(
712
+ params["office_integration_enabled"], bool
713
+ ):
714
+ raise InvalidParameterError(
715
+ "Bad parameter: office_integration_enabled must be an bool"
716
+ )
717
+ if "partner_admin" in params and not isinstance(
718
+ params["partner_admin"], bool
719
+ ):
720
+ raise InvalidParameterError(
721
+ "Bad parameter: partner_admin must be an bool"
722
+ )
723
+ if "partner_id" in params and not isinstance(params["partner_id"], int):
724
+ raise InvalidParameterError("Bad parameter: partner_id must be an int")
725
+ if "password_validity_days" in params and not isinstance(
726
+ params["password_validity_days"], int
727
+ ):
728
+ raise InvalidParameterError(
729
+ "Bad parameter: password_validity_days must be an int"
730
+ )
731
+ if "readonly_site_admin" in params and not isinstance(
732
+ params["readonly_site_admin"], bool
733
+ ):
734
+ raise InvalidParameterError(
735
+ "Bad parameter: readonly_site_admin must be an bool"
736
+ )
737
+ if "receive_admin_alerts" in params and not isinstance(
738
+ params["receive_admin_alerts"], bool
739
+ ):
740
+ raise InvalidParameterError(
741
+ "Bad parameter: receive_admin_alerts must be an bool"
742
+ )
743
+ if "require_login_by" in params and not isinstance(
744
+ params["require_login_by"], str
745
+ ):
746
+ raise InvalidParameterError(
747
+ "Bad parameter: require_login_by must be an str"
748
+ )
749
+ if "require_password_change" in params and not isinstance(
750
+ params["require_password_change"], bool
751
+ ):
752
+ raise InvalidParameterError(
753
+ "Bad parameter: require_password_change must be an bool"
754
+ )
755
+ if "restapi_permission" in params and not isinstance(
756
+ params["restapi_permission"], bool
757
+ ):
758
+ raise InvalidParameterError(
759
+ "Bad parameter: restapi_permission must be an bool"
760
+ )
761
+ if "self_managed" in params and not isinstance(
762
+ params["self_managed"], bool
763
+ ):
764
+ raise InvalidParameterError(
765
+ "Bad parameter: self_managed must be an bool"
766
+ )
767
+ if "sftp_permission" in params and not isinstance(
768
+ params["sftp_permission"], bool
769
+ ):
770
+ raise InvalidParameterError(
771
+ "Bad parameter: sftp_permission must be an bool"
772
+ )
773
+ if "site_admin" in params and not isinstance(params["site_admin"], bool):
774
+ raise InvalidParameterError(
775
+ "Bad parameter: site_admin must be an bool"
776
+ )
777
+ if "skip_welcome_screen" in params and not isinstance(
778
+ params["skip_welcome_screen"], bool
779
+ ):
780
+ raise InvalidParameterError(
781
+ "Bad parameter: skip_welcome_screen must be an bool"
782
+ )
783
+ if "ssl_required" in params and not isinstance(
784
+ params["ssl_required"], str
785
+ ):
786
+ raise InvalidParameterError(
787
+ "Bad parameter: ssl_required must be an str"
788
+ )
789
+ if "sso_strategy_id" in params and not isinstance(
790
+ params["sso_strategy_id"], int
791
+ ):
792
+ raise InvalidParameterError(
793
+ "Bad parameter: sso_strategy_id must be an int"
794
+ )
795
+ if "subscribe_to_newsletter" in params and not isinstance(
796
+ params["subscribe_to_newsletter"], bool
797
+ ):
798
+ raise InvalidParameterError(
799
+ "Bad parameter: subscribe_to_newsletter must be an bool"
800
+ )
801
+ if "require_2fa" in params and not isinstance(params["require_2fa"], str):
802
+ raise InvalidParameterError(
803
+ "Bad parameter: require_2fa must be an str"
804
+ )
805
+ if "tags" in params and not isinstance(params["tags"], str):
806
+ raise InvalidParameterError("Bad parameter: tags must be an str")
807
+ if "time_zone" in params and not isinstance(params["time_zone"], str):
808
+ raise InvalidParameterError("Bad parameter: time_zone must be an str")
809
+ if "user_root" in params and not isinstance(params["user_root"], str):
810
+ raise InvalidParameterError("Bad parameter: user_root must be an str")
811
+ if "user_home" in params and not isinstance(params["user_home"], str):
812
+ raise InvalidParameterError("Bad parameter: user_home must be an str")
813
+ if "workspace_admin" in params and not isinstance(
814
+ params["workspace_admin"], bool
815
+ ):
816
+ raise InvalidParameterError(
817
+ "Bad parameter: workspace_admin must be an bool"
818
+ )
819
+ if "username" in params and not isinstance(params["username"], str):
820
+ raise InvalidParameterError("Bad parameter: username must be an str")
821
+ if "workspace_id" in params and not isinstance(
822
+ params["workspace_id"], int
823
+ ):
824
+ raise InvalidParameterError(
825
+ "Bad parameter: workspace_id must be an int"
826
+ )
827
+ if "username" not in params:
828
+ raise MissingParameterError("Parameter missing: username")
829
+ response, options = Api.send_request("POST", "/users", params, options)
830
+ return User(response.data, options)
831
+
832
+
833
+ # Unlock user who has been locked out due to failed logins
834
+ def unlock(id, params=None, options=None):
835
+ if not isinstance(params, dict):
836
+ params = {}
837
+ if not isinstance(options, dict):
838
+ options = {}
839
+ params["id"] = id
840
+ if "id" in params and not isinstance(params["id"], int):
841
+ raise InvalidParameterError("Bad parameter: id must be an int")
842
+ if "id" not in params:
843
+ raise MissingParameterError("Parameter missing: id")
844
+ Api.send_request(
845
+ "POST", "/users/{id}/unlock".format(id=params["id"]), params, options
846
+ )
847
+
848
+
849
+ # Resend user welcome email
850
+ def resend_welcome_email(id, params=None, options=None):
851
+ if not isinstance(params, dict):
852
+ params = {}
853
+ if not isinstance(options, dict):
854
+ options = {}
855
+ params["id"] = id
856
+ if "id" in params and not isinstance(params["id"], int):
857
+ raise InvalidParameterError("Bad parameter: id must be an int")
858
+ if "id" not in params:
859
+ raise MissingParameterError("Parameter missing: id")
860
+ Api.send_request(
861
+ "POST",
862
+ "/users/{id}/resend_welcome_email".format(id=params["id"]),
863
+ params,
864
+ options,
865
+ )
866
+
867
+
868
+ # Trigger 2FA Reset process for user who has lost access to their existing 2FA methods
869
+ def user_2fa_reset(id, params=None, options=None):
870
+ if not isinstance(params, dict):
871
+ params = {}
872
+ if not isinstance(options, dict):
873
+ options = {}
874
+ params["id"] = id
875
+ if "id" in params and not isinstance(params["id"], int):
876
+ raise InvalidParameterError("Bad parameter: id must be an int")
877
+ if "id" not in params:
878
+ raise MissingParameterError("Parameter missing: id")
879
+ Api.send_request(
880
+ "POST",
881
+ "/users/{id}/2fa/reset".format(id=params["id"]),
882
+ params,
883
+ options,
884
+ )
885
+
886
+
887
+ # Parameters:
888
+ # avatar_file - file - An image file for your user avatar.
889
+ # avatar_delete - boolean - If true, the avatar will be deleted.
890
+ # change_password - string - Used for changing a password on an existing user.
891
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
892
+ # email - string - User's email.
893
+ # 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`
894
+ # group_id - int64 - Group ID to associate this user with.
895
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
896
+ # 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.
897
+ # password - string - User password.
898
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
899
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
900
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
901
+ # attachments_permission - boolean - DEPRECATED: If `true`, the user can user create Bundles (aka Share Links). Use the bundle permission instead.
902
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
903
+ # authentication_method - string - How is this user authenticated?
904
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
905
+ # bypass_user_lifecycle_rules - boolean - Exempt this user from user lifecycle rules?
906
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
907
+ # dav_permission - boolean - Can the user connect with WebDAV?
908
+ # 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.
909
+ # filesystem_layout - string - File system layout
910
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
911
+ # header_text - string - Text to display to the user in the header of the UI
912
+ # language - string - Preferred language
913
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
914
+ # name - string - User's full name
915
+ # company - string - User's company
916
+ # notes - string - Any internal notes on the user
917
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
918
+ # partner_admin - boolean - Is this user a Partner administrator?
919
+ # partner_id - int64 - Partner ID if this user belongs to a Partner
920
+ # password_validity_days - int64 - Number of days to allow user to use the same password
921
+ # readonly_site_admin - boolean - Is the user an allowed to view all (non-billing) site configuration for this site?
922
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
923
+ # require_login_by - string - Require user to login by specified date otherwise it will be disabled.
924
+ # require_password_change - boolean - Is a password change required upon next user login?
925
+ # 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.)
926
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
927
+ # sftp_permission - boolean - Can the user access with SFTP?
928
+ # site_admin - boolean - Is the user an administrator for this site?
929
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
930
+ # ssl_required - string - SSL required setting
931
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
932
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
933
+ # require_2fa - string - 2FA required setting
934
+ # tags - string - Comma-separated list of Tags for this user. Tags are used for other features, such as UserLifecycleRules, which can target specific tags. Tags must only contain lowercase letters, numbers, and hyphens.
935
+ # time_zone - string - User time zone
936
+ # 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.
937
+ # user_home - string - Home folder for FTP/SFTP. Note that this is not used for API, Desktop, or Web interface.
938
+ # workspace_admin - boolean - Is the user a Workspace administrator? Applicable only to the workspace ID related to this user, if one is set.
939
+ # username - string - User's username
940
+ # clear_2fa - boolean - If true when changing authentication_method from `password` to `sso`, remove all two-factor methods. Ignored in all other cases.
941
+ # convert_to_partner_user - boolean - If true, convert this user to a partner user by assigning the partner_id provided.
942
+ def update(id, params=None, options=None):
943
+ if not isinstance(params, dict):
944
+ params = {}
945
+ if not isinstance(options, dict):
946
+ options = {}
947
+ params["id"] = id
948
+ if "id" in params and not isinstance(params["id"], int):
949
+ raise InvalidParameterError("Bad parameter: id must be an int")
950
+ if "avatar_delete" in params and not isinstance(
951
+ params["avatar_delete"], bool
952
+ ):
953
+ raise InvalidParameterError(
954
+ "Bad parameter: avatar_delete must be an bool"
955
+ )
956
+ if "change_password" in params and not isinstance(
957
+ params["change_password"], str
958
+ ):
959
+ raise InvalidParameterError(
960
+ "Bad parameter: change_password must be an str"
961
+ )
962
+ if "change_password_confirmation" in params and not isinstance(
963
+ params["change_password_confirmation"], str
964
+ ):
965
+ raise InvalidParameterError(
966
+ "Bad parameter: change_password_confirmation must be an str"
967
+ )
968
+ if "email" in params and not isinstance(params["email"], str):
969
+ raise InvalidParameterError("Bad parameter: email must be an str")
970
+ if "grant_permission" in params and not isinstance(
971
+ params["grant_permission"], str
972
+ ):
973
+ raise InvalidParameterError(
974
+ "Bad parameter: grant_permission must be an str"
975
+ )
976
+ if "group_id" in params and not isinstance(params["group_id"], int):
977
+ raise InvalidParameterError("Bad parameter: group_id must be an int")
978
+ if "group_ids" in params and not isinstance(params["group_ids"], str):
979
+ raise InvalidParameterError("Bad parameter: group_ids must be an str")
980
+ if "imported_password_hash" in params and not isinstance(
981
+ params["imported_password_hash"], str
982
+ ):
983
+ raise InvalidParameterError(
984
+ "Bad parameter: imported_password_hash must be an str"
985
+ )
986
+ if "password" in params and not isinstance(params["password"], str):
987
+ raise InvalidParameterError("Bad parameter: password must be an str")
988
+ if "password_confirmation" in params and not isinstance(
989
+ params["password_confirmation"], str
990
+ ):
991
+ raise InvalidParameterError(
992
+ "Bad parameter: password_confirmation must be an str"
993
+ )
994
+ if "announcements_read" in params and not isinstance(
995
+ params["announcements_read"], bool
996
+ ):
997
+ raise InvalidParameterError(
998
+ "Bad parameter: announcements_read must be an bool"
999
+ )
1000
+ if "allowed_ips" in params and not isinstance(params["allowed_ips"], str):
1001
+ raise InvalidParameterError(
1002
+ "Bad parameter: allowed_ips must be an str"
1003
+ )
1004
+ if "attachments_permission" in params and not isinstance(
1005
+ params["attachments_permission"], bool
1006
+ ):
1007
+ raise InvalidParameterError(
1008
+ "Bad parameter: attachments_permission must be an bool"
1009
+ )
1010
+ if "authenticate_until" in params and not isinstance(
1011
+ params["authenticate_until"], str
1012
+ ):
1013
+ raise InvalidParameterError(
1014
+ "Bad parameter: authenticate_until must be an str"
1015
+ )
1016
+ if "authentication_method" in params and not isinstance(
1017
+ params["authentication_method"], str
1018
+ ):
1019
+ raise InvalidParameterError(
1020
+ "Bad parameter: authentication_method must be an str"
1021
+ )
1022
+ if "billing_permission" in params and not isinstance(
1023
+ params["billing_permission"], bool
1024
+ ):
1025
+ raise InvalidParameterError(
1026
+ "Bad parameter: billing_permission must be an bool"
1027
+ )
1028
+ if "bypass_user_lifecycle_rules" in params and not isinstance(
1029
+ params["bypass_user_lifecycle_rules"], bool
1030
+ ):
1031
+ raise InvalidParameterError(
1032
+ "Bad parameter: bypass_user_lifecycle_rules must be an bool"
1033
+ )
1034
+ if "bypass_site_allowed_ips" in params and not isinstance(
1035
+ params["bypass_site_allowed_ips"], bool
1036
+ ):
1037
+ raise InvalidParameterError(
1038
+ "Bad parameter: bypass_site_allowed_ips must be an bool"
1039
+ )
1040
+ if "dav_permission" in params and not isinstance(
1041
+ params["dav_permission"], bool
1042
+ ):
1043
+ raise InvalidParameterError(
1044
+ "Bad parameter: dav_permission must be an bool"
1045
+ )
1046
+ if "disabled" in params and not isinstance(params["disabled"], bool):
1047
+ raise InvalidParameterError("Bad parameter: disabled must be an bool")
1048
+ if "filesystem_layout" in params and not isinstance(
1049
+ params["filesystem_layout"], str
1050
+ ):
1051
+ raise InvalidParameterError(
1052
+ "Bad parameter: filesystem_layout must be an str"
1053
+ )
1054
+ if "ftp_permission" in params and not isinstance(
1055
+ params["ftp_permission"], bool
1056
+ ):
1057
+ raise InvalidParameterError(
1058
+ "Bad parameter: ftp_permission must be an bool"
1059
+ )
1060
+ if "header_text" in params and not isinstance(params["header_text"], str):
1061
+ raise InvalidParameterError(
1062
+ "Bad parameter: header_text must be an str"
1063
+ )
1064
+ if "language" in params and not isinstance(params["language"], str):
1065
+ raise InvalidParameterError("Bad parameter: language must be an str")
1066
+ if "notification_daily_send_time" in params and not isinstance(
1067
+ params["notification_daily_send_time"], int
1068
+ ):
1069
+ raise InvalidParameterError(
1070
+ "Bad parameter: notification_daily_send_time must be an int"
1071
+ )
1072
+ if "name" in params and not isinstance(params["name"], str):
1073
+ raise InvalidParameterError("Bad parameter: name must be an str")
1074
+ if "company" in params and not isinstance(params["company"], str):
1075
+ raise InvalidParameterError("Bad parameter: company must be an str")
1076
+ if "notes" in params and not isinstance(params["notes"], str):
1077
+ raise InvalidParameterError("Bad parameter: notes must be an str")
1078
+ if "office_integration_enabled" in params and not isinstance(
1079
+ params["office_integration_enabled"], bool
1080
+ ):
1081
+ raise InvalidParameterError(
1082
+ "Bad parameter: office_integration_enabled must be an bool"
1083
+ )
1084
+ if "partner_admin" in params and not isinstance(
1085
+ params["partner_admin"], bool
1086
+ ):
1087
+ raise InvalidParameterError(
1088
+ "Bad parameter: partner_admin must be an bool"
1089
+ )
1090
+ if "partner_id" in params and not isinstance(params["partner_id"], int):
1091
+ raise InvalidParameterError("Bad parameter: partner_id must be an int")
1092
+ if "password_validity_days" in params and not isinstance(
1093
+ params["password_validity_days"], int
1094
+ ):
1095
+ raise InvalidParameterError(
1096
+ "Bad parameter: password_validity_days must be an int"
1097
+ )
1098
+ if "readonly_site_admin" in params and not isinstance(
1099
+ params["readonly_site_admin"], bool
1100
+ ):
1101
+ raise InvalidParameterError(
1102
+ "Bad parameter: readonly_site_admin must be an bool"
1103
+ )
1104
+ if "receive_admin_alerts" in params and not isinstance(
1105
+ params["receive_admin_alerts"], bool
1106
+ ):
1107
+ raise InvalidParameterError(
1108
+ "Bad parameter: receive_admin_alerts must be an bool"
1109
+ )
1110
+ if "require_login_by" in params and not isinstance(
1111
+ params["require_login_by"], str
1112
+ ):
1113
+ raise InvalidParameterError(
1114
+ "Bad parameter: require_login_by must be an str"
1115
+ )
1116
+ if "require_password_change" in params and not isinstance(
1117
+ params["require_password_change"], bool
1118
+ ):
1119
+ raise InvalidParameterError(
1120
+ "Bad parameter: require_password_change must be an bool"
1121
+ )
1122
+ if "restapi_permission" in params and not isinstance(
1123
+ params["restapi_permission"], bool
1124
+ ):
1125
+ raise InvalidParameterError(
1126
+ "Bad parameter: restapi_permission must be an bool"
1127
+ )
1128
+ if "self_managed" in params and not isinstance(
1129
+ params["self_managed"], bool
1130
+ ):
1131
+ raise InvalidParameterError(
1132
+ "Bad parameter: self_managed must be an bool"
1133
+ )
1134
+ if "sftp_permission" in params and not isinstance(
1135
+ params["sftp_permission"], bool
1136
+ ):
1137
+ raise InvalidParameterError(
1138
+ "Bad parameter: sftp_permission must be an bool"
1139
+ )
1140
+ if "site_admin" in params and not isinstance(params["site_admin"], bool):
1141
+ raise InvalidParameterError(
1142
+ "Bad parameter: site_admin must be an bool"
1143
+ )
1144
+ if "skip_welcome_screen" in params and not isinstance(
1145
+ params["skip_welcome_screen"], bool
1146
+ ):
1147
+ raise InvalidParameterError(
1148
+ "Bad parameter: skip_welcome_screen must be an bool"
1149
+ )
1150
+ if "ssl_required" in params and not isinstance(
1151
+ params["ssl_required"], str
1152
+ ):
1153
+ raise InvalidParameterError(
1154
+ "Bad parameter: ssl_required must be an str"
1155
+ )
1156
+ if "sso_strategy_id" in params and not isinstance(
1157
+ params["sso_strategy_id"], int
1158
+ ):
1159
+ raise InvalidParameterError(
1160
+ "Bad parameter: sso_strategy_id must be an int"
1161
+ )
1162
+ if "subscribe_to_newsletter" in params and not isinstance(
1163
+ params["subscribe_to_newsletter"], bool
1164
+ ):
1165
+ raise InvalidParameterError(
1166
+ "Bad parameter: subscribe_to_newsletter must be an bool"
1167
+ )
1168
+ if "require_2fa" in params and not isinstance(params["require_2fa"], str):
1169
+ raise InvalidParameterError(
1170
+ "Bad parameter: require_2fa must be an str"
1171
+ )
1172
+ if "tags" in params and not isinstance(params["tags"], str):
1173
+ raise InvalidParameterError("Bad parameter: tags must be an str")
1174
+ if "time_zone" in params and not isinstance(params["time_zone"], str):
1175
+ raise InvalidParameterError("Bad parameter: time_zone must be an str")
1176
+ if "user_root" in params and not isinstance(params["user_root"], str):
1177
+ raise InvalidParameterError("Bad parameter: user_root must be an str")
1178
+ if "user_home" in params and not isinstance(params["user_home"], str):
1179
+ raise InvalidParameterError("Bad parameter: user_home must be an str")
1180
+ if "workspace_admin" in params and not isinstance(
1181
+ params["workspace_admin"], bool
1182
+ ):
1183
+ raise InvalidParameterError(
1184
+ "Bad parameter: workspace_admin must be an bool"
1185
+ )
1186
+ if "username" in params and not isinstance(params["username"], str):
1187
+ raise InvalidParameterError("Bad parameter: username must be an str")
1188
+ if "clear_2fa" in params and not isinstance(params["clear_2fa"], bool):
1189
+ raise InvalidParameterError("Bad parameter: clear_2fa must be an bool")
1190
+ if "convert_to_partner_user" in params and not isinstance(
1191
+ params["convert_to_partner_user"], bool
1192
+ ):
1193
+ raise InvalidParameterError(
1194
+ "Bad parameter: convert_to_partner_user must be an bool"
1195
+ )
1196
+ if "id" not in params:
1197
+ raise MissingParameterError("Parameter missing: id")
1198
+ response, options = Api.send_request(
1199
+ "PATCH", "/users/{id}".format(id=params["id"]), params, options
1200
+ )
1201
+ return User(response.data, options)
1202
+
1203
+
1204
+ # Parameters:
1205
+ # new_owner_id - int64 - Provide a User ID here to transfer ownership of certain resources such as Automations and Share Links (Bundles) to that new user.
1206
+ def delete(id, params=None, options=None):
1207
+ if not isinstance(params, dict):
1208
+ params = {}
1209
+ if not isinstance(options, dict):
1210
+ options = {}
1211
+ params["id"] = id
1212
+ if "id" in params and not isinstance(params["id"], int):
1213
+ raise InvalidParameterError("Bad parameter: id must be an int")
1214
+ if "new_owner_id" in params and not isinstance(
1215
+ params["new_owner_id"], int
1216
+ ):
1217
+ raise InvalidParameterError(
1218
+ "Bad parameter: new_owner_id must be an int"
1219
+ )
1220
+ if "id" not in params:
1221
+ raise MissingParameterError("Parameter missing: id")
1222
+ Api.send_request(
1223
+ "DELETE", "/users/{id}".format(id=params["id"]), params, options
1224
+ )
1225
+
1226
+
1227
+ def destroy(id, params=None, options=None):
1228
+ delete(id, params, options)
1229
+
1230
+
1231
+ def new(*args, **kwargs):
1232
+ return User(*args, **kwargs)