files.com 1.1.18 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. package/.eslintrc.js +0 -3
  2. package/_VERSION +1 -1
  3. package/docs/Errors.md +1 -0
  4. package/lib/Api.js +1 -1
  5. package/lib/Errors.js +957 -933
  6. package/lib/Files.js +1 -1
  7. package/lib/models/ActionNotificationExport.js +25 -25
  8. package/lib/models/ActionNotificationExportResult.js +10 -10
  9. package/lib/models/ActionWebhookFailure.js +5 -9
  10. package/lib/models/ApiKey.js +62 -70
  11. package/lib/models/App.js +5 -5
  12. package/lib/models/As2IncomingMessage.js +7 -7
  13. package/lib/models/As2OutgoingMessage.js +7 -7
  14. package/lib/models/As2Partner.js +54 -58
  15. package/lib/models/As2Station.js +51 -55
  16. package/lib/models/Automation.js +102 -110
  17. package/lib/models/AutomationRun.js +13 -13
  18. package/lib/models/BandwidthSnapshot.js +5 -5
  19. package/lib/models/Behavior.js +77 -85
  20. package/lib/models/Bundle.js +102 -110
  21. package/lib/models/BundleDownload.js +9 -9
  22. package/lib/models/BundleNotification.js +37 -41
  23. package/lib/models/BundleRecipient.js +22 -22
  24. package/lib/models/BundleRegistration.js +7 -7
  25. package/lib/models/Clickwrap.js +52 -56
  26. package/lib/models/DnsRecord.js +5 -5
  27. package/lib/models/EmailIncomingMessage.js +5 -5
  28. package/lib/models/ExternalEvent.js +18 -18
  29. package/lib/models/File.js +89 -93
  30. package/lib/models/FileComment.js +41 -45
  31. package/lib/models/FileCommentReaction.js +15 -19
  32. package/lib/models/FileMigration.js +5 -5
  33. package/lib/models/Folder.js +24 -24
  34. package/lib/models/FormFieldSet.js +44 -48
  35. package/lib/models/GpgKey.js +53 -57
  36. package/lib/models/Group.js +51 -55
  37. package/lib/models/GroupUser.js +53 -57
  38. package/lib/models/History.js +72 -72
  39. package/lib/models/HistoryExport.js +51 -51
  40. package/lib/models/HistoryExportResult.js +10 -10
  41. package/lib/models/InboxRecipient.js +22 -22
  42. package/lib/models/InboxRegistration.js +7 -7
  43. package/lib/models/InboxUpload.js +9 -9
  44. package/lib/models/Invoice.js +12 -12
  45. package/lib/models/IpAddress.js +17 -17
  46. package/lib/models/Lock.js +27 -31
  47. package/lib/models/Message.js +60 -64
  48. package/lib/models/MessageComment.js +46 -50
  49. package/lib/models/MessageCommentReaction.js +27 -31
  50. package/lib/models/MessageReaction.js +27 -31
  51. package/lib/models/Notification.js +66 -70
  52. package/lib/models/Payment.js +12 -12
  53. package/lib/models/Permission.js +28 -32
  54. package/lib/models/Priority.js +9 -9
  55. package/lib/models/Project.js +39 -43
  56. package/lib/models/PublicKey.js +46 -50
  57. package/lib/models/RemoteBandwidthSnapshot.js +5 -5
  58. package/lib/models/RemoteServer.js +306 -310
  59. package/lib/models/Request.js +33 -37
  60. package/lib/models/Session.js +11 -15
  61. package/lib/models/SettingsChange.js +5 -5
  62. package/lib/models/SftpHostKey.js +40 -44
  63. package/lib/models/ShareGroup.js +50 -54
  64. package/lib/models/Site.js +138 -138
  65. package/lib/models/Snapshot.js +44 -48
  66. package/lib/models/SsoStrategy.js +15 -19
  67. package/lib/models/Style.js +17 -21
  68. package/lib/models/UsageDailySnapshot.js +5 -5
  69. package/lib/models/UsageSnapshot.js +5 -5
  70. package/lib/models/User.js +156 -172
  71. package/lib/models/UserCipherUse.js +7 -7
  72. package/lib/models/UserRequest.js +26 -30
  73. package/lib/models/WebhookTest.js +15 -15
  74. package/package.json +6 -2
  75. package/src/Api.js +2 -1
  76. package/src/Errors.js +189 -177
  77. package/src/Files.js +1 -1
  78. package/src/models/AccountLineItem.js +5 -2
  79. package/src/models/Action.js +5 -2
  80. package/src/models/ActionNotificationExport.js +36 -35
  81. package/src/models/ActionNotificationExportResult.js +15 -13
  82. package/src/models/ActionWebhookFailure.js +9 -8
  83. package/src/models/ApiKey.js +69 -72
  84. package/src/models/App.js +10 -8
  85. package/src/models/As2IncomingMessage.js +12 -10
  86. package/src/models/As2OutgoingMessage.js +12 -10
  87. package/src/models/As2Partner.js +61 -60
  88. package/src/models/As2Station.js +58 -57
  89. package/src/models/Auto.js +5 -2
  90. package/src/models/Automation.js +121 -110
  91. package/src/models/AutomationRun.js +18 -17
  92. package/src/models/BandwidthSnapshot.js +10 -8
  93. package/src/models/Behavior.js +85 -86
  94. package/src/models/Bundle.js +121 -110
  95. package/src/models/BundleDownload.js +14 -12
  96. package/src/models/BundleNotification.js +40 -43
  97. package/src/models/BundleRecipient.js +33 -32
  98. package/src/models/BundleRegistration.js +12 -10
  99. package/src/models/Clickwrap.js +60 -58
  100. package/src/models/DnsRecord.js +10 -8
  101. package/src/models/EmailIncomingMessage.js +10 -8
  102. package/src/models/Errors.js +5 -2
  103. package/src/models/ExternalEvent.js +29 -29
  104. package/src/models/File.js +116 -108
  105. package/src/models/FileAction.js +5 -2
  106. package/src/models/FileComment.js +45 -46
  107. package/src/models/FileCommentReaction.js +26 -26
  108. package/src/models/FileMigration.js +10 -8
  109. package/src/models/FileUploadPart.js +5 -2
  110. package/src/models/Folder.js +32 -29
  111. package/src/models/FormField.js +5 -2
  112. package/src/models/FormFieldSet.js +49 -50
  113. package/src/models/GpgKey.js +60 -59
  114. package/src/models/Group.js +58 -57
  115. package/src/models/GroupUser.js +60 -58
  116. package/src/models/History.js +77 -74
  117. package/src/models/HistoryExport.js +62 -61
  118. package/src/models/HistoryExportResult.js +15 -13
  119. package/src/models/Image.js +5 -2
  120. package/src/models/InboxRecipient.js +33 -32
  121. package/src/models/InboxRegistration.js +12 -10
  122. package/src/models/InboxUpload.js +14 -12
  123. package/src/models/Invoice.js +17 -14
  124. package/src/models/InvoiceLineItem.js +5 -2
  125. package/src/models/IpAddress.js +22 -20
  126. package/src/models/Lock.js +36 -36
  127. package/src/models/Message.js +66 -66
  128. package/src/models/MessageComment.js +50 -52
  129. package/src/models/MessageCommentReaction.js +38 -40
  130. package/src/models/MessageReaction.js +38 -40
  131. package/src/models/Notification.js +74 -72
  132. package/src/models/Payment.js +17 -14
  133. package/src/models/PaymentLineItem.js +5 -2
  134. package/src/models/Permission.js +39 -40
  135. package/src/models/Preview.js +5 -2
  136. package/src/models/Priority.js +14 -12
  137. package/src/models/Project.js +43 -45
  138. package/src/models/PublicIpAddress.js +5 -2
  139. package/src/models/PublicKey.js +50 -52
  140. package/src/models/RemoteBandwidthSnapshot.js +10 -8
  141. package/src/models/RemoteServer.js +380 -312
  142. package/src/models/RemoteServerConfigurationFile.js +5 -2
  143. package/src/models/Request.js +44 -46
  144. package/src/models/Session.js +22 -22
  145. package/src/models/SettingsChange.js +10 -8
  146. package/src/models/SftpHostKey.js +45 -46
  147. package/src/models/ShareGroup.js +56 -56
  148. package/src/models/ShareGroupMember.js +5 -2
  149. package/src/models/Site.js +143 -142
  150. package/src/models/Snapshot.js +50 -50
  151. package/src/models/SsoStrategy.js +20 -21
  152. package/src/models/Status.js +5 -2
  153. package/src/models/Style.js +22 -23
  154. package/src/models/UsageDailySnapshot.js +10 -8
  155. package/src/models/UsageSnapshot.js +10 -8
  156. package/src/models/User.js +185 -168
  157. package/src/models/UserCipherUse.js +12 -10
  158. package/src/models/UserRequest.js +37 -39
  159. package/src/models/WebhookTest.js +26 -24
  160. package/test/Api.test.js +163 -0
  161. package/test/{package.json → integration/package.json} +1 -1
  162. package/test/{src → integration/src}/index.js +1 -1
  163. package/test.sh +2 -1
  164. /package/test/{.babelrc → integration/.babelrc} +0 -0
  165. /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 { getType, isArray, isInt, isObject, isString } from '../utils'
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['cursor'] && !isString(params['cursor'])) {
96
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
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['per_page'] && !isInt(params['per_page'])) {
100
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
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(`/apps`, 'GET', params, options)
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 { getType, isArray, isInt, isObject, isString } from '../utils'
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['cursor'] && !isString(params['cursor'])) {
145
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
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['per_page'] && !isInt(params['per_page'])) {
149
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
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['as2_partner_id'] && !isInt(params['as2_partner_id'])) {
153
- throw new errors.InvalidParameterError(`Bad parameter: as2_partner_id must be of type Int, received ${getType(params['as2_partner_id'])}`)
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(`/as2_incoming_messages`, 'GET', params, options)
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 { getType, isArray, isInt, isObject, isString } from '../utils'
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['cursor'] && !isString(params['cursor'])) {
133
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
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['per_page'] && !isInt(params['per_page'])) {
137
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
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['as2_partner_id'] && !isInt(params['as2_partner_id'])) {
141
- throw new errors.InvalidParameterError(`Bad parameter: as2_partner_id must be of type Int, received ${getType(params['as2_partner_id'])}`)
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(`/as2_outgoing_messages`, 'GET', params, options)
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
 
@@ -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 { getType, isArray, isInt, isObject, isString } from '../utils'
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['id'] && !isInt(params['id'])) {
143
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
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
- if (params['name'] && !isString(params['name'])) {
146
- throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
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
- if (params['uri'] && !isString(params['uri'])) {
149
- throw new errors.InvalidParameterError(`Bad parameter: uri must be of type String, received ${getType(params['uri'])}`)
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
- if (params['server_certificate'] && !isString(params['server_certificate'])) {
152
- throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(params['server_certificate'])}`)
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
- if (params['public_certificate'] && !isString(params['public_certificate'])) {
155
- throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(params['public_certificate'])}`)
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['id']) {
165
+ if (!params.id) {
159
166
  if (this.attributes.id) {
160
- params['id'] = this.id
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['id'])}`, 'PATCH', params, this.options)
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['id'] && !isInt(params['id'])) {
183
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
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['id']) {
192
+ if (!params.id) {
187
193
  if (this.attributes.id) {
188
- params['id'] = this.id
194
+ params.id = this.id
189
195
  } else {
190
196
  throw new errors.MissingParameterError('Parameter missing: id')
191
197
  }
192
198
  }
193
199
 
194
- const response = await Api.sendRequest(`/as2_partners/${encodeURIComponent(params['id'])}`, 'DELETE', params, this.options)
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
- if (this.attributes['id']) {
204
- const newObject = await this.update(this.attributes)
205
- this.attributes = { ...newObject.attributes }
206
- return true
207
- } else {
208
- const newObject = await As2Partner.create(this.attributes, this.options)
209
- this.attributes = { ...newObject.attributes }
210
- return true
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['cursor'] && !isString(params['cursor'])) {
219
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
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['per_page'] && !isInt(params['per_page'])) {
223
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
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(`/as2_partners`, 'GET', params, options)
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['id'] = id
245
+ params.id = id
243
246
 
244
- if (!params['id']) {
247
+ if (!params.id) {
245
248
  throw new errors.MissingParameterError('Parameter missing: id')
246
249
  }
247
250
 
248
- if (params['id'] && !isInt(params['id'])) {
249
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
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['id'])}`, 'GET', params, options)
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['name']) {
271
+ if (!params.name) {
270
272
  throw new errors.MissingParameterError('Parameter missing: name')
271
273
  }
272
274
 
273
- if (!params['uri']) {
275
+ if (!params.uri) {
274
276
  throw new errors.MissingParameterError('Parameter missing: uri')
275
277
  }
276
278
 
277
- if (!params['public_certificate']) {
279
+ if (!params.public_certificate) {
278
280
  throw new errors.MissingParameterError('Parameter missing: public_certificate')
279
281
  }
280
282
 
281
- if (!params['as2_station_id']) {
283
+ if (!params.as2_station_id) {
282
284
  throw new errors.MissingParameterError('Parameter missing: as2_station_id')
283
285
  }
284
286
 
285
- if (params['name'] && !isString(params['name'])) {
286
- throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
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['uri'] && !isString(params['uri'])) {
290
- throw new errors.InvalidParameterError(`Bad parameter: uri must be of type String, received ${getType(params['uri'])}`)
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['public_certificate'] && !isString(params['public_certificate'])) {
294
- throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(params['public_certificate'])}`)
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['as2_station_id'] && !isInt(params['as2_station_id'])) {
298
- throw new errors.InvalidParameterError(`Bad parameter: as2_station_id must be of type Int, received ${getType(params['as2_station_id'])}`)
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['server_certificate'] && !isString(params['server_certificate'])) {
302
- throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(params['server_certificate'])}`)
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(`/as2_partners`, 'POST', params, options)
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
  }