files.com 1.1.19 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +0 -3
- package/_VERSION +1 -1
- package/lib/Api.js +1 -1
- package/lib/Errors.js +354 -512
- package/lib/Files.js +1 -1
- package/lib/models/ActionNotificationExport.js +25 -25
- package/lib/models/ActionNotificationExportResult.js +10 -10
- package/lib/models/ActionWebhookFailure.js +5 -9
- package/lib/models/ApiKey.js +62 -70
- package/lib/models/App.js +5 -5
- package/lib/models/As2IncomingMessage.js +7 -7
- package/lib/models/As2OutgoingMessage.js +7 -7
- package/lib/models/As2Partner.js +54 -58
- package/lib/models/As2Station.js +51 -55
- package/lib/models/Automation.js +102 -110
- package/lib/models/AutomationRun.js +13 -13
- package/lib/models/BandwidthSnapshot.js +5 -5
- package/lib/models/Behavior.js +77 -85
- package/lib/models/Bundle.js +102 -110
- package/lib/models/BundleDownload.js +9 -9
- package/lib/models/BundleNotification.js +37 -41
- package/lib/models/BundleRecipient.js +22 -22
- package/lib/models/BundleRegistration.js +7 -7
- package/lib/models/Clickwrap.js +52 -56
- package/lib/models/DnsRecord.js +5 -5
- package/lib/models/EmailIncomingMessage.js +5 -5
- package/lib/models/ExternalEvent.js +18 -18
- package/lib/models/File.js +89 -93
- package/lib/models/FileComment.js +41 -45
- package/lib/models/FileCommentReaction.js +15 -19
- package/lib/models/FileMigration.js +5 -5
- package/lib/models/Folder.js +24 -24
- package/lib/models/FormFieldSet.js +44 -48
- package/lib/models/GpgKey.js +53 -57
- package/lib/models/Group.js +51 -55
- package/lib/models/GroupUser.js +53 -57
- package/lib/models/History.js +72 -72
- package/lib/models/HistoryExport.js +51 -51
- package/lib/models/HistoryExportResult.js +10 -10
- package/lib/models/InboxRecipient.js +22 -22
- package/lib/models/InboxRegistration.js +7 -7
- package/lib/models/InboxUpload.js +9 -9
- package/lib/models/Invoice.js +12 -12
- package/lib/models/IpAddress.js +17 -17
- package/lib/models/Lock.js +27 -31
- package/lib/models/Message.js +60 -64
- package/lib/models/MessageComment.js +46 -50
- package/lib/models/MessageCommentReaction.js +27 -31
- package/lib/models/MessageReaction.js +27 -31
- package/lib/models/Notification.js +66 -70
- package/lib/models/Payment.js +12 -12
- package/lib/models/Permission.js +28 -32
- package/lib/models/Priority.js +9 -9
- package/lib/models/Project.js +39 -43
- package/lib/models/PublicKey.js +46 -50
- package/lib/models/RemoteBandwidthSnapshot.js +5 -5
- package/lib/models/RemoteServer.js +306 -310
- package/lib/models/Request.js +33 -37
- package/lib/models/Session.js +11 -15
- package/lib/models/SettingsChange.js +5 -5
- package/lib/models/SftpHostKey.js +40 -44
- package/lib/models/ShareGroup.js +50 -54
- package/lib/models/Site.js +138 -138
- package/lib/models/Snapshot.js +44 -48
- package/lib/models/SsoStrategy.js +15 -19
- package/lib/models/Style.js +17 -21
- package/lib/models/UsageDailySnapshot.js +5 -5
- package/lib/models/UsageSnapshot.js +5 -5
- package/lib/models/User.js +156 -172
- package/lib/models/UserCipherUse.js +7 -7
- package/lib/models/UserRequest.js +26 -30
- package/lib/models/WebhookTest.js +15 -15
- package/package.json +6 -2
- package/src/Api.js +2 -1
- package/src/Errors.js +189 -178
- package/src/Files.js +1 -1
- package/src/models/AccountLineItem.js +5 -2
- package/src/models/Action.js +5 -2
- package/src/models/ActionNotificationExport.js +36 -35
- package/src/models/ActionNotificationExportResult.js +15 -13
- package/src/models/ActionWebhookFailure.js +9 -8
- package/src/models/ApiKey.js +69 -72
- package/src/models/App.js +10 -8
- package/src/models/As2IncomingMessage.js +12 -10
- package/src/models/As2OutgoingMessage.js +12 -10
- package/src/models/As2Partner.js +61 -60
- package/src/models/As2Station.js +58 -57
- package/src/models/Auto.js +5 -2
- package/src/models/Automation.js +121 -110
- package/src/models/AutomationRun.js +18 -17
- package/src/models/BandwidthSnapshot.js +10 -8
- package/src/models/Behavior.js +85 -86
- package/src/models/Bundle.js +121 -110
- package/src/models/BundleDownload.js +14 -12
- package/src/models/BundleNotification.js +40 -43
- package/src/models/BundleRecipient.js +33 -32
- package/src/models/BundleRegistration.js +12 -10
- package/src/models/Clickwrap.js +60 -58
- package/src/models/DnsRecord.js +10 -8
- package/src/models/EmailIncomingMessage.js +10 -8
- package/src/models/Errors.js +5 -2
- package/src/models/ExternalEvent.js +29 -29
- package/src/models/File.js +116 -108
- package/src/models/FileAction.js +5 -2
- package/src/models/FileComment.js +45 -46
- package/src/models/FileCommentReaction.js +26 -26
- package/src/models/FileMigration.js +10 -8
- package/src/models/FileUploadPart.js +5 -2
- package/src/models/Folder.js +32 -29
- package/src/models/FormField.js +5 -2
- package/src/models/FormFieldSet.js +49 -50
- package/src/models/GpgKey.js +60 -59
- package/src/models/Group.js +58 -57
- package/src/models/GroupUser.js +60 -58
- package/src/models/History.js +77 -74
- package/src/models/HistoryExport.js +62 -61
- package/src/models/HistoryExportResult.js +15 -13
- package/src/models/Image.js +5 -2
- package/src/models/InboxRecipient.js +33 -32
- package/src/models/InboxRegistration.js +12 -10
- package/src/models/InboxUpload.js +14 -12
- package/src/models/Invoice.js +17 -14
- package/src/models/InvoiceLineItem.js +5 -2
- package/src/models/IpAddress.js +22 -20
- package/src/models/Lock.js +36 -36
- package/src/models/Message.js +66 -66
- package/src/models/MessageComment.js +50 -52
- package/src/models/MessageCommentReaction.js +38 -40
- package/src/models/MessageReaction.js +38 -40
- package/src/models/Notification.js +74 -72
- package/src/models/Payment.js +17 -14
- package/src/models/PaymentLineItem.js +5 -2
- package/src/models/Permission.js +39 -40
- package/src/models/Preview.js +5 -2
- package/src/models/Priority.js +14 -12
- package/src/models/Project.js +43 -45
- package/src/models/PublicIpAddress.js +5 -2
- package/src/models/PublicKey.js +50 -52
- package/src/models/RemoteBandwidthSnapshot.js +10 -8
- package/src/models/RemoteServer.js +380 -312
- package/src/models/RemoteServerConfigurationFile.js +5 -2
- package/src/models/Request.js +44 -46
- package/src/models/Session.js +22 -22
- package/src/models/SettingsChange.js +10 -8
- package/src/models/SftpHostKey.js +45 -46
- package/src/models/ShareGroup.js +56 -56
- package/src/models/ShareGroupMember.js +5 -2
- package/src/models/Site.js +143 -142
- package/src/models/Snapshot.js +50 -50
- package/src/models/SsoStrategy.js +20 -21
- package/src/models/Status.js +5 -2
- package/src/models/Style.js +22 -23
- package/src/models/UsageDailySnapshot.js +10 -8
- package/src/models/UsageSnapshot.js +10 -8
- package/src/models/User.js +185 -168
- package/src/models/UserCipherUse.js +12 -10
- package/src/models/UserRequest.js +37 -39
- package/src/models/WebhookTest.js +26 -24
- package/test/Api.test.js +163 -0
- package/test/{package.json → integration/package.json} +1 -1
- package/test/{src → integration/src}/index.js +1 -1
- package/test.sh +2 -1
- /package/test/{.babelrc → integration/.babelrc} +0 -0
- /package/test/{index.js → integration/index.js} +0 -0
package/src/models/Payment.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 Payment {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class Payment {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Line item Id
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -66,22 +70,21 @@ class Payment {
|
|
66
70
|
// date-time # Line item updated at
|
67
71
|
getUpdatedAt = () => this.attributes.updated_at
|
68
72
|
|
69
|
-
|
70
73
|
// Parameters:
|
71
74
|
// 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.
|
72
75
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
73
76
|
static list = async (params = {}, options = {}) => {
|
74
|
-
if (params
|
75
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
77
|
+
if (params.cursor && !isString(params.cursor)) {
|
78
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
76
79
|
}
|
77
80
|
|
78
|
-
if (params
|
79
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
81
|
+
if (params.per_page && !isInt(params.per_page)) {
|
82
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
80
83
|
}
|
81
84
|
|
82
|
-
const response = await Api.sendRequest(
|
85
|
+
const response = await Api.sendRequest('/payments', 'GET', params, options)
|
83
86
|
|
84
|
-
const AccountLineItem = require(
|
87
|
+
const AccountLineItem = require('./AccountLineItem.js').default
|
85
88
|
return response?.data?.map(obj => new AccountLineItem(obj, options)) || []
|
86
89
|
}
|
87
90
|
|
@@ -95,19 +98,19 @@ class Payment {
|
|
95
98
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
96
99
|
}
|
97
100
|
|
98
|
-
params
|
101
|
+
params.id = id
|
99
102
|
|
100
|
-
if (!params
|
103
|
+
if (!params.id) {
|
101
104
|
throw new errors.MissingParameterError('Parameter missing: id')
|
102
105
|
}
|
103
106
|
|
104
|
-
if (params
|
105
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
107
|
+
if (params.id && !isInt(params.id)) {
|
108
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
106
109
|
}
|
107
110
|
|
108
|
-
const response = await Api.sendRequest(`/payments/${encodeURIComponent(params
|
111
|
+
const response = await Api.sendRequest(`/payments/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
109
112
|
|
110
|
-
const AccountLineItem = require(
|
113
|
+
const AccountLineItem = require('./AccountLineItem.js').default
|
111
114
|
return new AccountLineItem(response?.data, options)
|
112
115
|
}
|
113
116
|
|
@@ -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 PaymentLineItem {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class PaymentLineItem {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// double # Payment line item amount
|
28
32
|
getAmount = () => this.attributes.amount
|
29
33
|
|
@@ -35,7 +39,6 @@ class PaymentLineItem {
|
|
35
39
|
|
36
40
|
// int64 # Payment ID
|
37
41
|
getPaymentId = () => this.attributes.payment_id
|
38
|
-
|
39
42
|
}
|
40
43
|
|
41
44
|
export default PaymentLineItem
|
package/src/models/Permission.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 Permission {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class Permission {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Permission ID
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -80,7 +84,6 @@ class Permission {
|
|
80
84
|
this.attributes.recursive = 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 Permission {
|
|
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(`/permissions/${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 Permission object doesn\'t support updates.')
|
118
|
+
} else {
|
119
|
+
const newObject = await Permission.create(this.attributes, this.options)
|
120
|
+
this.attributes = { ...newObject.attributes }
|
121
|
+
return true
|
122
|
+
}
|
122
123
|
}
|
123
124
|
|
124
125
|
// Parameters:
|
@@ -132,29 +133,28 @@ class Permission {
|
|
132
133
|
// group_id - string
|
133
134
|
// user_id - string
|
134
135
|
static list = async (params = {}, options = {}) => {
|
135
|
-
if (params
|
136
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
136
|
+
if (params.cursor && !isString(params.cursor)) {
|
137
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
137
138
|
}
|
138
139
|
|
139
|
-
if (params
|
140
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
140
|
+
if (params.per_page && !isInt(params.per_page)) {
|
141
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
141
142
|
}
|
142
143
|
|
143
|
-
if (params
|
144
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
144
|
+
if (params.path && !isString(params.path)) {
|
145
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
145
146
|
}
|
146
147
|
|
147
|
-
if (params
|
148
|
-
throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type String, received ${getType(params
|
148
|
+
if (params.group_id && !isString(params.group_id)) {
|
149
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type String, received ${getType(params.group_id)}`)
|
149
150
|
}
|
150
151
|
|
151
|
-
if (params
|
152
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type String, received ${getType(params
|
152
|
+
if (params.user_id && !isString(params.user_id)) {
|
153
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type String, received ${getType(params.user_id)}`)
|
153
154
|
}
|
154
155
|
|
155
|
-
const response = await Api.sendRequest(
|
156
|
+
const response = await Api.sendRequest('/permissions', 'GET', params, options)
|
156
157
|
|
157
|
-
|
158
158
|
return response?.data?.map(obj => new Permission(obj, options)) || []
|
159
159
|
}
|
160
160
|
|
@@ -169,29 +169,28 @@ class Permission {
|
|
169
169
|
// user_id - int64 - User ID. Provide `username` or `user_id`
|
170
170
|
// username - string - User username. Provide `username` or `user_id`
|
171
171
|
static create = async (params = {}, options = {}) => {
|
172
|
-
if (params
|
173
|
-
throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type Int, received ${getType(params
|
172
|
+
if (params.group_id && !isInt(params.group_id)) {
|
173
|
+
throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type Int, received ${getType(params.group_id)}`)
|
174
174
|
}
|
175
175
|
|
176
|
-
if (params
|
177
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
176
|
+
if (params.path && !isString(params.path)) {
|
177
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
178
178
|
}
|
179
179
|
|
180
|
-
if (params
|
181
|
-
throw new errors.InvalidParameterError(`Bad parameter: permission must be of type String, received ${getType(params
|
180
|
+
if (params.permission && !isString(params.permission)) {
|
181
|
+
throw new errors.InvalidParameterError(`Bad parameter: permission must be of type String, received ${getType(params.permission)}`)
|
182
182
|
}
|
183
183
|
|
184
|
-
if (params
|
185
|
-
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params
|
184
|
+
if (params.user_id && !isInt(params.user_id)) {
|
185
|
+
throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
|
186
186
|
}
|
187
187
|
|
188
|
-
if (params
|
189
|
-
throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(params
|
188
|
+
if (params.username && !isString(params.username)) {
|
189
|
+
throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(params.username)}`)
|
190
190
|
}
|
191
191
|
|
192
|
-
const response = await Api.sendRequest(
|
192
|
+
const response = await Api.sendRequest('/permissions', 'POST', params, options)
|
193
193
|
|
194
|
-
|
195
194
|
return new Permission(response?.data, options)
|
196
195
|
}
|
197
196
|
}
|
package/src/models/Preview.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 Preview {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class Preview {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Preview ID
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -38,7 +42,6 @@ class Preview {
|
|
38
42
|
|
39
43
|
// string # Preview size
|
40
44
|
getSize = () => this.attributes.size
|
41
|
-
|
42
45
|
}
|
43
46
|
|
44
47
|
export default Preview
|
package/src/models/Priority.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 Priority {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,13 +27,13 @@ class Priority {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.path
|
30
|
+
|
27
31
|
// string # The path corresponding to the priority color This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
28
32
|
getPath = () => this.attributes.path
|
29
33
|
|
30
34
|
// string # The priority color
|
31
35
|
getColor = () => this.attributes.color
|
32
36
|
|
33
|
-
|
34
37
|
// Parameters:
|
35
38
|
// 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.
|
36
39
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
@@ -40,27 +43,26 @@ class Priority {
|
|
40
43
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
41
44
|
}
|
42
45
|
|
43
|
-
params
|
46
|
+
params.path = path
|
44
47
|
|
45
|
-
if (!params
|
48
|
+
if (!params.path) {
|
46
49
|
throw new errors.MissingParameterError('Parameter missing: path')
|
47
50
|
}
|
48
51
|
|
49
|
-
if (params
|
50
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
52
|
+
if (params.cursor && !isString(params.cursor)) {
|
53
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
51
54
|
}
|
52
55
|
|
53
|
-
if (params
|
54
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
56
|
+
if (params.per_page && !isInt(params.per_page)) {
|
57
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
55
58
|
}
|
56
59
|
|
57
|
-
if (params
|
58
|
-
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params
|
60
|
+
if (params.path && !isString(params.path)) {
|
61
|
+
throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
|
59
62
|
}
|
60
63
|
|
61
|
-
const response = await Api.sendRequest(
|
64
|
+
const response = await Api.sendRequest('/priorities', 'GET', params, options)
|
62
65
|
|
63
|
-
|
64
66
|
return response?.data?.map(obj => new Priority(obj, options)) || []
|
65
67
|
}
|
66
68
|
|
package/src/models/Project.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 Project {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class Project {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Project ID
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -38,7 +42,6 @@ class Project {
|
|
38
42
|
this.attributes.global_access = value
|
39
43
|
}
|
40
44
|
|
41
|
-
|
42
45
|
// Parameters:
|
43
46
|
// global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
|
44
47
|
update = async (params = {}) => {
|
@@ -51,32 +54,32 @@ class Project {
|
|
51
54
|
}
|
52
55
|
|
53
56
|
params.id = this.attributes.id
|
54
|
-
if (params
|
55
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
57
|
+
if (params.id && !isInt(params.id)) {
|
58
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
56
59
|
}
|
57
|
-
|
58
|
-
|
60
|
+
|
61
|
+
if (params.global_access && !isString(params.global_access)) {
|
62
|
+
throw new errors.InvalidParameterError(`Bad parameter: global_access must be of type String, received ${getType(params.global_access)}`)
|
59
63
|
}
|
60
64
|
|
61
|
-
if (!params
|
65
|
+
if (!params.id) {
|
62
66
|
if (this.attributes.id) {
|
63
|
-
params
|
67
|
+
params.id = this.id
|
64
68
|
} else {
|
65
69
|
throw new errors.MissingParameterError('Parameter missing: id')
|
66
70
|
}
|
67
71
|
}
|
68
72
|
|
69
|
-
if (!params
|
73
|
+
if (!params.global_access) {
|
70
74
|
if (this.attributes.global_access) {
|
71
|
-
params
|
75
|
+
params.global_access = this.global_access
|
72
76
|
} else {
|
73
77
|
throw new errors.MissingParameterError('Parameter missing: global_access')
|
74
78
|
}
|
75
79
|
}
|
76
80
|
|
77
|
-
const response = await Api.sendRequest(`/projects/${encodeURIComponent(params
|
81
|
+
const response = await Api.sendRequest(`/projects/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
78
82
|
|
79
|
-
|
80
83
|
return new Project(response?.data, this.options)
|
81
84
|
}
|
82
85
|
|
@@ -90,53 +93,50 @@ class Project {
|
|
90
93
|
}
|
91
94
|
|
92
95
|
params.id = this.attributes.id
|
93
|
-
if (params
|
94
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
96
|
+
if (params.id && !isInt(params.id)) {
|
97
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
95
98
|
}
|
96
99
|
|
97
|
-
if (!params
|
100
|
+
if (!params.id) {
|
98
101
|
if (this.attributes.id) {
|
99
|
-
params
|
102
|
+
params.id = this.id
|
100
103
|
} else {
|
101
104
|
throw new errors.MissingParameterError('Parameter missing: id')
|
102
105
|
}
|
103
106
|
}
|
104
107
|
|
105
|
-
|
106
|
-
|
107
|
-
return
|
108
|
+
await Api.sendRequest(`/projects/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
108
109
|
}
|
109
110
|
|
110
111
|
destroy = (params = {}) =>
|
111
112
|
this.delete(params)
|
112
113
|
|
113
114
|
save = async () => {
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
115
|
+
if (this.attributes.id) {
|
116
|
+
const newObject = await this.update(this.attributes)
|
117
|
+
this.attributes = { ...newObject.attributes }
|
118
|
+
return true
|
119
|
+
}
|
120
|
+
|
121
|
+
const newObject = await Project.create(this.attributes, this.options)
|
122
|
+
this.attributes = { ...newObject.attributes }
|
123
|
+
return true
|
123
124
|
}
|
124
125
|
|
125
126
|
// Parameters:
|
126
127
|
// 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.
|
127
128
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
128
129
|
static list = async (params = {}, options = {}) => {
|
129
|
-
if (params
|
130
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
130
|
+
if (params.cursor && !isString(params.cursor)) {
|
131
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
131
132
|
}
|
132
133
|
|
133
|
-
if (params
|
134
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
134
|
+
if (params.per_page && !isInt(params.per_page)) {
|
135
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
135
136
|
}
|
136
137
|
|
137
|
-
const response = await Api.sendRequest(
|
138
|
+
const response = await Api.sendRequest('/projects', 'GET', params, options)
|
138
139
|
|
139
|
-
|
140
140
|
return response?.data?.map(obj => new Project(obj, options)) || []
|
141
141
|
}
|
142
142
|
|
@@ -150,19 +150,18 @@ class Project {
|
|
150
150
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
151
151
|
}
|
152
152
|
|
153
|
-
params
|
153
|
+
params.id = id
|
154
154
|
|
155
|
-
if (!params
|
155
|
+
if (!params.id) {
|
156
156
|
throw new errors.MissingParameterError('Parameter missing: id')
|
157
157
|
}
|
158
158
|
|
159
|
-
if (params
|
160
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
159
|
+
if (params.id && !isInt(params.id)) {
|
160
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
161
161
|
}
|
162
162
|
|
163
|
-
const response = await Api.sendRequest(`/projects/${encodeURIComponent(params
|
163
|
+
const response = await Api.sendRequest(`/projects/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
164
164
|
|
165
|
-
|
166
165
|
return new Project(response?.data, options)
|
167
166
|
}
|
168
167
|
|
@@ -172,17 +171,16 @@ class Project {
|
|
172
171
|
// Parameters:
|
173
172
|
// global_access (required) - string - Global permissions. Can be: `none`, `anyone_with_read`, `anyone_with_full`.
|
174
173
|
static create = async (params = {}, options = {}) => {
|
175
|
-
if (!params
|
174
|
+
if (!params.global_access) {
|
176
175
|
throw new errors.MissingParameterError('Parameter missing: global_access')
|
177
176
|
}
|
178
177
|
|
179
|
-
if (params
|
180
|
-
throw new errors.InvalidParameterError(`Bad parameter: global_access must be of type String, received ${getType(params
|
178
|
+
if (params.global_access && !isString(params.global_access)) {
|
179
|
+
throw new errors.InvalidParameterError(`Bad parameter: global_access must be of type String, received ${getType(params.global_access)}`)
|
181
180
|
}
|
182
181
|
|
183
|
-
const response = await Api.sendRequest(
|
182
|
+
const response = await Api.sendRequest('/projects', 'POST', params, options)
|
184
183
|
|
185
|
-
|
186
184
|
return new Project(response?.data, options)
|
187
185
|
}
|
188
186
|
}
|
@@ -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 PublicIpAddress {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class PublicIpAddress {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// string # The public IP address.
|
28
32
|
getIpAddress = () => this.attributes.ip_address
|
29
33
|
|
@@ -35,7 +39,6 @@ class PublicIpAddress {
|
|
35
39
|
|
36
40
|
// boolean
|
37
41
|
getSftpEnabled = () => this.attributes.sftp_enabled
|
38
|
-
|
39
42
|
}
|
40
43
|
|
41
44
|
export default PublicIpAddress
|