files.com 1.1.19 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +0 -3
- package/_VERSION +1 -1
- package/lib/Api.js +1 -1
- package/lib/Errors.js +354 -512
- 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 -178
- 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
@@ -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 InboxRecipient {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class InboxRecipient {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// string # The recipient's company.
|
28
32
|
getCompany = () => this.attributes.company
|
29
33
|
|
@@ -73,15 +77,14 @@ class InboxRecipient {
|
|
73
77
|
this.attributes.share_after_create = value
|
74
78
|
}
|
75
79
|
|
76
|
-
|
77
80
|
save = async () => {
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
if (this.attributes.id) {
|
82
|
+
throw new errors.NotImplementedError('The InboxRecipient object doesn\'t support updates.')
|
83
|
+
} else {
|
84
|
+
const newObject = await InboxRecipient.create(this.attributes, this.options)
|
85
|
+
this.attributes = { ...newObject.attributes }
|
86
|
+
return true
|
87
|
+
}
|
85
88
|
}
|
86
89
|
|
87
90
|
// Parameters:
|
@@ -91,25 +94,24 @@ class InboxRecipient {
|
|
91
94
|
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `has_registrations`.
|
92
95
|
// inbox_id (required) - int64 - List recipients for the inbox with this ID.
|
93
96
|
static list = async (params = {}, options = {}) => {
|
94
|
-
if (!params
|
97
|
+
if (!params.inbox_id) {
|
95
98
|
throw new errors.MissingParameterError('Parameter missing: inbox_id')
|
96
99
|
}
|
97
100
|
|
98
|
-
if (params
|
99
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
101
|
+
if (params.cursor && !isString(params.cursor)) {
|
102
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
100
103
|
}
|
101
104
|
|
102
|
-
if (params
|
103
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
105
|
+
if (params.per_page && !isInt(params.per_page)) {
|
106
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
104
107
|
}
|
105
108
|
|
106
|
-
if (params
|
107
|
-
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params
|
109
|
+
if (params.inbox_id && !isInt(params.inbox_id)) {
|
110
|
+
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
|
108
111
|
}
|
109
112
|
|
110
|
-
const response = await Api.sendRequest(
|
113
|
+
const response = await Api.sendRequest('/inbox_recipients', 'GET', params, options)
|
111
114
|
|
112
|
-
|
113
115
|
return response?.data?.map(obj => new InboxRecipient(obj, options)) || []
|
114
116
|
}
|
115
117
|
|
@@ -124,37 +126,36 @@ class InboxRecipient {
|
|
124
126
|
// note - string - Note to include in email.
|
125
127
|
// share_after_create - boolean - Set to true to share the link with the recipient upon creation.
|
126
128
|
static create = async (params = {}, options = {}) => {
|
127
|
-
if (!params
|
129
|
+
if (!params.inbox_id) {
|
128
130
|
throw new errors.MissingParameterError('Parameter missing: inbox_id')
|
129
131
|
}
|
130
132
|
|
131
|
-
if (!params
|
133
|
+
if (!params.recipient) {
|
132
134
|
throw new errors.MissingParameterError('Parameter missing: recipient')
|
133
135
|
}
|
134
136
|
|
135
|
-
if (params
|
136
|
-
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params
|
137
|
+
if (params.inbox_id && !isInt(params.inbox_id)) {
|
138
|
+
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
|
137
139
|
}
|
138
140
|
|
139
|
-
if (params
|
140
|
-
throw new errors.InvalidParameterError(`Bad parameter: recipient must be of type String, received ${getType(params
|
141
|
+
if (params.recipient && !isString(params.recipient)) {
|
142
|
+
throw new errors.InvalidParameterError(`Bad parameter: recipient must be of type String, received ${getType(params.recipient)}`)
|
141
143
|
}
|
142
144
|
|
143
|
-
if (params
|
144
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params
|
145
|
+
if (params.name && !isString(params.name)) {
|
146
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
145
147
|
}
|
146
148
|
|
147
|
-
if (params
|
148
|
-
throw new errors.InvalidParameterError(`Bad parameter: company must be of type String, received ${getType(params
|
149
|
+
if (params.company && !isString(params.company)) {
|
150
|
+
throw new errors.InvalidParameterError(`Bad parameter: company must be of type String, received ${getType(params.company)}`)
|
149
151
|
}
|
150
152
|
|
151
|
-
if (params
|
152
|
-
throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params
|
153
|
+
if (params.note && !isString(params.note)) {
|
154
|
+
throw new errors.InvalidParameterError(`Bad parameter: note must be of type String, received ${getType(params.note)}`)
|
153
155
|
}
|
154
156
|
|
155
|
-
const response = await Api.sendRequest(
|
157
|
+
const response = await Api.sendRequest('/inbox_recipients', 'POST', params, options)
|
156
158
|
|
157
|
-
|
158
159
|
return new InboxRecipient(response?.data, options)
|
159
160
|
}
|
160
161
|
}
|
@@ -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 InboxRegistration {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class InboxRegistration {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// string # Registration cookie code
|
28
32
|
getCode = () => this.attributes.code
|
29
33
|
|
@@ -60,27 +64,25 @@ class InboxRegistration {
|
|
60
64
|
// date-time # Registration creation date/time
|
61
65
|
getCreatedAt = () => this.attributes.created_at
|
62
66
|
|
63
|
-
|
64
67
|
// Parameters:
|
65
68
|
// 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.
|
66
69
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
67
70
|
// folder_behavior_id - int64 - ID of the associated Inbox.
|
68
71
|
static list = async (params = {}, options = {}) => {
|
69
|
-
if (params
|
70
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
72
|
+
if (params.cursor && !isString(params.cursor)) {
|
73
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
71
74
|
}
|
72
75
|
|
73
|
-
if (params
|
74
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
76
|
+
if (params.per_page && !isInt(params.per_page)) {
|
77
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
75
78
|
}
|
76
79
|
|
77
|
-
if (params
|
78
|
-
throw new errors.InvalidParameterError(`Bad parameter: folder_behavior_id must be of type Int, received ${getType(params
|
80
|
+
if (params.folder_behavior_id && !isInt(params.folder_behavior_id)) {
|
81
|
+
throw new errors.InvalidParameterError(`Bad parameter: folder_behavior_id must be of type Int, received ${getType(params.folder_behavior_id)}`)
|
79
82
|
}
|
80
83
|
|
81
|
-
const response = await Api.sendRequest(
|
84
|
+
const response = await Api.sendRequest('/inbox_registrations', 'GET', params, options)
|
82
85
|
|
83
|
-
|
84
86
|
return response?.data?.map(obj => new InboxRegistration(obj, options)) || []
|
85
87
|
}
|
86
88
|
|
@@ -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 InboxUpload {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class InboxUpload {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// InboxRegistration
|
28
32
|
getInboxRegistration = () => this.attributes.inbox_registration
|
29
33
|
|
@@ -33,7 +37,6 @@ class InboxUpload {
|
|
33
37
|
// date-time # Upload date/time
|
34
38
|
getCreatedAt = () => this.attributes.created_at
|
35
39
|
|
36
|
-
|
37
40
|
// Parameters:
|
38
41
|
// 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.
|
39
42
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
@@ -46,25 +49,24 @@ class InboxUpload {
|
|
46
49
|
// inbox_registration_id - int64 - InboxRegistration ID
|
47
50
|
// inbox_id - int64 - Inbox ID
|
48
51
|
static list = async (params = {}, options = {}) => {
|
49
|
-
if (params
|
50
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
52
|
+
if (params.cursor && !isString(params.cursor)) {
|
53
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
51
54
|
}
|
52
55
|
|
53
|
-
if (params
|
54
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
56
|
+
if (params.per_page && !isInt(params.per_page)) {
|
57
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
55
58
|
}
|
56
59
|
|
57
|
-
if (params
|
58
|
-
throw new errors.InvalidParameterError(`Bad parameter: inbox_registration_id must be of type Int, received ${getType(params
|
60
|
+
if (params.inbox_registration_id && !isInt(params.inbox_registration_id)) {
|
61
|
+
throw new errors.InvalidParameterError(`Bad parameter: inbox_registration_id must be of type Int, received ${getType(params.inbox_registration_id)}`)
|
59
62
|
}
|
60
63
|
|
61
|
-
if (params
|
62
|
-
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params
|
64
|
+
if (params.inbox_id && !isInt(params.inbox_id)) {
|
65
|
+
throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params.inbox_id)}`)
|
63
66
|
}
|
64
67
|
|
65
|
-
const response = await Api.sendRequest(
|
68
|
+
const response = await Api.sendRequest('/inbox_uploads', 'GET', params, options)
|
66
69
|
|
67
|
-
|
68
70
|
return response?.data?.map(obj => new InboxUpload(obj, options)) || []
|
69
71
|
}
|
70
72
|
|
package/src/models/Invoice.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 Invoice {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class Invoice {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Line item Id
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -66,22 +70,21 @@ class Invoice {
|
|
66
70
|
// date-time # Line item updated at
|
67
71
|
getUpdatedAt = () => this.attributes.updated_at
|
68
72
|
|
69
|
-
|
70
73
|
// Parameters:
|
71
74
|
// 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.
|
72
75
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
73
76
|
static list = async (params = {}, options = {}) => {
|
74
|
-
if (params
|
75
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
77
|
+
if (params.cursor && !isString(params.cursor)) {
|
78
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
76
79
|
}
|
77
80
|
|
78
|
-
if (params
|
79
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
81
|
+
if (params.per_page && !isInt(params.per_page)) {
|
82
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
80
83
|
}
|
81
84
|
|
82
|
-
const response = await Api.sendRequest(
|
85
|
+
const response = await Api.sendRequest('/invoices', 'GET', params, options)
|
83
86
|
|
84
|
-
const AccountLineItem = require(
|
87
|
+
const AccountLineItem = require('./AccountLineItem.js').default
|
85
88
|
return response?.data?.map(obj => new AccountLineItem(obj, options)) || []
|
86
89
|
}
|
87
90
|
|
@@ -95,19 +98,19 @@ class Invoice {
|
|
95
98
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
96
99
|
}
|
97
100
|
|
98
|
-
params
|
101
|
+
params.id = id
|
99
102
|
|
100
|
-
if (!params
|
103
|
+
if (!params.id) {
|
101
104
|
throw new errors.MissingParameterError('Parameter missing: id')
|
102
105
|
}
|
103
106
|
|
104
|
-
if (params
|
105
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
107
|
+
if (params.id && !isInt(params.id)) {
|
108
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
106
109
|
}
|
107
110
|
|
108
|
-
const response = await Api.sendRequest(`/invoices/${encodeURIComponent(params
|
111
|
+
const response = await Api.sendRequest(`/invoices/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
109
112
|
|
110
|
-
const AccountLineItem = require(
|
113
|
+
const AccountLineItem = require('./AccountLineItem.js').default
|
111
114
|
return new AccountLineItem(response?.data, options)
|
112
115
|
}
|
113
116
|
|
@@ -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 InvoiceLineItem {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class InvoiceLineItem {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// double # Invoice line item amount
|
28
32
|
getAmount = () => this.attributes.amount
|
29
33
|
|
@@ -50,7 +54,6 @@ class InvoiceLineItem {
|
|
50
54
|
|
51
55
|
// string # Site name
|
52
56
|
getSite = () => this.attributes.site
|
53
|
-
|
54
57
|
}
|
55
58
|
|
56
59
|
export default InvoiceLineItem
|
package/src/models/IpAddress.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 IpAddress {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class IpAddress {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// string # Unique label for list; used by Zapier and other integrations.
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -36,22 +40,20 @@ class IpAddress {
|
|
36
40
|
// array # A list of IP addresses.
|
37
41
|
getIpAddresses = () => this.attributes.ip_addresses
|
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).
|
43
46
|
static list = async (params = {}, options = {}) => {
|
44
|
-
if (params
|
45
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
47
|
+
if (params.cursor && !isString(params.cursor)) {
|
48
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
46
49
|
}
|
47
50
|
|
48
|
-
if (params
|
49
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
51
|
+
if (params.per_page && !isInt(params.per_page)) {
|
52
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
50
53
|
}
|
51
54
|
|
52
|
-
const response = await Api.sendRequest(
|
55
|
+
const response = await Api.sendRequest('/ip_addresses', 'GET', params, options)
|
53
56
|
|
54
|
-
|
55
57
|
return response?.data?.map(obj => new IpAddress(obj, options)) || []
|
56
58
|
}
|
57
59
|
|
@@ -62,17 +64,17 @@ class IpAddress {
|
|
62
64
|
// 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.
|
63
65
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
64
66
|
static getExavaultReserved = async (params = {}, options = {}) => {
|
65
|
-
if (params
|
66
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
67
|
+
if (params.cursor && !isString(params.cursor)) {
|
68
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
67
69
|
}
|
68
70
|
|
69
|
-
if (params
|
70
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
71
|
+
if (params.per_page && !isInt(params.per_page)) {
|
72
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
71
73
|
}
|
72
74
|
|
73
|
-
const response = await Api.sendRequest(
|
75
|
+
const response = await Api.sendRequest('/ip_addresses/exavault-reserved', 'GET', params, options)
|
74
76
|
|
75
|
-
const PublicIpAddress = require(
|
77
|
+
const PublicIpAddress = require('./PublicIpAddress.js').default
|
76
78
|
return response?.data?.map(obj => new PublicIpAddress(obj, options)) || []
|
77
79
|
}
|
78
80
|
|
@@ -80,17 +82,17 @@ class IpAddress {
|
|
80
82
|
// 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.
|
81
83
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
82
84
|
static getReserved = async (params = {}, options = {}) => {
|
83
|
-
if (params
|
84
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
85
|
+
if (params.cursor && !isString(params.cursor)) {
|
86
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
85
87
|
}
|
86
88
|
|
87
|
-
if (params
|
88
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
89
|
+
if (params.per_page && !isInt(params.per_page)) {
|
90
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
89
91
|
}
|
90
92
|
|
91
|
-
const response = await Api.sendRequest(
|
93
|
+
const response = await Api.sendRequest('/ip_addresses/reserved', 'GET', params, options)
|
92
94
|
|
93
|
-
const PublicIpAddress = require(
|
95
|
+
const PublicIpAddress = require('./PublicIpAddress.js').default
|
94
96
|
return response?.data?.map(obj => new PublicIpAddress(obj, options)) || []
|
95
97
|
}
|
96
98
|
}
|
package/src/models/Lock.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 Lock {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class Lock {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.path
|
30
|
+
|
27
31
|
// string # Path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
28
32
|
getPath = () => this.attributes.path
|
29
33
|
|
@@ -108,7 +112,6 @@ class Lock {
|
|
108
112
|
this.attributes.username = value
|
109
113
|
}
|
110
114
|
|
111
|
-
|
112
115
|
// Parameters:
|
113
116
|
// token (required) - string - Lock token
|
114
117
|
delete = async (params = {}) => {
|
@@ -121,41 +124,40 @@ class Lock {
|
|
121
124
|
}
|
122
125
|
|
123
126
|
params.path = this.attributes.path
|
124
|
-
if (params
|
125
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
127
|
+
if (params.path && !isString(params.path)) {
|
128
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
126
129
|
}
|
127
|
-
|
128
|
-
|
130
|
+
|
131
|
+
if (params.token && !isString(params.token)) {
|
132
|
+
throw new errors.InvalidParameterError(`Bad parameter: token must be of type String, received ${getType(params.token)}`)
|
129
133
|
}
|
130
134
|
|
131
|
-
if (!params
|
135
|
+
if (!params.path) {
|
132
136
|
if (this.attributes.path) {
|
133
|
-
params
|
137
|
+
params.path = this.path
|
134
138
|
} else {
|
135
139
|
throw new errors.MissingParameterError('Parameter missing: path')
|
136
140
|
}
|
137
141
|
}
|
138
142
|
|
139
|
-
if (!params
|
143
|
+
if (!params.token) {
|
140
144
|
if (this.attributes.token) {
|
141
|
-
params
|
145
|
+
params.token = this.token
|
142
146
|
} else {
|
143
147
|
throw new errors.MissingParameterError('Parameter missing: token')
|
144
148
|
}
|
145
149
|
}
|
146
150
|
|
147
|
-
|
148
|
-
|
149
|
-
return
|
151
|
+
await Api.sendRequest(`/locks/${encodeURIComponent(params.path)}`, 'DELETE', params, this.options)
|
150
152
|
}
|
151
153
|
|
152
154
|
destroy = (params = {}) =>
|
153
155
|
this.delete(params)
|
154
156
|
|
155
157
|
save = async () => {
|
156
|
-
|
157
|
-
|
158
|
-
|
158
|
+
const newObject = await Lock.create(this.attributes.path, this.attributes, this.options)
|
159
|
+
this.attributes = { ...newObject.attributes }
|
160
|
+
return true
|
159
161
|
}
|
160
162
|
|
161
163
|
// Parameters:
|
@@ -168,27 +170,26 @@ class Lock {
|
|
168
170
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
169
171
|
}
|
170
172
|
|
171
|
-
params
|
173
|
+
params.path = path
|
172
174
|
|
173
|
-
if (!params
|
175
|
+
if (!params.path) {
|
174
176
|
throw new errors.MissingParameterError('Parameter missing: path')
|
175
177
|
}
|
176
178
|
|
177
|
-
if (params
|
178
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
179
|
+
if (params.cursor && !isString(params.cursor)) {
|
180
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
179
181
|
}
|
180
182
|
|
181
|
-
if (params
|
182
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
183
|
+
if (params.per_page && !isInt(params.per_page)) {
|
184
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
183
185
|
}
|
184
186
|
|
185
|
-
if (params
|
186
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
187
|
+
if (params.path && !isString(params.path)) {
|
188
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
187
189
|
}
|
188
190
|
|
189
|
-
const response = await Api.sendRequest(`/locks/${encodeURIComponent(params
|
191
|
+
const response = await Api.sendRequest(`/locks/${encodeURIComponent(params.path)}`, 'GET', params, options)
|
190
192
|
|
191
|
-
|
192
193
|
return response?.data?.map(obj => new Lock(obj, options)) || []
|
193
194
|
}
|
194
195
|
|
@@ -203,27 +204,26 @@ class Lock {
|
|
203
204
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
204
205
|
}
|
205
206
|
|
206
|
-
params
|
207
|
+
params.path = path
|
207
208
|
|
208
|
-
if (!params
|
209
|
+
if (!params.path) {
|
209
210
|
throw new errors.MissingParameterError('Parameter missing: path')
|
210
211
|
}
|
211
212
|
|
212
|
-
if (params
|
213
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
213
|
+
if (params.path && !isString(params.path)) {
|
214
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
214
215
|
}
|
215
216
|
|
216
|
-
if (params
|
217
|
-
throw new errors.InvalidParameterError(`Bad parameter: recursive must be of type String, received ${getType(params
|
217
|
+
if (params.recursive && !isString(params.recursive)) {
|
218
|
+
throw new errors.InvalidParameterError(`Bad parameter: recursive must be of type String, received ${getType(params.recursive)}`)
|
218
219
|
}
|
219
220
|
|
220
|
-
if (params
|
221
|
-
throw new errors.InvalidParameterError(`Bad parameter: timeout must be of type Int, received ${getType(params
|
221
|
+
if (params.timeout && !isInt(params.timeout)) {
|
222
|
+
throw new errors.InvalidParameterError(`Bad parameter: timeout must be of type Int, received ${getType(params.timeout)}`)
|
222
223
|
}
|
223
224
|
|
224
|
-
const response = await Api.sendRequest(`/locks/${encodeURIComponent(params
|
225
|
+
const response = await Api.sendRequest(`/locks/${encodeURIComponent(params.path)}`, 'POST', params, options)
|
225
226
|
|
226
|
-
|
227
227
|
return new Lock(response?.data, options)
|
228
228
|
}
|
229
229
|
}
|