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/History.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 History {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class History {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.path
|
|
30
|
+
|
|
27
31
|
// int64 # Action ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -63,7 +67,6 @@ class History {
|
|
|
63
67
|
// string # Interface on which this action occurred.
|
|
64
68
|
getInterface = () => this.attributes.interface
|
|
65
69
|
|
|
66
|
-
|
|
67
70
|
// Parameters:
|
|
68
71
|
// start_at - string - Leave blank or set to a date/time to filter earlier entries.
|
|
69
72
|
// end_at - string - Leave blank or set to a date/time to filter later entries.
|
|
@@ -77,39 +80,39 @@ class History {
|
|
|
77
80
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
78
81
|
}
|
|
79
82
|
|
|
80
|
-
params
|
|
83
|
+
params.path = path
|
|
81
84
|
|
|
82
|
-
if (!params
|
|
85
|
+
if (!params.path) {
|
|
83
86
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
if (params
|
|
87
|
-
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params
|
|
89
|
+
if (params.start_at && !isString(params.start_at)) {
|
|
90
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params.start_at)}`)
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
if (params
|
|
91
|
-
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params
|
|
93
|
+
if (params.end_at && !isString(params.end_at)) {
|
|
94
|
+
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params.end_at)}`)
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
if (params
|
|
95
|
-
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params
|
|
97
|
+
if (params.display && !isString(params.display)) {
|
|
98
|
+
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params.display)}`)
|
|
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: path must be of type String, received ${getType(params
|
|
109
|
+
if (params.path && !isString(params.path)) {
|
|
110
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
const response = await Api.sendRequest(`/history/files/${encodeURIComponent(params
|
|
113
|
+
const response = await Api.sendRequest(`/history/files/${encodeURIComponent(params.path)}`, 'GET', params, options)
|
|
111
114
|
|
|
112
|
-
const Action = require(
|
|
115
|
+
const Action = require('./Action.js').default
|
|
113
116
|
return response?.data?.map(obj => new Action(obj, options)) || []
|
|
114
117
|
}
|
|
115
118
|
|
|
@@ -126,39 +129,39 @@ class History {
|
|
|
126
129
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
127
130
|
}
|
|
128
131
|
|
|
129
|
-
params
|
|
132
|
+
params.path = path
|
|
130
133
|
|
|
131
|
-
if (!params
|
|
134
|
+
if (!params.path) {
|
|
132
135
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
133
136
|
}
|
|
134
137
|
|
|
135
|
-
if (params
|
|
136
|
-
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params
|
|
138
|
+
if (params.start_at && !isString(params.start_at)) {
|
|
139
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params.start_at)}`)
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
if (params
|
|
140
|
-
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params
|
|
142
|
+
if (params.end_at && !isString(params.end_at)) {
|
|
143
|
+
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params.end_at)}`)
|
|
141
144
|
}
|
|
142
145
|
|
|
143
|
-
if (params
|
|
144
|
-
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params
|
|
146
|
+
if (params.display && !isString(params.display)) {
|
|
147
|
+
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params.display)}`)
|
|
145
148
|
}
|
|
146
149
|
|
|
147
|
-
if (params
|
|
148
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
150
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
151
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
if (params
|
|
152
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
154
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
155
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
153
156
|
}
|
|
154
157
|
|
|
155
|
-
if (params
|
|
156
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
158
|
+
if (params.path && !isString(params.path)) {
|
|
159
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
157
160
|
}
|
|
158
161
|
|
|
159
|
-
const response = await Api.sendRequest(`/history/folders/${encodeURIComponent(params
|
|
162
|
+
const response = await Api.sendRequest(`/history/folders/${encodeURIComponent(params.path)}`, 'GET', params, options)
|
|
160
163
|
|
|
161
|
-
const Action = require(
|
|
164
|
+
const Action = require('./Action.js').default
|
|
162
165
|
return response?.data?.map(obj => new Action(obj, options)) || []
|
|
163
166
|
}
|
|
164
167
|
|
|
@@ -175,39 +178,39 @@ class History {
|
|
|
175
178
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
176
179
|
}
|
|
177
180
|
|
|
178
|
-
params
|
|
181
|
+
params.user_id = userId
|
|
179
182
|
|
|
180
|
-
if (!params
|
|
183
|
+
if (!params.user_id) {
|
|
181
184
|
throw new errors.MissingParameterError('Parameter missing: user_id')
|
|
182
185
|
}
|
|
183
186
|
|
|
184
|
-
if (params
|
|
185
|
-
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params
|
|
187
|
+
if (params.start_at && !isString(params.start_at)) {
|
|
188
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params.start_at)}`)
|
|
186
189
|
}
|
|
187
190
|
|
|
188
|
-
if (params
|
|
189
|
-
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params
|
|
191
|
+
if (params.end_at && !isString(params.end_at)) {
|
|
192
|
+
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params.end_at)}`)
|
|
190
193
|
}
|
|
191
194
|
|
|
192
|
-
if (params
|
|
193
|
-
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params
|
|
195
|
+
if (params.display && !isString(params.display)) {
|
|
196
|
+
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params.display)}`)
|
|
194
197
|
}
|
|
195
198
|
|
|
196
|
-
if (params
|
|
197
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
199
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
200
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
198
201
|
}
|
|
199
202
|
|
|
200
|
-
if (params
|
|
201
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
203
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
204
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
202
205
|
}
|
|
203
206
|
|
|
204
|
-
if (params
|
|
205
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
|
207
|
+
if (params.user_id && !isInt(params.user_id)) {
|
|
208
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
|
206
209
|
}
|
|
207
210
|
|
|
208
|
-
const response = await Api.sendRequest(`/history/users/${encodeURIComponent(params
|
|
211
|
+
const response = await Api.sendRequest(`/history/users/${encodeURIComponent(params.user_id)}`, 'GET', params, options)
|
|
209
212
|
|
|
210
|
-
const Action = require(
|
|
213
|
+
const Action = require('./Action.js').default
|
|
211
214
|
return response?.data?.map(obj => new Action(obj, options)) || []
|
|
212
215
|
}
|
|
213
216
|
|
|
@@ -219,29 +222,29 @@ class History {
|
|
|
219
222
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
220
223
|
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[user_id]=desc`). Valid fields are `user_id` and `created_at`.
|
|
221
224
|
static listLogins = async (params = {}, options = {}) => {
|
|
222
|
-
if (params
|
|
223
|
-
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params
|
|
225
|
+
if (params.start_at && !isString(params.start_at)) {
|
|
226
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params.start_at)}`)
|
|
224
227
|
}
|
|
225
228
|
|
|
226
|
-
if (params
|
|
227
|
-
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params
|
|
229
|
+
if (params.end_at && !isString(params.end_at)) {
|
|
230
|
+
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params.end_at)}`)
|
|
228
231
|
}
|
|
229
232
|
|
|
230
|
-
if (params
|
|
231
|
-
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params
|
|
233
|
+
if (params.display && !isString(params.display)) {
|
|
234
|
+
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params.display)}`)
|
|
232
235
|
}
|
|
233
236
|
|
|
234
|
-
if (params
|
|
235
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
237
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
238
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
236
239
|
}
|
|
237
240
|
|
|
238
|
-
if (params
|
|
239
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
241
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
242
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
240
243
|
}
|
|
241
244
|
|
|
242
|
-
const response = await Api.sendRequest(
|
|
245
|
+
const response = await Api.sendRequest('/history/login', 'GET', params, options)
|
|
243
246
|
|
|
244
|
-
const Action = require(
|
|
247
|
+
const Action = require('./Action.js').default
|
|
245
248
|
return response?.data?.map(obj => new Action(obj, options)) || []
|
|
246
249
|
}
|
|
247
250
|
|
|
@@ -255,29 +258,29 @@ class History {
|
|
|
255
258
|
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `user_id`, `folder` or `path`.
|
|
256
259
|
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `path`.
|
|
257
260
|
static list = async (params = {}, options = {}) => {
|
|
258
|
-
if (params
|
|
259
|
-
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params
|
|
261
|
+
if (params.start_at && !isString(params.start_at)) {
|
|
262
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params.start_at)}`)
|
|
260
263
|
}
|
|
261
264
|
|
|
262
|
-
if (params
|
|
263
|
-
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params
|
|
265
|
+
if (params.end_at && !isString(params.end_at)) {
|
|
266
|
+
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params.end_at)}`)
|
|
264
267
|
}
|
|
265
268
|
|
|
266
|
-
if (params
|
|
267
|
-
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params
|
|
269
|
+
if (params.display && !isString(params.display)) {
|
|
270
|
+
throw new errors.InvalidParameterError(`Bad parameter: display must be of type String, received ${getType(params.display)}`)
|
|
268
271
|
}
|
|
269
272
|
|
|
270
|
-
if (params
|
|
271
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
273
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
274
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
272
275
|
}
|
|
273
276
|
|
|
274
|
-
if (params
|
|
275
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
277
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
278
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
276
279
|
}
|
|
277
280
|
|
|
278
|
-
const response = await Api.sendRequest(
|
|
281
|
+
const response = await Api.sendRequest('/history', 'GET', params, options)
|
|
279
282
|
|
|
280
|
-
const Action = require(
|
|
283
|
+
const Action = require('./Action.js').default
|
|
281
284
|
return response?.data?.map(obj => new Action(obj, options)) || []
|
|
282
285
|
}
|
|
283
286
|
|
|
@@ -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 HistoryExport {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class HistoryExport {
|
|
|
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
|
|
|
@@ -206,15 +210,14 @@ class HistoryExport {
|
|
|
206
210
|
this.attributes.user_id = value
|
|
207
211
|
}
|
|
208
212
|
|
|
209
|
-
|
|
210
213
|
save = async () => {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
if (this.attributes.id) {
|
|
215
|
+
throw new errors.NotImplementedError('The HistoryExport object doesn\'t support updates.')
|
|
216
|
+
} else {
|
|
217
|
+
const newObject = await HistoryExport.create(this.attributes, this.options)
|
|
218
|
+
this.attributes = { ...newObject.attributes }
|
|
219
|
+
return true
|
|
220
|
+
}
|
|
218
221
|
}
|
|
219
222
|
|
|
220
223
|
// Parameters:
|
|
@@ -224,19 +227,18 @@ class HistoryExport {
|
|
|
224
227
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
225
228
|
}
|
|
226
229
|
|
|
227
|
-
params
|
|
230
|
+
params.id = id
|
|
228
231
|
|
|
229
|
-
if (!params
|
|
232
|
+
if (!params.id) {
|
|
230
233
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
231
234
|
}
|
|
232
235
|
|
|
233
|
-
if (params
|
|
234
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
236
|
+
if (params.id && !isInt(params.id)) {
|
|
237
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
235
238
|
}
|
|
236
239
|
|
|
237
|
-
const response = await Api.sendRequest(`/history_exports/${encodeURIComponent(params
|
|
240
|
+
const response = await Api.sendRequest(`/history_exports/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
238
241
|
|
|
239
|
-
|
|
240
242
|
return new HistoryExport(response?.data, options)
|
|
241
243
|
}
|
|
242
244
|
|
|
@@ -267,97 +269,96 @@ class HistoryExport {
|
|
|
267
269
|
// query_target_platform - string - If searching for Histories about API keys, this parameter restricts results to API keys associated with this platform.
|
|
268
270
|
// query_target_permission_set - string - If searching for Histories about API keys, this parameter restricts results to API keys with this permission set.
|
|
269
271
|
static create = async (params = {}, options = {}) => {
|
|
270
|
-
if (params
|
|
271
|
-
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)}`)
|
|
272
274
|
}
|
|
273
275
|
|
|
274
|
-
if (params
|
|
275
|
-
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params
|
|
276
|
+
if (params.start_at && !isString(params.start_at)) {
|
|
277
|
+
throw new errors.InvalidParameterError(`Bad parameter: start_at must be of type String, received ${getType(params.start_at)}`)
|
|
276
278
|
}
|
|
277
279
|
|
|
278
|
-
if (params
|
|
279
|
-
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params
|
|
280
|
+
if (params.end_at && !isString(params.end_at)) {
|
|
281
|
+
throw new errors.InvalidParameterError(`Bad parameter: end_at must be of type String, received ${getType(params.end_at)}`)
|
|
280
282
|
}
|
|
281
283
|
|
|
282
|
-
if (params
|
|
283
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_action must be of type String, received ${getType(params
|
|
284
|
+
if (params.query_action && !isString(params.query_action)) {
|
|
285
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_action must be of type String, received ${getType(params.query_action)}`)
|
|
284
286
|
}
|
|
285
287
|
|
|
286
|
-
if (params
|
|
287
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_interface must be of type String, received ${getType(params
|
|
288
|
+
if (params.query_interface && !isString(params.query_interface)) {
|
|
289
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_interface must be of type String, received ${getType(params.query_interface)}`)
|
|
288
290
|
}
|
|
289
291
|
|
|
290
|
-
if (params
|
|
291
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_user_id must be of type String, received ${getType(params
|
|
292
|
+
if (params.query_user_id && !isString(params.query_user_id)) {
|
|
293
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_user_id must be of type String, received ${getType(params.query_user_id)}`)
|
|
292
294
|
}
|
|
293
295
|
|
|
294
|
-
if (params
|
|
295
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_file_id must be of type String, received ${getType(params
|
|
296
|
+
if (params.query_file_id && !isString(params.query_file_id)) {
|
|
297
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_file_id must be of type String, received ${getType(params.query_file_id)}`)
|
|
296
298
|
}
|
|
297
299
|
|
|
298
|
-
if (params
|
|
299
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_parent_id must be of type String, received ${getType(params
|
|
300
|
+
if (params.query_parent_id && !isString(params.query_parent_id)) {
|
|
301
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_parent_id must be of type String, received ${getType(params.query_parent_id)}`)
|
|
300
302
|
}
|
|
301
303
|
|
|
302
|
-
if (params
|
|
303
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_path must be of type String, received ${getType(params
|
|
304
|
+
if (params.query_path && !isString(params.query_path)) {
|
|
305
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_path must be of type String, received ${getType(params.query_path)}`)
|
|
304
306
|
}
|
|
305
307
|
|
|
306
|
-
if (params
|
|
307
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_folder must be of type String, received ${getType(params
|
|
308
|
+
if (params.query_folder && !isString(params.query_folder)) {
|
|
309
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_folder must be of type String, received ${getType(params.query_folder)}`)
|
|
308
310
|
}
|
|
309
311
|
|
|
310
|
-
if (params
|
|
311
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_src must be of type String, received ${getType(params
|
|
312
|
+
if (params.query_src && !isString(params.query_src)) {
|
|
313
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_src must be of type String, received ${getType(params.query_src)}`)
|
|
312
314
|
}
|
|
313
315
|
|
|
314
|
-
if (params
|
|
315
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_destination must be of type String, received ${getType(params
|
|
316
|
+
if (params.query_destination && !isString(params.query_destination)) {
|
|
317
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_destination must be of type String, received ${getType(params.query_destination)}`)
|
|
316
318
|
}
|
|
317
319
|
|
|
318
|
-
if (params
|
|
319
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_ip must be of type String, received ${getType(params
|
|
320
|
+
if (params.query_ip && !isString(params.query_ip)) {
|
|
321
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_ip must be of type String, received ${getType(params.query_ip)}`)
|
|
320
322
|
}
|
|
321
323
|
|
|
322
|
-
if (params
|
|
323
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_username must be of type String, received ${getType(params
|
|
324
|
+
if (params.query_username && !isString(params.query_username)) {
|
|
325
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_username must be of type String, received ${getType(params.query_username)}`)
|
|
324
326
|
}
|
|
325
327
|
|
|
326
|
-
if (params
|
|
327
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_failure_type must be of type String, received ${getType(params
|
|
328
|
+
if (params.query_failure_type && !isString(params.query_failure_type)) {
|
|
329
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_failure_type must be of type String, received ${getType(params.query_failure_type)}`)
|
|
328
330
|
}
|
|
329
331
|
|
|
330
|
-
if (params
|
|
331
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_target_id must be of type String, received ${getType(params
|
|
332
|
+
if (params.query_target_id && !isString(params.query_target_id)) {
|
|
333
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_target_id must be of type String, received ${getType(params.query_target_id)}`)
|
|
332
334
|
}
|
|
333
335
|
|
|
334
|
-
if (params
|
|
335
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_target_name must be of type String, received ${getType(params
|
|
336
|
+
if (params.query_target_name && !isString(params.query_target_name)) {
|
|
337
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_target_name must be of type String, received ${getType(params.query_target_name)}`)
|
|
336
338
|
}
|
|
337
339
|
|
|
338
|
-
if (params
|
|
339
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_target_permission must be of type String, received ${getType(params
|
|
340
|
+
if (params.query_target_permission && !isString(params.query_target_permission)) {
|
|
341
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_target_permission must be of type String, received ${getType(params.query_target_permission)}`)
|
|
340
342
|
}
|
|
341
343
|
|
|
342
|
-
if (params
|
|
343
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_target_user_id must be of type String, received ${getType(params
|
|
344
|
+
if (params.query_target_user_id && !isString(params.query_target_user_id)) {
|
|
345
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_target_user_id must be of type String, received ${getType(params.query_target_user_id)}`)
|
|
344
346
|
}
|
|
345
347
|
|
|
346
|
-
if (params
|
|
347
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_target_username must be of type String, received ${getType(params
|
|
348
|
+
if (params.query_target_username && !isString(params.query_target_username)) {
|
|
349
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_target_username must be of type String, received ${getType(params.query_target_username)}`)
|
|
348
350
|
}
|
|
349
351
|
|
|
350
|
-
if (params
|
|
351
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_target_platform must be of type String, received ${getType(params
|
|
352
|
+
if (params.query_target_platform && !isString(params.query_target_platform)) {
|
|
353
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_target_platform must be of type String, received ${getType(params.query_target_platform)}`)
|
|
352
354
|
}
|
|
353
355
|
|
|
354
|
-
if (params
|
|
355
|
-
throw new errors.InvalidParameterError(`Bad parameter: query_target_permission_set must be of type String, received ${getType(params
|
|
356
|
+
if (params.query_target_permission_set && !isString(params.query_target_permission_set)) {
|
|
357
|
+
throw new errors.InvalidParameterError(`Bad parameter: query_target_permission_set must be of type String, received ${getType(params.query_target_permission_set)}`)
|
|
356
358
|
}
|
|
357
359
|
|
|
358
|
-
const response = await Api.sendRequest(
|
|
360
|
+
const response = await Api.sendRequest('/history_exports', 'POST', params, options)
|
|
359
361
|
|
|
360
|
-
|
|
361
362
|
return new HistoryExport(response?.data, options)
|
|
362
363
|
}
|
|
363
364
|
}
|
|
@@ -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 HistoryExportResult {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class HistoryExportResult {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Action ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -99,36 +103,34 @@ class HistoryExportResult {
|
|
|
99
103
|
// int64 # If searching for Histories about API keys, this is the User ID on which the action was taken
|
|
100
104
|
getTargetUserId = () => this.attributes.target_user_id
|
|
101
105
|
|
|
102
|
-
|
|
103
106
|
// Parameters:
|
|
104
107
|
// user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
|
|
105
108
|
// 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.
|
|
106
109
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
107
110
|
// history_export_id (required) - int64 - ID of the associated history export.
|
|
108
111
|
static list = async (params = {}, options = {}) => {
|
|
109
|
-
if (!params
|
|
112
|
+
if (!params.history_export_id) {
|
|
110
113
|
throw new errors.MissingParameterError('Parameter missing: history_export_id')
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
if (params
|
|
114
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
|
116
|
+
if (params.user_id && !isInt(params.user_id)) {
|
|
117
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
|
115
118
|
}
|
|
116
119
|
|
|
117
|
-
if (params
|
|
118
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
120
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
121
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
119
122
|
}
|
|
120
123
|
|
|
121
|
-
if (params
|
|
122
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
124
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
125
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
123
126
|
}
|
|
124
127
|
|
|
125
|
-
if (params
|
|
126
|
-
throw new errors.InvalidParameterError(`Bad parameter: history_export_id must be of type Int, received ${getType(params
|
|
128
|
+
if (params.history_export_id && !isInt(params.history_export_id)) {
|
|
129
|
+
throw new errors.InvalidParameterError(`Bad parameter: history_export_id must be of type Int, received ${getType(params.history_export_id)}`)
|
|
127
130
|
}
|
|
128
131
|
|
|
129
|
-
const response = await Api.sendRequest(
|
|
132
|
+
const response = await Api.sendRequest('/history_export_results', 'GET', params, options)
|
|
130
133
|
|
|
131
|
-
|
|
132
134
|
return response?.data?.map(obj => new HistoryExportResult(obj, options)) || []
|
|
133
135
|
}
|
|
134
136
|
|
package/src/models/Image.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 Image {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,12 +27,12 @@ class Image {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// string # Image name
|
|
28
32
|
getName = () => this.attributes.name
|
|
29
33
|
|
|
30
34
|
// string # Image URI
|
|
31
35
|
getUri = () => this.attributes.uri
|
|
32
|
-
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export default Image
|