files.com 1.0.92

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTORS +4 -0
  3. data/Gemfile +12 -0
  4. data/Gemfile.lock +82 -0
  5. data/LICENSE +21 -0
  6. data/README.md +119 -0
  7. data/Rakefile +12 -0
  8. data/SECURITY.md +24 -0
  9. data/_VERSION +1 -0
  10. data/bin/files +8 -0
  11. data/bin/files-console +16 -0
  12. data/docs/account_line_item.md +41 -0
  13. data/docs/action.md +37 -0
  14. data/docs/api_key.md +202 -0
  15. data/docs/app.md +59 -0
  16. data/docs/as2_key.md +133 -0
  17. data/docs/auto.md +11 -0
  18. data/docs/automation.md +190 -0
  19. data/docs/behavior.md +208 -0
  20. data/docs/bundle.md +252 -0
  21. data/docs/bundle_download.md +35 -0
  22. data/docs/clickwrap.md +143 -0
  23. data/docs/dns_record.md +35 -0
  24. data/docs/errors.md +17 -0
  25. data/docs/file.md +204 -0
  26. data/docs/file_action.md +126 -0
  27. data/docs/file_comment.md +116 -0
  28. data/docs/file_comment_reaction.md +62 -0
  29. data/docs/file_part_upload.md +37 -0
  30. data/docs/file_utils.md +4 -0
  31. data/docs/folder.md +90 -0
  32. data/docs/group.md +153 -0
  33. data/docs/group_user.md +124 -0
  34. data/docs/history.md +171 -0
  35. data/docs/history_export.md +174 -0
  36. data/docs/image.md +13 -0
  37. data/docs/invoice.md +72 -0
  38. data/docs/invoice_line_item.md +27 -0
  39. data/docs/ip_address.md +55 -0
  40. data/docs/lock.md +98 -0
  41. data/docs/message.md +147 -0
  42. data/docs/message_comment.md +132 -0
  43. data/docs/message_comment_reaction.md +94 -0
  44. data/docs/message_reaction.md +94 -0
  45. data/docs/notification.md +177 -0
  46. data/docs/payment.md +72 -0
  47. data/docs/payment_line_item.md +19 -0
  48. data/docs/permission.md +95 -0
  49. data/docs/preview.md +19 -0
  50. data/docs/project.md +121 -0
  51. data/docs/public_ip_address.md +13 -0
  52. data/docs/public_key.md +133 -0
  53. data/docs/remote_server.md +356 -0
  54. data/docs/request.md +100 -0
  55. data/docs/session.md +78 -0
  56. data/docs/site.md +448 -0
  57. data/docs/sso_strategy.md +114 -0
  58. data/docs/status.md +21 -0
  59. data/docs/style.md +93 -0
  60. data/docs/usage_daily_snapshot.md +45 -0
  61. data/docs/usage_snapshot.md +53 -0
  62. data/docs/user.md +535 -0
  63. data/docs/user_cipher_use.md +41 -0
  64. data/docs/user_request.md +93 -0
  65. data/files.com.gemspec +22 -0
  66. data/lib/files.com.rb +184 -0
  67. data/lib/files.com/api.rb +38 -0
  68. data/lib/files.com/api_client.rb +340 -0
  69. data/lib/files.com/errors.rb +41 -0
  70. data/lib/files.com/list.rb +95 -0
  71. data/lib/files.com/models/account_line_item.rb +82 -0
  72. data/lib/files.com/models/action.rb +77 -0
  73. data/lib/files.com/models/api_key.rb +270 -0
  74. data/lib/files.com/models/app.rb +106 -0
  75. data/lib/files.com/models/as2_key.rb +179 -0
  76. data/lib/files.com/models/auto.rb +17 -0
  77. data/lib/files.com/models/automation.rb +304 -0
  78. data/lib/files.com/models/behavior.rb +266 -0
  79. data/lib/files.com/models/bundle.rb +371 -0
  80. data/lib/files.com/models/bundle_download.rb +49 -0
  81. data/lib/files.com/models/clickwrap.rb +197 -0
  82. data/lib/files.com/models/dir.rb +3 -0
  83. data/lib/files.com/models/dns_record.rb +51 -0
  84. data/lib/files.com/models/errors.rb +22 -0
  85. data/lib/files.com/models/file.rb +968 -0
  86. data/lib/files.com/models/file_action.rb +126 -0
  87. data/lib/files.com/models/file_comment.rb +146 -0
  88. data/lib/files.com/models/file_comment_reaction.rb +100 -0
  89. data/lib/files.com/models/file_part_upload.rb +82 -0
  90. data/lib/files.com/models/file_utils.rb +118 -0
  91. data/lib/files.com/models/folder.rb +357 -0
  92. data/lib/files.com/models/group.rb +208 -0
  93. data/lib/files.com/models/group_user.rb +171 -0
  94. data/lib/files.com/models/history.rb +228 -0
  95. data/lib/files.com/models/history_export.rb +353 -0
  96. data/lib/files.com/models/image.rb +22 -0
  97. data/lib/files.com/models/invoice.rb +117 -0
  98. data/lib/files.com/models/invoice_line_item.rb +57 -0
  99. data/lib/files.com/models/ip_address.rb +66 -0
  100. data/lib/files.com/models/lock.rb +173 -0
  101. data/lib/files.com/models/message.rb +201 -0
  102. data/lib/files.com/models/message_comment.rb +165 -0
  103. data/lib/files.com/models/message_comment_reaction.rb +128 -0
  104. data/lib/files.com/models/message_reaction.rb +128 -0
  105. data/lib/files.com/models/notification.rb +263 -0
  106. data/lib/files.com/models/payment.rb +117 -0
  107. data/lib/files.com/models/payment_line_item.rb +37 -0
  108. data/lib/files.com/models/permission.rb +172 -0
  109. data/lib/files.com/models/preview.rb +37 -0
  110. data/lib/files.com/models/project.rb +140 -0
  111. data/lib/files.com/models/public_ip_address.rb +22 -0
  112. data/lib/files.com/models/public_key.rb +179 -0
  113. data/lib/files.com/models/remote_server.rb +680 -0
  114. data/lib/files.com/models/request.rb +179 -0
  115. data/lib/files.com/models/session.rb +247 -0
  116. data/lib/files.com/models/site.rb +733 -0
  117. data/lib/files.com/models/sso_strategy.rb +227 -0
  118. data/lib/files.com/models/status.rb +37 -0
  119. data/lib/files.com/models/style.rb +131 -0
  120. data/lib/files.com/models/usage_daily_snapshot.rb +66 -0
  121. data/lib/files.com/models/usage_snapshot.rb +96 -0
  122. data/lib/files.com/models/user.rb +876 -0
  123. data/lib/files.com/models/user_cipher_use.rb +63 -0
  124. data/lib/files.com/models/user_request.rb +127 -0
  125. data/lib/files.com/response.rb +25 -0
  126. data/lib/files.com/sizable_io.rb +32 -0
  127. data/lib/files.com/system_profiler.rb +56 -0
  128. data/lib/files.com/util.rb +106 -0
  129. data/lib/files.com/version.rb +5 -0
  130. data/spec/list_spec.rb +214 -0
  131. data/spec/models/file_spec.rb +68 -0
  132. data/spec/models/folder_spec.rb +40 -0
  133. data/spec/spec_helper.rb +36 -0
  134. data/test.sh +8 -0
  135. data/test/test.rb +75 -0
  136. metadata +235 -0
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class UsageSnapshot
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - Site usage ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ # date-time - Site usage report start date/time
18
+ def start_at
19
+ @attributes[:start_at]
20
+ end
21
+
22
+ # date-time - Site usage report end date/time
23
+ def end_at
24
+ @attributes[:end_at]
25
+ end
26
+
27
+ # date-time - Site usage report created at date/time
28
+ def created_at
29
+ @attributes[:created_at]
30
+ end
31
+
32
+ # double - Current site usage as of report
33
+ def current_storage
34
+ @attributes[:current_storage]
35
+ end
36
+
37
+ # double - Site usage report highest usage in time period
38
+ def high_water_storage
39
+ @attributes[:high_water_storage]
40
+ end
41
+
42
+ # int64 - Number of downloads in report time period
43
+ def total_downloads
44
+ @attributes[:total_downloads]
45
+ end
46
+
47
+ # int64 - Number of uploads in time period
48
+ def total_uploads
49
+ @attributes[:total_uploads]
50
+ end
51
+
52
+ # date-time - The last time this site usage report was updated
53
+ def updated_at
54
+ @attributes[:updated_at]
55
+ end
56
+
57
+ # object - A map of root folders to their total usage
58
+ def usage_by_top_level_dir
59
+ @attributes[:usage_by_top_level_dir]
60
+ end
61
+
62
+ # double - Usage for root folder
63
+ def root_storage
64
+ @attributes[:root_storage]
65
+ end
66
+
67
+ # double - Usage for files that are deleted but uploaded within last 30 days
68
+ def deleted_files_counted_in_minimum
69
+ @attributes[:deleted_files_counted_in_minimum]
70
+ end
71
+
72
+ # double - Usage for files that are deleted but retained as backups
73
+ def deleted_files_storage
74
+ @attributes[:deleted_files_storage]
75
+ end
76
+
77
+ # Parameters:
78
+ # page - int64 - Current page number.
79
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
80
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
81
+ def self.list(params = {}, options = {})
82
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
83
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
84
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
85
+
86
+ response, options = Api.send_request("/usage_snapshots", :get, params, options)
87
+ response.data.map do |entity_data|
88
+ UsageSnapshot.new(entity_data, options)
89
+ end
90
+ end
91
+
92
+ def self.all(params = {}, options = {})
93
+ list(params, options)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,876 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Files
4
+ class User
5
+ attr_reader :options, :attributes
6
+
7
+ def initialize(attributes = {}, options = {})
8
+ @attributes = attributes || {}
9
+ @options = options || {}
10
+ end
11
+
12
+ # int64 - User ID
13
+ def id
14
+ @attributes[:id]
15
+ end
16
+
17
+ def id=(value)
18
+ @attributes[:id] = value
19
+ end
20
+
21
+ # string - User's username
22
+ def username
23
+ @attributes[:username]
24
+ end
25
+
26
+ def username=(value)
27
+ @attributes[:username] = value
28
+ end
29
+
30
+ # array - List of group IDs of which this user is an administrator
31
+ def admin_group_ids
32
+ @attributes[:admin_group_ids]
33
+ end
34
+
35
+ def admin_group_ids=(value)
36
+ @attributes[:admin_group_ids] = value
37
+ end
38
+
39
+ # string - A list of allowed IPs if applicable. Newline delimited
40
+ def allowed_ips
41
+ @attributes[:allowed_ips]
42
+ end
43
+
44
+ def allowed_ips=(value)
45
+ @attributes[:allowed_ips] = value
46
+ end
47
+
48
+ # boolean - Can the user create Bundles (aka Share Links)? This field will be aliased or renamed in the future to `bundles_permission`.
49
+ def attachments_permission
50
+ @attributes[:attachments_permission]
51
+ end
52
+
53
+ def attachments_permission=(value)
54
+ @attributes[:attachments_permission] = value
55
+ end
56
+
57
+ # int64 - Number of api keys associated with this user
58
+ def api_keys_count
59
+ @attributes[:api_keys_count]
60
+ end
61
+
62
+ def api_keys_count=(value)
63
+ @attributes[:api_keys_count] = value
64
+ end
65
+
66
+ # date-time - Scheduled Date/Time at which user will be deactivated
67
+ def authenticate_until
68
+ @attributes[:authenticate_until]
69
+ end
70
+
71
+ def authenticate_until=(value)
72
+ @attributes[:authenticate_until] = value
73
+ end
74
+
75
+ # string - How is this user authenticated?
76
+ def authentication_method
77
+ @attributes[:authentication_method]
78
+ end
79
+
80
+ def authentication_method=(value)
81
+ @attributes[:authentication_method] = value
82
+ end
83
+
84
+ # string - URL holding the user's avatar
85
+ def avatar_url
86
+ @attributes[:avatar_url]
87
+ end
88
+
89
+ def avatar_url=(value)
90
+ @attributes[:avatar_url] = value
91
+ end
92
+
93
+ # boolean - Allow this user to perform operations on the account, payments, and invoices?
94
+ def billing_permission
95
+ @attributes[:billing_permission]
96
+ end
97
+
98
+ def billing_permission=(value)
99
+ @attributes[:billing_permission] = value
100
+ end
101
+
102
+ # boolean - Allow this user to skip site-wide IP blacklists?
103
+ def bypass_site_allowed_ips
104
+ @attributes[:bypass_site_allowed_ips]
105
+ end
106
+
107
+ def bypass_site_allowed_ips=(value)
108
+ @attributes[:bypass_site_allowed_ips] = value
109
+ end
110
+
111
+ # boolean - Exempt this user from being disabled based on inactivity?
112
+ def bypass_inactive_disable
113
+ @attributes[:bypass_inactive_disable]
114
+ end
115
+
116
+ def bypass_inactive_disable=(value)
117
+ @attributes[:bypass_inactive_disable] = value
118
+ end
119
+
120
+ # date-time - When this user was created
121
+ def created_at
122
+ @attributes[:created_at]
123
+ end
124
+
125
+ # boolean - Can the user connect with WebDAV?
126
+ def dav_permission
127
+ @attributes[:dav_permission]
128
+ end
129
+
130
+ def dav_permission=(value)
131
+ @attributes[:dav_permission] = value
132
+ end
133
+
134
+ # 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.
135
+ def disabled
136
+ @attributes[:disabled]
137
+ end
138
+
139
+ def disabled=(value)
140
+ @attributes[:disabled] = value
141
+ end
142
+
143
+ # email - User email address
144
+ def email
145
+ @attributes[:email]
146
+ end
147
+
148
+ def email=(value)
149
+ @attributes[:email] = value
150
+ end
151
+
152
+ # boolean - Can the user access with FTP/FTPS?
153
+ def ftp_permission
154
+ @attributes[:ftp_permission]
155
+ end
156
+
157
+ def ftp_permission=(value)
158
+ @attributes[:ftp_permission] = value
159
+ end
160
+
161
+ # string - Comma-separated list of group IDs of which this user is a member
162
+ def group_ids
163
+ @attributes[:group_ids]
164
+ end
165
+
166
+ def group_ids=(value)
167
+ @attributes[:group_ids] = value
168
+ end
169
+
170
+ # string - Text to display to the user in the header of the UI
171
+ def header_text
172
+ @attributes[:header_text]
173
+ end
174
+
175
+ def header_text=(value)
176
+ @attributes[:header_text] = value
177
+ end
178
+
179
+ # string - Preferred language
180
+ def language
181
+ @attributes[:language]
182
+ end
183
+
184
+ def language=(value)
185
+ @attributes[:language] = value
186
+ end
187
+
188
+ # date-time - User's last login time
189
+ def last_login_at
190
+ @attributes[:last_login_at]
191
+ end
192
+
193
+ def last_login_at=(value)
194
+ @attributes[:last_login_at] = value
195
+ end
196
+
197
+ # string - The last protocol and cipher used
198
+ def last_protocol_cipher
199
+ @attributes[:last_protocol_cipher]
200
+ end
201
+
202
+ def last_protocol_cipher=(value)
203
+ @attributes[:last_protocol_cipher] = value
204
+ end
205
+
206
+ # date-time - Time in the future that the user will no longer be locked out if applicable
207
+ def lockout_expires
208
+ @attributes[:lockout_expires]
209
+ end
210
+
211
+ def lockout_expires=(value)
212
+ @attributes[:lockout_expires] = value
213
+ end
214
+
215
+ # string - User's full name
216
+ def name
217
+ @attributes[:name]
218
+ end
219
+
220
+ def name=(value)
221
+ @attributes[:name] = value
222
+ end
223
+
224
+ # string - Any internal notes on the user
225
+ def notes
226
+ @attributes[:notes]
227
+ end
228
+
229
+ def notes=(value)
230
+ @attributes[:notes] = value
231
+ end
232
+
233
+ # int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
234
+ def notification_daily_send_time
235
+ @attributes[:notification_daily_send_time]
236
+ end
237
+
238
+ def notification_daily_send_time=(value)
239
+ @attributes[:notification_daily_send_time] = value
240
+ end
241
+
242
+ # boolean - Enable integration with Office for the web?
243
+ def office_integration_enabled
244
+ @attributes[:office_integration_enabled]
245
+ end
246
+
247
+ def office_integration_enabled=(value)
248
+ @attributes[:office_integration_enabled] = value
249
+ end
250
+
251
+ # date-time - Last time the user's password was set
252
+ def password_set_at
253
+ @attributes[:password_set_at]
254
+ end
255
+
256
+ def password_set_at=(value)
257
+ @attributes[:password_set_at] = value
258
+ end
259
+
260
+ # int64 - Number of days to allow user to use the same password
261
+ def password_validity_days
262
+ @attributes[:password_validity_days]
263
+ end
264
+
265
+ def password_validity_days=(value)
266
+ @attributes[:password_validity_days] = value
267
+ end
268
+
269
+ # int64 - Number of public keys associated with this user
270
+ def public_keys_count
271
+ @attributes[:public_keys_count]
272
+ end
273
+
274
+ def public_keys_count=(value)
275
+ @attributes[:public_keys_count] = value
276
+ end
277
+
278
+ # boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
279
+ def receive_admin_alerts
280
+ @attributes[:receive_admin_alerts]
281
+ end
282
+
283
+ def receive_admin_alerts=(value)
284
+ @attributes[:receive_admin_alerts] = value
285
+ end
286
+
287
+ # boolean - Is 2fa required to sign in?
288
+ def require_2fa
289
+ @attributes[:require_2fa]
290
+ end
291
+
292
+ def require_2fa=(value)
293
+ @attributes[:require_2fa] = value
294
+ end
295
+
296
+ # boolean - Is a password change required upon next user login?
297
+ def require_password_change
298
+ @attributes[:require_password_change]
299
+ end
300
+
301
+ def require_password_change=(value)
302
+ @attributes[:require_password_change] = value
303
+ end
304
+
305
+ # boolean - Can this user access the REST API?
306
+ def restapi_permission
307
+ @attributes[:restapi_permission]
308
+ end
309
+
310
+ def restapi_permission=(value)
311
+ @attributes[:restapi_permission] = value
312
+ end
313
+
314
+ # boolean - Does this user manage it's own credentials or is it a shared/bot user?
315
+ def self_managed
316
+ @attributes[:self_managed]
317
+ end
318
+
319
+ def self_managed=(value)
320
+ @attributes[:self_managed] = value
321
+ end
322
+
323
+ # boolean - Can the user access with SFTP?
324
+ def sftp_permission
325
+ @attributes[:sftp_permission]
326
+ end
327
+
328
+ def sftp_permission=(value)
329
+ @attributes[:sftp_permission] = value
330
+ end
331
+
332
+ # boolean - Is the user an administrator for this site?
333
+ def site_admin
334
+ @attributes[:site_admin]
335
+ end
336
+
337
+ def site_admin=(value)
338
+ @attributes[:site_admin] = value
339
+ end
340
+
341
+ # boolean - Skip Welcome page in the UI?
342
+ def skip_welcome_screen
343
+ @attributes[:skip_welcome_screen]
344
+ end
345
+
346
+ def skip_welcome_screen=(value)
347
+ @attributes[:skip_welcome_screen] = value
348
+ end
349
+
350
+ # string - SSL required setting
351
+ def ssl_required
352
+ @attributes[:ssl_required]
353
+ end
354
+
355
+ def ssl_required=(value)
356
+ @attributes[:ssl_required] = value
357
+ end
358
+
359
+ # int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
360
+ def sso_strategy_id
361
+ @attributes[:sso_strategy_id]
362
+ end
363
+
364
+ def sso_strategy_id=(value)
365
+ @attributes[:sso_strategy_id] = value
366
+ end
367
+
368
+ # boolean - Is the user subscribed to the newsletter?
369
+ def subscribe_to_newsletter
370
+ @attributes[:subscribe_to_newsletter]
371
+ end
372
+
373
+ def subscribe_to_newsletter=(value)
374
+ @attributes[:subscribe_to_newsletter] = value
375
+ end
376
+
377
+ # boolean - Is this user managed by a SsoStrategy?
378
+ def externally_managed
379
+ @attributes[:externally_managed]
380
+ end
381
+
382
+ def externally_managed=(value)
383
+ @attributes[:externally_managed] = value
384
+ end
385
+
386
+ # string - User time zone
387
+ def time_zone
388
+ @attributes[:time_zone]
389
+ end
390
+
391
+ def time_zone=(value)
392
+ @attributes[:time_zone] = value
393
+ end
394
+
395
+ # string - Type(s) of 2FA methods in use. Will be either `sms`, `totp`, `u2f`, `yubi`, or multiple values sorted alphabetically and joined by an underscore.
396
+ def type_of_2fa
397
+ @attributes[:type_of_2fa]
398
+ end
399
+
400
+ def type_of_2fa=(value)
401
+ @attributes[:type_of_2fa] = value
402
+ end
403
+
404
+ # 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.
405
+ def user_root
406
+ @attributes[:user_root]
407
+ end
408
+
409
+ def user_root=(value)
410
+ @attributes[:user_root] = value
411
+ end
412
+
413
+ # file - An image file for your user avatar.
414
+ def avatar_file
415
+ @attributes[:avatar_file]
416
+ end
417
+
418
+ def avatar_file=(value)
419
+ @attributes[:avatar_file] = value
420
+ end
421
+
422
+ # boolean - If true, the avatar will be deleted.
423
+ def avatar_delete
424
+ @attributes[:avatar_delete]
425
+ end
426
+
427
+ def avatar_delete=(value)
428
+ @attributes[:avatar_delete] = value
429
+ end
430
+
431
+ # string - Used for changing a password on an existing user.
432
+ def change_password
433
+ @attributes[:change_password]
434
+ end
435
+
436
+ def change_password=(value)
437
+ @attributes[:change_password] = value
438
+ end
439
+
440
+ # string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
441
+ def change_password_confirmation
442
+ @attributes[:change_password_confirmation]
443
+ end
444
+
445
+ def change_password_confirmation=(value)
446
+ @attributes[:change_password_confirmation] = value
447
+ end
448
+
449
+ # string - Permission to grant on the user root. Can be blank or `full`, `read`, `write`, `list`, or `history`.
450
+ def grant_permission
451
+ @attributes[:grant_permission]
452
+ end
453
+
454
+ def grant_permission=(value)
455
+ @attributes[:grant_permission] = value
456
+ end
457
+
458
+ # int64 - Group ID to associate this user with.
459
+ def group_id
460
+ @attributes[:group_id]
461
+ end
462
+
463
+ def group_id=(value)
464
+ @attributes[:group_id] = value
465
+ end
466
+
467
+ # string - User password.
468
+ def password
469
+ @attributes[:password]
470
+ end
471
+
472
+ def password=(value)
473
+ @attributes[:password] = value
474
+ end
475
+
476
+ # string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
477
+ def password_confirmation
478
+ @attributes[:password_confirmation]
479
+ end
480
+
481
+ def password_confirmation=(value)
482
+ @attributes[:password_confirmation] = value
483
+ end
484
+
485
+ # boolean - Signifies that the user has read all the announcements in the UI.
486
+ def announcements_read
487
+ @attributes[:announcements_read]
488
+ end
489
+
490
+ def announcements_read=(value)
491
+ @attributes[:announcements_read] = value
492
+ end
493
+
494
+ # Unlock user who has been locked out due to failed logins
495
+ def unlock(params = {})
496
+ params ||= {}
497
+ params[:id] = @attributes[:id]
498
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
499
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
500
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
501
+
502
+ Api.send_request("/users/#{@attributes[:id]}/unlock", :post, params, @options)
503
+ end
504
+
505
+ # Resend user welcome email
506
+ def resend_welcome_email(params = {})
507
+ params ||= {}
508
+ params[:id] = @attributes[:id]
509
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
510
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
511
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
512
+
513
+ Api.send_request("/users/#{@attributes[:id]}/resend_welcome_email", :post, params, @options)
514
+ end
515
+
516
+ # Trigger 2FA Reset process for user who has lost access to their existing 2FA methods
517
+ def user_2fa_reset(params = {})
518
+ params ||= {}
519
+ params[:id] = @attributes[:id]
520
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
521
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
522
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
523
+
524
+ Api.send_request("/users/#{@attributes[:id]}/2fa/reset", :post, params, @options)
525
+ end
526
+
527
+ # Parameters:
528
+ # avatar_file - file - An image file for your user avatar.
529
+ # avatar_delete - boolean - If true, the avatar will be deleted.
530
+ # change_password - string - Used for changing a password on an existing user.
531
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
532
+ # email - string - User's email.
533
+ # grant_permission - string - Permission to grant on the user root. Can be blank or `full`, `read`, `write`, `list`, or `history`.
534
+ # group_id - int64 - Group ID to associate this user with.
535
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
536
+ # password - string - User password.
537
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
538
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
539
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
540
+ # attachments_permission - boolean - Can the user create Bundles (aka Share Links)? This field will be aliased or renamed in the future to `bundles_permission`.
541
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
542
+ # authentication_method - string - How is this user authenticated?
543
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
544
+ # bypass_inactive_disable - boolean - Exempt this user from being disabled based on inactivity?
545
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
546
+ # dav_permission - boolean - Can the user connect with WebDAV?
547
+ # 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.
548
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
549
+ # header_text - string - Text to display to the user in the header of the UI
550
+ # language - string - Preferred language
551
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
552
+ # name - string - User's full name
553
+ # notes - string - Any internal notes on the user
554
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
555
+ # password_validity_days - int64 - Number of days to allow user to use the same password
556
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
557
+ # require_password_change - boolean - Is a password change required upon next user login?
558
+ # restapi_permission - boolean - Can this user access the REST API?
559
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
560
+ # sftp_permission - boolean - Can the user access with SFTP?
561
+ # site_admin - boolean - Is the user an administrator for this site?
562
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
563
+ # ssl_required - string - SSL required setting
564
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
565
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
566
+ # time_zone - string - User time zone
567
+ # 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.
568
+ # username - string - User's username
569
+ def update(params = {})
570
+ params ||= {}
571
+ params[:id] = @attributes[:id]
572
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
573
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
574
+ raise InvalidParameterError.new("Bad parameter: change_password must be an String") if params.dig(:change_password) and !params.dig(:change_password).is_a?(String)
575
+ raise InvalidParameterError.new("Bad parameter: change_password_confirmation must be an String") if params.dig(:change_password_confirmation) and !params.dig(:change_password_confirmation).is_a?(String)
576
+ raise InvalidParameterError.new("Bad parameter: email must be an String") if params.dig(:email) and !params.dig(:email).is_a?(String)
577
+ raise InvalidParameterError.new("Bad parameter: grant_permission must be an String") if params.dig(:grant_permission) and !params.dig(:grant_permission).is_a?(String)
578
+ raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
579
+ raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params.dig(:group_ids) and !params.dig(:group_ids).is_a?(String)
580
+ raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
581
+ raise InvalidParameterError.new("Bad parameter: password_confirmation must be an String") if params.dig(:password_confirmation) and !params.dig(:password_confirmation).is_a?(String)
582
+ raise InvalidParameterError.new("Bad parameter: allowed_ips must be an String") if params.dig(:allowed_ips) and !params.dig(:allowed_ips).is_a?(String)
583
+ raise InvalidParameterError.new("Bad parameter: authenticate_until must be an String") if params.dig(:authenticate_until) and !params.dig(:authenticate_until).is_a?(String)
584
+ raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if params.dig(:authentication_method) and !params.dig(:authentication_method).is_a?(String)
585
+ raise InvalidParameterError.new("Bad parameter: header_text must be an String") if params.dig(:header_text) and !params.dig(:header_text).is_a?(String)
586
+ raise InvalidParameterError.new("Bad parameter: language must be an String") if params.dig(:language) and !params.dig(:language).is_a?(String)
587
+ raise InvalidParameterError.new("Bad parameter: notification_daily_send_time must be an Integer") if params.dig(:notification_daily_send_time) and !params.dig(:notification_daily_send_time).is_a?(Integer)
588
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
589
+ raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
590
+ raise InvalidParameterError.new("Bad parameter: password_validity_days must be an Integer") if params.dig(:password_validity_days) and !params.dig(:password_validity_days).is_a?(Integer)
591
+ raise InvalidParameterError.new("Bad parameter: ssl_required must be an String") if params.dig(:ssl_required) and !params.dig(:ssl_required).is_a?(String)
592
+ raise InvalidParameterError.new("Bad parameter: sso_strategy_id must be an Integer") if params.dig(:sso_strategy_id) and !params.dig(:sso_strategy_id).is_a?(Integer)
593
+ raise InvalidParameterError.new("Bad parameter: time_zone must be an String") if params.dig(:time_zone) and !params.dig(:time_zone).is_a?(String)
594
+ raise InvalidParameterError.new("Bad parameter: user_root must be an String") if params.dig(:user_root) and !params.dig(:user_root).is_a?(String)
595
+ raise InvalidParameterError.new("Bad parameter: username must be an String") if params.dig(:username) and !params.dig(:username).is_a?(String)
596
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
597
+
598
+ Api.send_request("/users/#{@attributes[:id]}", :patch, params, @options)
599
+ end
600
+
601
+ def delete(params = {})
602
+ params ||= {}
603
+ params[:id] = @attributes[:id]
604
+ raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
605
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
606
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
607
+
608
+ Api.send_request("/users/#{@attributes[:id]}", :delete, params, @options)
609
+ end
610
+
611
+ def destroy(params = {})
612
+ delete(params)
613
+ end
614
+
615
+ def save
616
+ if @attributes[:id]
617
+ update(@attributes)
618
+ else
619
+ new_obj = User.create(@attributes, @options)
620
+ @attributes = new_obj.attributes
621
+ end
622
+ end
623
+
624
+ # Parameters:
625
+ # page - int64 - Current page number.
626
+ # per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
627
+ # action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
628
+ # cursor - string - Send cursor to resume an existing list from the point at which you left off. Get a cursor from an existing list via the X-Files-Cursor-Next header.
629
+ # sort_by - object - If set, sort records by the specified field in either 'asc' or 'desc' direction (e.g. sort_by[last_login_at]=desc). Valid fields are `active`, `master_admin`, `site_id`, `authenticate_until`, `email`, `last_desktop_login_at`, `last_login_at`, `username`, `notes`, `site_admin`, `receive_admin_alerts`, `allowed_ips`, `password_validity_days`, `ssl_required` or `not_site_admin`.
630
+ # filter - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
631
+ # filter_gt - object - If set, return records where the specifiied field is greater than the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
632
+ # filter_gteq - object - If set, return records where the specifiied field is greater than or equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
633
+ # filter_like - object - If set, return records where the specifiied field is equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
634
+ # filter_lt - object - If set, return records where the specifiied field is less than the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
635
+ # filter_lteq - object - If set, return records where the specifiied field is less than or equal to the supplied value. Valid fields are `username`, `email`, `notes`, `site_admin`, `allowed_ips`, `password_validity_days`, `ssl_required`, `last_login_at`, `authenticate_until` or `not_site_admin`.
636
+ # ids - string - comma-separated list of User IDs
637
+ # q[username] - string - List users matching username.
638
+ # q[email] - string - List users matching email.
639
+ # q[notes] - string - List users matching notes field.
640
+ # q[admin] - string - If `true`, list only admin users.
641
+ # q[allowed_ips] - string - If set, list only users with overridden allowed IP setting.
642
+ # q[password_validity_days] - string - If set, list only users with overridden password validity days setting.
643
+ # q[ssl_required] - string - If set, list only users with overridden SSL required setting.
644
+ # search - string - Searches for partial matches of name, username, or email.
645
+ def self.list(params = {}, options = {})
646
+ raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
647
+ raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
648
+ raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
649
+ raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)
650
+ raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params.dig(:sort_by) and !params.dig(:sort_by).is_a?(Hash)
651
+ raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params.dig(:filter) and !params.dig(:filter).is_a?(Hash)
652
+ raise InvalidParameterError.new("Bad parameter: filter_gt must be an Hash") if params.dig(:filter_gt) and !params.dig(:filter_gt).is_a?(Hash)
653
+ raise InvalidParameterError.new("Bad parameter: filter_gteq must be an Hash") if params.dig(:filter_gteq) and !params.dig(:filter_gteq).is_a?(Hash)
654
+ raise InvalidParameterError.new("Bad parameter: filter_like must be an Hash") if params.dig(:filter_like) and !params.dig(:filter_like).is_a?(Hash)
655
+ raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params.dig(:filter_lt) and !params.dig(:filter_lt).is_a?(Hash)
656
+ raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params.dig(:filter_lteq) and !params.dig(:filter_lteq).is_a?(Hash)
657
+ raise InvalidParameterError.new("Bad parameter: ids must be an String") if params.dig(:ids) and !params.dig(:ids).is_a?(String)
658
+ raise InvalidParameterError.new("Bad parameter: search must be an String") if params.dig(:search) and !params.dig(:search).is_a?(String)
659
+
660
+ List.new(User, params) do
661
+ Api.send_request("/users", :get, params, options)
662
+ end
663
+ end
664
+
665
+ def self.all(params = {}, options = {})
666
+ list(params, options)
667
+ end
668
+
669
+ # Parameters:
670
+ # id (required) - int64 - User ID.
671
+ def self.find(id, params = {}, options = {})
672
+ params ||= {}
673
+ params[:id] = id
674
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
675
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
676
+
677
+ response, options = Api.send_request("/users/#{params[:id]}", :get, params, options)
678
+ User.new(response.data, options)
679
+ end
680
+
681
+ def self.get(id, params = {}, options = {})
682
+ find(id, params, options)
683
+ end
684
+
685
+ # Parameters:
686
+ # avatar_file - file - An image file for your user avatar.
687
+ # avatar_delete - boolean - If true, the avatar will be deleted.
688
+ # change_password - string - Used for changing a password on an existing user.
689
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
690
+ # email - string - User's email.
691
+ # grant_permission - string - Permission to grant on the user root. Can be blank or `full`, `read`, `write`, `list`, or `history`.
692
+ # group_id - int64 - Group ID to associate this user with.
693
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
694
+ # password - string - User password.
695
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
696
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
697
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
698
+ # attachments_permission - boolean - Can the user create Bundles (aka Share Links)? This field will be aliased or renamed in the future to `bundles_permission`.
699
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
700
+ # authentication_method - string - How is this user authenticated?
701
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
702
+ # bypass_inactive_disable - boolean - Exempt this user from being disabled based on inactivity?
703
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
704
+ # dav_permission - boolean - Can the user connect with WebDAV?
705
+ # 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.
706
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
707
+ # header_text - string - Text to display to the user in the header of the UI
708
+ # language - string - Preferred language
709
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
710
+ # name - string - User's full name
711
+ # notes - string - Any internal notes on the user
712
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
713
+ # password_validity_days - int64 - Number of days to allow user to use the same password
714
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
715
+ # require_password_change - boolean - Is a password change required upon next user login?
716
+ # restapi_permission - boolean - Can this user access the REST API?
717
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
718
+ # sftp_permission - boolean - Can the user access with SFTP?
719
+ # site_admin - boolean - Is the user an administrator for this site?
720
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
721
+ # ssl_required - string - SSL required setting
722
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
723
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
724
+ # time_zone - string - User time zone
725
+ # 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.
726
+ # username - string - User's username
727
+ def self.create(params = {}, options = {})
728
+ raise InvalidParameterError.new("Bad parameter: change_password must be an String") if params.dig(:change_password) and !params.dig(:change_password).is_a?(String)
729
+ raise InvalidParameterError.new("Bad parameter: change_password_confirmation must be an String") if params.dig(:change_password_confirmation) and !params.dig(:change_password_confirmation).is_a?(String)
730
+ raise InvalidParameterError.new("Bad parameter: email must be an String") if params.dig(:email) and !params.dig(:email).is_a?(String)
731
+ raise InvalidParameterError.new("Bad parameter: grant_permission must be an String") if params.dig(:grant_permission) and !params.dig(:grant_permission).is_a?(String)
732
+ raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
733
+ raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params.dig(:group_ids) and !params.dig(:group_ids).is_a?(String)
734
+ raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
735
+ raise InvalidParameterError.new("Bad parameter: password_confirmation must be an String") if params.dig(:password_confirmation) and !params.dig(:password_confirmation).is_a?(String)
736
+ raise InvalidParameterError.new("Bad parameter: allowed_ips must be an String") if params.dig(:allowed_ips) and !params.dig(:allowed_ips).is_a?(String)
737
+ raise InvalidParameterError.new("Bad parameter: authenticate_until must be an String") if params.dig(:authenticate_until) and !params.dig(:authenticate_until).is_a?(String)
738
+ raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if params.dig(:authentication_method) and !params.dig(:authentication_method).is_a?(String)
739
+ raise InvalidParameterError.new("Bad parameter: header_text must be an String") if params.dig(:header_text) and !params.dig(:header_text).is_a?(String)
740
+ raise InvalidParameterError.new("Bad parameter: language must be an String") if params.dig(:language) and !params.dig(:language).is_a?(String)
741
+ raise InvalidParameterError.new("Bad parameter: notification_daily_send_time must be an Integer") if params.dig(:notification_daily_send_time) and !params.dig(:notification_daily_send_time).is_a?(Integer)
742
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
743
+ raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
744
+ raise InvalidParameterError.new("Bad parameter: password_validity_days must be an Integer") if params.dig(:password_validity_days) and !params.dig(:password_validity_days).is_a?(Integer)
745
+ raise InvalidParameterError.new("Bad parameter: ssl_required must be an String") if params.dig(:ssl_required) and !params.dig(:ssl_required).is_a?(String)
746
+ raise InvalidParameterError.new("Bad parameter: sso_strategy_id must be an Integer") if params.dig(:sso_strategy_id) and !params.dig(:sso_strategy_id).is_a?(Integer)
747
+ raise InvalidParameterError.new("Bad parameter: time_zone must be an String") if params.dig(:time_zone) and !params.dig(:time_zone).is_a?(String)
748
+ raise InvalidParameterError.new("Bad parameter: user_root must be an String") if params.dig(:user_root) and !params.dig(:user_root).is_a?(String)
749
+ raise InvalidParameterError.new("Bad parameter: username must be an String") if params.dig(:username) and !params.dig(:username).is_a?(String)
750
+
751
+ response, options = Api.send_request("/users", :post, params, options)
752
+ User.new(response.data, options)
753
+ end
754
+
755
+ # Unlock user who has been locked out due to failed logins
756
+ def self.unlock(id, params = {}, options = {})
757
+ params ||= {}
758
+ params[:id] = id
759
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
760
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
761
+
762
+ response, _options = Api.send_request("/users/#{params[:id]}/unlock", :post, params, options)
763
+ response.data
764
+ end
765
+
766
+ # Resend user welcome email
767
+ def self.resend_welcome_email(id, params = {}, options = {})
768
+ params ||= {}
769
+ params[:id] = id
770
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
771
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
772
+
773
+ response, _options = Api.send_request("/users/#{params[:id]}/resend_welcome_email", :post, params, options)
774
+ response.data
775
+ end
776
+
777
+ # Trigger 2FA Reset process for user who has lost access to their existing 2FA methods
778
+ def self.user_2fa_reset(id, params = {}, options = {})
779
+ params ||= {}
780
+ params[:id] = id
781
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
782
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
783
+
784
+ response, _options = Api.send_request("/users/#{params[:id]}/2fa/reset", :post, params, options)
785
+ response.data
786
+ end
787
+
788
+ # Parameters:
789
+ # avatar_file - file - An image file for your user avatar.
790
+ # avatar_delete - boolean - If true, the avatar will be deleted.
791
+ # change_password - string - Used for changing a password on an existing user.
792
+ # change_password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `change_password`.
793
+ # email - string - User's email.
794
+ # grant_permission - string - Permission to grant on the user root. Can be blank or `full`, `read`, `write`, `list`, or `history`.
795
+ # group_id - int64 - Group ID to associate this user with.
796
+ # group_ids - string - A list of group ids to associate this user with. Comma delimited.
797
+ # password - string - User password.
798
+ # password_confirmation - string - Optional, but if provided, we will ensure that it matches the value sent in `password`.
799
+ # announcements_read - boolean - Signifies that the user has read all the announcements in the UI.
800
+ # allowed_ips - string - A list of allowed IPs if applicable. Newline delimited
801
+ # attachments_permission - boolean - Can the user create Bundles (aka Share Links)? This field will be aliased or renamed in the future to `bundles_permission`.
802
+ # authenticate_until - string - Scheduled Date/Time at which user will be deactivated
803
+ # authentication_method - string - How is this user authenticated?
804
+ # billing_permission - boolean - Allow this user to perform operations on the account, payments, and invoices?
805
+ # bypass_inactive_disable - boolean - Exempt this user from being disabled based on inactivity?
806
+ # bypass_site_allowed_ips - boolean - Allow this user to skip site-wide IP blacklists?
807
+ # dav_permission - boolean - Can the user connect with WebDAV?
808
+ # 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.
809
+ # ftp_permission - boolean - Can the user access with FTP/FTPS?
810
+ # header_text - string - Text to display to the user in the header of the UI
811
+ # language - string - Preferred language
812
+ # notification_daily_send_time - int64 - Hour of the day at which daily notifications should be sent. Can be in range 0 to 23
813
+ # name - string - User's full name
814
+ # notes - string - Any internal notes on the user
815
+ # office_integration_enabled - boolean - Enable integration with Office for the web?
816
+ # password_validity_days - int64 - Number of days to allow user to use the same password
817
+ # receive_admin_alerts - boolean - Should the user receive admin alerts such a certificate expiration notifications and overages?
818
+ # require_password_change - boolean - Is a password change required upon next user login?
819
+ # restapi_permission - boolean - Can this user access the REST API?
820
+ # self_managed - boolean - Does this user manage it's own credentials or is it a shared/bot user?
821
+ # sftp_permission - boolean - Can the user access with SFTP?
822
+ # site_admin - boolean - Is the user an administrator for this site?
823
+ # skip_welcome_screen - boolean - Skip Welcome page in the UI?
824
+ # ssl_required - string - SSL required setting
825
+ # sso_strategy_id - int64 - SSO (Single Sign On) strategy ID for the user, if applicable.
826
+ # subscribe_to_newsletter - boolean - Is the user subscribed to the newsletter?
827
+ # time_zone - string - User time zone
828
+ # 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.
829
+ # username - string - User's username
830
+ def self.update(id, params = {}, options = {})
831
+ params ||= {}
832
+ params[:id] = id
833
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
834
+ raise InvalidParameterError.new("Bad parameter: change_password must be an String") if params.dig(:change_password) and !params.dig(:change_password).is_a?(String)
835
+ raise InvalidParameterError.new("Bad parameter: change_password_confirmation must be an String") if params.dig(:change_password_confirmation) and !params.dig(:change_password_confirmation).is_a?(String)
836
+ raise InvalidParameterError.new("Bad parameter: email must be an String") if params.dig(:email) and !params.dig(:email).is_a?(String)
837
+ raise InvalidParameterError.new("Bad parameter: grant_permission must be an String") if params.dig(:grant_permission) and !params.dig(:grant_permission).is_a?(String)
838
+ raise InvalidParameterError.new("Bad parameter: group_id must be an Integer") if params.dig(:group_id) and !params.dig(:group_id).is_a?(Integer)
839
+ raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params.dig(:group_ids) and !params.dig(:group_ids).is_a?(String)
840
+ raise InvalidParameterError.new("Bad parameter: password must be an String") if params.dig(:password) and !params.dig(:password).is_a?(String)
841
+ raise InvalidParameterError.new("Bad parameter: password_confirmation must be an String") if params.dig(:password_confirmation) and !params.dig(:password_confirmation).is_a?(String)
842
+ raise InvalidParameterError.new("Bad parameter: allowed_ips must be an String") if params.dig(:allowed_ips) and !params.dig(:allowed_ips).is_a?(String)
843
+ raise InvalidParameterError.new("Bad parameter: authenticate_until must be an String") if params.dig(:authenticate_until) and !params.dig(:authenticate_until).is_a?(String)
844
+ raise InvalidParameterError.new("Bad parameter: authentication_method must be an String") if params.dig(:authentication_method) and !params.dig(:authentication_method).is_a?(String)
845
+ raise InvalidParameterError.new("Bad parameter: header_text must be an String") if params.dig(:header_text) and !params.dig(:header_text).is_a?(String)
846
+ raise InvalidParameterError.new("Bad parameter: language must be an String") if params.dig(:language) and !params.dig(:language).is_a?(String)
847
+ raise InvalidParameterError.new("Bad parameter: notification_daily_send_time must be an Integer") if params.dig(:notification_daily_send_time) and !params.dig(:notification_daily_send_time).is_a?(Integer)
848
+ raise InvalidParameterError.new("Bad parameter: name must be an String") if params.dig(:name) and !params.dig(:name).is_a?(String)
849
+ raise InvalidParameterError.new("Bad parameter: notes must be an String") if params.dig(:notes) and !params.dig(:notes).is_a?(String)
850
+ raise InvalidParameterError.new("Bad parameter: password_validity_days must be an Integer") if params.dig(:password_validity_days) and !params.dig(:password_validity_days).is_a?(Integer)
851
+ raise InvalidParameterError.new("Bad parameter: ssl_required must be an String") if params.dig(:ssl_required) and !params.dig(:ssl_required).is_a?(String)
852
+ raise InvalidParameterError.new("Bad parameter: sso_strategy_id must be an Integer") if params.dig(:sso_strategy_id) and !params.dig(:sso_strategy_id).is_a?(Integer)
853
+ raise InvalidParameterError.new("Bad parameter: time_zone must be an String") if params.dig(:time_zone) and !params.dig(:time_zone).is_a?(String)
854
+ raise InvalidParameterError.new("Bad parameter: user_root must be an String") if params.dig(:user_root) and !params.dig(:user_root).is_a?(String)
855
+ raise InvalidParameterError.new("Bad parameter: username must be an String") if params.dig(:username) and !params.dig(:username).is_a?(String)
856
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
857
+
858
+ response, options = Api.send_request("/users/#{params[:id]}", :patch, params, options)
859
+ User.new(response.data, options)
860
+ end
861
+
862
+ def self.delete(id, params = {}, options = {})
863
+ params ||= {}
864
+ params[:id] = id
865
+ raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
866
+ raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
867
+
868
+ response, _options = Api.send_request("/users/#{params[:id]}", :delete, params, options)
869
+ response.data
870
+ end
871
+
872
+ def self.destroy(id, params = {}, options = {})
873
+ delete(id, params, options)
874
+ end
875
+ end
876
+ end