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 AccountLineItem {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class AccountLineItem {
|
|
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
|
|
@@ -65,7 +69,6 @@ class AccountLineItem {
|
|
65
69
|
|
66
70
|
// date-time # Line item updated at
|
67
71
|
getUpdatedAt = () => this.attributes.updated_at
|
68
|
-
|
69
72
|
}
|
70
73
|
|
71
74
|
export default AccountLineItem
|
package/src/models/Action.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 Action {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class Action {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Action ID
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -62,7 +66,6 @@ class Action {
|
|
62
66
|
|
63
67
|
// string # Interface on which this action occurred.
|
64
68
|
getInterface = () => this.attributes.interface
|
65
|
-
|
66
69
|
}
|
67
70
|
|
68
71
|
export default Action
|
@@ -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 ActionNotificationExport {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class ActionNotificationExport {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # History Export ID
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -122,15 +126,14 @@ class ActionNotificationExport {
|
|
122
126
|
this.attributes.user_id = value
|
123
127
|
}
|
124
128
|
|
125
|
-
|
126
129
|
save = async () => {
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
130
|
+
if (this.attributes.id) {
|
131
|
+
throw new errors.NotImplementedError('The ActionNotificationExport object doesn\'t support updates.')
|
132
|
+
} else {
|
133
|
+
const newObject = await ActionNotificationExport.create(this.attributes, this.options)
|
134
|
+
this.attributes = { ...newObject.attributes }
|
135
|
+
return true
|
136
|
+
}
|
134
137
|
}
|
135
138
|
|
136
139
|
// Parameters:
|
@@ -140,19 +143,18 @@ class ActionNotificationExport {
|
|
140
143
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
141
144
|
}
|
142
145
|
|
143
|
-
params
|
146
|
+
params.id = id
|
144
147
|
|
145
|
-
if (!params
|
148
|
+
if (!params.id) {
|
146
149
|
throw new errors.MissingParameterError('Parameter missing: id')
|
147
150
|
}
|
148
151
|
|
149
|
-
if (params
|
150
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
152
|
+
if (params.id && !isInt(params.id)) {
|
153
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
151
154
|
}
|
152
155
|
|
153
|
-
const response = await Api.sendRequest(`/action_notification_exports/${encodeURIComponent(params
|
156
|
+
const response = await Api.sendRequest(`/action_notification_exports/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
154
157
|
|
155
|
-
|
156
158
|
return new ActionNotificationExport(response?.data, options)
|
157
159
|
}
|
158
160
|
|
@@ -171,45 +173,44 @@ class ActionNotificationExport {
|
|
171
173
|
// query_path - string - Return notifications that were triggered by actions on this specific path.
|
172
174
|
// query_folder - string - Return notifications that were triggered by actions in this folder.
|
173
175
|
static create = async (params = {}, options = {}) => {
|
174
|
-
if (params
|
175
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
176
|
+
if (params.user_id && !isInt(params.user_id)) {
|
177
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
176
178
|
}
|
177
179
|
|
178
|
-
if (params
|
179
|
-
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params
|
180
|
+
if (params.start_at && !isString(params.start_at)) {
|
181
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params.start_at)}`)
|
180
182
|
}
|
181
183
|
|
182
|
-
if (params
|
183
|
-
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params
|
184
|
+
if (params.end_at && !isString(params.end_at)) {
|
185
|
+
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params.end_at)}`)
|
184
186
|
}
|
185
187
|
|
186
|
-
if (params
|
187
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_message must be of type String, received ${getType(params
|
188
|
+
if (params.query_message && !isString(params.query_message)) {
|
189
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_message must be of type String, received ${getType(params.query_message)}`)
|
188
190
|
}
|
189
191
|
|
190
|
-
if (params
|
191
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_request_method must be of type String, received ${getType(params
|
192
|
+
if (params.query_request_method && !isString(params.query_request_method)) {
|
193
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_request_method must be of type String, received ${getType(params.query_request_method)}`)
|
192
194
|
}
|
193
195
|
|
194
|
-
if (params
|
195
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_request_url must be of type String, received ${getType(params
|
196
|
+
if (params.query_request_url && !isString(params.query_request_url)) {
|
197
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_request_url must be of type String, received ${getType(params.query_request_url)}`)
|
196
198
|
}
|
197
199
|
|
198
|
-
if (params
|
199
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_status must be of type String, received ${getType(params
|
200
|
+
if (params.query_status && !isString(params.query_status)) {
|
201
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_status must be of type String, received ${getType(params.query_status)}`)
|
200
202
|
}
|
201
203
|
|
202
|
-
if (params
|
203
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_path must be of type String, received ${getType(params
|
204
|
+
if (params.query_path && !isString(params.query_path)) {
|
205
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_path must be of type String, received ${getType(params.query_path)}`)
|
204
206
|
}
|
205
207
|
|
206
|
-
if (params
|
207
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_folder must be of type String, received ${getType(params
|
208
|
+
if (params.query_folder && !isString(params.query_folder)) {
|
209
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_folder must be of type String, received ${getType(params.query_folder)}`)
|
208
210
|
}
|
209
211
|
|
210
|
-
const response = await Api.sendRequest(
|
212
|
+
const response = await Api.sendRequest('/action_notification_exports', 'POST', params, options)
|
211
213
|
|
212
|
-
|
213
214
|
return new ActionNotificationExport(response?.data, options)
|
214
215
|
}
|
215
216
|
}
|
@@ -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 ActionNotificationExportResult {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class ActionNotificationExportResult {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Notification ID
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -54,36 +58,34 @@ class ActionNotificationExportResult {
|
|
54
58
|
// string # The folder associated with the triggering action for this notification.
|
55
59
|
getFolder = () => this.attributes.folder
|
56
60
|
|
57
|
-
|
58
61
|
// Parameters:
|
59
62
|
// user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
60
63
|
// 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.
|
61
64
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
62
65
|
// action_notification_export_id (required) - int64 - ID of the associated action notification export.
|
63
66
|
static list = async (params = {}, options = {}) => {
|
64
|
-
if (!params
|
67
|
+
if (!params.action_notification_export_id) {
|
65
68
|
throw new errors.MissingParameterError('Parameter missing: action_notification_export_id')
|
66
69
|
}
|
67
70
|
|
68
|
-
if (params
|
69
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
71
|
+
if (params.user_id && !isInt(params.user_id)) {
|
72
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
70
73
|
}
|
71
74
|
|
72
|
-
if (params
|
73
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
75
|
+
if (params.cursor && !isString(params.cursor)) {
|
76
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
74
77
|
}
|
75
78
|
|
76
|
-
if (params
|
77
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
79
|
+
if (params.per_page && !isInt(params.per_page)) {
|
80
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
78
81
|
}
|
79
82
|
|
80
|
-
if (params
|
81
|
-
throw new errors.InvalidParameterError(`Bad parameter: action_notification_export_id must be of type Int, received ${getType(params
|
83
|
+
if (params.action_notification_export_id && !isInt(params.action_notification_export_id)) {
|
84
|
+
throw new errors.InvalidParameterError(`Bad parameter: action_notification_export_id must be of type Int, received ${getType(params.action_notification_export_id)}`)
|
82
85
|
}
|
83
86
|
|
84
|
-
const response = await Api.sendRequest(
|
87
|
+
const response = await Api.sendRequest('/action_notification_export_results', 'GET', params, options)
|
85
88
|
|
86
|
-
|
87
89
|
return response?.data?.map(obj => new ActionNotificationExportResult(obj, options)) || []
|
88
90
|
}
|
89
91
|
|
@@ -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 ActionWebhookFailure {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -36,21 +39,19 @@ class ActionWebhookFailure {
|
|
36
39
|
}
|
37
40
|
|
38
41
|
params.id = this.attributes.id
|
39
|
-
if (params
|
40
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
42
|
+
if (params.id && !isInt(params.id)) {
|
43
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
41
44
|
}
|
42
45
|
|
43
|
-
if (!params
|
46
|
+
if (!params.id) {
|
44
47
|
if (this.attributes.id) {
|
45
|
-
params
|
48
|
+
params.id = this.id
|
46
49
|
} else {
|
47
50
|
throw new errors.MissingParameterError('Parameter missing: id')
|
48
51
|
}
|
49
52
|
}
|
50
53
|
|
51
|
-
|
52
|
-
|
53
|
-
return
|
54
|
+
await Api.sendRequest(`/action_webhook_failures/${encodeURIComponent(params.id)}/retry`, 'POST', params, this.options)
|
54
55
|
}
|
55
56
|
}
|
56
57
|
|
package/src/models/ApiKey.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 ApiKey {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class ApiKey {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # API Key ID
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -104,7 +108,6 @@ class ApiKey {
|
|
104
108
|
this.attributes.user_id = value
|
105
109
|
}
|
106
110
|
|
107
|
-
|
108
111
|
// Parameters:
|
109
112
|
// description - string - User-supplied description of API key.
|
110
113
|
// expires_at - string - API Key expiration date
|
@@ -120,33 +123,36 @@ class ApiKey {
|
|
120
123
|
}
|
121
124
|
|
122
125
|
params.id = this.attributes.id
|
123
|
-
if (params
|
124
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
126
|
+
if (params.id && !isInt(params.id)) {
|
127
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
125
128
|
}
|
126
|
-
|
127
|
-
|
129
|
+
|
130
|
+
if (params.description && !isString(params.description)) {
|
131
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
128
132
|
}
|
129
|
-
|
130
|
-
|
133
|
+
|
134
|
+
if (params.expires_at && !isString(params.expires_at)) {
|
135
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
|
131
136
|
}
|
132
|
-
|
133
|
-
|
137
|
+
|
138
|
+
if (params.permission_set && !isString(params.permission_set)) {
|
139
|
+
throw new errors.InvalidParameterError(`Bad parameter: permission_set must be of type String, received ${getType(params.permission_set)}`)
|
134
140
|
}
|
135
|
-
|
136
|
-
|
141
|
+
|
142
|
+
if (params.name && !isString(params.name)) {
|
143
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
137
144
|
}
|
138
145
|
|
139
|
-
if (!params
|
146
|
+
if (!params.id) {
|
140
147
|
if (this.attributes.id) {
|
141
|
-
params
|
148
|
+
params.id = this.id
|
142
149
|
} else {
|
143
150
|
throw new errors.MissingParameterError('Parameter missing: id')
|
144
151
|
}
|
145
152
|
}
|
146
153
|
|
147
|
-
const response = await Api.sendRequest(`/api_keys/${encodeURIComponent(params
|
154
|
+
const response = await Api.sendRequest(`/api_keys/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
148
155
|
|
149
|
-
|
150
156
|
return new ApiKey(response?.data, this.options)
|
151
157
|
}
|
152
158
|
|
@@ -160,36 +166,34 @@ class ApiKey {
|
|
160
166
|
}
|
161
167
|
|
162
168
|
params.id = this.attributes.id
|
163
|
-
if (params
|
164
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
169
|
+
if (params.id && !isInt(params.id)) {
|
170
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
165
171
|
}
|
166
172
|
|
167
|
-
if (!params
|
173
|
+
if (!params.id) {
|
168
174
|
if (this.attributes.id) {
|
169
|
-
params
|
175
|
+
params.id = this.id
|
170
176
|
} else {
|
171
177
|
throw new errors.MissingParameterError('Parameter missing: id')
|
172
178
|
}
|
173
179
|
}
|
174
180
|
|
175
|
-
|
176
|
-
|
177
|
-
return
|
181
|
+
await Api.sendRequest(`/api_keys/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
178
182
|
}
|
179
183
|
|
180
184
|
destroy = (params = {}) =>
|
181
185
|
this.delete(params)
|
182
186
|
|
183
187
|
save = async () => {
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
188
|
+
if (this.attributes.id) {
|
189
|
+
const newObject = await this.update(this.attributes)
|
190
|
+
this.attributes = { ...newObject.attributes }
|
191
|
+
return true
|
192
|
+
}
|
193
|
+
|
194
|
+
const newObject = await ApiKey.create(this.attributes, this.options)
|
195
|
+
this.attributes = { ...newObject.attributes }
|
196
|
+
return true
|
193
197
|
}
|
194
198
|
|
195
199
|
// Parameters:
|
@@ -203,21 +207,20 @@ class ApiKey {
|
|
203
207
|
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `expires_at`.
|
204
208
|
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `expires_at`.
|
205
209
|
static list = async (params = {}, options = {}) => {
|
206
|
-
if (params
|
207
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
210
|
+
if (params.user_id && !isInt(params.user_id)) {
|
211
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
208
212
|
}
|
209
213
|
|
210
|
-
if (params
|
211
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
214
|
+
if (params.cursor && !isString(params.cursor)) {
|
215
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
212
216
|
}
|
213
217
|
|
214
|
-
if (params
|
215
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
218
|
+
if (params.per_page && !isInt(params.per_page)) {
|
219
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
216
220
|
}
|
217
221
|
|
218
|
-
const response = await Api.sendRequest(
|
222
|
+
const response = await Api.sendRequest('/api_keys', 'GET', params, options)
|
219
223
|
|
220
|
-
|
221
224
|
return response?.data?.map(obj => new ApiKey(obj, options)) || []
|
222
225
|
}
|
223
226
|
|
@@ -225,9 +228,8 @@ class ApiKey {
|
|
225
228
|
ApiKey.list(params, options)
|
226
229
|
|
227
230
|
static findCurrent = async (options = {}) => {
|
228
|
-
const response = await Api.sendRequest(
|
231
|
+
const response = await Api.sendRequest('/api_key', 'GET', {}, options)
|
229
232
|
|
230
|
-
|
231
233
|
return new ApiKey(response?.data, options)
|
232
234
|
}
|
233
235
|
|
@@ -238,19 +240,18 @@ class ApiKey {
|
|
238
240
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
239
241
|
}
|
240
242
|
|
241
|
-
params
|
243
|
+
params.id = id
|
242
244
|
|
243
|
-
if (!params
|
245
|
+
if (!params.id) {
|
244
246
|
throw new errors.MissingParameterError('Parameter missing: id')
|
245
247
|
}
|
246
248
|
|
247
|
-
if (params
|
248
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
249
|
+
if (params.id && !isInt(params.id)) {
|
250
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
249
251
|
}
|
250
252
|
|
251
|
-
const response = await Api.sendRequest(`/api_keys/${encodeURIComponent(params
|
253
|
+
const response = await Api.sendRequest(`/api_keys/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
252
254
|
|
253
|
-
|
254
255
|
return new ApiKey(response?.data, options)
|
255
256
|
}
|
256
257
|
|
@@ -264,33 +265,32 @@ class ApiKey {
|
|
264
265
|
// permission_set - string - Permissions for this API Key. It must be full for site-wide API Keys. Keys with the `desktop_app` permission set only have the ability to do the functions provided in our Desktop App (File and Share Link operations). Additional permission sets may become available in the future, such as for a Site Admin to give a key with no administrator privileges. If you have ideas for permission sets, please let us know.
|
265
266
|
// name (required) - string - Internal name for the API Key. For your use.
|
266
267
|
static create = async (params = {}, options = {}) => {
|
267
|
-
if (!params
|
268
|
+
if (!params.name) {
|
268
269
|
throw new errors.MissingParameterError('Parameter missing: name')
|
269
270
|
}
|
270
271
|
|
271
|
-
if (params
|
272
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
272
|
+
if (params.user_id && !isInt(params.user_id)) {
|
273
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
273
274
|
}
|
274
275
|
|
275
|
-
if (params
|
276
|
-
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params
|
276
|
+
if (params.description && !isString(params.description)) {
|
277
|
+
throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(params.description)}`)
|
277
278
|
}
|
278
279
|
|
279
|
-
if (params
|
280
|
-
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params
|
280
|
+
if (params.expires_at && !isString(params.expires_at)) {
|
281
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
|
281
282
|
}
|
282
283
|
|
283
|
-
if (params
|
284
|
-
throw new errors.InvalidParameterError(`Bad parameter: permission_set must be of type String, received ${getType(params
|
284
|
+
if (params.permission_set && !isString(params.permission_set)) {
|
285
|
+
throw new errors.InvalidParameterError(`Bad parameter: permission_set must be of type String, received ${getType(params.permission_set)}`)
|
285
286
|
}
|
286
287
|
|
287
|
-
if (params
|
288
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params
|
288
|
+
if (params.name && !isString(params.name)) {
|
289
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
289
290
|
}
|
290
291
|
|
291
|
-
const response = await Api.sendRequest(
|
292
|
+
const response = await Api.sendRequest('/api_keys', 'POST', params, options)
|
292
293
|
|
293
|
-
|
294
294
|
return new ApiKey(response?.data, options)
|
295
295
|
}
|
296
296
|
|
@@ -299,28 +299,25 @@ class ApiKey {
|
|
299
299
|
// name - string - Internal name for the API Key. For your use.
|
300
300
|
// permission_set - string - Permissions for this API Key. It must be full for site-wide API Keys. Keys with the `desktop_app` permission set only have the ability to do the functions provided in our Desktop App (File and Share Link operations). Additional permission sets may become available in the future, such as for a Site Admin to give a key with no administrator privileges. If you have ideas for permission sets, please let us know.
|
301
301
|
static updateCurrent = async (params = {}, options = {}) => {
|
302
|
-
if (params
|
303
|
-
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params
|
302
|
+
if (params.expires_at && !isString(params.expires_at)) {
|
303
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
|
304
304
|
}
|
305
305
|
|
306
|
-
if (params
|
307
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params
|
306
|
+
if (params.name && !isString(params.name)) {
|
307
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
308
308
|
}
|
309
309
|
|
310
|
-
if (params
|
311
|
-
throw new errors.InvalidParameterError(`Bad parameter: permission_set must be of type String, received ${getType(params
|
310
|
+
if (params.permission_set && !isString(params.permission_set)) {
|
311
|
+
throw new errors.InvalidParameterError(`Bad parameter: permission_set must be of type String, received ${getType(params.permission_set)}`)
|
312
312
|
}
|
313
313
|
|
314
|
-
const response = await Api.sendRequest(
|
314
|
+
const response = await Api.sendRequest('/api_key', 'PATCH', params, options)
|
315
315
|
|
316
|
-
|
317
316
|
return new ApiKey(response?.data, options)
|
318
317
|
}
|
319
318
|
|
320
319
|
static deleteCurrent = async (options = {}) => {
|
321
|
-
|
322
|
-
|
323
|
-
return
|
320
|
+
await Api.sendRequest('/api_key', 'DELETE', {}, options)
|
324
321
|
}
|
325
322
|
}
|
326
323
|
|