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
|
@@ -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 RemoteServerConfigurationFile {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class RemoteServerConfigurationFile {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Agent ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -59,7 +63,6 @@ class RemoteServerConfigurationFile {
|
|
|
59
63
|
|
|
60
64
|
// string # agent config version
|
|
61
65
|
getConfigVersion = () => this.attributes.config_version
|
|
62
|
-
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
export default RemoteServerConfigurationFile
|
package/src/models/Request.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 Request {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class Request {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Request ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -80,7 +84,6 @@ class Request {
|
|
|
80
84
|
this.attributes.group_ids = value
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
|
|
84
87
|
delete = async (params = {}) => {
|
|
85
88
|
if (!this.attributes.id) {
|
|
86
89
|
throw new errors.EmptyPropertyError('Current object has no id')
|
|
@@ -91,34 +94,32 @@ class Request {
|
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
params.id = this.attributes.id
|
|
94
|
-
if (params
|
|
95
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
97
|
+
if (params.id && !isInt(params.id)) {
|
|
98
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
96
99
|
}
|
|
97
100
|
|
|
98
|
-
if (!params
|
|
101
|
+
if (!params.id) {
|
|
99
102
|
if (this.attributes.id) {
|
|
100
|
-
params
|
|
103
|
+
params.id = this.id
|
|
101
104
|
} else {
|
|
102
105
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return
|
|
109
|
+
await Api.sendRequest(`/requests/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
destroy = (params = {}) =>
|
|
112
113
|
this.delete(params)
|
|
113
114
|
|
|
114
115
|
save = async () => {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
if (this.attributes.id) {
|
|
117
|
+
throw new errors.NotImplementedError('The Request object doesn\'t support updates.')
|
|
118
|
+
} else {
|
|
119
|
+
const newObject = await Request.create(this.attributes, this.options)
|
|
120
|
+
this.attributes = { ...newObject.attributes }
|
|
121
|
+
return true
|
|
122
|
+
}
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
// Parameters:
|
|
@@ -128,21 +129,20 @@ class Request {
|
|
|
128
129
|
// mine - boolean - Only show requests of the current user? (Defaults to true if current user is not a site admin.)
|
|
129
130
|
// path - string - Path to show requests for. If omitted, shows all paths. Send `/` to represent the root directory.
|
|
130
131
|
static list = async (params = {}, options = {}) => {
|
|
131
|
-
if (params
|
|
132
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
132
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
133
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
if (params
|
|
136
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
136
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
137
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
if (params
|
|
140
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
140
|
+
if (params.path && !isString(params.path)) {
|
|
141
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
const response = await Api.sendRequest(
|
|
144
|
+
const response = await Api.sendRequest('/requests', 'GET', params, options)
|
|
144
145
|
|
|
145
|
-
|
|
146
146
|
return response?.data?.map(obj => new Request(obj, options)) || []
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -160,27 +160,26 @@ class Request {
|
|
|
160
160
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
params
|
|
163
|
+
params.path = path
|
|
164
164
|
|
|
165
|
-
if (!params
|
|
165
|
+
if (!params.path) {
|
|
166
166
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
if (params
|
|
170
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
169
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
170
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
if (params
|
|
174
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
173
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
174
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
if (params
|
|
178
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
177
|
+
if (params.path && !isString(params.path)) {
|
|
178
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
const response = await Api.sendRequest(`/requests/folders/${encodeURIComponent(params
|
|
181
|
+
const response = await Api.sendRequest(`/requests/folders/${encodeURIComponent(params.path)}`, 'GET', params, options)
|
|
182
182
|
|
|
183
|
-
|
|
184
183
|
return response?.data?.map(obj => new Request(obj, options)) || []
|
|
185
184
|
}
|
|
186
185
|
|
|
@@ -190,33 +189,32 @@ class Request {
|
|
|
190
189
|
// user_ids - string - A list of user IDs to request the file from. If sent as a string, it should be comma-delimited.
|
|
191
190
|
// group_ids - string - A list of group IDs to request the file from. If sent as a string, it should be comma-delimited.
|
|
192
191
|
static create = async (params = {}, options = {}) => {
|
|
193
|
-
if (!params
|
|
192
|
+
if (!params.path) {
|
|
194
193
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
195
194
|
}
|
|
196
195
|
|
|
197
|
-
if (!params
|
|
196
|
+
if (!params.destination) {
|
|
198
197
|
throw new errors.MissingParameterError('Parameter missing: destination')
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
if (params
|
|
202
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
200
|
+
if (params.path && !isString(params.path)) {
|
|
201
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
203
202
|
}
|
|
204
203
|
|
|
205
|
-
if (params
|
|
206
|
-
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(params
|
|
204
|
+
if (params.destination && !isString(params.destination)) {
|
|
205
|
+
throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(params.destination)}`)
|
|
207
206
|
}
|
|
208
207
|
|
|
209
|
-
if (params
|
|
210
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(params
|
|
208
|
+
if (params.user_ids && !isString(params.user_ids)) {
|
|
209
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(params.user_ids)}`)
|
|
211
210
|
}
|
|
212
211
|
|
|
213
|
-
if (params
|
|
214
|
-
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(params
|
|
212
|
+
if (params.group_ids && !isString(params.group_ids)) {
|
|
213
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(params.group_ids)}`)
|
|
215
214
|
}
|
|
216
215
|
|
|
217
|
-
const response = await Api.sendRequest(
|
|
216
|
+
const response = await Api.sendRequest('/requests', 'POST', params, options)
|
|
218
217
|
|
|
219
|
-
|
|
220
218
|
return new Request(response?.data, options)
|
|
221
219
|
}
|
|
222
220
|
}
|
package/src/models/Session.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 Session {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class Session {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// string # Session ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -80,15 +84,14 @@ class Session {
|
|
|
80
84
|
this.attributes.partial_session_id = value
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
|
|
84
87
|
save = async () => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
if (this.attributes.id) {
|
|
89
|
+
throw new errors.NotImplementedError('The Session object doesn\'t support updates.')
|
|
90
|
+
} else {
|
|
91
|
+
const newObject = await Session.create(this.attributes, this.options)
|
|
92
|
+
this.attributes = { ...newObject.attributes }
|
|
93
|
+
return true
|
|
94
|
+
}
|
|
92
95
|
}
|
|
93
96
|
|
|
94
97
|
// Parameters:
|
|
@@ -97,32 +100,29 @@ class Session {
|
|
|
97
100
|
// otp - string - If this user has a 2FA device, provide its OTP or code here.
|
|
98
101
|
// partial_session_id - string - Identifier for a partially-completed login
|
|
99
102
|
static create = async (params = {}, options = {}) => {
|
|
100
|
-
if (params
|
|
101
|
-
throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(params
|
|
103
|
+
if (params.username && !isString(params.username)) {
|
|
104
|
+
throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(params.username)}`)
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
if (params
|
|
105
|
-
throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params
|
|
107
|
+
if (params.password && !isString(params.password)) {
|
|
108
|
+
throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(params.password)}`)
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
if (params
|
|
109
|
-
throw new errors.InvalidParameterError(`Bad parameter: otp must be of type String, received ${getType(params
|
|
111
|
+
if (params.otp && !isString(params.otp)) {
|
|
112
|
+
throw new errors.InvalidParameterError(`Bad parameter: otp must be of type String, received ${getType(params.otp)}`)
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
if (params
|
|
113
|
-
throw new errors.InvalidParameterError(`Bad parameter: partial_session_id must be of type String, received ${getType(params
|
|
115
|
+
if (params.partial_session_id && !isString(params.partial_session_id)) {
|
|
116
|
+
throw new errors.InvalidParameterError(`Bad parameter: partial_session_id must be of type String, received ${getType(params.partial_session_id)}`)
|
|
114
117
|
}
|
|
115
118
|
|
|
116
|
-
const response = await Api.sendRequest(
|
|
119
|
+
const response = await Api.sendRequest('/sessions', 'POST', params, options)
|
|
117
120
|
|
|
118
|
-
|
|
119
121
|
return new Session(response?.data, options)
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
static delete = async (options = {}) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return
|
|
125
|
+
await Api.sendRequest('/sessions', 'DELETE', {}, options)
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
static destroy = (params = {}, options = {}) =>
|
|
@@ -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 SettingsChange {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class SettingsChange {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// array # Markdown-formatted change messages.
|
|
28
32
|
getChanges = () => this.attributes.changes
|
|
29
33
|
|
|
@@ -42,24 +46,22 @@ class SettingsChange {
|
|
|
42
46
|
// string # The username of the user responsible for this change
|
|
43
47
|
getUsername = () => this.attributes.username
|
|
44
48
|
|
|
45
|
-
|
|
46
49
|
// Parameters:
|
|
47
50
|
// 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.
|
|
48
51
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
49
52
|
// sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction (e.g. `sort_by[api_key_id]=desc`). Valid fields are `api_key_id`, `created_at` or `user_id`.
|
|
50
53
|
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `api_key_id` and `user_id`.
|
|
51
54
|
static list = async (params = {}, options = {}) => {
|
|
52
|
-
if (params
|
|
53
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
55
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
56
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
if (params
|
|
57
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
59
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
60
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
58
61
|
}
|
|
59
62
|
|
|
60
|
-
const response = await Api.sendRequest(
|
|
63
|
+
const response = await Api.sendRequest('/settings_changes', 'GET', params, options)
|
|
61
64
|
|
|
62
|
-
|
|
63
65
|
return response?.data?.map(obj => new SettingsChange(obj, options)) || []
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -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 SftpHostKey {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class SftpHostKey {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Sftp Host Key ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -59,7 +63,6 @@ class SftpHostKey {
|
|
|
59
63
|
this.attributes.private_key = value
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
|
|
63
66
|
// Parameters:
|
|
64
67
|
// name - string - The friendly name of this SFTP Host Key.
|
|
65
68
|
// private_key - string - The private key data.
|
|
@@ -73,27 +76,28 @@ class SftpHostKey {
|
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
params.id = this.attributes.id
|
|
76
|
-
if (params
|
|
77
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
79
|
+
if (params.id && !isInt(params.id)) {
|
|
80
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
78
81
|
}
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
|
|
83
|
+
if (params.name && !isString(params.name)) {
|
|
84
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
81
85
|
}
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
|
|
87
|
+
if (params.private_key && !isString(params.private_key)) {
|
|
88
|
+
throw new errors.InvalidParameterError(`Bad parameter: private_key must be of type String, received ${getType(params.private_key)}`)
|
|
84
89
|
}
|
|
85
90
|
|
|
86
|
-
if (!params
|
|
91
|
+
if (!params.id) {
|
|
87
92
|
if (this.attributes.id) {
|
|
88
|
-
params
|
|
93
|
+
params.id = this.id
|
|
89
94
|
} else {
|
|
90
95
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
const response = await Api.sendRequest(`/sftp_host_keys/${encodeURIComponent(params
|
|
99
|
+
const response = await Api.sendRequest(`/sftp_host_keys/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
|
95
100
|
|
|
96
|
-
|
|
97
101
|
return new SftpHostKey(response?.data, this.options)
|
|
98
102
|
}
|
|
99
103
|
|
|
@@ -107,53 +111,50 @@ class SftpHostKey {
|
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
params.id = this.attributes.id
|
|
110
|
-
if (params
|
|
111
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
114
|
+
if (params.id && !isInt(params.id)) {
|
|
115
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
if (!params
|
|
118
|
+
if (!params.id) {
|
|
115
119
|
if (this.attributes.id) {
|
|
116
|
-
params
|
|
120
|
+
params.id = this.id
|
|
117
121
|
} else {
|
|
118
122
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return
|
|
126
|
+
await Api.sendRequest(`/sftp_host_keys/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
destroy = (params = {}) =>
|
|
128
130
|
this.delete(params)
|
|
129
131
|
|
|
130
132
|
save = async () => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
if (this.attributes.id) {
|
|
134
|
+
const newObject = await this.update(this.attributes)
|
|
135
|
+
this.attributes = { ...newObject.attributes }
|
|
136
|
+
return true
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const newObject = await SftpHostKey.create(this.attributes, this.options)
|
|
140
|
+
this.attributes = { ...newObject.attributes }
|
|
141
|
+
return true
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
// Parameters:
|
|
143
145
|
// 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.
|
|
144
146
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
145
147
|
static list = async (params = {}, options = {}) => {
|
|
146
|
-
if (params
|
|
147
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
148
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
149
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
148
150
|
}
|
|
149
151
|
|
|
150
|
-
if (params
|
|
151
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
152
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
153
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
152
154
|
}
|
|
153
155
|
|
|
154
|
-
const response = await Api.sendRequest(
|
|
156
|
+
const response = await Api.sendRequest('/sftp_host_keys', 'GET', params, options)
|
|
155
157
|
|
|
156
|
-
|
|
157
158
|
return response?.data?.map(obj => new SftpHostKey(obj, options)) || []
|
|
158
159
|
}
|
|
159
160
|
|
|
@@ -167,19 +168,18 @@ class SftpHostKey {
|
|
|
167
168
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
168
169
|
}
|
|
169
170
|
|
|
170
|
-
params
|
|
171
|
+
params.id = id
|
|
171
172
|
|
|
172
|
-
if (!params
|
|
173
|
+
if (!params.id) {
|
|
173
174
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
if (params
|
|
177
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
177
|
+
if (params.id && !isInt(params.id)) {
|
|
178
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
178
179
|
}
|
|
179
180
|
|
|
180
|
-
const response = await Api.sendRequest(`/sftp_host_keys/${encodeURIComponent(params
|
|
181
|
+
const response = await Api.sendRequest(`/sftp_host_keys/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
181
182
|
|
|
182
|
-
|
|
183
183
|
return new SftpHostKey(response?.data, options)
|
|
184
184
|
}
|
|
185
185
|
|
|
@@ -190,17 +190,16 @@ class SftpHostKey {
|
|
|
190
190
|
// name - string - The friendly name of this SFTP Host Key.
|
|
191
191
|
// private_key - string - The private key data.
|
|
192
192
|
static create = async (params = {}, options = {}) => {
|
|
193
|
-
if (params
|
|
194
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params
|
|
193
|
+
if (params.name && !isString(params.name)) {
|
|
194
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
if (params
|
|
198
|
-
throw new errors.InvalidParameterError(`Bad parameter: private_key must be of type String, received ${getType(params
|
|
197
|
+
if (params.private_key && !isString(params.private_key)) {
|
|
198
|
+
throw new errors.InvalidParameterError(`Bad parameter: private_key must be of type String, received ${getType(params.private_key)}`)
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
const response = await Api.sendRequest(
|
|
201
|
+
const response = await Api.sendRequest('/sftp_host_keys', 'POST', params, options)
|
|
202
202
|
|
|
203
|
-
|
|
204
203
|
return new SftpHostKey(response?.data, options)
|
|
205
204
|
}
|
|
206
205
|
}
|