files.com 1.0.190 → 1.0.193

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. package/_VERSION +1 -1
  2. package/docs/Errors.md +186 -0
  3. package/docs/models/AccountLineItem.md +53 -0
  4. package/docs/models/Action.md +37 -0
  5. package/docs/models/ActionNotificationExport.md +82 -0
  6. package/docs/models/ActionNotificationExportResult.md +49 -0
  7. package/docs/models/ActionWebhookFailure.md +16 -0
  8. package/docs/models/ApiKey.md +183 -0
  9. package/docs/models/App.md +66 -0
  10. package/docs/models/As2IncomingMessage.md +104 -0
  11. package/docs/models/As2OutgoingMessage.md +96 -0
  12. package/docs/models/As2Partner.md +141 -0
  13. package/docs/models/As2Station.md +142 -0
  14. package/docs/models/Auto.md +11 -0
  15. package/docs/models/Automation.md +257 -0
  16. package/docs/models/AutomationRun.md +61 -0
  17. package/docs/models/BandwidthSnapshot.md +50 -0
  18. package/docs/models/Behavior.md +195 -0
  19. package/docs/models/Bundle.md +330 -0
  20. package/docs/models/BundleDownload.md +44 -0
  21. package/docs/models/BundleRecipient.md +76 -0
  22. package/docs/models/BundleRegistration.md +53 -0
  23. package/docs/models/Clickwrap.md +120 -0
  24. package/docs/models/DnsRecord.md +33 -0
  25. package/docs/models/Errors.md +17 -0
  26. package/docs/models/ExternalEvent.md +84 -0
  27. package/docs/models/File.md +339 -0
  28. package/docs/models/FileAction.md +13 -0
  29. package/docs/models/FileComment.md +98 -0
  30. package/docs/models/FileCommentReaction.md +50 -0
  31. package/docs/models/FileMigration.md +40 -0
  32. package/docs/models/FileUploadPart.md +39 -0
  33. package/docs/models/Folder.md +90 -0
  34. package/docs/models/FormField.md +29 -0
  35. package/docs/models/FormFieldSet.md +170 -0
  36. package/docs/models/Group.md +140 -0
  37. package/docs/models/GroupUser.md +116 -0
  38. package/docs/models/History.md +151 -0
  39. package/docs/models/HistoryExport.md +130 -0
  40. package/docs/models/HistoryExportResult.md +75 -0
  41. package/docs/models/Image.md +13 -0
  42. package/docs/models/InboxRecipient.md +76 -0
  43. package/docs/models/InboxRegistration.md +47 -0
  44. package/docs/models/InboxUpload.md +42 -0
  45. package/docs/models/Invoice.md +82 -0
  46. package/docs/models/InvoiceLineItem.md +27 -0
  47. package/docs/models/IpAddress.md +51 -0
  48. package/docs/models/Lock.md +92 -0
  49. package/docs/models/Message.md +134 -0
  50. package/docs/models/MessageComment.md +114 -0
  51. package/docs/models/MessageCommentReaction.md +79 -0
  52. package/docs/models/MessageReaction.md +79 -0
  53. package/docs/models/Notification.md +241 -0
  54. package/docs/models/Payment.md +82 -0
  55. package/docs/models/PaymentLineItem.md +19 -0
  56. package/docs/models/Permission.md +94 -0
  57. package/docs/models/Preview.md +19 -0
  58. package/docs/models/Priority.md +30 -0
  59. package/docs/models/Project.md +98 -0
  60. package/docs/models/PublicIpAddress.md +17 -0
  61. package/docs/models/PublicKey.md +112 -0
  62. package/docs/models/RemoteBandwidthSnapshot.md +42 -0
  63. package/docs/models/RemoteServer.md +385 -0
  64. package/docs/models/Request.md +97 -0
  65. package/docs/models/Session.md +50 -0
  66. package/docs/models/SettingsChange.md +44 -0
  67. package/docs/models/Site.md +607 -0
  68. package/docs/models/SsoStrategy.md +139 -0
  69. package/docs/models/Status.md +30 -0
  70. package/docs/models/Style.md +76 -0
  71. package/docs/models/UsageDailySnapshot.md +56 -0
  72. package/docs/models/UsageSnapshot.md +63 -0
  73. package/docs/models/User.md +465 -0
  74. package/docs/models/UserCipherUse.md +39 -0
  75. package/docs/models/UserRequest.md +80 -0
  76. package/docs/models/WebhookTest.md +59 -0
  77. package/lib/Api.js +12 -11
  78. package/lib/Errors.js +3125 -0
  79. package/lib/models/AccountLineItem.js +8 -0
  80. package/lib/models/Action.js +8 -0
  81. package/lib/models/ActionNotificationExport.js +21 -13
  82. package/lib/models/ActionNotificationExportResult.js +13 -5
  83. package/lib/models/ActionWebhookFailure.js +12 -4
  84. package/lib/models/ApiKey.js +33 -25
  85. package/lib/models/App.js +10 -2
  86. package/lib/models/As2IncomingMessage.js +11 -3
  87. package/lib/models/As2OutgoingMessage.js +11 -3
  88. package/lib/models/As2Partner.js +34 -26
  89. package/lib/models/As2Station.js +32 -24
  90. package/lib/models/Auto.js +8 -0
  91. package/lib/models/Automation.js +51 -43
  92. package/lib/models/AutomationRun.js +16 -8
  93. package/lib/models/BandwidthSnapshot.js +10 -2
  94. package/lib/models/Behavior.js +46 -38
  95. package/lib/models/Bundle.js +51 -43
  96. package/lib/models/BundleDownload.js +12 -4
  97. package/lib/models/BundleRecipient.js +22 -14
  98. package/lib/models/BundleRegistration.js +12 -4
  99. package/lib/models/Clickwrap.js +31 -23
  100. package/lib/models/DnsRecord.js +10 -2
  101. package/lib/models/Errors.js +8 -0
  102. package/lib/models/ExternalEvent.js +18 -10
  103. package/lib/models/File.js +68 -60
  104. package/lib/models/FileAction.js +8 -0
  105. package/lib/models/FileComment.js +27 -19
  106. package/lib/models/FileCommentReaction.js +18 -10
  107. package/lib/models/FileMigration.js +11 -3
  108. package/lib/models/FileUploadPart.js +8 -0
  109. package/lib/models/Folder.js +19 -11
  110. package/lib/models/FormField.js +8 -0
  111. package/lib/models/FormFieldSet.js +27 -19
  112. package/lib/models/Group.js +30 -22
  113. package/lib/models/GroupUser.js +32 -24
  114. package/lib/models/History.js +42 -34
  115. package/lib/models/HistoryExport.js +34 -26
  116. package/lib/models/HistoryExportResult.js +13 -5
  117. package/lib/models/Image.js +8 -0
  118. package/lib/models/InboxRecipient.js +22 -14
  119. package/lib/models/InboxRegistration.js +11 -3
  120. package/lib/models/InboxUpload.js +12 -4
  121. package/lib/models/Invoice.js +13 -5
  122. package/lib/models/InvoiceLineItem.js +8 -0
  123. package/lib/models/IpAddress.js +12 -4
  124. package/lib/models/Lock.js +24 -16
  125. package/lib/models/Message.js +37 -29
  126. package/lib/models/MessageComment.js +29 -21
  127. package/lib/models/MessageCommentReaction.js +24 -16
  128. package/lib/models/MessageReaction.js +24 -16
  129. package/lib/models/Notification.js +38 -30
  130. package/lib/models/Payment.js +13 -5
  131. package/lib/models/PaymentLineItem.js +8 -0
  132. package/lib/models/Permission.js +23 -15
  133. package/lib/models/Preview.js +8 -0
  134. package/lib/models/Priority.js +13 -5
  135. package/lib/models/Project.js +25 -17
  136. package/lib/models/PublicIpAddress.js +8 -0
  137. package/lib/models/PublicKey.js +29 -21
  138. package/lib/models/RemoteBandwidthSnapshot.js +10 -2
  139. package/lib/models/RemoteServer.js +113 -105
  140. package/lib/models/Request.js +27 -19
  141. package/lib/models/Session.js +13 -5
  142. package/lib/models/SettingsChange.js +10 -2
  143. package/lib/models/Site.js +65 -57
  144. package/lib/models/SsoStrategy.js +17 -9
  145. package/lib/models/Status.js +8 -0
  146. package/lib/models/Style.js +20 -12
  147. package/lib/models/UsageDailySnapshot.js +10 -2
  148. package/lib/models/UsageSnapshot.js +10 -2
  149. package/lib/models/User.js +85 -77
  150. package/lib/models/UserCipherUse.js +11 -3
  151. package/lib/models/UserRequest.js +24 -16
  152. package/lib/models/WebhookTest.js +16 -8
  153. package/package.json +1 -1
  154. package/src/Api.js +4 -8
  155. package/src/Errors.js +221 -0
  156. package/src/models/AccountLineItem.js +1 -0
  157. package/src/models/Action.js +1 -0
  158. package/src/models/ActionNotificationExport.js +14 -13
  159. package/src/models/ActionNotificationExportResult.js +6 -5
  160. package/src/models/ActionWebhookFailure.js +5 -4
  161. package/src/models/ApiKey.js +26 -25
  162. package/src/models/App.js +3 -2
  163. package/src/models/As2IncomingMessage.js +4 -3
  164. package/src/models/As2OutgoingMessage.js +4 -3
  165. package/src/models/As2Partner.js +27 -26
  166. package/src/models/As2Station.js +25 -24
  167. package/src/models/Auto.js +1 -0
  168. package/src/models/Automation.js +44 -43
  169. package/src/models/AutomationRun.js +9 -8
  170. package/src/models/BandwidthSnapshot.js +3 -2
  171. package/src/models/Behavior.js +39 -38
  172. package/src/models/Bundle.js +44 -43
  173. package/src/models/BundleDownload.js +5 -4
  174. package/src/models/BundleRecipient.js +15 -14
  175. package/src/models/BundleRegistration.js +5 -4
  176. package/src/models/Clickwrap.js +24 -23
  177. package/src/models/DnsRecord.js +3 -2
  178. package/src/models/Errors.js +1 -0
  179. package/src/models/ExternalEvent.js +11 -10
  180. package/src/models/File.js +61 -60
  181. package/src/models/FileAction.js +1 -0
  182. package/src/models/FileComment.js +20 -19
  183. package/src/models/FileCommentReaction.js +11 -10
  184. package/src/models/FileMigration.js +4 -3
  185. package/src/models/FileUploadPart.js +1 -0
  186. package/src/models/Folder.js +12 -11
  187. package/src/models/FormField.js +1 -0
  188. package/src/models/FormFieldSet.js +20 -19
  189. package/src/models/Group.js +23 -22
  190. package/src/models/GroupUser.js +25 -24
  191. package/src/models/History.js +35 -34
  192. package/src/models/HistoryExport.js +27 -26
  193. package/src/models/HistoryExportResult.js +6 -5
  194. package/src/models/Image.js +1 -0
  195. package/src/models/InboxRecipient.js +15 -14
  196. package/src/models/InboxRegistration.js +4 -3
  197. package/src/models/InboxUpload.js +5 -4
  198. package/src/models/Invoice.js +6 -5
  199. package/src/models/InvoiceLineItem.js +1 -0
  200. package/src/models/IpAddress.js +5 -4
  201. package/src/models/Lock.js +17 -16
  202. package/src/models/Message.js +30 -29
  203. package/src/models/MessageComment.js +22 -21
  204. package/src/models/MessageCommentReaction.js +17 -16
  205. package/src/models/MessageReaction.js +17 -16
  206. package/src/models/Notification.js +31 -30
  207. package/src/models/Payment.js +6 -5
  208. package/src/models/PaymentLineItem.js +1 -0
  209. package/src/models/Permission.js +16 -15
  210. package/src/models/Preview.js +1 -0
  211. package/src/models/Priority.js +6 -5
  212. package/src/models/Project.js +18 -17
  213. package/src/models/PublicIpAddress.js +1 -0
  214. package/src/models/PublicKey.js +22 -21
  215. package/src/models/RemoteBandwidthSnapshot.js +3 -2
  216. package/src/models/RemoteServer.js +106 -105
  217. package/src/models/Request.js +20 -19
  218. package/src/models/Session.js +6 -5
  219. package/src/models/SettingsChange.js +3 -2
  220. package/src/models/Site.js +58 -57
  221. package/src/models/SsoStrategy.js +10 -9
  222. package/src/models/Status.js +1 -0
  223. package/src/models/Style.js +13 -12
  224. package/src/models/UsageDailySnapshot.js +3 -2
  225. package/src/models/UsageSnapshot.js +3 -2
  226. package/src/models/User.js +78 -77
  227. package/src/models/UserCipherUse.js +4 -3
  228. package/src/models/UserRequest.js +17 -16
  229. package/src/models/WebhookTest.js +9 -8
  230. package/test/src/index.js +46 -0
