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
 
@@ -62,23 +63,23 @@ class Style {
62
63
  // file (required) - file - Logo for custom branding.
63
64
  update = async (params = {}) => {
64
65
  if (!this.attributes.path) {
65
- throw new Error('Current object has no path')
66
+ throw new errors.EmptyPropertyError('Current object has no path')
66
67
  }
67
68
 
68
69
  if (!isObject(params)) {
69
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
70
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
70
71
  }
71
72
 
72
73
  params.path = this.attributes.path
73
74
  if (params['path'] && !isString(params['path'])) {
74
- throw new Error(`Bad parameter: path must be of type String, received ${getType(path)}`)
75
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
75
76
  }
76
77
 
77
78
  if (!params['path']) {
78
79
  if (this.attributes.path) {
79
80
  params['path'] = this.path
80
81
  } else {
81
- throw new Error('Parameter missing: path')
82
+ throw new errors.MissingParameterError('Parameter missing: path')
82
83
  }
83
84
  }
84
85
 
@@ -86,7 +87,7 @@ class Style {
86
87
  if (this.attributes.file) {
87
88
  params['file'] = this.file
88
89
  } else {
89
- throw new Error('Parameter missing: file')
90
+ throw new errors.MissingParameterError('Parameter missing: file')
90
91
  }
91
92
  }
92
93
 
@@ -97,23 +98,23 @@ class Style {
97
98
 
98
99
  delete = async (params = {}) => {
99
100
  if (!this.attributes.path) {
100
- throw new Error('Current object has no path')
101
+ throw new errors.EmptyPropertyError('Current object has no path')
101
102
  }
102
103
 
103
104
  if (!isObject(params)) {
104
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
105
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
105
106
  }
106
107
 
107
108
  params.path = this.attributes.path
108
109
  if (params['path'] && !isString(params['path'])) {
109
- throw new Error(`Bad parameter: path must be of type String, received ${getType(path)}`)
110
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
110
111
  }
111
112
 
112
113
  if (!params['path']) {
113
114
  if (this.attributes.path) {
114
115
  params['path'] = this.path
115
116
  } else {
116
- throw new Error('Parameter missing: path')
117
+ throw new errors.MissingParameterError('Parameter missing: path')
117
118
  }
118
119
  }
119
120
 
@@ -132,17 +133,17 @@ class Style {
132
133
  // path (required) - string - Style path.
133
134
  static find = async (path, params = {}, options = {}) => {
134
135
  if (!isObject(params)) {
135
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
136
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
136
137
  }
137
138
 
138
139
  params['path'] = path
139
140
 
140
141
  if (!params['path']) {
141
- throw new Error('Parameter missing: path')
142
+ throw new errors.MissingParameterError('Parameter missing: path')
142
143
  }
143
144
 
144
145
  if (params['path'] && !isString(params['path'])) {
145
- throw new Error(`Bad parameter: path must be of type String, received ${getType(path)}`)
146
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(path)}`)
146
147
  }
147
148
 
148
149
  const response = await Api.sendRequest(`/styles/${params['path']}`, '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
 
@@ -68,11 +69,11 @@ class UsageDailySnapshot {
68
69
  // filter_lteq - object - If set, return records where the specified field is less than or equal to the supplied value. Valid fields are `date` and `usage_snapshot_id`. Valid field combinations are `[ usage_snapshot_id, date ]`.
69
70
  static list = async (params = {}, options = {}) => {
70
71
  if (params['cursor'] && !isString(params['cursor'])) {
71
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
72
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
72
73
  }
73
74
 
74
75
  if (params['per_page'] && !isInt(params['per_page'])) {
75
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
76
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
76
77
  }
77
78
 
78
79
  const response = await Api.sendRequest(`/usage_daily_snapshots`, '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
 
@@ -85,11 +86,11 @@ class UsageSnapshot {
85
86
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
86
87
  static list = async (params = {}, options = {}) => {
87
88
  if (params['cursor'] && !isString(params['cursor'])) {
88
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
89
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
89
90
  }
90
91
 
91
92
  if (params['per_page'] && !isInt(params['per_page'])) {
92
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
93
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
93
94
  }
94
95
 
95
96
  const response = await Api.sendRequest(`/usage_snapshots`, '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
 
@@ -428,23 +429,23 @@ class User {
428
429
  // Unlock user who has been locked out due to failed logins
429
430
  unlock = async (params = {}) => {
430
431
  if (!this.attributes.id) {
431
- throw new Error('Current object has no id')
432
+ throw new errors.EmptyPropertyError('Current object has no id')
432
433
  }
433
434
 
434
435
  if (!isObject(params)) {
435
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
436
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
436
437
  }
437
438
 
438
439
  params.id = this.attributes.id
439
440
  if (params['id'] && !isInt(params['id'])) {
440
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
441
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
441
442
  }
442
443
 
443
444
  if (!params['id']) {
444
445
  if (this.attributes.id) {
445
446
  params['id'] = this.id
446
447
  } else {
447
- throw new Error('Parameter missing: id')
448
+ throw new errors.MissingParameterError('Parameter missing: id')
448
449
  }
449
450
  }
450
451
 
@@ -456,23 +457,23 @@ class User {
456
457
  // Resend user welcome email
457
458
  resendWelcomeEmail = async (params = {}) => {
458
459
  if (!this.attributes.id) {
459
- throw new Error('Current object has no id')
460
+ throw new errors.EmptyPropertyError('Current object has no id')
460
461
  }
461
462
 
462
463
  if (!isObject(params)) {
463
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
464
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
464
465
  }
465
466
 
466
467
  params.id = this.attributes.id
467
468
  if (params['id'] && !isInt(params['id'])) {
468
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
469
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
469
470
  }
470
471
 
471
472
  if (!params['id']) {
472
473
  if (this.attributes.id) {
473
474
  params['id'] = this.id
474
475
  } else {
475
- throw new Error('Parameter missing: id')
476
+ throw new errors.MissingParameterError('Parameter missing: id')
476
477
  }
477
478
  }
478
479
 
@@ -484,23 +485,23 @@ class User {
484
485
  // Trigger 2FA Reset process for user who has lost access to their existing 2FA methods
485
486
  user2faReset = async (params = {}) => {
486
487
  if (!this.attributes.id) {
487
- throw new Error('Current object has no id')
488
+ throw new errors.EmptyPropertyError('Current object has no id')
488
489
  }
489
490
 
490
491
  if (!isObject(params)) {
491
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
492
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
492
493
  }
493
494
 
494
495
  params.id = this.attributes.id
495
496
  if (params['id'] && !isInt(params['id'])) {
496
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
497
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
497
498
  }
498
499
 
499
500
  if (!params['id']) {
500
501
  if (this.attributes.id) {
501
502
  params['id'] = this.id
502
503
  } else {
503
- throw new Error('Parameter missing: id')
504
+ throw new errors.MissingParameterError('Parameter missing: id')
504
505
  }
505
506
  }
506
507
 
@@ -556,98 +557,98 @@ class User {
556
557
  // username - string - User's username
557
558
  update = async (params = {}) => {
558
559
  if (!this.attributes.id) {
559
- throw new Error('Current object has no id')
560
+ throw new errors.EmptyPropertyError('Current object has no id')
560
561
  }
561
562
 
562
563
  if (!isObject(params)) {
563
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
564
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
564
565
  }
565
566
 
566
567
  params.id = this.attributes.id
567
568
  if (params['id'] && !isInt(params['id'])) {
568
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
569
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
569
570
  }
570
571
  if (params['change_password'] && !isString(params['change_password'])) {
571
- throw new Error(`Bad parameter: change_password must be of type String, received ${getType(change_password)}`)
572
+ throw new errors.InvalidParameterError(`Bad parameter: change_password must be of type String, received ${getType(change_password)}`)
572
573
  }
573
574
  if (params['change_password_confirmation'] && !isString(params['change_password_confirmation'])) {
574
- throw new Error(`Bad parameter: change_password_confirmation must be of type String, received ${getType(change_password_confirmation)}`)
575
+ throw new errors.InvalidParameterError(`Bad parameter: change_password_confirmation must be of type String, received ${getType(change_password_confirmation)}`)
575
576
  }
576
577
  if (params['email'] && !isString(params['email'])) {
577
- throw new Error(`Bad parameter: email must be of type String, received ${getType(email)}`)
578
+ throw new errors.InvalidParameterError(`Bad parameter: email must be of type String, received ${getType(email)}`)
578
579
  }
579
580
  if (params['grant_permission'] && !isString(params['grant_permission'])) {
580
- throw new Error(`Bad parameter: grant_permission must be of type String, received ${getType(grant_permission)}`)
581
+ throw new errors.InvalidParameterError(`Bad parameter: grant_permission must be of type String, received ${getType(grant_permission)}`)
581
582
  }
582
583
  if (params['group_id'] && !isInt(params['group_id'])) {
583
- throw new Error(`Bad parameter: group_id must be of type Int, received ${getType(group_id)}`)
584
+ throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type Int, received ${getType(group_id)}`)
584
585
  }
585
586
  if (params['group_ids'] && !isString(params['group_ids'])) {
586
- throw new Error(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
587
+ throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
587
588
  }
588
589
  if (params['imported_password_hash'] && !isString(params['imported_password_hash'])) {
589
- throw new Error(`Bad parameter: imported_password_hash must be of type String, received ${getType(imported_password_hash)}`)
590
+ throw new errors.InvalidParameterError(`Bad parameter: imported_password_hash must be of type String, received ${getType(imported_password_hash)}`)
590
591
  }
591
592
  if (params['password'] && !isString(params['password'])) {
592
- throw new Error(`Bad parameter: password must be of type String, received ${getType(password)}`)
593
+ throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(password)}`)
593
594
  }
594
595
  if (params['password_confirmation'] && !isString(params['password_confirmation'])) {
595
- throw new Error(`Bad parameter: password_confirmation must be of type String, received ${getType(password_confirmation)}`)
596
+ throw new errors.InvalidParameterError(`Bad parameter: password_confirmation must be of type String, received ${getType(password_confirmation)}`)
596
597
  }
597
598
  if (params['allowed_ips'] && !isString(params['allowed_ips'])) {
598
- throw new Error(`Bad parameter: allowed_ips must be of type String, received ${getType(allowed_ips)}`)
599
+ throw new errors.InvalidParameterError(`Bad parameter: allowed_ips must be of type String, received ${getType(allowed_ips)}`)
599
600
  }
600
601
  if (params['authenticate_until'] && !isString(params['authenticate_until'])) {
601
- throw new Error(`Bad parameter: authenticate_until must be of type String, received ${getType(authenticate_until)}`)
602
+ throw new errors.InvalidParameterError(`Bad parameter: authenticate_until must be of type String, received ${getType(authenticate_until)}`)
602
603
  }
603
604
  if (params['authentication_method'] && !isString(params['authentication_method'])) {
604
- throw new Error(`Bad parameter: authentication_method must be of type String, received ${getType(authentication_method)}`)
605
+ throw new errors.InvalidParameterError(`Bad parameter: authentication_method must be of type String, received ${getType(authentication_method)}`)
605
606
  }
606
607
  if (params['header_text'] && !isString(params['header_text'])) {
607
- throw new Error(`Bad parameter: header_text must be of type String, received ${getType(header_text)}`)
608
+ throw new errors.InvalidParameterError(`Bad parameter: header_text must be of type String, received ${getType(header_text)}`)
608
609
  }
609
610
  if (params['language'] && !isString(params['language'])) {
610
- throw new Error(`Bad parameter: language must be of type String, received ${getType(language)}`)
611
+ throw new errors.InvalidParameterError(`Bad parameter: language must be of type String, received ${getType(language)}`)
611
612
  }
612
613
  if (params['notification_daily_send_time'] && !isInt(params['notification_daily_send_time'])) {
613
- throw new Error(`Bad parameter: notification_daily_send_time must be of type Int, received ${getType(notification_daily_send_time)}`)
614
+ throw new errors.InvalidParameterError(`Bad parameter: notification_daily_send_time must be of type Int, received ${getType(notification_daily_send_time)}`)
614
615
  }
615
616
  if (params['name'] && !isString(params['name'])) {
616
- throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
617
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
617
618
  }
618
619
  if (params['company'] && !isString(params['company'])) {
619
- throw new Error(`Bad parameter: company must be of type String, received ${getType(company)}`)
620
+ throw new errors.InvalidParameterError(`Bad parameter: company must be of type String, received ${getType(company)}`)
620
621
  }
621
622
  if (params['notes'] && !isString(params['notes'])) {
622
- throw new Error(`Bad parameter: notes must be of type String, received ${getType(notes)}`)
623
+ throw new errors.InvalidParameterError(`Bad parameter: notes must be of type String, received ${getType(notes)}`)
623
624
  }
624
625
  if (params['password_validity_days'] && !isInt(params['password_validity_days'])) {
625
- throw new Error(`Bad parameter: password_validity_days must be of type Int, received ${getType(password_validity_days)}`)
626
+ throw new errors.InvalidParameterError(`Bad parameter: password_validity_days must be of type Int, received ${getType(password_validity_days)}`)
626
627
  }
627
628
  if (params['ssl_required'] && !isString(params['ssl_required'])) {
628
- throw new Error(`Bad parameter: ssl_required must be of type String, received ${getType(ssl_required)}`)
629
+ throw new errors.InvalidParameterError(`Bad parameter: ssl_required must be of type String, received ${getType(ssl_required)}`)
629
630
  }
630
631
  if (params['sso_strategy_id'] && !isInt(params['sso_strategy_id'])) {
631
- throw new Error(`Bad parameter: sso_strategy_id must be of type Int, received ${getType(sso_strategy_id)}`)
632
+ throw new errors.InvalidParameterError(`Bad parameter: sso_strategy_id must be of type Int, received ${getType(sso_strategy_id)}`)
632
633
  }
633
634
  if (params['require_2fa'] && !isString(params['require_2fa'])) {
634
- throw new Error(`Bad parameter: require_2fa must be of type String, received ${getType(require_2fa)}`)
635
+ throw new errors.InvalidParameterError(`Bad parameter: require_2fa must be of type String, received ${getType(require_2fa)}`)
635
636
  }
636
637
  if (params['time_zone'] && !isString(params['time_zone'])) {
637
- throw new Error(`Bad parameter: time_zone must be of type String, received ${getType(time_zone)}`)
638
+ throw new errors.InvalidParameterError(`Bad parameter: time_zone must be of type String, received ${getType(time_zone)}`)
638
639
  }
639
640
  if (params['user_root'] && !isString(params['user_root'])) {
640
- throw new Error(`Bad parameter: user_root must be of type String, received ${getType(user_root)}`)
641
+ throw new errors.InvalidParameterError(`Bad parameter: user_root must be of type String, received ${getType(user_root)}`)
641
642
  }
642
643
  if (params['username'] && !isString(params['username'])) {
643
- throw new Error(`Bad parameter: username must be of type String, received ${getType(username)}`)
644
+ throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(username)}`)
644
645
  }
645
646
 
646
647
  if (!params['id']) {
647
648
  if (this.attributes.id) {
648
649
  params['id'] = this.id
649
650
  } else {
650
- throw new Error('Parameter missing: id')
651
+ throw new errors.MissingParameterError('Parameter missing: id')
651
652
  }
652
653
  }
653
654
 
@@ -658,23 +659,23 @@ class User {
658
659
 
659
660
  delete = async (params = {}) => {
660
661
  if (!this.attributes.id) {
661
- throw new Error('Current object has no id')
662
+ throw new errors.EmptyPropertyError('Current object has no id')
662
663
  }
663
664
 
664
665
  if (!isObject(params)) {
665
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
666
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
666
667
  }
667
668
 
668
669
  params.id = this.attributes.id
669
670
  if (params['id'] && !isInt(params['id'])) {
670
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
671
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
671
672
  }
672
673
 
673
674
  if (!params['id']) {
674
675
  if (this.attributes.id) {
675
676
  params['id'] = this.id
676
677
  } else {
677
- throw new Error('Parameter missing: id')
678
+ throw new errors.MissingParameterError('Parameter missing: id')
678
679
  }
679
680
  }
680
681
 
@@ -717,19 +718,19 @@ class User {
717
718
  // search - string - Searches for partial matches of name, username, or email.
718
719
  static list = async (params = {}, options = {}) => {
719
720
  if (params['cursor'] && !isString(params['cursor'])) {
720
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
721
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
721
722
  }
722
723
 
723
724
  if (params['per_page'] && !isInt(params['per_page'])) {
724
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
725
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
725
726
  }
726
727
 
727
728
  if (params['ids'] && !isString(params['ids'])) {
728
- throw new Error(`Bad parameter: ids must be of type String, received ${getType(ids)}`)
729
+ throw new errors.InvalidParameterError(`Bad parameter: ids must be of type String, received ${getType(ids)}`)
729
730
  }
730
731
 
731
732
  if (params['search'] && !isString(params['search'])) {
732
- throw new Error(`Bad parameter: search must be of type String, received ${getType(search)}`)
733
+ throw new errors.InvalidParameterError(`Bad parameter: search must be of type String, received ${getType(search)}`)
733
734
  }
734
735
 
735
736
  const response = await Api.sendRequest(`/users`, 'GET', params, options)
@@ -744,17 +745,17 @@ class User {
744
745
  // id (required) - int64 - User ID.
745
746
  static find = async (id, params = {}, options = {}) => {
746
747
  if (!isObject(params)) {
747
- throw new Error(`Bad parameter: params must be of type object, received ${getType(params)}`)
748
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
748
749
  }
749
750
 
750
751
  params['id'] = id
751
752
 
752
753
  if (!params['id']) {
753
- throw new Error('Parameter missing: id')
754
+ throw new errors.MissingParameterError('Parameter missing: id')
754
755
  }
755
756
 
756
757
  if (params['id'] && !isInt(params['id'])) {
757
- throw new Error(`Bad parameter: id must be of type Int, received ${getType(id)}`)
758
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
758
759
  }
759
760
 
760
761
  const response = await Api.sendRequest(`/users/${params['id']}`, 'GET', params, options)
@@ -812,103 +813,103 @@ class User {
812
813
  // username - string - User's username
813
814
  static create = async (params = {}, options = {}) => {
814
815
  if (params['change_password'] && !isString(params['change_password'])) {
815
- throw new Error(`Bad parameter: change_password must be of type String, received ${getType(change_password)}`)
816
+ throw new errors.InvalidParameterError(`Bad parameter: change_password must be of type String, received ${getType(change_password)}`)
816
817
  }
817
818
 
818
819
  if (params['change_password_confirmation'] && !isString(params['change_password_confirmation'])) {
819
- throw new Error(`Bad parameter: change_password_confirmation must be of type String, received ${getType(change_password_confirmation)}`)
820
+ throw new errors.InvalidParameterError(`Bad parameter: change_password_confirmation must be of type String, received ${getType(change_password_confirmation)}`)
820
821
  }
821
822
 
822
823
  if (params['email'] && !isString(params['email'])) {
823
- throw new Error(`Bad parameter: email must be of type String, received ${getType(email)}`)
824
+ throw new errors.InvalidParameterError(`Bad parameter: email must be of type String, received ${getType(email)}`)
824
825
  }
825
826
 
826
827
  if (params['grant_permission'] && !isString(params['grant_permission'])) {
827
- throw new Error(`Bad parameter: grant_permission must be of type String, received ${getType(grant_permission)}`)
828
+ throw new errors.InvalidParameterError(`Bad parameter: grant_permission must be of type String, received ${getType(grant_permission)}`)
828
829
  }
829
830
 
830
831
  if (params['group_id'] && !isInt(params['group_id'])) {
831
- throw new Error(`Bad parameter: group_id must be of type Int, received ${getType(group_id)}`)
832
+ throw new errors.InvalidParameterError(`Bad parameter: group_id must be of type Int, received ${getType(group_id)}`)
832
833
  }
833
834
 
834
835
  if (params['group_ids'] && !isString(params['group_ids'])) {
835
- throw new Error(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
836
+ throw new errors.InvalidParameterError(`Bad parameter: group_ids must be of type String, received ${getType(group_ids)}`)
836
837
  }
837
838
 
838
839
  if (params['imported_password_hash'] && !isString(params['imported_password_hash'])) {
839
- throw new Error(`Bad parameter: imported_password_hash must be of type String, received ${getType(imported_password_hash)}`)
840
+ throw new errors.InvalidParameterError(`Bad parameter: imported_password_hash must be of type String, received ${getType(imported_password_hash)}`)
840
841
  }
841
842
 
842
843
  if (params['password'] && !isString(params['password'])) {
843
- throw new Error(`Bad parameter: password must be of type String, received ${getType(password)}`)
844
+ throw new errors.InvalidParameterError(`Bad parameter: password must be of type String, received ${getType(password)}`)
844
845
  }
845
846
 
846
847
  if (params['password_confirmation'] && !isString(params['password_confirmation'])) {
847
- throw new Error(`Bad parameter: password_confirmation must be of type String, received ${getType(password_confirmation)}`)
848
+ throw new errors.InvalidParameterError(`Bad parameter: password_confirmation must be of type String, received ${getType(password_confirmation)}`)
848
849
  }
849
850
 
850
851
  if (params['allowed_ips'] && !isString(params['allowed_ips'])) {
851
- throw new Error(`Bad parameter: allowed_ips must be of type String, received ${getType(allowed_ips)}`)
852
+ throw new errors.InvalidParameterError(`Bad parameter: allowed_ips must be of type String, received ${getType(allowed_ips)}`)
852
853
  }
853
854
 
854
855
  if (params['authenticate_until'] && !isString(params['authenticate_until'])) {
855
- throw new Error(`Bad parameter: authenticate_until must be of type String, received ${getType(authenticate_until)}`)
856
+ throw new errors.InvalidParameterError(`Bad parameter: authenticate_until must be of type String, received ${getType(authenticate_until)}`)
856
857
  }
857
858
 
858
859
  if (params['authentication_method'] && !isString(params['authentication_method'])) {
859
- throw new Error(`Bad parameter: authentication_method must be of type String, received ${getType(authentication_method)}`)
860
+ throw new errors.InvalidParameterError(`Bad parameter: authentication_method must be of type String, received ${getType(authentication_method)}`)
860
861
  }
861
862
 
862
863
  if (params['header_text'] && !isString(params['header_text'])) {
863
- throw new Error(`Bad parameter: header_text must be of type String, received ${getType(header_text)}`)
864
+ throw new errors.InvalidParameterError(`Bad parameter: header_text must be of type String, received ${getType(header_text)}`)
864
865
  }
865
866
 
866
867
  if (params['language'] && !isString(params['language'])) {
867
- throw new Error(`Bad parameter: language must be of type String, received ${getType(language)}`)
868
+ throw new errors.InvalidParameterError(`Bad parameter: language must be of type String, received ${getType(language)}`)
868
869
  }
869
870
 
870
871
  if (params['notification_daily_send_time'] && !isInt(params['notification_daily_send_time'])) {
871
- throw new Error(`Bad parameter: notification_daily_send_time must be of type Int, received ${getType(notification_daily_send_time)}`)
872
+ throw new errors.InvalidParameterError(`Bad parameter: notification_daily_send_time must be of type Int, received ${getType(notification_daily_send_time)}`)
872
873
  }
873
874
 
874
875
  if (params['name'] && !isString(params['name'])) {
875
- throw new Error(`Bad parameter: name must be of type String, received ${getType(name)}`)
876
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
876
877
  }
877
878
 
878
879
  if (params['company'] && !isString(params['company'])) {
879
- throw new Error(`Bad parameter: company must be of type String, received ${getType(company)}`)
880
+ throw new errors.InvalidParameterError(`Bad parameter: company must be of type String, received ${getType(company)}`)
880
881
  }
881
882
 
882
883
  if (params['notes'] && !isString(params['notes'])) {
883
- throw new Error(`Bad parameter: notes must be of type String, received ${getType(notes)}`)
884
+ throw new errors.InvalidParameterError(`Bad parameter: notes must be of type String, received ${getType(notes)}`)
884
885
  }
885
886
 
886
887
  if (params['password_validity_days'] && !isInt(params['password_validity_days'])) {
887
- throw new Error(`Bad parameter: password_validity_days must be of type Int, received ${getType(password_validity_days)}`)
888
+ throw new errors.InvalidParameterError(`Bad parameter: password_validity_days must be of type Int, received ${getType(password_validity_days)}`)
888
889
  }
889
890
 
890
891
  if (params['ssl_required'] && !isString(params['ssl_required'])) {
891
- throw new Error(`Bad parameter: ssl_required must be of type String, received ${getType(ssl_required)}`)
892
+ throw new errors.InvalidParameterError(`Bad parameter: ssl_required must be of type String, received ${getType(ssl_required)}`)
892
893
  }
893
894
 
894
895
  if (params['sso_strategy_id'] && !isInt(params['sso_strategy_id'])) {
895
- throw new Error(`Bad parameter: sso_strategy_id must be of type Int, received ${getType(sso_strategy_id)}`)
896
+ throw new errors.InvalidParameterError(`Bad parameter: sso_strategy_id must be of type Int, received ${getType(sso_strategy_id)}`)
896
897
  }
897
898
 
898
899
  if (params['require_2fa'] && !isString(params['require_2fa'])) {
899
- throw new Error(`Bad parameter: require_2fa must be of type String, received ${getType(require_2fa)}`)
900
+ throw new errors.InvalidParameterError(`Bad parameter: require_2fa must be of type String, received ${getType(require_2fa)}`)
900
901
  }
901
902
 
902
903
  if (params['time_zone'] && !isString(params['time_zone'])) {
903
- throw new Error(`Bad parameter: time_zone must be of type String, received ${getType(time_zone)}`)
904
+ throw new errors.InvalidParameterError(`Bad parameter: time_zone must be of type String, received ${getType(time_zone)}`)
904
905
  }
905
906
 
906
907
  if (params['user_root'] && !isString(params['user_root'])) {
907
- throw new Error(`Bad parameter: user_root must be of type String, received ${getType(user_root)}`)
908
+ throw new errors.InvalidParameterError(`Bad parameter: user_root must be of type String, received ${getType(user_root)}`)
908
909
  }
909
910
 
910
911
  if (params['username'] && !isString(params['username'])) {
911
- throw new Error(`Bad parameter: username must be of type String, received ${getType(username)}`)
912
+ throw new errors.InvalidParameterError(`Bad parameter: username must be of type String, received ${getType(username)}`)
912
913
  }
913
914
 
914
915
  const response = await Api.sendRequest(`/users`, '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
 
@@ -47,15 +48,15 @@ class UserCipherUse {
47
48
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
48
49
  static list = async (params = {}, options = {}) => {
49
50
  if (params['user_id'] && !isInt(params['user_id'])) {
50
- throw new Error(`Bad parameter: user_id must be of type Int, received ${getType(user_id)}`)
51
+ throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(user_id)}`)
51
52
  }
52
53
 
53
54
  if (params['cursor'] && !isString(params['cursor'])) {
54
- throw new Error(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
55
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(cursor)}`)
55
56
  }
56
57
 
57
58
  if (params['per_page'] && !isInt(params['per_page'])) {
58
- throw new Error(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
59
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(per_page)}`)
59
60
  }
60
61
 
61
62
  const response = await Api.sendRequest(`/user_cipher_uses`, 'GET', params, options)