files.com 1.1.19 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. package/.eslintrc.js +0 -3
  2. package/_VERSION +1 -1
  3. package/lib/Api.js +1 -1
  4. package/lib/Errors.js +345 -334
  5. package/lib/Files.js +1 -1
  6. package/lib/models/ActionNotificationExport.js +25 -25
  7. package/lib/models/ActionNotificationExportResult.js +10 -10
  8. package/lib/models/ActionWebhookFailure.js +5 -9
  9. package/lib/models/ApiKey.js +62 -70
  10. package/lib/models/App.js +5 -5
  11. package/lib/models/As2IncomingMessage.js +7 -7
  12. package/lib/models/As2OutgoingMessage.js +7 -7
  13. package/lib/models/As2Partner.js +54 -58
  14. package/lib/models/As2Station.js +51 -55
  15. package/lib/models/Automation.js +102 -110
  16. package/lib/models/AutomationRun.js +13 -13
  17. package/lib/models/BandwidthSnapshot.js +5 -5
  18. package/lib/models/Behavior.js +77 -85
  19. package/lib/models/Bundle.js +102 -110
  20. package/lib/models/BundleDownload.js +9 -9
  21. package/lib/models/BundleNotification.js +37 -41
  22. package/lib/models/BundleRecipient.js +22 -22
  23. package/lib/models/BundleRegistration.js +7 -7
  24. package/lib/models/Clickwrap.js +52 -56
  25. package/lib/models/DnsRecord.js +5 -5
  26. package/lib/models/EmailIncomingMessage.js +5 -5
  27. package/lib/models/ExternalEvent.js +18 -18
  28. package/lib/models/File.js +89 -93
  29. package/lib/models/FileComment.js +41 -45
  30. package/lib/models/FileCommentReaction.js +15 -19
  31. package/lib/models/FileMigration.js +5 -5
  32. package/lib/models/Folder.js +24 -24
  33. package/lib/models/FormFieldSet.js +44 -48
  34. package/lib/models/GpgKey.js +53 -57
  35. package/lib/models/Group.js +51 -55
  36. package/lib/models/GroupUser.js +53 -57
  37. package/lib/models/History.js +72 -72
  38. package/lib/models/HistoryExport.js +51 -51
  39. package/lib/models/HistoryExportResult.js +10 -10
  40. package/lib/models/InboxRecipient.js +22 -22
  41. package/lib/models/InboxRegistration.js +7 -7
  42. package/lib/models/InboxUpload.js +9 -9
  43. package/lib/models/Invoice.js +12 -12
  44. package/lib/models/IpAddress.js +17 -17
  45. package/lib/models/Lock.js +27 -31
  46. package/lib/models/Message.js +60 -64
  47. package/lib/models/MessageComment.js +46 -50
  48. package/lib/models/MessageCommentReaction.js +27 -31
  49. package/lib/models/MessageReaction.js +27 -31
  50. package/lib/models/Notification.js +66 -70
  51. package/lib/models/Payment.js +12 -12
  52. package/lib/models/Permission.js +28 -32
  53. package/lib/models/Priority.js +9 -9
  54. package/lib/models/Project.js +39 -43
  55. package/lib/models/PublicKey.js +46 -50
  56. package/lib/models/RemoteBandwidthSnapshot.js +5 -5
  57. package/lib/models/RemoteServer.js +306 -310
  58. package/lib/models/Request.js +33 -37
  59. package/lib/models/Session.js +11 -15
  60. package/lib/models/SettingsChange.js +5 -5
  61. package/lib/models/SftpHostKey.js +40 -44
  62. package/lib/models/ShareGroup.js +50 -54
  63. package/lib/models/Site.js +138 -138
  64. package/lib/models/Snapshot.js +44 -48
  65. package/lib/models/SsoStrategy.js +15 -19
  66. package/lib/models/Style.js +17 -21
  67. package/lib/models/UsageDailySnapshot.js +5 -5
  68. package/lib/models/UsageSnapshot.js +5 -5
  69. package/lib/models/User.js +156 -172
  70. package/lib/models/UserCipherUse.js +7 -7
  71. package/lib/models/UserRequest.js +26 -30
  72. package/lib/models/WebhookTest.js +15 -15
  73. package/package.json +6 -2
  74. package/src/Api.js +2 -1
  75. package/src/Errors.js +189 -178
  76. package/src/Files.js +1 -1
  77. package/src/models/AccountLineItem.js +5 -2
  78. package/src/models/Action.js +5 -2
  79. package/src/models/ActionNotificationExport.js +36 -35
  80. package/src/models/ActionNotificationExportResult.js +15 -13
  81. package/src/models/ActionWebhookFailure.js +9 -8
  82. package/src/models/ApiKey.js +69 -72
  83. package/src/models/App.js +10 -8
  84. package/src/models/As2IncomingMessage.js +12 -10
  85. package/src/models/As2OutgoingMessage.js +12 -10
  86. package/src/models/As2Partner.js +61 -60
  87. package/src/models/As2Station.js +58 -57
  88. package/src/models/Auto.js +5 -2
  89. package/src/models/Automation.js +121 -110
  90. package/src/models/AutomationRun.js +18 -17
  91. package/src/models/BandwidthSnapshot.js +10 -8
  92. package/src/models/Behavior.js +85 -86
  93. package/src/models/Bundle.js +121 -110
  94. package/src/models/BundleDownload.js +14 -12
  95. package/src/models/BundleNotification.js +40 -43
  96. package/src/models/BundleRecipient.js +33 -32
  97. package/src/models/BundleRegistration.js +12 -10
  98. package/src/models/Clickwrap.js +60 -58
  99. package/src/models/DnsRecord.js +10 -8
  100. package/src/models/EmailIncomingMessage.js +10 -8
  101. package/src/models/Errors.js +5 -2
  102. package/src/models/ExternalEvent.js +29 -29
  103. package/src/models/File.js +116 -108
  104. package/src/models/FileAction.js +5 -2
  105. package/src/models/FileComment.js +45 -46
  106. package/src/models/FileCommentReaction.js +26 -26
  107. package/src/models/FileMigration.js +10 -8
  108. package/src/models/FileUploadPart.js +5 -2
  109. package/src/models/Folder.js +32 -29
  110. package/src/models/FormField.js +5 -2
  111. package/src/models/FormFieldSet.js +49 -50
  112. package/src/models/GpgKey.js +60 -59
  113. package/src/models/Group.js +58 -57
  114. package/src/models/GroupUser.js +60 -58
  115. package/src/models/History.js +77 -74
  116. package/src/models/HistoryExport.js +62 -61
  117. package/src/models/HistoryExportResult.js +15 -13
  118. package/src/models/Image.js +5 -2
  119. package/src/models/InboxRecipient.js +33 -32
  120. package/src/models/InboxRegistration.js +12 -10
  121. package/src/models/InboxUpload.js +14 -12
  122. package/src/models/Invoice.js +17 -14
  123. package/src/models/InvoiceLineItem.js +5 -2
  124. package/src/models/IpAddress.js +22 -20
  125. package/src/models/Lock.js +36 -36
  126. package/src/models/Message.js +66 -66
  127. package/src/models/MessageComment.js +50 -52
  128. package/src/models/MessageCommentReaction.js +38 -40
  129. package/src/models/MessageReaction.js +38 -40
  130. package/src/models/Notification.js +74 -72
  131. package/src/models/Payment.js +17 -14
  132. package/src/models/PaymentLineItem.js +5 -2
  133. package/src/models/Permission.js +39 -40
  134. package/src/models/Preview.js +5 -2
  135. package/src/models/Priority.js +14 -12
  136. package/src/models/Project.js +43 -45
  137. package/src/models/PublicIpAddress.js +5 -2
  138. package/src/models/PublicKey.js +50 -52
  139. package/src/models/RemoteBandwidthSnapshot.js +10 -8
  140. package/src/models/RemoteServer.js +380 -312
  141. package/src/models/RemoteServerConfigurationFile.js +5 -2
  142. package/src/models/Request.js +44 -46
  143. package/src/models/Session.js +22 -22
  144. package/src/models/SettingsChange.js +10 -8
  145. package/src/models/SftpHostKey.js +45 -46
  146. package/src/models/ShareGroup.js +56 -56
  147. package/src/models/ShareGroupMember.js +5 -2
  148. package/src/models/Site.js +143 -142
  149. package/src/models/Snapshot.js +50 -50
  150. package/src/models/SsoStrategy.js +20 -21
  151. package/src/models/Status.js +5 -2
  152. package/src/models/Style.js +22 -23
  153. package/src/models/UsageDailySnapshot.js +10 -8
  154. package/src/models/UsageSnapshot.js +10 -8
  155. package/src/models/User.js +185 -168
  156. package/src/models/UserCipherUse.js +12 -10
  157. package/src/models/UserRequest.js +37 -39
  158. package/src/models/WebhookTest.js +26 -24
  159. package/test/Api.test.js +163 -0
  160. package/test/{package.json → integration/package.json} +1 -1
  161. package/test/{src → integration/src}/index.js +1 -1
  162. package/test.sh +2 -1
  163. /package/test/{.babelrc → integration/.babelrc} +0 -0
  164. /package/test/{index.js → integration/index.js} +0 -0