@@ -1,4 +1,5 @@
1
1
  import Api from '../Api'
2
+ import * as errors from '../Errors'
2
3
  import Logger from '../Logger'
3
4
  import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
5
 
@@ -141,15 +142,15 @@ class As2IncomingMessage {
141
142
  // as2_partner_id - int64 - As2 Partner ID. If provided, will return message specific to that partner.
142
143
  static list = async (params = {}, options = {}) => {
143
144
  if (params['cursor'] && !isString(params['cursor'])) {
144
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
145
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
145
146
  }
146
147
 
147
148
  if (params['per_page'] && !isInt(params['per_page'])) {
148
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
149
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
149
150
  }
150
151
 
151
152
  if (params['as2_partner_id'] && !isInt(params['as2_partner_id'])) {
152
- throw new Error(`Bad parameter: as2_partner_id must be of type Int, received ${getType(as2_partner_id)}`)
153
+ throw new errors.InvalidParameterError(`Bad parameter: as2_partner_id must be of type Int, received ${getType(as2_partner_id)}`)
153
154
  }
154
155
 
155
156
  const response = await Api.sendRequest(`/as2_incoming_messages`, 'GET', params, options)
@@ -1,4 +1,5 @@
1
1
  import Api from '../Api'
2
+ import * as errors from '../Errors'
2
3
  import Logger from '../Logger'
3
4
  import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
5
 
@@ -129,15 +130,15 @@ class As2OutgoingMessage {
129
130
  // as2_partner_id - int64 - As2 Partner ID. If provided, will return message specific to that partner.
130
131
  static list = async (params = {}, options = {}) => {
131
132
  if (params['cursor'] && !isString(params['cursor'])) {
132
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
133
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
133
134
  }
134
135
 
135
136
  if (params['per_page'] && !isInt(params['per_page'])) {
136
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
137
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
137
138
  }
138
139
 
139
140
  if (params['as2_partner_id'] && !isInt(params['as2_partner_id'])) {
140
- throw new Error(`Bad parameter: as2_partner_id must be of type Int, received ${getType(as2_partner_id)}`)
141
+ throw new errors.InvalidParameterError(`Bad parameter: as2_partner_id must be of type Int, received ${getType(as2_partner_id)}`)
141
142
  }
142
143
 
143
144
  const response = await Api.sendRequest(`/as2_outgoing_messages`, 'GET', params, options)
@@ -1,4 +1,5 @@
1
1
  import Api from '../Api'
2
+ import * as errors from '../Errors'
2
3
  import Logger from '../Logger'
3
4
  import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
5
 
@@ -121,35 +122,35 @@ class As2Partner {
121
122
  // public_certificate - string
122
123
  update = async (params = {}) => {
123
124
  if (!this.attributes.id) {
124
- throw new Error('Current object has no id')
125
+ throw new errors.EmptyPropertyError('Current object has no id')
125
126
  }
126
127
 
127
128
  if (!isObject(params)) {
128
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
129
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
129
130
  }
130
131
 
131
132
  params.id = this.attributes.id
132
133
  if (params['id'] && !isInt(params['id'])) {
133
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
134
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
134
135
  }
135
136
  if (params['name'] && !isString(params['name'])) {
136
- throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
137
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
137
138
  }
138
139
  if (params['uri'] && !isString(params['uri'])) {
139
- throw new Error(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
140
+ throw new errors.InvalidParameterError(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
140
141
  }
141
142
  if (params['server_certificate'] && !isString(params['server_certificate'])) {
142
- throw new Error(`Bad parameter: server_certificate must be of type String, received ${getType(server_certificate)}`)
143
+ throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(server_certificate)}`)
143
144
  }
144
145
  if (params['public_certificate'] && !isString(params['public_certificate'])) {
145
- throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
146
+ throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
146
147
  }
147
148
 
148
149
  if (!params['id']) {
149
150
  if (this.attributes.id) {
150
151
  params['id'] = this.id
151
152
  } else {
152
- throw new Error('Parameter missing: id')
153
+ throw new errors.MissingParameterError('Parameter missing: id')
153
154
  }
154
155
  }
155
156
 
@@ -160,23 +161,23 @@ class As2Partner {
160
161
 
161
162
  delete = async (params = {}) => {
162
163
  if (!this.attributes.id) {
163
- throw new Error('Current object has no id')
164
+ throw new errors.EmptyPropertyError('Current object has no id')
164
165
  }
165
166
 
166
167
  if (!isObject(params)) {
167
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
168
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
168
169
  }
169
170
 
170
171
  params.id = this.attributes.id
171
172
  if (params['id'] && !isInt(params['id'])) {
172
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
173
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
173
174
  }
174
175
 
175
176
  if (!params['id']) {
176
177
  if (this.attributes.id) {
177
178
  params['id'] = this.id
178
179
  } else {
179
- throw new Error('Parameter missing: id')
180
+ throw new errors.MissingParameterError('Parameter missing: id')
180
181
  }
181
182
  }
182
183
 
@@ -203,11 +204,11 @@ class As2Partner {
203
204
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
204
205
  static list = async (params = {}, options = {}) => {
205
206
  if (params['cursor'] && !isString(params['cursor'])) {
206
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
207
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
207
208
  }
208
209
 
209
210
  if (params['per_page'] && !isInt(params['per_page'])) {
210
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
211
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
211
212
  }
212
213
 
213
214
  const response = await Api.sendRequest(`/as2_partners`, 'GET', params, options)
@@ -222,17 +223,17 @@ class As2Partner {
222
223
  // id (required) - int64 - As2 Partner ID.
223
224
  static find = async (id, params = {}, options = {}) => {
224
225
  if (!isObject(params)) {
225
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
226
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
226
227
  }
227
228
 
228
229
  params['id'] = id
229
230
 
230
231
  if (!params['id']) {
231
- throw new Error('Parameter missing: id')
232
+ throw new errors.MissingParameterError('Parameter missing: id')
232
233
  }
233
234
 
234
235
  if (params['id'] && !isInt(params['id'])) {
235
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
236
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
236
237
  }
237
238
 
238
239
  const response = await Api.sendRequest(`/as2_partners/${params['id']}`, 'GET', params, options)
@@ -251,39 +252,39 @@ class As2Partner {
251
252
  // server_certificate - string - Remote server certificate security setting
252
253
  static create = async (params = {}, options = {}) => {
253
254
  if (!params['name']) {
254
- throw new Error('Parameter missing: name')
255
+ throw new errors.MissingParameterError('Parameter missing: name')
255
256
  }
256
257
 
257
258
  if (!params['uri']) {
258
- throw new Error('Parameter missing: uri')
259
+ throw new errors.MissingParameterError('Parameter missing: uri')
259
260
  }
260
261
 
261
262
  if (!params['public_certificate']) {
262
- throw new Error('Parameter missing: public_certificate')
263
+ throw new errors.MissingParameterError('Parameter missing: public_certificate')
263
264
  }
264
265
 
265
266
  if (!params['as2_station_id']) {
266
- throw new Error('Parameter missing: as2_station_id')
267
+ throw new errors.MissingParameterError('Parameter missing: as2_station_id')
267
268
  }
268
269
 
269
270
  if (params['name'] && !isString(params['name'])) {
270
- throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
271
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
271
272
  }
272
273
 
273
274
  if (params['uri'] && !isString(params['uri'])) {
274
- throw new Error(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
275
+ throw new errors.InvalidParameterError(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
275
276
  }
276
277
 
277
278
  if (params['public_certificate'] && !isString(params['public_certificate'])) {
278
- throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
279
+ throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
279
280
  }
280
281
 
281
282
  if (params['as2_station_id'] && !isInt(params['as2_station_id'])) {
282
- throw new Error(`Bad parameter: as2_station_id must be of type Int, received ${getType(as2_station_id)}`)
283
+ throw new errors.InvalidParameterError(`Bad parameter: as2_station_id must be of type Int, received ${getType(as2_station_id)}`)
283
284
  }
284
285
 
285
286
  if (params['server_certificate'] && !isString(params['server_certificate'])) {
286
- throw new Error(`Bad parameter: server_certificate must be of type String, received ${getType(server_certificate)}`)
287
+ throw new errors.InvalidParameterError(`Bad parameter: server_certificate must be of type String, received ${getType(server_certificate)}`)
287
288
  }
288
289
 
289
290
  const response = await Api.sendRequest(`/as2_partners`, 'POST', params, options)
@@ -1,4 +1,5 @@
1
1
  import Api from '../Api'
2
+ import * as errors from '../Errors'
2
3
  import Logger from '../Logger'
3
4
  import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
5
 
@@ -142,35 +143,35 @@ class As2Station {
142
143
  // private_key_password - string
143
144
  update = async (params = {}) => {
144
145
  if (!this.attributes.id) {
145
- throw new Error('Current object has no id')
146
+ throw new errors.EmptyPropertyError('Current object has no id')
146
147
  }
147
148
 
148
149
  if (!isObject(params)) {
149
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
150
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
150
151
  }
151
152
 
152
153
  params.id = this.attributes.id
153
154
  if (params['id'] && !isInt(params['id'])) {
154
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
155
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
155
156
  }
156
157
  if (params['name'] && !isString(params['name'])) {
157
- throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
158
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
158
159
  }
159
160
  if (params['public_certificate'] && !isString(params['public_certificate'])) {
160
- throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
161
+ throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
161
162
  }
162
163
  if (params['private_key'] && !isString(params['private_key'])) {
163
- throw new Error(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
164
+ throw new errors.InvalidParameterError(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
164
165
  }
165
166
  if (params['private_key_password'] && !isString(params['private_key_password'])) {
166
- throw new Error(`Bad parameter: private_key_password must be of type String, received ${getType(private_key_password)}`)
167
+ throw new errors.InvalidParameterError(`Bad parameter: private_key_password must be of type String, received ${getType(private_key_password)}`)
167
168
  }
168
169
 
169
170
  if (!params['id']) {
170
171
  if (this.attributes.id) {
171
172
  params['id'] = this.id
172
173
  } else {
173
- throw new Error('Parameter missing: id')
174
+ throw new errors.MissingParameterError('Parameter missing: id')
174
175
  }
175
176
  }
176
177
 
@@ -181,23 +182,23 @@ class As2Station {
181
182
 
182
183
  delete = async (params = {}) => {
183
184
  if (!this.attributes.id) {
184
- throw new Error('Current object has no id')
185
+ throw new errors.EmptyPropertyError('Current object has no id')
185
186
  }
186
187
 
187
188
  if (!isObject(params)) {
188
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
189
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
189
190
  }
190
191
 
191
192
  params.id = this.attributes.id
192
193
  if (params['id'] && !isInt(params['id'])) {
193
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
194
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
194
195
  }
195
196
 
196
197
  if (!params['id']) {
197
198
  if (this.attributes.id) {
198
199
  params['id'] = this.id
199
200
  } else {
200
- throw new Error('Parameter missing: id')
201
+ throw new errors.MissingParameterError('Parameter missing: id')
201
202
  }
202
203
  }
203
204
 
@@ -224,11 +225,11 @@ class As2Station {
224
225
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
225
226
  static list = async (params = {}, options = {}) => {
226
227
  if (params['cursor'] && !isString(params['cursor'])) {
227
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
228
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
228
229
  }
229
230
 
230
231
  if (params['per_page'] && !isInt(params['per_page'])) {
231
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
232
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
232
233
  }
233
234
 
234
235
  const response = await Api.sendRequest(`/as2_stations`, 'GET', params, options)
@@ -243,17 +244,17 @@ class As2Station {
243
244
  // id (required) - int64 - As2 Station ID.
244
245
  static find = async (id, params = {}, options = {}) => {
245
246
  if (!isObject(params)) {
246
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
247
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
247
248
  }
248
249
 
249
250
  params['id'] = id
250
251
 
251
252
  if (!params['id']) {
252
- throw new Error('Parameter missing: id')
253
+ throw new errors.MissingParameterError('Parameter missing: id')
253
254
  }
254
255
 
255
256
  if (params['id'] && !isInt(params['id'])) {
256
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
257
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
257
258
  }
258
259
 
259
260
  const response = await Api.sendRequest(`/as2_stations/${params['id']}`, 'GET', params, options)
@@ -271,31 +272,31 @@ class As2Station {
271
272
  // private_key_password - string
272
273
  static create = async (params = {}, options = {}) => {
273
274
  if (!params['name']) {
274
- throw new Error('Parameter missing: name')
275
+ throw new errors.MissingParameterError('Parameter missing: name')
275
276
  }
276
277
 
277
278
  if (!params['public_certificate']) {
278
- throw new Error('Parameter missing: public_certificate')
279
+ throw new errors.MissingParameterError('Parameter missing: public_certificate')
279
280
  }
280
281
 
281
282
  if (!params['private_key']) {
282
- throw new Error('Parameter missing: private_key')
283
+ throw new errors.MissingParameterError('Parameter missing: private_key')
283
284
  }
284
285
 
285
286
  if (params['name'] && !isString(params['name'])) {
286
- throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
287
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
287
288
  }
288
289
 
289
290
  if (params['public_certificate'] && !isString(params['public_certificate'])) {
290
- throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
291
+ throw new errors.InvalidParameterError(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
291
292
  }
292
293
 
293
294
  if (params['private_key'] && !isString(params['private_key'])) {
294
- throw new Error(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
295
+ throw new errors.InvalidParameterError(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
295
296
  }
296
297
 
297
298
  if (params['private_key_password'] && !isString(params['private_key_password'])) {
298
- throw new Error(`Bad parameter: private_key_password must be of type String, received ${getType(private_key_password)}`)
299
+ throw new errors.InvalidParameterError(`Bad parameter: private_key_password must be of type String, received ${getType(private_key_password)}`)
299
300
  }
300
301
 
301
302
  const response = await Api.sendRequest(`/as2_stations`, 'POST', params, options)
@@ -1,4 +1,5 @@
1
1
  import Api from '../Api'
2
+ import * as errors from '../Errors'
2
3
  import Logger from '../Logger'
3
4
  import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
5
 
@@ -1,4 +1,5 @@
1
1
  import Api from '../Api'
2
+ import * as errors from '../Errors'
2
3
  import Logger from '../Logger'
3
4
  import { getType, isArray, isBrowser, isInt, isObject, isString } from '../utils'
4
5
 
@@ -197,65 +198,65 @@ class Automation {
197
198
  // automation - string - Automation type
198
199
  update = async (params = {}) => {
199
200
  if (!this.attributes.id) {
200
- throw new Error('Current object has no id')
201
+ throw new errors.EmptyPropertyError('Current object has no id')
201
202
  }
202
203
 
203
204
  if (!isObject(params)) {
204
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
205
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
205
206
  }
206
207
 
207
208
  params.id = this.attributes.id
208
209
  if (params['id'] && !isInt(params['id'])) {
209
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
210
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
210
211
  }
211
212
  if (params['source'] && !isString(params['source'])) {
212
- throw new Error(`Bad parameter: source must be of type String, received ${getType(source)}`)
213
+ throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(source)}`)
213
214
  }
214
215
  if (params['destination'] && !isString(params['destination'])) {
215
- throw new Error(`Bad parameter: destination must be of type String, received ${getType(destination)}`)
216
+ throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(destination)}`)
216
217
  }
217
218
  if (params['destinations'] && !isArray(params['destinations'])) {
218
- throw new Error(`Bad parameter: destinations must be of type Array, received ${getType(destinations)}`)
219
+ throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(destinations)}`)
219
220
  }
220
221
  if (params['destination_replace_from'] && !isString(params['destination_replace_from'])) {
221
- throw new Error(`Bad parameter: destination_replace_from must be of type String, received ${getType(destination_replace_from)}`)
222
+ throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(destination_replace_from)}`)
222
223
  }
223
224
  if (params['destination_replace_to'] && !isString(params['destination_replace_to'])) {
224
- throw new Error(`Bad parameter: destination_replace_to must be of type String, received ${getType(destination_replace_to)}`)
225
+ throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(destination_replace_to)}`)
225
226
  }
226
227
  if (params['interval'] && !isString(params['interval'])) {
227
- throw new Error(`Bad parameter: interval must be of type String, received ${getType(interval)}`)
228
+ throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(interval)}`)
228
229
  }
229
230
  if (params['path'] && !isString(params['path'])) {
230
- throw new Error(`Bad parameter: path must be of type String, received ${getType(path)}`)
231
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
231
232
  }
232
233
  if (params['user_ids'] && !isString(params['user_ids'])) {
233
- throw new Error(`Bad parameter: user_ids must be of type String, received ${getType(user_ids)}`)
234
+ throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(user_ids)}`)
234
235
  }
