files.com 1.1.18 → 1.2.0
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.
- package/.eslintrc.js +0 -3
- package/_VERSION +1 -1
- package/docs/Errors.md +1 -0
- package/lib/Api.js +1 -1
- package/lib/Errors.js +957 -933
- package/lib/Files.js +1 -1
- package/lib/models/ActionNotificationExport.js +25 -25
- package/lib/models/ActionNotificationExportResult.js +10 -10
- package/lib/models/ActionWebhookFailure.js +5 -9
- package/lib/models/ApiKey.js +62 -70
- package/lib/models/App.js +5 -5
- package/lib/models/As2IncomingMessage.js +7 -7
- package/lib/models/As2OutgoingMessage.js +7 -7
- package/lib/models/As2Partner.js +54 -58
- package/lib/models/As2Station.js +51 -55
- package/lib/models/Automation.js +102 -110
- package/lib/models/AutomationRun.js +13 -13
- package/lib/models/BandwidthSnapshot.js +5 -5
- package/lib/models/Behavior.js +77 -85
- package/lib/models/Bundle.js +102 -110
- package/lib/models/BundleDownload.js +9 -9
- package/lib/models/BundleNotification.js +37 -41
- package/lib/models/BundleRecipient.js +22 -22
- package/lib/models/BundleRegistration.js +7 -7
- package/lib/models/Clickwrap.js +52 -56
- package/lib/models/DnsRecord.js +5 -5
- package/lib/models/EmailIncomingMessage.js +5 -5
- package/lib/models/ExternalEvent.js +18 -18
- package/lib/models/File.js +89 -93
- package/lib/models/FileComment.js +41 -45
- package/lib/models/FileCommentReaction.js +15 -19
- package/lib/models/FileMigration.js +5 -5
- package/lib/models/Folder.js +24 -24
- package/lib/models/FormFieldSet.js +44 -48
- package/lib/models/GpgKey.js +53 -57
- package/lib/models/Group.js +51 -55
- package/lib/models/GroupUser.js +53 -57
- package/lib/models/History.js +72 -72
- package/lib/models/HistoryExport.js +51 -51
- package/lib/models/HistoryExportResult.js +10 -10
- package/lib/models/InboxRecipient.js +22 -22
- package/lib/models/InboxRegistration.js +7 -7
- package/lib/models/InboxUpload.js +9 -9
- package/lib/models/Invoice.js +12 -12
- package/lib/models/IpAddress.js +17 -17
- package/lib/models/Lock.js +27 -31
- package/lib/models/Message.js +60 -64
- package/lib/models/MessageComment.js +46 -50
- package/lib/models/MessageCommentReaction.js +27 -31
- package/lib/models/MessageReaction.js +27 -31
- package/lib/models/Notification.js +66 -70
- package/lib/models/Payment.js +12 -12
- package/lib/models/Permission.js +28 -32
- package/lib/models/Priority.js +9 -9
- package/lib/models/Project.js +39 -43
- package/lib/models/PublicKey.js +46 -50
- package/lib/models/RemoteBandwidthSnapshot.js +5 -5
- package/lib/models/RemoteServer.js +306 -310
- package/lib/models/Request.js +33 -37
- package/lib/models/Session.js +11 -15
- package/lib/models/SettingsChange.js +5 -5
- package/lib/models/SftpHostKey.js +40 -44
- package/lib/models/ShareGroup.js +50 -54
- package/lib/models/Site.js +138 -138
- package/lib/models/Snapshot.js +44 -48
- package/lib/models/SsoStrategy.js +15 -19
- package/lib/models/Style.js +17 -21
- package/lib/models/UsageDailySnapshot.js +5 -5
- package/lib/models/UsageSnapshot.js +5 -5
- package/lib/models/User.js +156 -172
- package/lib/models/UserCipherUse.js +7 -7
- package/lib/models/UserRequest.js +26 -30
- package/lib/models/WebhookTest.js +15 -15
- package/package.json +6 -2
- package/src/Api.js +2 -1
- package/src/Errors.js +189 -177
- package/src/Files.js +1 -1
- package/src/models/AccountLineItem.js +5 -2
- package/src/models/Action.js +5 -2
- package/src/models/ActionNotificationExport.js +36 -35
- package/src/models/ActionNotificationExportResult.js +15 -13
- package/src/models/ActionWebhookFailure.js +9 -8
- package/src/models/ApiKey.js +69 -72
- package/src/models/App.js +10 -8
- package/src/models/As2IncomingMessage.js +12 -10
- package/src/models/As2OutgoingMessage.js +12 -10
- package/src/models/As2Partner.js +61 -60
- package/src/models/As2Station.js +58 -57
- package/src/models/Auto.js +5 -2
- package/src/models/Automation.js +121 -110
- package/src/models/AutomationRun.js +18 -17
- package/src/models/BandwidthSnapshot.js +10 -8
- package/src/models/Behavior.js +85 -86
- package/src/models/Bundle.js +121 -110
- package/src/models/BundleDownload.js +14 -12
- package/src/models/BundleNotification.js +40 -43
- package/src/models/BundleRecipient.js +33 -32
- package/src/models/BundleRegistration.js +12 -10
- package/src/models/Clickwrap.js +60 -58
- package/src/models/DnsRecord.js +10 -8
- package/src/models/EmailIncomingMessage.js +10 -8
- package/src/models/Errors.js +5 -2
- package/src/models/ExternalEvent.js +29 -29
- package/src/models/File.js +116 -108
- package/src/models/FileAction.js +5 -2
- package/src/models/FileComment.js +45 -46
- package/src/models/FileCommentReaction.js +26 -26
- package/src/models/FileMigration.js +10 -8
- package/src/models/FileUploadPart.js +5 -2
- package/src/models/Folder.js +32 -29
- package/src/models/FormField.js +5 -2
- package/src/models/FormFieldSet.js +49 -50
- package/src/models/GpgKey.js +60 -59
- package/src/models/Group.js +58 -57
- package/src/models/GroupUser.js +60 -58
- package/src/models/History.js +77 -74
- package/src/models/HistoryExport.js +62 -61
- package/src/models/HistoryExportResult.js +15 -13
- package/src/models/Image.js +5 -2
- package/src/models/InboxRecipient.js +33 -32
- package/src/models/InboxRegistration.js +12 -10
- package/src/models/InboxUpload.js +14 -12
- package/src/models/Invoice.js +17 -14
- package/src/models/InvoiceLineItem.js +5 -2
- package/src/models/IpAddress.js +22 -20
- package/src/models/Lock.js +36 -36
- package/src/models/Message.js +66 -66
- package/src/models/MessageComment.js +50 -52
- package/src/models/MessageCommentReaction.js +38 -40
- package/src/models/MessageReaction.js +38 -40
- package/src/models/Notification.js +74 -72
- package/src/models/Payment.js +17 -14
- package/src/models/PaymentLineItem.js +5 -2
- package/src/models/Permission.js +39 -40
- package/src/models/Preview.js +5 -2
- package/src/models/Priority.js +14 -12
- package/src/models/Project.js +43 -45
- package/src/models/PublicIpAddress.js +5 -2
- package/src/models/PublicKey.js +50 -52
- package/src/models/RemoteBandwidthSnapshot.js +10 -8
- package/src/models/RemoteServer.js +380 -312
- package/src/models/RemoteServerConfigurationFile.js +5 -2
- package/src/models/Request.js +44 -46
- package/src/models/Session.js +22 -22
- package/src/models/SettingsChange.js +10 -8
- package/src/models/SftpHostKey.js +45 -46
- package/src/models/ShareGroup.js +56 -56
- package/src/models/ShareGroupMember.js +5 -2
- package/src/models/Site.js +143 -142
- package/src/models/Snapshot.js +50 -50
- package/src/models/SsoStrategy.js +20 -21
- package/src/models/Status.js +5 -2
- package/src/models/Style.js +22 -23
- package/src/models/UsageDailySnapshot.js +10 -8
- package/src/models/UsageSnapshot.js +10 -8
- package/src/models/User.js +185 -168
- package/src/models/UserCipherUse.js +12 -10
- package/src/models/UserRequest.js +37 -39
- package/src/models/WebhookTest.js +26 -24
- package/test/Api.test.js +163 -0
- package/test/{package.json → integration/package.json} +1 -1
- package/test/{src → integration/src}/index.js +1 -1
- package/test.sh +2 -1
- /package/test/{.babelrc → integration/.babelrc} +0 -0
- /package/test/{index.js → integration/index.js} +0 -0
package/src/models/Bundle.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
2
|
import Api from '../Api'
|
|
3
3
|
import * as errors from '../Errors'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getType, isArray, isInt, isObject, isString,
|
|
6
|
+
} from '../utils'
|
|
5
7
|
/* eslint-enable no-unused-vars */
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
|
|
|
9
11
|
*/
|
|
10
12
|
class Bundle {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class Bundle {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// string # Bundle code. This code forms the end part of the Public URL.
|
|
28
32
|
getCode = () => this.attributes.code
|
|
29
33
|
|
|
@@ -321,7 +325,6 @@ class Bundle {
|
|
|
321
325
|
this.attributes.watermark_attachment_delete = value
|
|
322
326
|
}
|
|
323
327
|
|
|
324
|
-
|
|
325
328
|
// Send email(s) with a link to bundle
|
|
326
329
|
//
|
|
327
330
|
// Parameters:
|
|
@@ -338,30 +341,31 @@ class Bundle {
|
|
|
338
341
|
}
|
|
339
342
|
|
|
340
343
|
params.id = this.attributes.id
|
|
341
|
-
if (params
|
|
342
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
344
|
+
if (params.id && !isInt(params.id)) {
|
|
345
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
343
346
|
}
|
|
344
|
-
|
|
345
|
-
|
|
347
|
+
|
|
348
|
+
if (params.to && !isArray(params.to)) {
|
|
349
|
+
throw new errors.InvalidParameterError(`Bad parameter: to must be of type Array, received ${getType(params.to)}`)
|
|
346
350
|
}
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
|
|
352
|
+
if (params.note && !isString(params.note)) {
|
|
353
|
+
throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params.note)}`)
|
|
349
354
|
}
|
|
350
|
-
|
|
351
|
-
|
|
355
|
+
|
|
356
|
+
if (params.recipients && !isArray(params.recipients)) {
|
|
357
|
+
throw new errors.InvalidParameterError(`Bad parameter: recipients must be of type Array, received ${getType(params.recipients)}`)
|
|
352
358
|
}
|
|
353
359
|
|
|
354
|
-
if (!params
|
|
360
|
+
if (!params.id) {
|
|
355
361
|
if (this.attributes.id) {
|
|
356
|
-
params
|
|
362
|
+
params.id = this.id
|
|
357
363
|
} else {
|
|
358
364
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
359
365
|
}
|
|
360
366
|
}
|
|
361
367
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return
|
|
368
|
+
await Api.sendRequest(`/bundles/${encodeURIComponent(params.id)}/share`, 'POST', params, this.options)
|
|
365
369
|
}
|
|
366
370
|
|
|
367
371
|
// Parameters:
|
|
@@ -400,60 +404,72 @@ class Bundle {
|
|
|
400
404
|
}
|
|
401
405
|
|
|
402
406
|
params.id = this.attributes.id
|
|
403
|
-
if (params
|
|
404
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
407
|
+
if (params.id && !isInt(params.id)) {
|
|
408
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
405
409
|
}
|
|
406
|
-
|
|
407
|
-
|
|
410
|
+
|
|
411
|
+
if (params.paths && !isArray(params.paths)) {
|
|
412
|
+
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params.paths)}`)
|
|
408
413
|
}
|
|
409
|
-
|
|
410
|
-
|
|
414
|
+
|
|
415
|
+
if (params.password && !isString(params.password)) {
|
|
416
|
+
throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params.password)}`)
|
|
411
417
|
}
|
|
412
|
-
|
|
413
|
-
|
|
418
|
+
|
|
419
|
+
if (params.form_field_set_id && !isInt(params.form_field_set_id)) {
|
|
420
|
+
throw new errors.InvalidParameterError(`Bad parameter: form_field_set_id must be of type Int, received ${getType(params.form_field_set_id)}`)
|
|
414
421
|
}
|
|
415
|
-
|
|
416
|
-
|
|
422
|
+
|
|
423
|
+
if (params.clickwrap_id && !isInt(params.clickwrap_id)) {
|
|
424
|
+
throw new errors.InvalidParameterError(`Bad parameter: clickwrap_id must be of type Int, received ${getType(params.clickwrap_id)}`)
|
|
417
425
|
}
|
|
418
|
-
|
|
419
|
-
|
|
426
|
+
|
|
427
|
+
if (params.code && !isString(params.code)) {
|
|
428
|
+
throw new errors.InvalidParameterError(`Bad parameter: code must be of type String, received ${getType(params.code)}`)
|
|
420
429
|
}
|
|
421
|
-
|
|
422
|
-
|
|
430
|
+
|
|
431
|
+
if (params.description && !isString(params.description)) {
|
|
432
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
|
423
433
|
}
|
|
424
|
-
|
|
425
|
-
|
|
434
|
+
|
|
435
|
+
if (params.expires_at && !isString(params.expires_at)) {
|
|
436
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
|
|
426
437
|
}
|
|
427
|
-
|
|
428
|
-
|
|
438
|
+
|
|
439
|
+
if (params.inbox_id && !isInt(params.inbox_id)) {
|
|
440
|
+
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
|
|
429
441
|
}
|
|
430
|
-
|
|
431
|
-
|
|
442
|
+
|
|
443
|
+
if (params.max_uses && !isInt(params.max_uses)) {
|
|
444
|
+
throw new errors.InvalidParameterError(`Bad parameter: max_uses must be of type Int, received ${getType(params.max_uses)}`)
|
|
432
445
|
}
|
|
433
|
-
|
|
434
|
-
|
|
446
|
+
|
|
447
|
+
if (params.note && !isString(params.note)) {
|
|
448
|
+
throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params.note)}`)
|
|
435
449
|
}
|
|
436
|
-
|
|
437
|
-
|
|
450
|
+
|
|
451
|
+
if (params.path_template && !isString(params.path_template)) {
|
|
452
|
+
throw new errors.InvalidParameterError(`Bad parameter: path_template must be of type String, received ${getType(params.path_template)}`)
|
|
438
453
|
}
|
|
439
|
-
|
|
440
|
-
|
|
454
|
+
|
|
455
|
+
if (params.permissions && !isString(params.permissions)) {
|
|
456
|
+
throw new errors.InvalidParameterError(`Bad parameter: permissions must be of type String, received ${getType(params.permissions)}`)
|
|
441
457
|
}
|
|
442
|
-
|
|
443
|
-
|
|
458
|
+
|
|
459
|
+
if (params.start_access_on_date && !isString(params.start_access_on_date)) {
|
|
460
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_access_on_date must be of type String, received ${getType(params.start_access_on_date)}`)
|
|
444
461
|
}
|
|
445
462
|
|
|
446
|
-
if (!params
|
|
463
|
+
if (!params.id) {
|
|
447
464
|
if (this.attributes.id) {
|
|
448
|
-
params
|
|
465
|
+
params.id = this.id
|
|
449
466
|
} else {
|
|
450
467
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
451
468
|
}
|
|
452
469
|
}
|
|
453
470
|
|
|
454
|
-
const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params
|
|
471
|
+
const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
|
455
472
|
|
|
456
|
-
|
|
457
473
|
return new Bundle(response?.data, this.options)
|
|
458
474
|
}
|
|
459
475
|
|
|
@@ -467,36 +483,34 @@ class Bundle {
|
|
|
467
483
|
}
|
|
468
484
|
|
|
469
485
|
params.id = this.attributes.id
|
|
470
|
-
if (params
|
|
471
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
486
|
+
if (params.id && !isInt(params.id)) {
|
|
487
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
472
488
|
}
|
|
473
489
|
|
|
474
|
-
if (!params
|
|
490
|
+
if (!params.id) {
|
|
475
491
|
if (this.attributes.id) {
|
|
476
|
-
params
|
|
492
|
+
params.id = this.id
|
|
477
493
|
} else {
|
|
478
494
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
479
495
|
}
|
|
480
496
|
}
|
|
481
497
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
return
|
|
498
|
+
await Api.sendRequest(`/bundles/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
|
485
499
|
}
|
|
486
500
|
|
|
487
501
|
destroy = (params = {}) =>
|
|
488
502
|
this.delete(params)
|
|
489
503
|
|
|
490
504
|
save = async () => {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
505
|
+
if (this.attributes.id) {
|
|
506
|
+
const newObject = await this.update(this.attributes)
|
|
507
|
+
this.attributes = { ...newObject.attributes }
|
|
508
|
+
return true
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const newObject = await Bundle.create(this.attributes, this.options)
|
|
512
|
+
this.attributes = { ...newObject.attributes }
|
|
513
|
+
return true
|
|
500
514
|
}
|
|
501
515
|
|
|
502
516
|
// Parameters:
|
|
@@ -510,21 +524,20 @@ class Bundle {
|
|
|
510
524
|
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`.
|
|
511
525
|
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
|
|
512
526
|
static list = async (params = {}, options = {}) => {
|
|
513
|
-
if (params
|
|
514
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
|
527
|
+
if (params.user_id && !isInt(params.user_id)) {
|
|
528
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
|
515
529
|
}
|
|
516
530
|
|
|
517
|
-
if (params
|
|
518
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
531
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
532
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
519
533
|
}
|
|
520
534
|
|
|
521
|
-
if (params
|
|
522
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
535
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
536
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
523
537
|
}
|
|
524
538
|
|
|
525
|
-
const response = await Api.sendRequest(
|
|
539
|
+
const response = await Api.sendRequest('/bundles', 'GET', params, options)
|
|
526
540
|
|
|
527
|
-
|
|
528
541
|
return response?.data?.map(obj => new Bundle(obj, options)) || []
|
|
529
542
|
}
|
|
530
543
|
|
|
@@ -538,19 +551,18 @@ class Bundle {
|
|
|
538
551
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
539
552
|
}
|
|
540
553
|
|
|
541
|
-
params
|
|
554
|
+
params.id = id
|
|
542
555
|
|
|
543
|
-
if (!params
|
|
556
|
+
if (!params.id) {
|
|
544
557
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
545
558
|
}
|
|
546
559
|
|
|
547
|
-
if (params
|
|
548
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
560
|
+
if (params.id && !isInt(params.id)) {
|
|
561
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
549
562
|
}
|
|
550
563
|
|
|
551
|
-
const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params
|
|
564
|
+
const response = await Api.sendRequest(`/bundles/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
552
565
|
|
|
553
|
-
|
|
554
566
|
return new Bundle(response?.data, options)
|
|
555
567
|
}
|
|
556
568
|
|
|
@@ -585,73 +597,72 @@ class Bundle {
|
|
|
585
597
|
// snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
|
|
586
598
|
// watermark_attachment_file - file - Preview watermark image applied to all bundle items.
|
|
587
599
|
static create = async (params = {}, options = {}) => {
|
|
588
|
-
if (!params
|
|
600
|
+
if (!params.paths) {
|
|
589
601
|
throw new errors.MissingParameterError('Parameter missing: paths')
|
|
590
602
|
}
|
|
591
603
|
|
|
592
|
-
if (params
|
|
593
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
|
604
|
+
if (params.user_id && !isInt(params.user_id)) {
|
|
605
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
|
594
606
|
}
|
|
595
607
|
|
|
596
|
-
if (params
|
|
597
|
-
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params
|
|
608
|
+
if (params.paths && !isArray(params.paths)) {
|
|
609
|
+
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params.paths)}`)
|
|
598
610
|
}
|
|
599
611
|
|
|
600
|
-
if (params
|
|
601
|
-
throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params
|
|
612
|
+
if (params.password && !isString(params.password)) {
|
|
613
|
+
throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params.password)}`)
|
|
602
614
|
}
|
|
603
615
|
|
|
604
|
-
if (params
|
|
605
|
-
throw new errors.InvalidParameterError(`Bad parameter: form_field_set_id must be of type Int, received ${getType(params
|
|
616
|
+
if (params.form_field_set_id && !isInt(params.form_field_set_id)) {
|
|
617
|
+
throw new errors.InvalidParameterError(`Bad parameter: form_field_set_id must be of type Int, received ${getType(params.form_field_set_id)}`)
|
|
606
618
|
}
|
|
607
619
|
|
|
608
|
-
if (params
|
|
609
|
-
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params
|
|
620
|
+
if (params.expires_at && !isString(params.expires_at)) {
|
|
621
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
|
|
610
622
|
}
|
|
611
623
|
|
|
612
|
-
if (params
|
|
613
|
-
throw new errors.InvalidParameterError(`Bad parameter: max_uses must be of type Int, received ${getType(params
|
|
624
|
+
if (params.max_uses && !isInt(params.max_uses)) {
|
|
625
|
+
throw new errors.InvalidParameterError(`Bad parameter: max_uses must be of type Int, received ${getType(params.max_uses)}`)
|
|
614
626
|
}
|
|
615
627
|
|
|
616
|
-
if (params
|
|
617
|
-
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params
|
|
628
|
+
if (params.description && !isString(params.description)) {
|
|
629
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
|
618
630
|
}
|
|
619
631
|
|
|
620
|
-
if (params
|
|
621
|
-
throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params
|
|
632
|
+
if (params.note && !isString(params.note)) {
|
|
633
|
+
throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params.note)}`)
|
|
622
634
|
}
|
|
623
635
|
|
|
624
|
-
if (params
|
|
625
|
-
throw new errors.InvalidParameterError(`Bad parameter: code must be of type String, received ${getType(params
|
|
636
|
+
if (params.code && !isString(params.code)) {
|
|
637
|
+
throw new errors.InvalidParameterError(`Bad parameter: code must be of type String, received ${getType(params.code)}`)
|
|
626
638
|
}
|
|
627
639
|
|
|
628
|
-
if (params
|
|
629
|
-
throw new errors.InvalidParameterError(`Bad parameter: path_template must be of type String, received ${getType(params
|
|
640
|
+
if (params.path_template && !isString(params.path_template)) {
|
|
641
|
+
throw new errors.InvalidParameterError(`Bad parameter: path_template must be of type String, received ${getType(params.path_template)}`)
|
|
630
642
|
}
|
|
631
643
|
|
|
632
|
-
if (params
|
|
633
|
-
throw new errors.InvalidParameterError(`Bad parameter: permissions must be of type String, received ${getType(params
|
|
644
|
+
if (params.permissions && !isString(params.permissions)) {
|
|
645
|
+
throw new errors.InvalidParameterError(`Bad parameter: permissions must be of type String, received ${getType(params.permissions)}`)
|
|
634
646
|
}
|
|
635
647
|
|
|
636
|
-
if (params
|
|
637
|
-
throw new errors.InvalidParameterError(`Bad parameter: clickwrap_id must be of type Int, received ${getType(params
|
|
648
|
+
if (params.clickwrap_id && !isInt(params.clickwrap_id)) {
|
|
649
|
+
throw new errors.InvalidParameterError(`Bad parameter: clickwrap_id must be of type Int, received ${getType(params.clickwrap_id)}`)
|
|
638
650
|
}
|
|
639
651
|
|
|
640
|
-
if (params
|
|
641
|
-
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params
|
|
652
|
+
if (params.inbox_id && !isInt(params.inbox_id)) {
|
|
653
|
+
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
|
|
642
654
|
}
|
|
643
655
|
|
|
644
|
-
if (params
|
|
645
|
-
throw new errors.InvalidParameterError(`Bad parameter: start_access_on_date must be of type String, received ${getType(params
|
|
656
|
+
if (params.start_access_on_date && !isString(params.start_access_on_date)) {
|
|
657
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_access_on_date must be of type String, received ${getType(params.start_access_on_date)}`)
|
|
646
658
|
}
|
|
647
659
|
|
|
648
|
-
if (params
|
|
649
|
-
throw new errors.InvalidParameterError(`Bad parameter: snapshot_id must be of type Int, received ${getType(params
|
|
660
|
+
if (params.snapshot_id && !isInt(params.snapshot_id)) {
|
|
661
|
+
throw new errors.InvalidParameterError(`Bad parameter: snapshot_id must be of type Int, received ${getType(params.snapshot_id)}`)
|
|
650
662
|
}
|
|
651
663
|
|
|
652
|
-
const response = await Api.sendRequest(
|
|
664
|
+
const response = await Api.sendRequest('/bundles', 'POST', params, options)
|
|
653
665
|
|
|
654
|
-
|
|
655
666
|
return new Bundle(response?.data, options)
|
|
656
667
|
}
|
|
657
668
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
2
|
import Api from '../Api'
|
|
3
3
|
import * as errors from '../Errors'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getType, isArray, isInt, isObject, isString,
|
|
6
|
+
} from '../utils'
|
|
5
7
|
/* eslint-enable no-unused-vars */
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -9,6 +11,7 @@ import { getType, isArray, isInt, isObject, isString } from '../utils'
|
|
|
9
11
|
*/
|
|
10
12
|
class BundleDownload {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class BundleDownload {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// BundleRegistration
|
|
28
32
|
getBundleRegistration = () => this.attributes.bundle_registration
|
|
29
33
|
|
|
@@ -36,7 +40,6 @@ class BundleDownload {
|
|
|
36
40
|
// date-time # Download date/time
|
|
37
41
|
getCreatedAt = () => this.attributes.created_at
|
|
38
42
|
|
|
39
|
-
|
|
40
43
|
// Parameters:
|
|
41
44
|
// 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.
|
|
42
45
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
@@ -49,25 +52,24 @@ class BundleDownload {
|
|
|
49
52
|
// bundle_id - int64 - Bundle ID
|
|
50
53
|
// bundle_registration_id - int64 - BundleRegistration ID
|
|
51
54
|
static list = async (params = {}, options = {}) => {
|
|
52
|
-
if (params
|
|
53
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
55
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
56
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
if (params
|
|
57
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
59
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
60
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
if (params
|
|
61
|
-
throw new errors.InvalidParameterError(`Bad parameter: bundle_id must be of type Int, received ${getType(params
|
|
63
|
+
if (params.bundle_id && !isInt(params.bundle_id)) {
|
|
64
|
+
throw new errors.InvalidParameterError(`Bad parameter: bundle_id must be of type Int, received ${getType(params.bundle_id)}`)
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
if (params
|
|
65
|
-
throw new errors.InvalidParameterError(`Bad parameter: bundle_registration_id must be of type Int, received ${getType(params
|
|
67
|
+
if (params.bundle_registration_id && !isInt(params.bundle_registration_id)) {
|
|
68
|
+
throw new errors.InvalidParameterError(`Bad parameter: bundle_registration_id must be of type Int, received ${getType(params.bundle_registration_id)}`)
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
const response = await Api.sendRequest(
|
|
71
|
+
const response = await Api.sendRequest('/bundle_downloads', 'GET', params, options)
|
|
69
72
|
|
|
70
|
-
|
|
71
73
|
return response?.data?.map(obj => new BundleDownload(obj, options)) || []
|
|
72
74
|
}
|
|
73
75
|
|