@@ -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 PublicKey {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class PublicKey {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // int64 # Public key ID
28
32
  getId = () => this.attributes.id
29
33
 
@@ -76,7 +80,6 @@ class PublicKey {
76
80
  this.attributes.public_key = value
77
81
  }
78
82
 
79
-
80
83
  // Parameters:
81
84
  // title (required) - string - Internal reference for key.
82
85
  update = async (params = {}) => {
@@ -89,32 +92,32 @@ class PublicKey {
89
92
  }
90
93
 
91
94
  params.id = this.attributes.id
92
- if (params['id'] && !isInt(params['id'])) {
93
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
95
+ if (params.id && !isInt(params.id)) {
96
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
94
97
  }
95
- if (params['title'] && !isString(params['title'])) {
96
- throw new errors.InvalidParameterError(`Bad parameter: title must be of type String, received ${getType(params['title'])}`)
98
+
99
+ if (params.title && !isString(params.title)) {
100
+ throw new errors.InvalidParameterError(`Bad parameter: title must be of type String, received ${getType(params.title)}`)
97
101
  }
98
102
 
99
- if (!params['id']) {
103
+ if (!params.id) {
100
104
  if (this.attributes.id) {
101
- params['id'] = this.id
105
+ params.id = this.id
102
106
  } else {
103
107
  throw new errors.MissingParameterError('Parameter missing: id')
104
108
  }
105
109
  }
106
110
 
107
- if (!params['title']) {
111
+ if (!params.title) {
108
112
  if (this.attributes.title) {
109
- params['title'] = this.title
113
+ params.title = this.title
110
114
  } else {
111
115
  throw new errors.MissingParameterError('Parameter missing: title')
112
116
  }
113
117
  }
114
118
 
115
- const response = await Api.sendRequest(`/public_keys/${encodeURIComponent(params['id'])}`, 'PATCH', params, this.options)
119
+ const response = await Api.sendRequest(`/public_keys/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
116
120
 
117
-
118
121
  return new PublicKey(response?.data, this.options)
119
122
  }
120
123
 
@@ -128,36 +131,34 @@ class PublicKey {
128
131
  }
129
132
 
130
133
  params.id = this.attributes.id
131
- if (params['id'] && !isInt(params['id'])) {
132
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
134
+ if (params.id && !isInt(params.id)) {
135
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
133
136
  }
134
137
 
135
- if (!params['id']) {
138
+ if (!params.id) {
136
139
  if (this.attributes.id) {
137
- params['id'] = this.id
140
+ params.id = this.id
138
141
  } else {
139
142
  throw new errors.MissingParameterError('Parameter missing: id')
140
143
  }
141
144
  }
142
145
 
143
- const response = await Api.sendRequest(`/public_keys/${encodeURIComponent(params['id'])}`, 'DELETE', params, this.options)
144
-
145
- return
146
+ await Api.sendRequest(`/public_keys/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
146
147
  }
147
148
 
148
149
  destroy = (params = {}) =>
149
150
  this.delete(params)
150
151
 
151
152
  save = async () => {
152
- if (this.attributes['id']) {
153
- const newObject = await this.update(this.attributes)
154
- this.attributes = { ...newObject.attributes }
155
- return true
156
- } else {
157
- const newObject = await PublicKey.create(this.attributes, this.options)
158
- this.attributes = { ...newObject.attributes }
159
- return true
160
- }
153
+ if (this.attributes.id) {
154
+ const newObject = await this.update(this.attributes)
155
+ this.attributes = { ...newObject.attributes }
156
+ return true
157
+ }
158
+
159
+ const newObject = await PublicKey.create(this.attributes, this.options)
160
+ this.attributes = { ...newObject.attributes }
161
+ return true
161
162
  }
162
163
 
163
164
  // Parameters:
@@ -165,21 +166,20 @@ class PublicKey {
165
166
  // 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.
166
167
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
167
168
  static list = async (params = {}, options = {}) => {
168
- if (params['user_id'] && !isInt(params['user_id'])) {
169
- throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params['user_id'])}`)
169
+ if (params.user_id && !isInt(params.user_id)) {
170
+ throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
170
171
  }
171
172
 
172
- if (params['cursor'] && !isString(params['cursor'])) {
173
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
173
+ if (params.cursor && !isString(params.cursor)) {
174
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
174
175
  }
175
176
 
176
- if (params['per_page'] && !isInt(params['per_page'])) {
177
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
177
+ if (params.per_page && !isInt(params.per_page)) {
178
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
178
179
  }
179
180
 
180
- const response = await Api.sendRequest(`/public_keys`, 'GET', params, options)
181
+ const response = await Api.sendRequest('/public_keys', 'GET', params, options)
181
182
 
182
-
183
183
  return response?.data?.map(obj => new PublicKey(obj, options)) || []
184
184
  }
185
185
 
@@ -193,19 +193,18 @@ class PublicKey {
193
193
  throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
194
194
  }
195
195
 
196
- params['id'] = id
196
+ params.id = id
197
197
 
198
- if (!params['id']) {
198
+ if (!params.id) {
199
199
  throw new errors.MissingParameterError('Parameter missing: id')
200
200
  }
201
201
 
202
- if (params['id'] && !isInt(params['id'])) {
203
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
202
+ if (params.id && !isInt(params.id)) {
203
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
204
204
  }
205
205
 
206
- const response = await Api.sendRequest(`/public_keys/${encodeURIComponent(params['id'])}`, 'GET', params, options)
206
+ const response = await Api.sendRequest(`/public_keys/${encodeURIComponent(params.id)}`, 'GET', params, options)
207
207
 
208
-
209
208
  return new PublicKey(response?.data, options)
210
209
  }
211
210
 
@@ -217,29 +216,28 @@ class PublicKey {
217
216
  // title (required) - string - Internal reference for key.
218
217
  // public_key (required) - string - Actual contents of SSH key.
219
218
  static create = async (params = {}, options = {}) => {
220
- if (!params['title']) {
219
+ if (!params.title) {
221
220
  throw new errors.MissingParameterError('Parameter missing: title')
222
221
  }
223
222
 
224
- if (!params['public_key']) {
223
+ if (!params.public_key) {
225
224
  throw new errors.MissingParameterError('Parameter missing: public_key')
226
225
  }
227
226
 
228
- if (params['user_id'] && !isInt(params['user_id'])) {
229
- throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params['user_id'])}`)
227
+ if (params.user_id && !isInt(params.user_id)) {
228
+ throw new errors.InvalidParameterError(`Bad parameter: user_id must be of type Int, received ${getType(params.user_id)}`)
230
229
  }
231
230
 
232
- if (params['title'] && !isString(params['title'])) {
233
- throw new errors.InvalidParameterError(`Bad parameter: title must be of type String, received ${getType(params['title'])}`)
231
+ if (params.title && !isString(params.title)) {
232
+ throw new errors.InvalidParameterError(`Bad parameter: title must be of type String, received ${getType(params.title)}`)
234
233
  }
235
234
 
236
- if (params['public_key'] && !isString(params['public_key'])) {
237
- throw new errors.InvalidParameterError(`Bad parameter: public_key must be of type String, received ${getType(params['public_key'])}`)
235
+ if (params.public_key && !isString(params.public_key)) {
236
+ throw new errors.InvalidParameterError(`Bad parameter: public_key must be of type String, received ${getType(params.public_key)}`)
238
237
  }
239
238
 
240
- const response = await Api.sendRequest(`/public_keys`, 'POST', params, options)
239
+ const response = await Api.sendRequest('/public_keys', 'POST', params, options)
241
240
 
242
-
243
241
  return new PublicKey(response?.data, options)
244
242
  }
245
243
  }
@@ -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 RemoteBandwidthSnapshot {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class RemoteBandwidthSnapshot {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // int64 # Site bandwidth ID
28
32
  getId = () => this.attributes.id
29
33
 
@@ -39,7 +43,6 @@ class RemoteBandwidthSnapshot {
39
43
  // int64 # ID of related Remote Server
40
44
  getRemoteServerId = () => this.attributes.remote_server_id
41
45
 
42
-
43
46
  // Parameters:
44
47
  // 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.
45
48
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
@@ -50,17 +53,16 @@ class RemoteBandwidthSnapshot {
50
53
  // filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `logged_at`.
51
54
  // filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `logged_at`.
52
55
  static list = async (params = {}, options = {}) => {
53
- if (params['cursor'] && !isString(params['cursor'])) {
54
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
56
+ if (params.cursor && !isString(params.cursor)) {
57
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
55
58
  }
56
59
 
57
- if (params['per_page'] && !isInt(params['per_page'])) {
58
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
60
+ if (params.per_page && !isInt(params.per_page)) {
61
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
59
62
  }
60
63
 
61
- const response = await Api.sendRequest(`/remote_bandwidth_snapshots`, 'GET', params, options)
64
+ const response = await Api.sendRequest('/remote_bandwidth_snapshots', 'GET', params, options)
62
65
 
63
-
64
66
  return response?.data?.map(obj => new RemoteBandwidthSnapshot(obj, options)) || []
65
67
  }
66
68