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/Behavior.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 Behavior {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class Behavior {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Folder behavior ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -87,7 +91,6 @@ class Behavior {
|
|
|
87
91
|
this.attributes.attachment_delete = value
|
|
88
92
|
}
|
|
89
93
|
|
|
90
|
-
|
|
91
94
|
// Parameters:
|
|
92
95
|
// value - string - The value of the folder behavior. Can be a integer, array, or hash depending on the type of folder behavior. See The Behavior Types section for example values for each type of behavior.
|
|
93
96
|
// attachment_file - file - Certain behaviors may require a file, for instance, the "watermark" behavior requires a watermark image
|
|
@@ -106,36 +109,40 @@ class Behavior {
|
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
params.id = this.attributes.id
|
|
109
|
-
if (params
|
|
110
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
112
|
+
if (params.id && !isInt(params.id)) {
|
|
113
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
111
114
|
}
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
|
|
116
|
+
if (params.value && !isString(params.value)) {
|
|
117
|
+
throw new errors.InvalidParameterError(`Bad parameter: value must be of type String, received ${getType(params.value)}`)
|
|
114
118
|
}
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
|
|
120
|
+
if (params.name && !isString(params.name)) {
|
|
121
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
117
122
|
}
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
|
|
124
|
+
if (params.description && !isString(params.description)) {
|
|
125
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
|
120
126
|
}
|
|
121
|
-
|
|
122
|
-
|
|
127
|
+
|
|
128
|
+
if (params.behavior && !isString(params.behavior)) {
|
|
129
|
+
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(params.behavior)}`)
|
|
123
130
|
}
|
|
124
|
-
|
|
125
|
-
|
|
131
|
+
|
|
132
|
+
if (params.path && !isString(params.path)) {
|
|
133
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
126
134
|
}
|
|
127
135
|
|
|
128
|
-
if (!params
|
|
136
|
+
if (!params.id) {
|
|
129
137
|
if (this.attributes.id) {
|
|
130
|
-
params
|
|
138
|
+
params.id = this.id
|
|
131
139
|
} else {
|
|
132
140
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
143
|
|
|
136
|
-
const response = await Api.sendRequest(`/behaviors/${encodeURIComponent(params
|
|
144
|
+
const response = await Api.sendRequest(`/behaviors/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
|
137
145
|
|
|
138
|
-
|
|
139
146
|
return new Behavior(response?.data, this.options)
|
|
140
147
|
}
|
|
141
148
|
|
|
@@ -149,36 +156,34 @@ class Behavior {
|
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
params.id = this.attributes.id
|
|
152
|
-
if (params
|
|
153
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
159
|
+
if (params.id && !isInt(params.id)) {
|
|
160
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
154
161
|
}
|
|
155
162
|
|
|
156
|
-
if (!params
|
|
163
|
+
if (!params.id) {
|
|
157
164
|
if (this.attributes.id) {
|
|
158
|
-
params
|
|
165
|
+
params.id = this.id
|
|
159
166
|
} else {
|
|
160
167
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
161
168
|
}
|
|
162
169
|
}
|
|
163
170
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return
|
|
171
|
+
await Api.sendRequest(`/behaviors/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
|
167
172
|
}
|
|
168
173
|
|
|
169
174
|
destroy = (params = {}) =>
|
|
170
175
|
this.delete(params)
|
|
171
176
|
|
|
172
177
|
save = async () => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
if (this.attributes.id) {
|
|
179
|
+
const newObject = await this.update(this.attributes)
|
|
180
|
+
this.attributes = { ...newObject.attributes }
|
|
181
|
+
return true
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const newObject = await Behavior.create(this.attributes, this.options)
|
|
185
|
+
this.attributes = { ...newObject.attributes }
|
|
186
|
+
return true
|
|
182
187
|
}
|
|
183
188
|
|
|
184
189
|
// Parameters:
|
|
@@ -188,17 +193,16 @@ class Behavior {
|
|
|
188
193
|
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `behavior`.
|
|
189
194
|
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `behavior`.
|
|
190
195
|
static list = async (params = {}, options = {}) => {
|
|
191
|
-
if (params
|
|
192
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
196
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
197
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
193
198
|
}
|
|
194
199
|
|
|
195
|
-
if (params
|
|
196
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
200
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
201
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
197
202
|
}
|
|
198
203
|
|
|
199
|
-
const response = await Api.sendRequest(
|
|
204
|
+
const response = await Api.sendRequest('/behaviors', 'GET', params, options)
|
|
200
205
|
|
|
201
|
-
|
|
202
206
|
return response?.data?.map(obj => new Behavior(obj, options)) || []
|
|
203
207
|
}
|
|
204
208
|
|
|
@@ -212,19 +216,18 @@ class Behavior {
|
|
|
212
216
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
213
217
|
}
|
|
214
218
|
|
|
215
|
-
params
|
|
219
|
+
params.id = id
|
|
216
220
|
|
|
217
|
-
if (!params
|
|
221
|
+
if (!params.id) {
|
|
218
222
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
219
223
|
}
|
|
220
224
|
|
|
221
|
-
if (params
|
|
222
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
225
|
+
if (params.id && !isInt(params.id)) {
|
|
226
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
223
227
|
}
|
|
224
228
|
|
|
225
|
-
const response = await Api.sendRequest(`/behaviors/${encodeURIComponent(params
|
|
229
|
+
const response = await Api.sendRequest(`/behaviors/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
226
230
|
|
|
227
|
-
|
|
228
231
|
return new Behavior(response?.data, options)
|
|
229
232
|
}
|
|
230
233
|
|
|
@@ -245,35 +248,34 @@ class Behavior {
|
|
|
245
248
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
246
249
|
}
|
|
247
250
|
|
|
248
|
-
params
|
|
251
|
+
params.path = path
|
|
249
252
|
|
|
250
|
-
if (!params
|
|
253
|
+
if (!params.path) {
|
|
251
254
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
252
255
|
}
|
|
253
256
|
|
|
254
|
-
if (params
|
|
255
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
257
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
258
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
256
259
|
}
|
|
257
260
|
|
|
258
|
-
if (params
|
|
259
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
261
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
262
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
260
263
|
}
|
|
261
264
|
|
|
262
|
-
if (params
|
|
263
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
265
|
+
if (params.path && !isString(params.path)) {
|
|
266
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
264
267
|
}
|
|
265
268
|
|
|
266
|
-
if (params
|
|
267
|
-
throw new errors.InvalidParameterError(`Bad parameter: recursive must be of type String, received ${getType(params
|
|
269
|
+
if (params.recursive && !isString(params.recursive)) {
|
|
270
|
+
throw new errors.InvalidParameterError(`Bad parameter: recursive must be of type String, received ${getType(params.recursive)}`)
|
|
268
271
|
}
|
|
269
272
|
|
|
270
|
-
if (params
|
|
271
|
-
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(params
|
|
273
|
+
if (params.behavior && !isString(params.behavior)) {
|
|
274
|
+
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(params.behavior)}`)
|
|
272
275
|
}
|
|
273
276
|
|
|
274
|
-
const response = await Api.sendRequest(`/behaviors/folders/${encodeURIComponent(params
|
|
277
|
+
const response = await Api.sendRequest(`/behaviors/folders/${encodeURIComponent(params.path)}`, 'GET', params, options)
|
|
275
278
|
|
|
276
|
-
|
|
277
279
|
return response?.data?.map(obj => new Behavior(obj, options)) || []
|
|
278
280
|
}
|
|
279
281
|
|
|
@@ -285,37 +287,36 @@ class Behavior {
|
|
|
285
287
|
// path (required) - string - Folder behaviors path.
|
|
286
288
|
// behavior (required) - string - Behavior type.
|
|
287
289
|
static create = async (params = {}, options = {}) => {
|
|
288
|
-
if (!params
|
|
290
|
+
if (!params.path) {
|
|
289
291
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
290
292
|
}
|
|
291
293
|
|
|
292
|
-
if (!params
|
|
294
|
+
if (!params.behavior) {
|
|
293
295
|
throw new errors.MissingParameterError('Parameter missing: behavior')
|
|
294
296
|
}
|
|
295
297
|
|
|
296
|
-
if (params
|
|
297
|
-
throw new errors.InvalidParameterError(`Bad parameter: value must be of type String, received ${getType(params
|
|
298
|
+
if (params.value && !isString(params.value)) {
|
|
299
|
+
throw new errors.InvalidParameterError(`Bad parameter: value must be of type String, received ${getType(params.value)}`)
|
|
298
300
|
}
|
|
299
301
|
|
|
300
|
-
if (params
|
|
301
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params
|
|
302
|
+
if (params.name && !isString(params.name)) {
|
|
303
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
302
304
|
}
|
|
303
305
|
|
|
304
|
-
if (params
|
|
305
|
-
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params
|
|
306
|
+
if (params.description && !isString(params.description)) {
|
|
307
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
|
306
308
|
}
|
|
307
309
|
|
|
308
|
-
if (params
|
|
309
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
310
|
+
if (params.path && !isString(params.path)) {
|
|
311
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
310
312
|
}
|
|
311
313
|
|
|
312
|
-
if (params
|
|
313
|
-
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(params
|
|
314
|
+
if (params.behavior && !isString(params.behavior)) {
|
|
315
|
+
throw new errors.InvalidParameterError(`Bad parameter: behavior must be of type String, received ${getType(params.behavior)}`)
|
|
314
316
|
}
|
|
315
317
|
|
|
316
|
-
const response = await Api.sendRequest(
|
|
318
|
+
const response = await Api.sendRequest('/behaviors', 'POST', params, options)
|
|
317
319
|
|
|
318
|
-
|
|
319
320
|
return new Behavior(response?.data, options)
|
|
320
321
|
}
|
|
321
322
|
|
|
@@ -327,29 +328,27 @@ class Behavior {
|
|
|
327
328
|
// body - object - Additional body parameters.
|
|
328
329
|
// action - string - action for test body
|
|
329
330
|
static webhookTest = async (params = {}, options = {}) => {
|
|
330
|
-
if (!params
|
|
331
|
+
if (!params.url) {
|
|
331
332
|
throw new errors.MissingParameterError('Parameter missing: url')
|
|
332
333
|
}
|
|
333
334
|
|
|
334
|
-
if (params
|
|
335
|
-
throw new errors.InvalidParameterError(`Bad parameter: url must be of type String, received ${getType(params
|
|
335
|
+
if (params.url && !isString(params.url)) {
|
|
336
|
+
throw new errors.InvalidParameterError(`Bad parameter: url must be of type String, received ${getType(params.url)}`)
|
|
336
337
|
}
|
|
337
338
|
|
|
338
|
-
if (params
|
|
339
|
-
throw new errors.InvalidParameterError(`Bad parameter: method must be of type String, received ${getType(params
|
|
339
|
+
if (params.method && !isString(params.method)) {
|
|
340
|
+
throw new errors.InvalidParameterError(`Bad parameter: method must be of type String, received ${getType(params.method)}`)
|
|
340
341
|
}
|
|
341
342
|
|
|
342
|
-
if (params
|
|
343
|
-
throw new errors.InvalidParameterError(`Bad parameter: encoding must be of type String, received ${getType(params
|
|
343
|
+
if (params.encoding && !isString(params.encoding)) {
|
|
344
|
+
throw new errors.InvalidParameterError(`Bad parameter: encoding must be of type String, received ${getType(params.encoding)}`)
|
|
344
345
|
}
|
|
345
346
|
|
|
346
|
-
if (params
|
|
347
|
-
throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(params
|
|
347
|
+
if (params.action && !isString(params.action)) {
|
|
348
|
+
throw new errors.InvalidParameterError(`Bad parameter: action must be of type String, received ${getType(params.action)}`)
|
|
348
349
|
}
|
|
349
350
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return
|
|
351
|
+
await Api.sendRequest('/behaviors/webhook/test', 'POST', params, options)
|
|
353
352
|
}
|
|
354
353
|
}
|
|
355
354
|
|