files.com 1.0.188 → 1.0.191
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/docs/Errors.md +186 -0
- package/docs/models/AccountLineItem.md +53 -0
- package/docs/models/Action.md +37 -0
- package/docs/models/ActionNotificationExport.md +82 -0
- package/docs/models/ActionNotificationExportResult.md +49 -0
- package/docs/models/ActionWebhookFailure.md +16 -0
- package/docs/models/ApiKey.md +183 -0
- package/docs/models/App.md +66 -0
- package/docs/models/As2IncomingMessage.md +104 -0
- package/docs/models/As2OutgoingMessage.md +96 -0
- package/docs/models/As2Partner.md +141 -0
- package/docs/models/As2Station.md +142 -0
- package/docs/models/Auto.md +11 -0
- package/docs/models/Automation.md +257 -0
- package/docs/models/AutomationRun.md +61 -0
- package/docs/models/BandwidthSnapshot.md +50 -0
- package/docs/models/Behavior.md +195 -0
- package/docs/models/Bundle.md +330 -0
- package/docs/models/BundleDownload.md +44 -0
- package/docs/models/BundleRecipient.md +76 -0
- package/docs/models/BundleRegistration.md +53 -0
- package/docs/models/Clickwrap.md +120 -0
- package/docs/models/DnsRecord.md +33 -0
- package/docs/models/Errors.md +17 -0
- package/docs/models/ExternalEvent.md +84 -0
- package/docs/models/File.md +339 -0
- package/docs/models/FileAction.md +13 -0
- package/docs/models/FileComment.md +98 -0
- package/docs/models/FileCommentReaction.md +50 -0
- package/docs/models/FileMigration.md +40 -0
- package/docs/models/FileUploadPart.md +39 -0
- package/docs/models/Folder.md +90 -0
- package/docs/models/FormField.md +29 -0
- package/docs/models/FormFieldSet.md +170 -0
- package/docs/models/Group.md +140 -0
- package/docs/models/GroupUser.md +116 -0
- package/docs/models/History.md +151 -0
- package/docs/models/HistoryExport.md +130 -0
- package/docs/models/HistoryExportResult.md +75 -0
- package/docs/models/Image.md +13 -0
- package/docs/models/InboxRecipient.md +76 -0
- package/docs/models/InboxRegistration.md +47 -0
- package/docs/models/InboxUpload.md +42 -0
- package/docs/models/Invoice.md +82 -0
- package/docs/models/InvoiceLineItem.md +27 -0
- package/docs/models/IpAddress.md +51 -0
- package/docs/models/Lock.md +92 -0
- package/docs/models/Message.md +134 -0
- package/docs/models/MessageComment.md +114 -0
- package/docs/models/MessageCommentReaction.md +79 -0
- package/docs/models/MessageReaction.md +79 -0
- package/docs/models/Notification.md +241 -0
- package/docs/models/Payment.md +82 -0
- package/docs/models/PaymentLineItem.md +19 -0
- package/docs/models/Permission.md +94 -0
- package/docs/models/Preview.md +19 -0
- package/docs/models/Priority.md +30 -0
- package/docs/models/Project.md +98 -0
- package/docs/models/PublicIpAddress.md +17 -0
- package/docs/models/PublicKey.md +112 -0
- package/docs/models/RemoteBandwidthSnapshot.md +42 -0
- package/docs/models/RemoteServer.md +385 -0
- package/docs/models/Request.md +97 -0
- package/docs/models/Session.md +50 -0
- package/docs/models/SettingsChange.md +44 -0
- package/docs/models/Site.md +607 -0
- package/docs/models/SsoStrategy.md +139 -0
- package/docs/models/Status.md +30 -0
- package/docs/models/Style.md +76 -0
- package/docs/models/UsageDailySnapshot.md +56 -0
- package/docs/models/UsageSnapshot.md +63 -0
- package/docs/models/User.md +465 -0
- package/docs/models/UserCipherUse.md +39 -0
- package/docs/models/UserRequest.md +80 -0
- package/docs/models/WebhookTest.md +59 -0
- package/lib/Api.js +12 -11
- package/lib/Errors.js +3126 -0
- package/lib/models/AccountLineItem.js +8 -0
- package/lib/models/Action.js +8 -0
- package/lib/models/ActionNotificationExport.js +21 -13
- package/lib/models/ActionNotificationExportResult.js +13 -5
- package/lib/models/ActionWebhookFailure.js +12 -4
- package/lib/models/ApiKey.js +33 -25
- package/lib/models/App.js +10 -2
- package/lib/models/As2IncomingMessage.js +11 -3
- package/lib/models/As2OutgoingMessage.js +11 -3
- package/lib/models/As2Partner.js +34 -26
- package/lib/models/As2Station.js +32 -24
- package/lib/models/Auto.js +8 -0
- package/lib/models/Automation.js +54 -60
- package/lib/models/AutomationRun.js +16 -8
- package/lib/models/BandwidthSnapshot.js +10 -2
- package/lib/models/Behavior.js +46 -38
- package/lib/models/Bundle.js +51 -43
- package/lib/models/BundleDownload.js +12 -4
- package/lib/models/BundleRecipient.js +22 -14
- package/lib/models/BundleRegistration.js +12 -4
- package/lib/models/Clickwrap.js +31 -23
- package/lib/models/DnsRecord.js +10 -2
- package/lib/models/Errors.js +8 -0
- package/lib/models/ExternalEvent.js +18 -10
- package/lib/models/File.js +68 -60
- package/lib/models/FileAction.js +8 -0
- package/lib/models/FileComment.js +27 -19
- package/lib/models/FileCommentReaction.js +18 -10
- package/lib/models/FileMigration.js +11 -3
- package/lib/models/FileUploadPart.js +8 -0
- package/lib/models/Folder.js +19 -11
- package/lib/models/FormField.js +8 -0
- package/lib/models/FormFieldSet.js +27 -19
- package/lib/models/Group.js +30 -22
- package/lib/models/GroupUser.js +32 -24
- package/lib/models/History.js +42 -34
- package/lib/models/HistoryExport.js +34 -26
- package/lib/models/HistoryExportResult.js +13 -5
- package/lib/models/Image.js +8 -0
- package/lib/models/InboxRecipient.js +22 -14
- package/lib/models/InboxRegistration.js +11 -3
- package/lib/models/InboxUpload.js +12 -4
- package/lib/models/Invoice.js +13 -5
- package/lib/models/InvoiceLineItem.js +8 -0
- package/lib/models/IpAddress.js +12 -4
- package/lib/models/Lock.js +24 -16
- package/lib/models/Message.js +37 -29
- package/lib/models/MessageComment.js +29 -21
- package/lib/models/MessageCommentReaction.js +24 -16
- package/lib/models/MessageReaction.js +24 -16
- package/lib/models/Notification.js +38 -30
- package/lib/models/Payment.js +13 -5
- package/lib/models/PaymentLineItem.js +8 -0
- package/lib/models/Permission.js +23 -15
- package/lib/models/Preview.js +8 -0
- package/lib/models/Priority.js +13 -5
- package/lib/models/Project.js +25 -17
- package/lib/models/PublicIpAddress.js +8 -0
- package/lib/models/PublicKey.js +29 -21
- package/lib/models/RemoteBandwidthSnapshot.js +10 -2
- package/lib/models/RemoteServer.js +226 -196
- package/lib/models/Request.js +27 -19
- package/lib/models/Session.js +13 -5
- package/lib/models/SettingsChange.js +10 -2
- package/lib/models/Site.js +65 -57
- package/lib/models/SsoStrategy.js +17 -9
- package/lib/models/Status.js +8 -0
- package/lib/models/Style.js +20 -12
- package/lib/models/UsageDailySnapshot.js +10 -2
- package/lib/models/UsageSnapshot.js +10 -2
- package/lib/models/User.js +85 -77
- package/lib/models/UserCipherUse.js +11 -3
- package/lib/models/UserRequest.js +24 -16
- package/lib/models/WebhookTest.js +16 -8
- package/package.json +1 -1
- package/src/Api.js +4 -8
- package/src/Errors.js +222 -0
- package/src/models/AccountLineItem.js +1 -0
- package/src/models/Action.js +1 -0
- package/src/models/ActionNotificationExport.js +14 -13
- package/src/models/ActionNotificationExportResult.js +6 -5
- package/src/models/ActionWebhookFailure.js +5 -4
- package/src/models/ApiKey.js +26 -25
- package/src/models/App.js +3 -2
- package/src/models/As2IncomingMessage.js +4 -3
- package/src/models/As2OutgoingMessage.js +4 -3
- package/src/models/As2Partner.js +27 -26
- package/src/models/As2Station.js +25 -24
- package/src/models/Auto.js +1 -0
- package/src/models/Automation.js +51 -62
- package/src/models/AutomationRun.js +9 -8
- package/src/models/BandwidthSnapshot.js +3 -2
- package/src/models/Behavior.js +39 -38
- package/src/models/Bundle.js +44 -43
- package/src/models/BundleDownload.js +5 -4
- package/src/models/BundleRecipient.js +15 -14
- package/src/models/BundleRegistration.js +5 -4
- package/src/models/Clickwrap.js +24 -23
- package/src/models/DnsRecord.js +3 -2
- package/src/models/Errors.js +1 -0
- package/src/models/ExternalEvent.js +11 -10
- package/src/models/File.js +61 -60
- package/src/models/FileAction.js +1 -0
- package/src/models/FileComment.js +20 -19
- package/src/models/FileCommentReaction.js +11 -10
- package/src/models/FileMigration.js +4 -3
- package/src/models/FileUploadPart.js +1 -0
- package/src/models/Folder.js +12 -11
- package/src/models/FormField.js +1 -0
- package/src/models/FormFieldSet.js +20 -19
- package/src/models/Group.js +23 -22
- package/src/models/GroupUser.js +25 -24
- package/src/models/History.js +35 -34
- package/src/models/HistoryExport.js +27 -26
- package/src/models/HistoryExportResult.js +6 -5
- package/src/models/Image.js +1 -0
- package/src/models/InboxRecipient.js +15 -14
- package/src/models/InboxRegistration.js +4 -3
- package/src/models/InboxUpload.js +5 -4
- package/src/models/Invoice.js +6 -5
- package/src/models/InvoiceLineItem.js +1 -0
- package/src/models/IpAddress.js +5 -4
- package/src/models/Lock.js +17 -16
- package/src/models/Message.js +30 -29
- package/src/models/MessageComment.js +22 -21
- package/src/models/MessageCommentReaction.js +17 -16
- package/src/models/MessageReaction.js +17 -16
- package/src/models/Notification.js +31 -30
- package/src/models/Payment.js +6 -5
- package/src/models/PaymentLineItem.js +1 -0
- package/src/models/Permission.js +16 -15
- package/src/models/Preview.js +3 -2
- package/src/models/Priority.js +6 -5
- package/src/models/Project.js +18 -17
- package/src/models/PublicIpAddress.js +1 -0
- package/src/models/PublicKey.js +22 -21
- package/src/models/RemoteBandwidthSnapshot.js +3 -2
- package/src/models/RemoteServer.js +120 -103
- package/src/models/Request.js +20 -19
- package/src/models/Session.js +6 -5
- package/src/models/SettingsChange.js +3 -2
- package/src/models/Site.js +58 -57
- package/src/models/SsoStrategy.js +10 -9
- package/src/models/Status.js +1 -0
- package/src/models/Style.js +13 -12
- package/src/models/UsageDailySnapshot.js +3 -2
- package/src/models/UsageSnapshot.js +3 -2
- package/src/models/User.js +78 -77
- package/src/models/UserCipherUse.js +4 -3
- package/src/models/UserRequest.js +17 -16
- package/src/models/WebhookTest.js +9 -8
- package/test/src/index.js +46 -0
package/src/models/File.js
CHANGED
@@ -2,6 +2,7 @@ import Readable from 'readable-stream'
|
|
2
2
|
import { Buffer } from 'safe-buffer'
|
3
3
|
|
4
4
|
import Api from '../Api'
|
5
|
+
import * as errors from '../Errors'
|
5
6
|
import Logger from '../Logger'
|
6
7
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
7
8
|
import FileUploadPart from './FileUploadPart'
|
@@ -126,7 +127,7 @@ class File {
|
|
126
127
|
|
127
128
|
return file
|
128
129
|
} catch (error) {
|
129
|
-
|
130
|
+
errors.handleErrorResponse(error)
|
130
131
|
}
|
131
132
|
}
|
132
133
|
|
@@ -135,7 +136,7 @@ class File {
|
|
135
136
|
*/
|
136
137
|
static uploadData = async (destinationPath, data) => {
|
137
138
|
if (!data) {
|
138
|
-
throw new
|
139
|
+
throw new errors.MissingParameterError('Upload data was not provided')
|
139
140
|
}
|
140
141
|
|
141
142
|
return File.uploadStream(destinationPath, Readable.from(data))
|
@@ -143,7 +144,7 @@ class File {
|
|
143
144
|
|
144
145
|
static uploadFile = async (destinationPath, sourceFilePath) => {
|
145
146
|
if (isBrowser()) {
|
146
|
-
throw new
|
147
|
+
throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment')
|
147
148
|
}
|
148
149
|
|
149
150
|
const { openDiskFileReadStream } = require('../isomorphic/File.node.js')
|
@@ -154,13 +155,13 @@ class File {
|
|
154
155
|
|
155
156
|
downloadToStream = async writableStream => {
|
156
157
|
if (isBrowser()) {
|
157
|
-
throw new
|
158
|
+
throw new errors.NotImplementedError('Stream downloads are only available in a NodeJS environment')
|
158
159
|
}
|
159
160
|
|
160
161
|
const downloadUri = this.getDownloadUri()
|
161
162
|
|
162
163
|
if (!downloadUri) {
|
163
|
-
throw new
|
164
|
+
throw new errors.EmptyPropertyError('Current object has no download URI')
|
164
165
|
}
|
165
166
|
|
166
167
|
const { saveUrlToStream } = require('../isomorphic/File.node.js')
|
@@ -169,13 +170,13 @@ class File {
|
|
169
170
|
|
170
171
|
downloadToFile = async destinationPath => {
|
171
172
|
if (isBrowser()) {
|
172
|
-
throw new
|
173
|
+
throw new errors.NotImplementedError('Disk file downloads are only available in a NodeJS environment')
|
173
174
|
}
|
174
175
|
|
175
176
|
const downloadUri = this.getDownloadUri()
|
176
177
|
|
177
178
|
if (!downloadUri) {
|
178
|
-
throw new
|
179
|
+
throw new errors.EmptyPropertyError('Current object has no download URI')
|
179
180
|
}
|
180
181
|
|
181
182
|
const { saveUrlToFile } = require('../isomorphic/File.node.js')
|
@@ -377,29 +378,29 @@ class File {
|
|
377
378
|
// with_priority_color - boolean - Include file priority color information?
|
378
379
|
download = async (params = {}) => {
|
379
380
|
if (!this.attributes.path) {
|
380
|
-
throw new
|
381
|
+
throw new errors.EmptyPropertyError('Current object has no path')
|
381
382
|
}
|
382
383
|
|
383
384
|
if (!isObject(params)) {
|
384
|
-
throw new
|
385
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
385
386
|
}
|
386
387
|
|
387
388
|
params.path = this.attributes.path
|
388
389
|
if (params['path'] && !isString(params['path'])) {
|
389
|
-
throw new
|
390
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
390
391
|
}
|
391
392
|
if (params['action'] && !isString(params['action'])) {
|
392
|
-
throw new
|
393
|
+
throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(action)}`)
|
393
394
|
}
|
394
395
|
if (params['preview_size'] && !isString(params['preview_size'])) {
|
395
|
-
throw new
|
396
|
+
throw new errors.InvalidParameterError(`Bad parameter: preview_size must be of type String, received ${getType(preview_size)}`)
|
396
397
|
}
|
397
398
|
|
398
399
|
if (!params['path']) {
|
399
400
|
if (this.attributes.path) {
|
400
401
|
params['path'] = this.path
|
401
402
|
} else {
|
402
|
-
throw new
|
403
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
403
404
|
}
|
404
405
|
}
|
405
406
|
|
@@ -413,29 +414,29 @@ class File {
|
|
413
414
|
// priority_color - string - Priority/Bookmark color of file.
|
414
415
|
update = async (params = {}) => {
|
415
416
|
if (!this.attributes.path) {
|
416
|
-
throw new
|
417
|
+
throw new errors.EmptyPropertyError('Current object has no path')
|
417
418
|
}
|
418
419
|
|
419
420
|
if (!isObject(params)) {
|
420
|
-
throw new
|
421
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
421
422
|
}
|
422
423
|
|
423
424
|
params.path = this.attributes.path
|
424
425
|
if (params['path'] && !isString(params['path'])) {
|
425
|
-
throw new
|
426
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
426
427
|
}
|
427
428
|
if (params['provided_mtime'] && !isString(params['provided_mtime'])) {
|
428
|
-
throw new
|
429
|
+
throw new errors.InvalidParameterError(`Bad parameter: provided_mtime must be of type String, received ${getType(provided_mtime)}`)
|
429
430
|
}
|
430
431
|
if (params['priority_color'] && !isString(params['priority_color'])) {
|
431
|
-
throw new
|
432
|
+
throw new errors.InvalidParameterError(`Bad parameter: priority_color must be of type String, received ${getType(priority_color)}`)
|
432
433
|
}
|
433
434
|
|
434
435
|
if (!params['path']) {
|
435
436
|
if (this.attributes.path) {
|
436
437
|
params['path'] = this.path
|
437
438
|
} else {
|
438
|
-
throw new
|
439
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
439
440
|
}
|
440
441
|
}
|
441
442
|
|
@@ -448,23 +449,23 @@ class File {
|
|
448
449
|
// recursive - boolean - If true, will recursively delete folers. Otherwise, will error on non-empty folders.
|
449
450
|
delete = async (params = {}) => {
|
450
451
|
if (!this.attributes.path) {
|
451
|
-
throw new
|
452
|
+
throw new errors.EmptyPropertyError('Current object has no path')
|
452
453
|
}
|
453
454
|
|
454
455
|
if (!isObject(params)) {
|
455
|
-
throw new
|
456
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
456
457
|
}
|
457
458
|
|
458
459
|
params.path = this.attributes.path
|
459
460
|
if (params['path'] && !isString(params['path'])) {
|
460
|
-
throw new
|
461
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
461
462
|
}
|
462
463
|
|
463
464
|
if (!params['path']) {
|
464
465
|
if (this.attributes.path) {
|
465
466
|
params['path'] = this.path
|
466
467
|
} else {
|
467
|
-
throw new
|
468
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
468
469
|
}
|
469
470
|
}
|
470
471
|
|
@@ -483,26 +484,26 @@ class File {
|
|
483
484
|
// structure - boolean - Copy structure only?
|
484
485
|
copy = async (params = {}) => {
|
485
486
|
if (!this.attributes.path) {
|
486
|
-
throw new
|
487
|
+
throw new errors.EmptyPropertyError('Current object has no path')
|
487
488
|
}
|
488
489
|
|
489
490
|
if (!isObject(params)) {
|
490
|
-
throw new
|
491
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
491
492
|
}
|
492
493
|
|
493
494
|
params.path = this.attributes.path
|
494
495
|
if (params['path'] && !isString(params['path'])) {
|
495
|
-
throw new
|
496
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
496
497
|
}
|
497
498
|
if (params['destination'] && !isString(params['destination'])) {
|
498
|
-
throw new
|
499
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(destination)}`)
|
499
500
|
}
|
500
501
|
|
501
502
|
if (!params['path']) {
|
502
503
|
if (this.attributes.path) {
|
503
504
|
params['path'] = this.path
|
504
505
|
} else {
|
505
|
-
throw new
|
506
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
506
507
|
}
|
507
508
|
}
|
508
509
|
|
@@ -510,7 +511,7 @@ class File {
|
|
510
511
|
if (this.attributes.destination) {
|
511
512
|
params['destination'] = this.destination
|
512
513
|
} else {
|
513
|
-
throw new
|
514
|
+
throw new errors.MissingParameterError('Parameter missing: destination')
|
514
515
|
}
|
515
516
|
}
|
516
517
|
|
@@ -525,26 +526,26 @@ class File {
|
|
525
526
|
// destination (required) - string - Move destination path.
|
526
527
|
move = async (params = {}) => {
|
527
528
|
if (!this.attributes.path) {
|
528
|
-
throw new
|
529
|
+
throw new errors.EmptyPropertyError('Current object has no path')
|
529
530
|
}
|
530
531
|
|
531
532
|
if (!isObject(params)) {
|
532
|
-
throw new
|
533
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
533
534
|
}
|
534
535
|
|
535
536
|
params.path = this.attributes.path
|
536
537
|
if (params['path'] && !isString(params['path'])) {
|
537
|
-
throw new
|
538
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
538
539
|
}
|
539
540
|
if (params['destination'] && !isString(params['destination'])) {
|
540
|
-
throw new
|
541
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(destination)}`)
|
541
542
|
}
|
542
543
|
|
543
544
|
if (!params['path']) {
|
544
545
|
if (this.attributes.path) {
|
545
546
|
params['path'] = this.path
|
546
547
|
} else {
|
547
|
-
throw new
|
548
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
548
549
|
}
|
549
550
|
}
|
550
551
|
|
@@ -552,7 +553,7 @@ class File {
|
|
552
553
|
if (this.attributes.destination) {
|
553
554
|
params['destination'] = this.destination
|
554
555
|
} else {
|
555
|
-
throw new
|
556
|
+
throw new errors.MissingParameterError('Parameter missing: destination')
|
556
557
|
}
|
557
558
|
}
|
558
559
|
|
@@ -573,38 +574,38 @@ class File {
|
|
573
574
|
// with_rename - boolean - Allow file rename instead of overwrite?
|
574
575
|
beginUpload = async (params = {}) => {
|
575
576
|
if (!this.attributes.path) {
|
576
|
-
throw new
|
577
|
+
throw new errors.EmptyPropertyError('Current object has no path')
|
577
578
|
}
|
578
579
|
|
579
580
|
if (!isObject(params)) {
|
580
|
-
throw new
|
581
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
581
582
|
}
|
582
583
|
|
583
584
|
params.path = this.attributes.path
|
584
585
|
if (params['path'] && !isString(params['path'])) {
|
585
|
-
throw new
|
586
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
586
587
|
}
|
587
588
|
if (params['part'] && !isInt(params['part'])) {
|
588
|
-
throw new
|
589
|
+
throw new errors.InvalidParameterError(`Bad parameter: part must be of type Int, received ${getType(part)}`)
|
589
590
|
}
|
590
591
|
if (params['parts'] && !isInt(params['parts'])) {
|
591
|
-
throw new
|
592
|
+
throw new errors.InvalidParameterError(`Bad parameter: parts must be of type Int, received ${getType(parts)}`)
|
592
593
|
}
|
593
594
|
if (params['ref'] && !isString(params['ref'])) {
|
594
|
-
throw new
|
595
|
+
throw new errors.InvalidParameterError(`Bad parameter: ref must be of type String, received ${getType(ref)}`)
|
595
596
|
}
|
596
597
|
if (params['restart'] && !isInt(params['restart'])) {
|
597
|
-
throw new
|
598
|
+
throw new errors.InvalidParameterError(`Bad parameter: restart must be of type Int, received ${getType(restart)}`)
|
598
599
|
}
|
599
600
|
if (params['size'] && !isInt(params['size'])) {
|
600
|
-
throw new
|
601
|
+
throw new errors.InvalidParameterError(`Bad parameter: size must be of type Int, received ${getType(size)}`)
|
601
602
|
}
|
602
603
|
|
603
604
|
if (!params['path']) {
|
604
605
|
if (this.attributes.path) {
|
605
606
|
params['path'] = this.path
|
606
607
|
} else {
|
607
|
-
throw new
|
608
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
608
609
|
}
|
609
610
|
}
|
610
611
|
|
@@ -636,53 +637,53 @@ class File {
|
|
636
637
|
// with_rename - boolean - Allow file rename instead of overwrite?
|
637
638
|
static create = async (path, params = {}, options = {}) => {
|
638
639
|
if (!isObject(params)) {
|
639
|
-
throw new
|
640
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
640
641
|
}
|
641
642
|
|
642
643
|
params['path'] = path
|
643
644
|
|
644
645
|
if (!params['path']) {
|
645
|
-
throw new
|
646
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
646
647
|
}
|
647
648
|
|
648
649
|
if (params['path'] && !isString(params['path'])) {
|
649
|
-
throw new
|
650
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
650
651
|
}
|
651
652
|
|
652
653
|
if (params['action'] && !isString(params['action'])) {
|
653
|
-
throw new
|
654
|
+
throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(action)}`)
|
654
655
|
}
|
655
656
|
|
656
657
|
if (params['length'] && !isInt(params['length'])) {
|
657
|
-
throw new
|
658
|
+
throw new errors.InvalidParameterError(`Bad parameter: length must be of type Int, received ${getType(length)}`)
|
658
659
|
}
|
659
660
|
|
660
661
|
if (params['part'] && !isInt(params['part'])) {
|
661
|
-
throw new
|
662
|
+
throw new errors.InvalidParameterError(`Bad parameter: part must be of type Int, received ${getType(part)}`)
|
662
663
|
}
|
663
664
|
|
664
665
|
if (params['parts'] && !isInt(params['parts'])) {
|
665
|
-
throw new
|
666
|
+
throw new errors.InvalidParameterError(`Bad parameter: parts must be of type Int, received ${getType(parts)}`)
|
666
667
|
}
|
667
668
|
|
668
669
|
if (params['provided_mtime'] && !isString(params['provided_mtime'])) {
|
669
|
-
throw new
|
670
|
+
throw new errors.InvalidParameterError(`Bad parameter: provided_mtime must be of type String, received ${getType(provided_mtime)}`)
|
670
671
|
}
|
671
672
|
|
672
673
|
if (params['ref'] && !isString(params['ref'])) {
|
673
|
-
throw new
|
674
|
+
throw new errors.InvalidParameterError(`Bad parameter: ref must be of type String, received ${getType(ref)}`)
|
674
675
|
}
|
675
676
|
|
676
677
|
if (params['restart'] && !isInt(params['restart'])) {
|
677
|
-
throw new
|
678
|
+
throw new errors.InvalidParameterError(`Bad parameter: restart must be of type Int, received ${getType(restart)}`)
|
678
679
|
}
|
679
680
|
|
680
681
|
if (params['size'] && !isInt(params['size'])) {
|
681
|
-
throw new
|
682
|
+
throw new errors.InvalidParameterError(`Bad parameter: size must be of type Int, received ${getType(size)}`)
|
682
683
|
}
|
683
684
|
|
684
685
|
if (params['structure'] && !isString(params['structure'])) {
|
685
|
-
throw new
|
686
|
+
throw new errors.InvalidParameterError(`Bad parameter: structure must be of type String, received ${getType(structure)}`)
|
686
687
|
}
|
687
688
|
|
688
689
|
const response = await Api.sendRequest(`/files/${params['path']}`, 'POST', params, options)
|
@@ -697,21 +698,21 @@ class File {
|
|
697
698
|
// with_priority_color - boolean - Include file priority color information?
|
698
699
|
static find = async (path, params = {}, options = {}) => {
|
699
700
|
if (!isObject(params)) {
|
700
|
-
throw new
|
701
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
701
702
|
}
|
702
703
|
|
703
704
|
params['path'] = path
|
704
705
|
|
705
706
|
if (!params['path']) {
|
706
|
-
throw new
|
707
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
707
708
|
}
|
708
709
|
|
709
710
|
if (params['path'] && !isString(params['path'])) {
|
710
|
-
throw new
|
711
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
711
712
|
}
|
712
713
|
|
713
714
|
if (params['preview_size'] && !isString(params['preview_size'])) {
|
714
|
-
throw new
|
715
|
+
throw new errors.InvalidParameterError(`Bad parameter: preview_size must be of type String, received ${getType(preview_size)}`)
|
715
716
|
}
|
716
717
|
|
717
718
|
const response = await Api.sendRequest(`/file_actions/metadata/${params['path']}`, 'GET', params, options)
|
package/src/models/FileAction.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import Api from '../Api'
|
2
|
+
import * as errors from '../Errors'
|
2
3
|
import Logger from '../Logger'
|
3
4
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
5
|
|
@@ -55,26 +56,26 @@ class FileComment {
|
|
55
56
|
// body (required) - string - Comment body.
|
56
57
|
update = async (params = {}) => {
|
57
58
|
if (!this.attributes.id) {
|
58
|
-
throw new
|
59
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
59
60
|
}
|
60
61
|
|
61
62
|
if (!isObject(params)) {
|
62
|
-
throw new
|
63
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
63
64
|
}
|
64
65
|
|
65
66
|
params.id = this.attributes.id
|
66
67
|
if (params['id'] && !isInt(params['id'])) {
|
67
|
-
throw new
|
68
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
68
69
|
}
|
69
70
|
if (params['body'] && !isString(params['body'])) {
|
70
|
-
throw new
|
71
|
+
throw new errors.InvalidParameterError(`Bad parameter: body must be of type String, received ${getType(body)}`)
|
71
72
|
}
|
72
73
|
|
73
74
|
if (!params['id']) {
|
74
75
|
if (this.attributes.id) {
|
75
76
|
params['id'] = this.id
|
76
77
|
} else {
|
77
|
-
throw new
|
78
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
78
79
|
}
|
79
80
|
}
|
80
81
|
|
@@ -82,7 +83,7 @@ class FileComment {
|
|
82
83
|
if (this.attributes.body) {
|
83
84
|
params['body'] = this.body
|
84
85
|
} else {
|
85
|
-
throw new
|
86
|
+
throw new errors.MissingParameterError('Parameter missing: body')
|
86
87
|
}
|
87
88
|
}
|
88
89
|
|
@@ -93,23 +94,23 @@ class FileComment {
|
|
93
94
|
|
94
95
|
delete = async (params = {}) => {
|
95
96
|
if (!this.attributes.id) {
|
96
|
-
throw new
|
97
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
97
98
|
}
|
98
99
|
|
99
100
|
if (!isObject(params)) {
|
100
|
-
throw new
|
101
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
101
102
|
}
|
102
103
|
|
103
104
|
params.id = this.attributes.id
|
104
105
|
if (params['id'] && !isInt(params['id'])) {
|
105
|
-
throw new
|
106
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
106
107
|
}
|
107
108
|
|
108
109
|
if (!params['id']) {
|
109
110
|
if (this.attributes.id) {
|
110
111
|
params['id'] = this.id
|
111
112
|
} else {
|
112
|
-
throw new
|
113
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
113
114
|
}
|
114
115
|
}
|
115
116
|
|
@@ -137,25 +138,25 @@ class FileComment {
|
|
137
138
|
// path (required) - string - Path to operate on.
|
138
139
|
static listFor = async (path, params = {}, options = {}) => {
|
139
140
|
if (!isObject(params)) {
|
140
|
-
throw new
|
141
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
141
142
|
}
|
142
143
|
|
143
144
|
params['path'] = path
|
144
145
|
|
145
146
|
if (!params['path']) {
|
146
|
-
throw new
|
147
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
147
148
|
}
|
148
149
|
|
149
150
|
if (params['cursor'] && !isString(params['cursor'])) {
|
150
|
-
throw new
|
151
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
|
151
152
|
}
|
152
153
|
|
153
154
|
if (params['per_page'] && !isInt(params['per_page'])) {
|
154
|
-
throw new
|
155
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
|
155
156
|
}
|
156
157
|
|
157
158
|
if (params['path'] && !isString(params['path'])) {
|
158
|
-
throw new
|
159
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
159
160
|
}
|
160
161
|
|
161
162
|
const response = await Api.sendRequest(`/file_comments/files/${params['path']}`, 'GET', params, options)
|
@@ -168,19 +169,19 @@ class FileComment {
|
|
168
169
|
// path (required) - string - File path.
|
169
170
|
static create = async (params = {}, options = {}) => {
|
170
171
|
if (!params['body']) {
|
171
|
-
throw new
|
172
|
+
throw new errors.MissingParameterError('Parameter missing: body')
|
172
173
|
}
|
173
174
|
|
174
175
|
if (!params['path']) {
|
175
|
-
throw new
|
176
|
+
throw new errors.MissingParameterError('Parameter missing: path')
|
176
177
|
}
|
177
178
|
|
178
179
|
if (params['body'] && !isString(params['body'])) {
|
179
|
-
throw new
|
180
|
+
throw new errors.InvalidParameterError(`Bad parameter: body must be of type String, received ${getType(body)}`)
|
180
181
|
}
|
181
182
|
|
182
183
|
if (params['path'] && !isString(params['path'])) {
|
183
|
-
throw new
|
184
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
|
184
185
|
}
|
185
186
|
|
186
187
|
const response = await Api.sendRequest(`/file_comments`, 'POST', params, options)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import Api from '../Api'
|
2
|
+
import * as errors from '../Errors'
|
2
3
|
import Logger from '../Logger'
|
3
4
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
5
|
|
@@ -53,23 +54,23 @@ class FileCommentReaction {
|
|
53
54
|
|
54
55
|
delete = async (params = {}) => {
|
55
56
|
if (!this.attributes.id) {
|
56
|
-
throw new
|
57
|
+
throw new errors.EmptyPropertyError('Current object has no id')
|
57
58
|
}
|
58
59
|
|
59
60
|
if (!isObject(params)) {
|
60
|
-
throw new
|
61
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
61
62
|
}
|
62
63
|
|
63
64
|
params.id = this.attributes.id
|
64
65
|
if (params['id'] && !isInt(params['id'])) {
|
65
|
-
throw new
|
66
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
66
67
|
}
|
67
68
|
|
68
69
|
if (!params['id']) {
|
69
70
|
if (this.attributes.id) {
|
70
71
|
params['id'] = this.id
|
71
72
|
} else {
|
72
|
-
throw new
|
73
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
73
74
|
}
|
74
75
|
}
|
75
76
|
|
@@ -83,7 +84,7 @@ class FileCommentReaction {
|
|
83
84
|
|
84
85
|
save = () => {
|
85
86
|
if (this.attributes['id']) {
|
86
|
-
throw new
|
87
|
+
throw new errors.NotImplementedError('The FileCommentReaction object doesn\'t support updates.')
|
87
88
|
} else {
|
88
89
|
const newObject = FileCommentReaction.create(this.attributes, this.options)
|
89
90
|
this.attributes = { ...newObject.attributes }
|
@@ -97,23 +98,23 @@ class FileCommentReaction {
|
|
97
98
|
// emoji (required) - string - Emoji to react with.
|
98
99
|
static create = async (params = {}, options = {}) => {
|
99
100
|
if (!params['file_comment_id']) {
|
100
|
-
throw new
|
101
|
+
throw new errors.MissingParameterError('Parameter missing: file_comment_id')
|
101
102
|
}
|
102
103
|
|
103
104
|
if (!params['emoji']) {
|
104
|
-
throw new
|
105
|
+
throw new errors.MissingParameterError('Parameter missing: emoji')
|
105
106
|
}
|
106
107
|
|
107
108
|
if (params['user_id'] && !isInt(params['user_id'])) {
|
108
|
-
throw new
|
109
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(user_id)}`)
|
109
110
|
}
|
110
111
|
|
111
112
|
if (params['file_comment_id'] && !isInt(params['file_comment_id'])) {
|
112
|
-
throw new
|
113
|
+
throw new errors.InvalidParameterError(`Bad parameter: file_comment_id must be of type Int, received ${getType(file_comment_id)}`)
|
113
114
|
}
|
114
115
|
|
115
116
|
if (params['emoji'] && !isString(params['emoji'])) {
|
116
|
-
throw new
|
117
|
+
throw new errors.InvalidParameterError(`Bad parameter: emoji must be of type String, received ${getType(emoji)}`)
|
117
118
|
}
|
118
119
|
|
119
120
|
const response = await Api.sendRequest(`/file_comment_reactions`, 'POST', params, options)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import Api from '../Api'
|
2
|
+
import * as errors from '../Errors'
|
2
3
|
import Logger from '../Logger'
|
3
4
|
import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
|
4
5
|
|
@@ -54,17 +55,17 @@ class FileMigration {
|
|
54
55
|
// id (required) - int64 - File Migration ID.
|
55
56
|
static find = async (id, params = {}, options = {}) => {
|
56
57
|
if (!isObject(params)) {
|
57
|
-
throw new
|
58
|
+
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
58
59
|
}
|
59
60
|
|
60
61
|
params['id'] = id
|
61
62
|
|
62
63
|
if (!params['id']) {
|
63
|
-
throw new
|
64
|
+
throw new errors.MissingParameterError('Parameter missing: id')
|
64
65
|
}
|
65
66
|
|
66
67
|
if (params['id'] && !isInt(params['id'])) {
|
67
|
-
throw new
|
68
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
|
68
69
|
}
|
69
70
|
|
70
71
|
const response = await Api.sendRequest(`/file_migrations/${params['id']}`, 'GET', params, options)
|