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/App.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 App {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class App {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// string # The type of the App
|
28
32
|
getAppType = () => this.attributes.app_type
|
29
33
|
|
@@ -84,7 +88,6 @@ class App {
|
|
84
88
|
// string # Tutorial video page
|
85
89
|
getTutorialYoutubeUrl = () => this.attributes.tutorial_youtube_url
|
86
90
|
|
87
|
-
|
88
91
|
// Parameters:
|
89
92
|
// 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.
|
90
93
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
@@ -92,17 +95,16 @@ class App {
|
|
92
95
|
// filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `name` and `app_type`. Valid field combinations are `[ name, app_type ]` and `[ app_type, name ]`.
|
93
96
|
// filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `name`.
|
94
97
|
static list = async (params = {}, options = {}) => {
|
95
|
-
if (params
|
96
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
98
|
+
if (params.cursor && !isString(params.cursor)) {
|
99
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
97
100
|
}
|
98
101
|
|
99
|
-
if (params
|
100
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
102
|
+
if (params.per_page && !isInt(params.per_page)) {
|
103
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
101
104
|
}
|
102
105
|
|
103
|
-
const response = await Api.sendRequest(
|
106
|
+
const response = await Api.sendRequest('/apps', 'GET', params, options)
|
104
107
|
|
105
|
-
|
106
108
|
return response?.data?.map(obj => new App(obj, options)) || []
|
107
109
|
}
|
108
110
|
|
@@ -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 As2IncomingMessage {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class As2IncomingMessage {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Id of the AS2 Partner.
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -129,7 +133,6 @@ class As2IncomingMessage {
|
|
129
133
|
// string # URL to download the http response body
|
130
134
|
getMdnResponseUri = () => this.attributes.mdn_response_uri
|
131
135
|
|
132
|
-
|
133
136
|
// Parameters:
|
134
137
|
// 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.
|
135
138
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
@@ -141,21 +144,20 @@ class As2IncomingMessage {
|
|
141
144
|
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
|
142
145
|
// as2_partner_id - int64 - As2 Partner ID. If provided, will return message specific to that partner.
|
143
146
|
static list = async (params = {}, options = {}) => {
|
144
|
-
if (params
|
145
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
147
|
+
if (params.cursor && !isString(params.cursor)) {
|
148
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
146
149
|
}
|
147
150
|
|
148
|
-
if (params
|
149
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
151
|
+
if (params.per_page && !isInt(params.per_page)) {
|
152
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
150
153
|
}
|
151
154
|
|
152
|
-
if (params
|
153
|
-
throw new errors.InvalidParameterError(`Bad parameter: as2_partner_id must be of type Int, received ${getType(params
|
155
|
+
if (params.as2_partner_id && !isInt(params.as2_partner_id)) {
|
156
|
+
throw new errors.InvalidParameterError(`Bad parameter: as2_partner_id must be of type Int, received ${getType(params.as2_partner_id)}`)
|
154
157
|
}
|
155
158
|
|
156
|
-
const response = await Api.sendRequest(
|
159
|
+
const response = await Api.sendRequest('/as2_incoming_messages', 'GET', params, options)
|
157
160
|
|
158
|
-
|
159
161
|
return response?.data?.map(obj => new As2IncomingMessage(obj, options)) || []
|
160
162
|
}
|
161
163
|
|
@@ -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 As2OutgoingMessage {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class As2OutgoingMessage {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Id of the AS2 Partner.
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -117,7 +121,6 @@ class As2OutgoingMessage {
|
|
117
121
|
// string # URL to download the http response body
|
118
122
|
getMdnResponseUri = () => this.attributes.mdn_response_uri
|
119
123
|
|
120
|
-
|
121
124
|
// Parameters:
|
122
125
|
// 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.
|
123
126
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
@@ -129,21 +132,20 @@ class As2OutgoingMessage {
|
|
129
132
|
// filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`.
|
130
133
|
// as2_partner_id - int64 - As2 Partner ID. If provided, will return message specific to that partner.
|
131
134
|
static list = async (params = {}, options = {}) => {
|
132
|
-
if (params
|
133
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
135
|
+
if (params.cursor && !isString(params.cursor)) {
|
136
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
134
137
|
}
|
135
138
|
|
136
|
-
if (params
|
137
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
139
|
+
if (params.per_page && !isInt(params.per_page)) {
|
140
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
138
141
|
}
|
139
142
|
|
140
|
-
if (params
|
141
|
-
throw new errors.InvalidParameterError(`Bad parameter: as2_partner_id must be of type Int, received ${getType(params
|
143
|
+
if (params.as2_partner_id && !isInt(params.as2_partner_id)) {
|
144
|
+
throw new errors.InvalidParameterError(`Bad parameter: as2_partner_id must be of type Int, received ${getType(params.as2_partner_id)}`)
|
142
145
|
}
|
143
146
|
|
144
|
-
const response = await Api.sendRequest(
|
147
|
+
const response = await Api.sendRequest('/as2_outgoing_messages', 'GET', params, options)
|
145
148
|
|
146
|
-
|
147
149
|
return response?.data?.map(obj => new As2OutgoingMessage(obj, options)) || []
|
148
150
|
}
|
149
151
|
|
package/src/models/As2Partner.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 As2Partner {
|
11
13
|
attributes = {}
|
14
|
+
|
12
15
|
options = {}
|
13
16
|
|
14
17
|
constructor(attributes = {}, options = {}) {
|
@@ -24,6 +27,7 @@ class As2Partner {
|
|
24
27
|
}
|
25
28
|
|
26
29
|
isLoaded = () => !!this.attributes.id
|
30
|
+
|
27
31
|
// int64 # Id of the AS2 Partner.
|
28
32
|
getId = () => this.attributes.id
|
29
33
|
|
@@ -122,7 +126,6 @@ class As2Partner {
|
|
122
126
|
this.attributes.public_certificate = value
|
123
127
|
}
|
124
128
|
|
125
|
-
|
126
129
|
// Parameters:
|
127
130
|
// name - string - AS2 Name
|
128
131
|
// uri - string - URL base for AS2 responses
|
@@ -139,33 +142,36 @@ class As2Partner {
|
|
139
142
|
}
|
140
143
|
|
141
144
|
params.id = this.attributes.id
|
142
|
-
if (params
|
143
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
145
|
+
if (params.id && !isInt(params.id)) {
|
146
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
144
147
|
}
|
145
|
-
|
146
|
-
|
148
|
+
|
149
|
+
if (params.name && !isString(params.name)) {
|
150
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
147
151
|
}
|
148
|
-
|
149
|
-
|
152
|
+
|
153
|
+
if (params.uri && !isString(params.uri)) {
|
154
|
+
throw new errors.InvalidParameterError(`Bad parameter: uri must be of type String, received ${getType(params.uri)}`)
|
150
155
|
}
|
151
|
-
|
152
|
-
|
156
|
+
|
157
|
+
if (params.server_certificate && !isString(params.server_certificate)) {
|
158
|
+
throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(params.server_certificate)}`)
|
153
159
|
}
|
154
|
-
|
155
|
-
|
160
|
+
|
161
|
+
if (params.public_certificate && !isString(params.public_certificate)) {
|
162
|
+
throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(params.public_certificate)}`)
|
156
163
|
}
|
157
164
|
|
158
|
-
if (!params
|
165
|
+
if (!params.id) {
|
159
166
|
if (this.attributes.id) {
|
160
|
-
params
|
167
|
+
params.id = this.id
|
161
168
|
} else {
|
162
169
|
throw new errors.MissingParameterError('Parameter missing: id')
|
163
170
|
}
|
164
171
|
}
|
165
172
|
|
166
|
-
const response = await Api.sendRequest(`/as2_partners/${encodeURIComponent(params
|
173
|
+
const response = await Api.sendRequest(`/as2_partners/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
|
167
174
|
|
168
|
-
|
169
175
|
return new As2Partner(response?.data, this.options)
|
170
176
|
}
|
171
177
|
|
@@ -179,53 +185,50 @@ class As2Partner {
|
|
179
185
|
}
|
180
186
|
|
181
187
|
params.id = this.attributes.id
|
182
|
-
if (params
|
183
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
188
|
+
if (params.id && !isInt(params.id)) {
|
189
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
184
190
|
}
|
185
191
|
|
186
|
-
if (!params
|
192
|
+
if (!params.id) {
|
187
193
|
if (this.attributes.id) {
|
188
|
-
params
|
194
|
+
params.id = this.id
|
189
195
|
} else {
|
190
196
|
throw new errors.MissingParameterError('Parameter missing: id')
|
191
197
|
}
|
192
198
|
}
|
193
199
|
|
194
|
-
|
195
|
-
|
196
|
-
return
|
200
|
+
await Api.sendRequest(`/as2_partners/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
|
197
201
|
}
|
198
202
|
|
199
203
|
destroy = (params = {}) =>
|
200
204
|
this.delete(params)
|
201
205
|
|
202
206
|
save = async () => {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
207
|
+
if (this.attributes.id) {
|
208
|
+
const newObject = await this.update(this.attributes)
|
209
|
+
this.attributes = { ...newObject.attributes }
|
210
|
+
return true
|
211
|
+
}
|
212
|
+
|
213
|
+
const newObject = await As2Partner.create(this.attributes, this.options)
|
214
|
+
this.attributes = { ...newObject.attributes }
|
215
|
+
return true
|
212
216
|
}
|
213
217
|
|
214
218
|
// Parameters:
|
215
219
|
// 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.
|
216
220
|
// per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
|
217
221
|
static list = async (params = {}, options = {}) => {
|
218
|
-
if (params
|
219
|
-
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params
|
222
|
+
if (params.cursor && !isString(params.cursor)) {
|
223
|
+
throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
|
220
224
|
}
|
221
225
|
|
222
|
-
if (params
|
223
|
-
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params
|
226
|
+
if (params.per_page && !isInt(params.per_page)) {
|
227
|
+
throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
|
224
228
|
}
|
225
229
|
|
226
|
-
const response = await Api.sendRequest(
|
230
|
+
const response = await Api.sendRequest('/as2_partners', 'GET', params, options)
|
227
231
|
|
228
|
-
|
229
232
|
return response?.data?.map(obj => new As2Partner(obj, options)) || []
|
230
233
|
}
|
231
234
|
|
@@ -239,19 +242,18 @@ class As2Partner {
|
|
239
242
|
throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
|
240
243
|
}
|
241
244
|
|
242
|
-
params
|
245
|
+
params.id = id
|
243
246
|
|
244
|
-
if (!params
|
247
|
+
if (!params.id) {
|
245
248
|
throw new errors.MissingParameterError('Parameter missing: id')
|
246
249
|
}
|
247
250
|
|
248
|
-
if (params
|
249
|
-
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params
|
251
|
+
if (params.id && !isInt(params.id)) {
|
252
|
+
throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
|
250
253
|
}
|
251
254
|
|
252
|
-
const response = await Api.sendRequest(`/as2_partners/${encodeURIComponent(params
|
255
|
+
const response = await Api.sendRequest(`/as2_partners/${encodeURIComponent(params.id)}`, 'GET', params, options)
|
253
256
|
|
254
|
-
|
255
257
|
return new As2Partner(response?.data, options)
|
256
258
|
}
|
257
259
|
|
@@ -266,45 +268,44 @@ class As2Partner {
|
|
266
268
|
// server_certificate - string - Remote server certificate security setting
|
267
269
|
// enable_dedicated_ips - boolean
|
268
270
|
static create = async (params = {}, options = {}) => {
|
269
|
-
if (!params
|
271
|
+
if (!params.name) {
|
270
272
|
throw new errors.MissingParameterError('Parameter missing: name')
|
271
273
|
}
|
272
274
|
|
273
|
-
if (!params
|
275
|
+
if (!params.uri) {
|
274
276
|
throw new errors.MissingParameterError('Parameter missing: uri')
|
275
277
|
}
|
276
278
|
|
277
|
-
if (!params
|
279
|
+
if (!params.public_certificate) {
|
278
280
|
throw new errors.MissingParameterError('Parameter missing: public_certificate')
|
279
281
|
}
|
280
282
|
|
281
|
-
if (!params
|
283
|
+
if (!params.as2_station_id) {
|
282
284
|
throw new errors.MissingParameterError('Parameter missing: as2_station_id')
|
283
285
|
}
|
284
286
|
|
285
|
-
if (params
|
286
|
-
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params
|
287
|
+
if (params.name && !isString(params.name)) {
|
288
|
+
throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
|
287
289
|
}
|
288
290
|
|
289
|
-
if (params
|
290
|
-
throw new errors.InvalidParameterError(`Bad parameter: uri must be of type String, received ${getType(params
|
291
|
+
if (params.uri && !isString(params.uri)) {
|
292
|
+
throw new errors.InvalidParameterError(`Bad parameter: uri must be of type String, received ${getType(params.uri)}`)
|
291
293
|
}
|
292
294
|
|
293
|
-
if (params
|
294
|
-
throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(params
|
295
|
+
if (params.public_certificate && !isString(params.public_certificate)) {
|
296
|
+
throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(params.public_certificate)}`)
|
295
297
|
}
|
296
298
|
|
297
|
-
if (params
|
298
|
-
throw new errors.InvalidParameterError(`Bad parameter: as2_station_id must be of type Int, received ${getType(params
|
299
|
+
if (params.as2_station_id && !isInt(params.as2_station_id)) {
|
300
|
+
throw new errors.InvalidParameterError(`Bad parameter: as2_station_id must be of type Int, received ${getType(params.as2_station_id)}`)
|
299
301
|
}
|
300
302
|
|
301
|
-
if (params
|
302
|
-
throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(params
|
303
|
+
if (params.server_certificate && !isString(params.server_certificate)) {
|
304
|
+
throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(params.server_certificate)}`)
|
303
305
|
}
|
304
306
|
|
305
|
-
const response = await Api.sendRequest(
|
307
|
+
const response = await Api.sendRequest('/as2_partners', 'POST', params, options)
|
306
308
|
|
307
|
-
|
308
309
|
return new As2Partner(response?.data, options)
|
309
310
|
}
|
310
311
|
}
|