235
236
  if (params['group_ids'] && !isString(params['group_ids'])) {
236
- throw new Error(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
237
+ throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
237
238
  }
238
239
  if (params['description'] && !isString(params['description'])) {
239
- throw new Error(`Bad parameter: description must be of type String, received ${getType(description)}`)
240
+ throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(description)}`)
240
241
  }
241
242
  if (params['name'] && !isString(params['name'])) {
242
- throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
243
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
243
244
  }
244
245
  if (params['trigger'] && !isString(params['trigger'])) {
245
- throw new Error(`Bad parameter: trigger must be of type String, received ${getType(trigger)}`)
246
+ throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(trigger)}`)
246
247
  }
247
248
  if (params['trigger_actions'] && !isArray(params['trigger_actions'])) {
248
- throw new Error(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
249
+ throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
249
250
  }
250
251
  if (params['automation'] && !isString(params['automation'])) {
251
- throw new Error(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
252
+ throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
252
253
  }
253
254
 
254
255
  if (!params['id']) {
255
256
  if (this.attributes.id) {
256
257
  params['id'] = this.id
257
258
  } else {
258
- throw new Error('Parameter missing: id')
259
+ throw new errors.MissingParameterError('Parameter missing: id')
259
260
  }
260
261
  }
261
262
 
@@ -266,23 +267,23 @@ class Automation {
266
267
 
267
268
  delete = async (params = {}) => {
268
269
  if (!this.attributes.id) {
269
- throw new Error('Current object has no id')
270
+ throw new errors.EmptyPropertyError('Current object has no id')
270
271
  }
271
272
 
272
273
  if (!isObject(params)) {
273
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
274
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
274
275
  }
275
276
 
276
277
  params.id = this.attributes.id
277
278
  if (params['id'] && !isInt(params['id'])) {
278
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
279
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
279
280
  }
280
281
 
281
282
  if (!params['id']) {
282
283
  if (this.attributes.id) {
283
284
  params['id'] = this.id
284
285
  } else {
285
- throw new Error('Parameter missing: id')
286
+ throw new errors.MissingParameterError('Parameter missing: id')
286
287
  }
287
288
  }
288
289
 
@@ -318,15 +319,15 @@ class Automation {
318
319
  // automation - string - DEPRECATED: Type of automation to filter by. Use `filter[automation]` instead.
319
320
  static list = async (params = {}, options = {}) => {
320
321
  if (params['cursor'] && !isString(params['cursor'])) {
321
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
322
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
322
323
  }
323
324
 
324
325
  if (params['per_page'] && !isInt(params['per_page'])) {
325
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
326
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
326
327
  }
327
328
 
328
329
  if (params['automation'] && !isString(params['automation'])) {
329
- throw new Error(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
330
+ throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
330
331
  }
331
332
 
332
333
  const response = await Api.sendRequest(`/automations`, 'GET', params, options)
@@ -341,17 +342,17 @@ class Automation {
341
342
  // id (required) - int64 - Automation ID.
342
343
  static find = async (id, params = {}, options = {}) => {
343
344
  if (!isObject(params)) {
344
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
345
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
345
346
  }
346
347
 
347
348
  params['id'] = id
348
349
 
349
350
  if (!params['id']) {
350
- throw new Error('Parameter missing: id')
351
+ throw new errors.MissingParameterError('Parameter missing: id')
351
352
  }
352
353
 
353
354
  if (params['id'] && !isInt(params['id'])) {
354
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
355
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
355
356
  }
356
357
 
357
358
  const response = await Api.sendRequest(`/automations/${params['id']}`, 'GET', params, options)
@@ -382,63 +383,63 @@ class Automation {
382
383
  // automation (required) - string - Automation type
383
384
  static create = async (params = {}, options = {}) => {
384
385
  if (!params['automation']) {
385
- throw new Error('Parameter missing: automation')
386
+ throw new errors.MissingParameterError('Parameter missing: automation')
386
387
  }
387
388
 
388
389
  if (params['source'] && !isString(params['source'])) {
389
- throw new Error(`Bad parameter: source must be of type String, received ${getType(source)}`)
390
+ throw new errors.InvalidParameterError(`Bad parameter: source must be of type String, received ${getType(source)}`)
390
391
  }
391
392
 
392
393
  if (params['destination'] && !isString(params['destination'])) {
393
- throw new Error(`Bad parameter: destination must be of type String, received ${getType(destination)}`)
394
+ throw new errors.InvalidParameterError(`Bad parameter: destination must be of type String, received ${getType(destination)}`)
394
395
  }
395
396
 
396
397
  if (params['destinations'] && !isArray(params['destinations'])) {
397
- throw new Error(`Bad parameter: destinations must be of type Array, received ${getType(destinations)}`)
398
+ throw new errors.InvalidParameterError(`Bad parameter: destinations must be of type Array, received ${getType(destinations)}`)
398
399
  }
399
400
 
400
401
  if (params['destination_replace_from'] && !isString(params['destination_replace_from'])) {
401
- throw new Error(`Bad parameter: destination_replace_from must be of type String, received ${getType(destination_replace_from)}`)
402
+ throw new errors.InvalidParameterError(`Bad parameter: destination_replace_from must be of type String, received ${getType(destination_replace_from)}`)
402
403
  }
403
404
 
404
405
  if (params['destination_replace_to'] && !isString(params['destination_replace_to'])) {
405
- throw new Error(`Bad parameter: destination_replace_to must be of type String, received ${getType(destination_replace_to)}`)
406
+ throw new errors.InvalidParameterError(`Bad parameter: destination_replace_to must be of type String, received ${getType(destination_replace_to)}`)
406
407
  }
407
408
 
408
409
  if (params['interval'] && !isString(params['interval'])) {
409
- throw new Error(`Bad parameter: interval must be of type String, received ${getType(interval)}`)
410
+ throw new errors.InvalidParameterError(`Bad parameter: interval must be of type String, received ${getType(interval)}`)
410
411
  }
411
412
 
412
413
  if (params['path'] && !isString(params['path'])) {
413
- throw new Error(`Bad parameter: path must be of type String, received ${getType(path)}`)
414
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
414
415
  }
415
416
 
416
417
  if (params['user_ids'] && !isString(params['user_ids'])) {
417
- throw new Error(`Bad parameter: user_ids must be of type String, received ${getType(user_ids)}`)
418
+ throw new errors.InvalidParameterError(`Bad parameter: user_ids must be of type String, received ${getType(user_ids)}`)
418
419
  }
419
420
 
420
421
  if (params['group_ids'] && !isString(params['group_ids'])) {
421
- throw new Error(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
422
+ throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
422
423
  }
423
424
 
424
425
  if (params['description'] && !isString(params['description'])) {
425
- throw new Error(`Bad parameter: description must be of type String, received ${getType(description)}`)
426
+ throw new errors.InvalidParameterError(`Bad parameter: description must be of type String, received ${getType(description)}`)
426
427
  }
427
428
 
428
429
  if (params['name'] && !isString(params['name'])) {
429
- throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
430
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
430
431
  }
431
432
 
432
433
  if (params['trigger'] && !isString(params['trigger'])) {
433
- throw new Error(`Bad parameter: trigger must be of type String, received ${getType(trigger)}`)
434
+ throw new errors.InvalidParameterError(`Bad parameter: trigger must be of type String, received ${getType(trigger)}`)
434
435
  }
435
436
 
436
437
  if (params['trigger_actions'] && !isArray(params['trigger_actions'])) {
437
- throw new Error(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
438
+ throw new errors.InvalidParameterError(`Bad parameter: trigger_actions must be of type Array, received ${getType(trigger_actions)}`)
438
439
  }
439
440
 
440
441
  if (params['automation'] && !isString(params['automation'])) {
441
- throw new Error(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
442
+ throw new errors.InvalidParameterError(`Bad parameter: automation must be of type String, received ${getType(automation)}`)
442
443
  }
443
444
 
444
445
  const response = await Api.sendRequest(`/automations`, 'POST', params, options)