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/Snapshot.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 Snapshot {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class Snapshot {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # The snapshot's unique ID.
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -73,7 +77,6 @@ class Snapshot {
|
|
|
73
77
|
this.attributes.paths = value
|
|
74
78
|
}
|
|
75
79
|
|
|
76
|
-
|
|
77
80
|
// Parameters:
|
|
78
81
|
// expires_at - string - When the snapshot expires.
|
|
79
82
|
// name - string - A name for the snapshot.
|
|
@@ -88,30 +91,32 @@ class Snapshot {
|
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
params.id = this.attributes.id
|
|
91
|
-
if (params
|
|
92
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
94
|
+
if (params.id && !isInt(params.id)) {
|
|
95
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
93
96
|
}
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
|
|
98
|
+
if (params.expires_at && !isString(params.expires_at)) {
|
|
99
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
|
|
96
100
|
}
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
|
|
102
|
+
if (params.name && !isString(params.name)) {
|
|
103
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
99
104
|
}
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
|
|
106
|
+
if (params.paths && !isArray(params.paths)) {
|
|
107
|
+
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params.paths)}`)
|
|
102
108
|
}
|
|
103
109
|
|
|
104
|
-
if (!params
|
|
110
|
+
if (!params.id) {
|
|
105
111
|
if (this.attributes.id) {
|
|
106
|
-
params
|
|
112
|
+
params.id = this.id
|
|
107
113
|
} else {
|
|
108
114
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
117
|
|
|
112
|
-
const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params
|
|
118
|
+
const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
|
113
119
|
|
|
114
|
-
|
|
115
120
|
return new Snapshot(response?.data, this.options)
|
|
116
121
|
}
|
|
117
122
|
|
|
@@ -125,53 +130,50 @@ class Snapshot {
|
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
params.id = this.attributes.id
|
|
128
|
-
if (params
|
|
129
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
133
|
+
if (params.id && !isInt(params.id)) {
|
|
134
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
130
135
|
}
|
|
131
136
|
|
|
132
|
-
if (!params
|
|
137
|
+
if (!params.id) {
|
|
133
138
|
if (this.attributes.id) {
|
|
134
|
-
params
|
|
139
|
+
params.id = this.id
|
|
135
140
|
} else {
|
|
136
141
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
137
142
|
}
|
|
138
143
|
}
|
|
139
144
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return
|
|
145
|
+
await Api.sendRequest(`/snapshots/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
destroy = (params = {}) =>
|
|
146
149
|
this.delete(params)
|
|
147
150
|
|
|
148
151
|
save = async () => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
if (this.attributes.id) {
|
|
153
|
+
const newObject = await this.update(this.attributes)
|
|
154
|
+
this.attributes = { ...newObject.attributes }
|
|
155
|
+
return true
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const newObject = await Snapshot.create(this.attributes, this.options)
|
|
159
|
+
this.attributes = { ...newObject.attributes }
|
|
160
|
+
return true
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
// Parameters:
|
|
161
164
|
// 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.
|
|
162
165
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
163
166
|
static list = async (params = {}, options = {}) => {
|
|
164
|
-
if (params
|
|
165
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
167
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
168
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
166
169
|
}
|
|
167
170
|
|
|
168
|
-
if (params
|
|
169
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
171
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
172
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
170
173
|
}
|
|
171
174
|
|
|
172
|
-
const response = await Api.sendRequest(
|
|
175
|
+
const response = await Api.sendRequest('/snapshots', 'GET', params, options)
|
|
173
176
|
|
|
174
|
-
|
|
175
177
|
return response?.data?.map(obj => new Snapshot(obj, options)) || []
|
|
176
178
|
}
|
|
177
179
|
|
|
@@ -185,19 +187,18 @@ class Snapshot {
|
|
|
185
187
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
186
188
|
}
|
|
187
189
|
|
|
188
|
-
params
|
|
190
|
+
params.id = id
|
|
189
191
|
|
|
190
|
-
if (!params
|
|
192
|
+
if (!params.id) {
|
|
191
193
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
192
194
|
}
|
|
193
195
|
|
|
194
|
-
if (params
|
|
195
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
196
|
+
if (params.id && !isInt(params.id)) {
|
|
197
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params
|
|
200
|
+
const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
199
201
|
|
|
200
|
-
|
|
201
202
|
return new Snapshot(response?.data, options)
|
|
202
203
|
}
|
|
203
204
|
|
|
@@ -209,21 +210,20 @@ class Snapshot {
|
|
|
209
210
|
// name - string - A name for the snapshot.
|
|
210
211
|
// paths - array(string) - An array of paths to add to the snapshot.
|
|
211
212
|
static create = async (params = {}, options = {}) => {
|
|
212
|
-
if (params
|
|
213
|
-
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params
|
|
213
|
+
if (params.expires_at && !isString(params.expires_at)) {
|
|
214
|
+
throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
if (params
|
|
217
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params
|
|
217
|
+
if (params.name && !isString(params.name)) {
|
|
218
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
|
218
219
|
}
|
|
219
220
|
|
|
220
|
-
if (params
|
|
221
|
-
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params
|
|
221
|
+
if (params.paths && !isArray(params.paths)) {
|
|
222
|
+
throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params.paths)}`)
|
|
222
223
|
}
|
|
223
224
|
|
|
224
|
-
const response = await Api.sendRequest(
|
|
225
|
+
const response = await Api.sendRequest('/snapshots', 'POST', params, options)
|
|
225
226
|
|
|
226
|
-
|
|
227
227
|
return new Snapshot(response?.data, options)
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -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 SsoStrategy {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class SsoStrategy {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// string # SSO Protocol
|
|
28
32
|
getProtocol = () => this.attributes.protocol
|
|
29
33
|
|
|
@@ -159,7 +163,6 @@ class SsoStrategy {
|
|
|
159
163
|
// string # LDAP username field
|
|
160
164
|
getLdapUsernameField = () => this.attributes.ldap_username_field
|
|
161
165
|
|
|
162
|
-
|
|
163
166
|
// Synchronize provisioning data with the SSO remote server
|
|
164
167
|
sync = async (params = {}) => {
|
|
165
168
|
if (!this.attributes.id) {
|
|
@@ -171,38 +174,35 @@ class SsoStrategy {
|
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
params.id = this.attributes.id
|
|
174
|
-
if (params
|
|
175
|
-
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)}`)
|
|
176
179
|
}
|
|
177
180
|
|
|
178
|
-
if (!params
|
|
181
|
+
if (!params.id) {
|
|
179
182
|
if (this.attributes.id) {
|
|
180
|
-
params
|
|
183
|
+
params.id = this.id
|
|
181
184
|
} else {
|
|
182
185
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return
|
|
189
|
+
await Api.sendRequest(`/sso_strategies/${encodeURIComponent(params.id)}/sync`, 'POST', params, this.options)
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
// Parameters:
|
|
192
193
|
// 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.
|
|
193
194
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
194
195
|
static list = async (params = {}, options = {}) => {
|
|
195
|
-
if (params
|
|
196
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
196
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
197
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
197
198
|
}
|
|
198
199
|
|
|
199
|
-
if (params
|
|
200
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
200
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
201
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
const response = await Api.sendRequest(
|
|
204
|
+
const response = await Api.sendRequest('/sso_strategies', 'GET', params, options)
|
|
204
205
|
|
|
205
|
-
|
|
206
206
|
return response?.data?.map(obj => new SsoStrategy(obj, options)) || []
|
|
207
207
|
}
|
|
208
208
|
|
|
@@ -216,19 +216,18 @@ class SsoStrategy {
|
|
|
216
216
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
params
|
|
219
|
+
params.id = id
|
|
220
220
|
|
|
221
|
-
if (!params
|
|
221
|
+
if (!params.id) {
|
|
222
222
|
throw new errors.MissingParameterError('Parameter missing: id')
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
if (params
|
|
226
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
|
225
|
+
if (params.id && !isInt(params.id)) {
|
|
226
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
const response = await Api.sendRequest(`/sso_strategies/${encodeURIComponent(params
|
|
229
|
+
const response = await Api.sendRequest(`/sso_strategies/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
|
230
230
|
|
|
231
|
-
|
|
232
231
|
return new SsoStrategy(response?.data, options)
|
|
233
232
|
}
|
|
234
233
|
|
package/src/models/Status.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 Status {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class Status {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Status HTTP code
|
|
28
32
|
getCode = () => this.attributes.code
|
|
29
33
|
|
|
@@ -44,7 +48,6 @@ class Status {
|
|
|
44
48
|
|
|
45
49
|
// string # Required Clickwrap body
|
|
46
50
|
getClickwrapBody = () => this.attributes.clickwrap_body
|
|
47
|
-
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export default Status
|
package/src/models/Style.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 Style {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class Style {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.path
|
|
30
|
+
|
|
27
31
|
// int64 # Style ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -59,7 +63,6 @@ class Style {
|
|
|
59
63
|
this.attributes.file = value
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
|
|
63
66
|
// Parameters:
|
|
64
67
|
// file (required) - file - Logo for custom branding.
|
|
65
68
|
update = async (params = {}) => {
|
|
@@ -72,29 +75,28 @@ class Style {
|
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
params.path = this.attributes.path
|
|
75
|
-
if (params
|
|
76
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
78
|
+
if (params.path && !isString(params.path)) {
|
|
79
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
if (!params
|
|
82
|
+
if (!params.path) {
|
|
80
83
|
if (this.attributes.path) {
|
|
81
|
-
params
|
|
84
|
+
params.path = this.path
|
|
82
85
|
} else {
|
|
83
86
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
if (!params
|
|
90
|
+
if (!params.file) {
|
|
88
91
|
if (this.attributes.file) {
|
|
89
|
-
params
|
|
92
|
+
params.file = this.file
|
|
90
93
|
} else {
|
|
91
94
|
throw new errors.MissingParameterError('Parameter missing: file')
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
const response = await Api.sendRequest(`/styles/${encodeURIComponent(params
|
|
98
|
+
const response = await Api.sendRequest(`/styles/${encodeURIComponent(params.path)}`, 'PATCH', params, this.options)
|
|
96
99
|
|
|
97
|
-
|
|
98
100
|
return new Style(response?.data, this.options)
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -108,21 +110,19 @@ class Style {
|
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
params.path = this.attributes.path
|
|
111
|
-
if (params
|
|
112
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
113
|
+
if (params.path && !isString(params.path)) {
|
|
114
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
113
115
|
}
|
|
114
116
|
|
|
115
|
-
if (!params
|
|
117
|
+
if (!params.path) {
|
|
116
118
|
if (this.attributes.path) {
|
|
117
|
-
params
|
|
119
|
+
params.path = this.path
|
|
118
120
|
} else {
|
|
119
121
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return
|
|
125
|
+
await Api.sendRequest(`/styles/${encodeURIComponent(params.path)}`, 'DELETE', params, this.options)
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
destroy = (params = {}) =>
|
|
@@ -141,19 +141,18 @@ class Style {
|
|
|
141
141
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
params
|
|
144
|
+
params.path = path
|
|
145
145
|
|
|
146
|
-
if (!params
|
|
146
|
+
if (!params.path) {
|
|
147
147
|
throw new errors.MissingParameterError('Parameter missing: path')
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
if (params
|
|
151
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
|
150
|
+
if (params.path && !isString(params.path)) {
|
|
151
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
const response = await Api.sendRequest(`/styles/${encodeURIComponent(params
|
|
154
|
+
const response = await Api.sendRequest(`/styles/${encodeURIComponent(params.path)}`, 'GET', params, options)
|
|
155
155
|
|
|
156
|
-
|
|
157
156
|
return new Style(response?.data, options)
|
|
158
157
|
}
|
|
159
158
|
|
|
@@ -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 UsageDailySnapshot {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class UsageDailySnapshot {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # ID of the usage record
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -57,7 +61,6 @@ class UsageDailySnapshot {
|
|
|
57
61
|
// object # Usage broken down by each top-level folder
|
|
58
62
|
getUsageByTopLevelDir = () => this.attributes.usage_by_top_level_dir
|
|
59
63
|
|
|
60
|
-
|
|
61
64
|
// Parameters:
|
|
62
65
|
// cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
63
66
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
@@ -68,17 +71,16 @@ class UsageDailySnapshot {
|
|
|
68
71
|
// filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `date`.
|
|
69
72
|
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `date`.
|
|
70
73
|
static list = async (params = {}, options = {}) => {
|
|
71
|
-
if (params
|
|
72
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
74
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
75
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
if (params
|
|
76
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
78
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
79
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
const response = await Api.sendRequest(
|
|
82
|
+
const response = await Api.sendRequest('/usage_daily_snapshots', 'GET', params, options)
|
|
80
83
|
|
|
81
|
-
|
|
82
84
|
return response?.data?.map(obj => new UsageDailySnapshot(obj, options)) || []
|
|
83
85
|
}
|
|
84
86
|
|
|
@@ -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 UsageSnapshot {
|
|
11
13
|
attributes = {}
|
|
14
|
+
|
|
12
15
|
options = {}
|
|
13
16
|
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
|
@@ -24,6 +27,7 @@ class UsageSnapshot {
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
|
30
|
+
|
|
27
31
|
// int64 # Usage snapshot ID
|
|
28
32
|
getId = () => this.attributes.id
|
|
29
33
|
|
|
@@ -69,22 +73,20 @@ class UsageSnapshot {
|
|
|
69
73
|
// double # Transfer Usage for period - Outbound GB from Remote Servers (Sync/Mount)
|
|
70
74
|
getSyncBytesSent = () => this.attributes.sync_bytes_sent
|
|
71
75
|
|
|
72
|
-
|
|
73
76
|
// Parameters:
|
|
74
77
|
// 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.
|
|
75
78
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
|
76
79
|
static list = async (params = {}, options = {}) => {
|
|
77
|
-
if (params
|
|
78
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
|
80
|
+
if (params.cursor && !isString(params.cursor)) {
|
|
81
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
|
79
82
|
}
|
|
80
83
|
|
|
81
|
-
if (params
|
|
82
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
|
84
|
+
if (params.per_page && !isInt(params.per_page)) {
|
|
85
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
|
83
86
|
}
|
|
84
87
|
|
|
85
|
-
const response = await Api.sendRequest(
|
|
88
|
+
const response = await Api.sendRequest('/usage_snapshots', 'GET', params, options)
|
|
86
89
|
|
|
87
|
-
|
|
88
90
|
return response?.data?.map(obj => new UsageSnapshot(obj, options)) || []
|
|
89
91
|
}
|
|
90
92
|
|