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 Snapshot {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class Snapshot {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // int64 # The snapshot's unique ID.
28
32
  getId = () => this.attributes.id
29
33
 
@@ -73,7 +77,6 @@ class Snapshot {
73
77
  this.attributes.paths = value
74
78
  }
75
79
 
76
-
77
80
  // Parameters:
78
81
  // expires_at - string - When the snapshot expires.
79
82
  // name - string - A name for the snapshot.
@@ -88,30 +91,32 @@ class Snapshot {
88
91
  }
89
92
 
90
93
  params.id = this.attributes.id
91
- if (params['id'] && !isInt(params['id'])) {
92
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
94
+ if (params.id && !isInt(params.id)) {
95
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
93
96
  }
94
- if (params['expires_at'] && !isString(params['expires_at'])) {
95
- throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params['expires_at'])}`)
97
+
98
+ if (params.expires_at && !isString(params.expires_at)) {
99
+ throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
96
100
  }
97
- if (params['name'] && !isString(params['name'])) {
98
- throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
101
+
102
+ if (params.name && !isString(params.name)) {
103
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
99
104
  }
100
- if (params['paths'] && !isArray(params['paths'])) {
101
- throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params['paths'])}`)
105
+
106
+ if (params.paths && !isArray(params.paths)) {
107
+ throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params.paths)}`)
102
108
  }
103
109
 
104
- if (!params['id']) {
110
+ if (!params.id) {
105
111
  if (this.attributes.id) {
106
- params['id'] = this.id
112
+ params.id = this.id
107
113
  } else {
108
114
  throw new errors.MissingParameterError('Parameter missing: id')
109
115
  }
110
116
  }
111
117
 
112
- const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params['id'])}`, 'PATCH', params, this.options)
118
+ const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params.id)}`, 'PATCH', params, this.options)
113
119
 
114
-
115
120
  return new Snapshot(response?.data, this.options)
116
121
  }
117
122
 
@@ -125,53 +130,50 @@ class Snapshot {
125
130
  }
126
131
 
127
132
  params.id = this.attributes.id
128
- if (params['id'] && !isInt(params['id'])) {
129
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
133
+ if (params.id && !isInt(params.id)) {
134
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
130
135
  }
131
136
 
132
- if (!params['id']) {
137
+ if (!params.id) {
133
138
  if (this.attributes.id) {
134
- params['id'] = this.id
139
+ params.id = this.id
135
140
  } else {
136
141
  throw new errors.MissingParameterError('Parameter missing: id')
137
142
  }
138
143
  }
139
144
 
140
- const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params['id'])}`, 'DELETE', params, this.options)
141
-
142
- return
145
+ await Api.sendRequest(`/snapshots/${encodeURIComponent(params.id)}`, 'DELETE', params, this.options)
143
146
  }
144
147
 
145
148
  destroy = (params = {}) =>
146
149
  this.delete(params)
147
150
 
148
151
  save = async () => {
149
- if (this.attributes['id']) {
150
- const newObject = await this.update(this.attributes)
151
- this.attributes = { ...newObject.attributes }
152
- return true
153
- } else {
154
- const newObject = await Snapshot.create(this.attributes, this.options)
155
- this.attributes = { ...newObject.attributes }
156
- return true
157
- }
152
+ if (this.attributes.id) {
153
+ const newObject = await this.update(this.attributes)
154
+ this.attributes = { ...newObject.attributes }
155
+ return true
156
+ }
157
+
158
+ const newObject = await Snapshot.create(this.attributes, this.options)
159
+ this.attributes = { ...newObject.attributes }
160
+ return true
158
161
  }
159
162
 
160
163
  // Parameters:
161
164
  // 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.
162
165
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
163
166
  static list = async (params = {}, options = {}) => {
164
- if (params['cursor'] && !isString(params['cursor'])) {
165
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
167
+ if (params.cursor && !isString(params.cursor)) {
168
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
166
169
  }
167
170
 
168
- if (params['per_page'] && !isInt(params['per_page'])) {
169
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
171
+ if (params.per_page && !isInt(params.per_page)) {
172
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
170
173
  }
171
174
 
172
- const response = await Api.sendRequest(`/snapshots`, 'GET', params, options)
175
+ const response = await Api.sendRequest('/snapshots', 'GET', params, options)
173
176
 
174
-
175
177
  return response?.data?.map(obj => new Snapshot(obj, options)) || []
176
178
  }
177
179
 
@@ -185,19 +187,18 @@ class Snapshot {
185
187
  throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
186
188
  }
187
189
 
188
- params['id'] = id
190
+ params.id = id
189
191
 
190
- if (!params['id']) {
192
+ if (!params.id) {
191
193
  throw new errors.MissingParameterError('Parameter missing: id')
192
194
  }
193
195
 
194
- if (params['id'] && !isInt(params['id'])) {
195
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
196
+ if (params.id && !isInt(params.id)) {
197
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
196
198
  }
197
199
 
198
- const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params['id'])}`, 'GET', params, options)
200
+ const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params.id)}`, 'GET', params, options)
199
201
 
200
-
201
202
  return new Snapshot(response?.data, options)
202
203
  }
203
204
 
@@ -209,21 +210,20 @@ class Snapshot {
209
210
  // name - string - A name for the snapshot.
210
211
  // paths - array(string) - An array of paths to add to the snapshot.
211
212
  static create = async (params = {}, options = {}) => {
212
- if (params['expires_at'] && !isString(params['expires_at'])) {
213
- throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params['expires_at'])}`)
213
+ if (params.expires_at && !isString(params.expires_at)) {
214
+ throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params.expires_at)}`)
214
215
  }
215
216
 
216
- if (params['name'] && !isString(params['name'])) {
217
- throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
217
+ if (params.name && !isString(params.name)) {
218
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params.name)}`)
218
219
  }
219
220
 
220
- if (params['paths'] && !isArray(params['paths'])) {
221
- throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params['paths'])}`)
221
+ if (params.paths && !isArray(params.paths)) {
222
+ throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params.paths)}`)
222
223
  }
223
224
 
224
- const response = await Api.sendRequest(`/snapshots`, 'POST', params, options)
225
+ const response = await Api.sendRequest('/snapshots', 'POST', params, options)
225
226
 
226
-
227
227
  return new Snapshot(response?.data, options)
228
228
  }
229
229
  }
@@ -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 SsoStrategy {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class SsoStrategy {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // string # SSO Protocol
28
32
  getProtocol = () => this.attributes.protocol
29
33
 
@@ -159,7 +163,6 @@ class SsoStrategy {
159
163
  // string # LDAP username field
160
164
  getLdapUsernameField = () => this.attributes.ldap_username_field
161
165
 
162
-
163
166
  // Synchronize provisioning data with the SSO remote server
164
167
  sync = async (params = {}) => {
165
168
  if (!this.attributes.id) {
@@ -171,38 +174,35 @@ class SsoStrategy {
171
174
  }
172
175
 
173
176
  params.id = this.attributes.id
174
- if (params['id'] && !isInt(params['id'])) {
175
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
177
+ if (params.id && !isInt(params.id)) {
178
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
176
179
  }
177
180
 
178
- if (!params['id']) {
181
+ if (!params.id) {
179
182
  if (this.attributes.id) {
180
- params['id'] = this.id
183
+ params.id = this.id
181
184
  } else {
182
185
  throw new errors.MissingParameterError('Parameter missing: id')
183
186
  }
184
187
  }
185
188
 
186
- const response = await Api.sendRequest(`/sso_strategies/${encodeURIComponent(params['id'])}/sync`, 'POST', params, this.options)
187
-
188
- return
189
+ await Api.sendRequest(`/sso_strategies/${encodeURIComponent(params.id)}/sync`, 'POST', params, this.options)
189
190
  }
190
191
 
191
192
  // Parameters:
192
193
  // 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.
193
194
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
194
195
  static list = async (params = {}, options = {}) => {
195
- if (params['cursor'] && !isString(params['cursor'])) {
196
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
196
+ if (params.cursor && !isString(params.cursor)) {
197
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
197
198
  }
198
199
 
199
- if (params['per_page'] && !isInt(params['per_page'])) {
200
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
200
+ if (params.per_page && !isInt(params.per_page)) {
201
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
201
202
  }
202
203
 
203
- const response = await Api.sendRequest(`/sso_strategies`, 'GET', params, options)
204
+ const response = await Api.sendRequest('/sso_strategies', 'GET', params, options)
204
205
 
205
-
206
206
  return response?.data?.map(obj => new SsoStrategy(obj, options)) || []
207
207
  }
208
208
 
@@ -216,19 +216,18 @@ class SsoStrategy {
216
216
  throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
217
217
  }
218
218
 
219
- params['id'] = id
219
+ params.id = id
220
220
 
221
- if (!params['id']) {
221
+ if (!params.id) {
222
222
  throw new errors.MissingParameterError('Parameter missing: id')
223
223
  }
224
224
 
225
- if (params['id'] && !isInt(params['id'])) {
226
- throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params['id'])}`)
225
+ if (params.id && !isInt(params.id)) {
226
+ throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(params.id)}`)
227
227
  }
228
228
 
229
- const response = await Api.sendRequest(`/sso_strategies/${encodeURIComponent(params['id'])}`, 'GET', params, options)
229
+ const response = await Api.sendRequest(`/sso_strategies/${encodeURIComponent(params.id)}`, 'GET', params, options)
230
230
 
231
-
232
231
  return new SsoStrategy(response?.data, options)
233
232
  }
234
233
 
@@ -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 Status {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class Status {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // int64 # Status HTTP code
28
32
  getCode = () => this.attributes.code
29
33
 
@@ -44,7 +48,6 @@ class Status {
44
48
 
45
49
  // string # Required Clickwrap body
46
50
  getClickwrapBody = () => this.attributes.clickwrap_body
47
-
48
51
  }
49
52
 
50
53
  export default Status
@@ -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 Style {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class Style {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.path
30
+
27
31
  // int64 # Style ID
28
32
  getId = () => this.attributes.id
29
33
 
@@ -59,7 +63,6 @@ class Style {
59
63
  this.attributes.file = value
60
64
  }
61
65
 
62
-
63
66
  // Parameters:
64
67
  // file (required) - file - Logo for custom branding.
65
68
  update = async (params = {}) => {
@@ -72,29 +75,28 @@ class Style {
72
75
  }
73
76
 
74
77
  params.path = this.attributes.path
75
- if (params['path'] && !isString(params['path'])) {
76
- throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
78
+ if (params.path && !isString(params.path)) {
79
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
77
80
  }
78
81
 
79
- if (!params['path']) {
82
+ if (!params.path) {
80
83
  if (this.attributes.path) {
81
- params['path'] = this.path
84
+ params.path = this.path
82
85
  } else {
83
86
  throw new errors.MissingParameterError('Parameter missing: path')
84
87
  }
85
88
  }
86
89
 
87
- if (!params['file']) {
90
+ if (!params.file) {
88
91
  if (this.attributes.file) {
89
- params['file'] = this.file
92
+ params.file = this.file
90
93
  } else {
91
94
  throw new errors.MissingParameterError('Parameter missing: file')
92
95
  }
93
96
  }
94
97
 
95
- const response = await Api.sendRequest(`/styles/${encodeURIComponent(params['path'])}`, 'PATCH', params, this.options)
98
+ const response = await Api.sendRequest(`/styles/${encodeURIComponent(params.path)}`, 'PATCH', params, this.options)
96
99
 
97
-
98
100
  return new Style(response?.data, this.options)
99
101
  }
100
102
 
@@ -108,21 +110,19 @@ class Style {
108
110
  }
109
111
 
110
112
  params.path = this.attributes.path
111
- if (params['path'] && !isString(params['path'])) {
112
- throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
113
+ if (params.path && !isString(params.path)) {
114
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
113
115
  }
114
116
 
115
- if (!params['path']) {
117
+ if (!params.path) {
116
118
  if (this.attributes.path) {
117
- params['path'] = this.path
119
+ params.path = this.path
118
120
  } else {
119
121
  throw new errors.MissingParameterError('Parameter missing: path')
120
122
  }
121
123
  }
122
124
 
123
- const response = await Api.sendRequest(`/styles/${encodeURIComponent(params['path'])}`, 'DELETE', params, this.options)
124
-
125
- return
125
+ await Api.sendRequest(`/styles/${encodeURIComponent(params.path)}`, 'DELETE', params, this.options)
126
126
  }
127
127
 
128
128
  destroy = (params = {}) =>
@@ -141,19 +141,18 @@ class Style {
141
141
  throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
142
142
  }
143
143
 
144
- params['path'] = path
144
+ params.path = path
145
145
 
146
- if (!params['path']) {
146
+ if (!params.path) {
147
147
  throw new errors.MissingParameterError('Parameter missing: path')
148
148
  }
149
149
 
150
- if (params['path'] && !isString(params['path'])) {
151
- throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params['path'])}`)
150
+ if (params.path && !isString(params.path)) {
151
+ throw new errors.InvalidParameterError(`Bad parameter: path must be of type String, received ${getType(params.path)}`)
152
152
  }
153
153
 
154
- const response = await Api.sendRequest(`/styles/${encodeURIComponent(params['path'])}`, 'GET', params, options)
154
+ const response = await Api.sendRequest(`/styles/${encodeURIComponent(params.path)}`, 'GET', params, options)
155
155
 
156
-
157
156
  return new Style(response?.data, options)
158
157
  }
159
158
 
@@ -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 UsageDailySnapshot {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class UsageDailySnapshot {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // int64 # ID of the usage record
28
32
  getId = () => this.attributes.id
29
33
 
@@ -57,7 +61,6 @@ class UsageDailySnapshot {
57
61
  // object # Usage broken down by each top-level folder
58
62
  getUsageByTopLevelDir = () => this.attributes.usage_by_top_level_dir
59
63
 
60
-
61
64
  // Parameters:
62
65
  // 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.
63
66
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
@@ -68,17 +71,16 @@ class UsageDailySnapshot {
68
71
  // filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `date`.
69
72
  // filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `date`.
70
73
  static list = async (params = {}, options = {}) => {
71
- if (params['cursor'] && !isString(params['cursor'])) {
72
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
74
+ if (params.cursor && !isString(params.cursor)) {
75
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
73
76
  }
74
77
 
75
- if (params['per_page'] && !isInt(params['per_page'])) {
76
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
78
+ if (params.per_page && !isInt(params.per_page)) {
79
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
77
80
  }
78
81
 
79
- const response = await Api.sendRequest(`/usage_daily_snapshots`, 'GET', params, options)
82
+ const response = await Api.sendRequest('/usage_daily_snapshots', 'GET', params, options)
80
83
 
81
-
82
84
  return response?.data?.map(obj => new UsageDailySnapshot(obj, options)) || []
83
85
  }
84
86
 
@@ -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 UsageSnapshot {
11
13
  attributes = {}
14
+
12
15
  options = {}
13
16
 
14
17
  constructor(attributes = {}, options = {}) {
@@ -24,6 +27,7 @@ class UsageSnapshot {
24
27
  }
25
28
 
26
29
  isLoaded = () => !!this.attributes.id
30
+
27
31
  // int64 # Usage snapshot ID
28
32
  getId = () => this.attributes.id
29
33
 
@@ -69,22 +73,20 @@ class UsageSnapshot {
69
73
  // double # Transfer Usage for period - Outbound GB from Remote Servers (Sync/Mount)
70
74
  getSyncBytesSent = () => this.attributes.sync_bytes_sent
71
75
 
72
-
73
76
  // Parameters:
74
77
  // 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.
75
78
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
76
79
  static list = async (params = {}, options = {}) => {
77
- if (params['cursor'] && !isString(params['cursor'])) {
78
- throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params['cursor'])}`)
80
+ if (params.cursor && !isString(params.cursor)) {
81
+ throw new errors.InvalidParameterError(`Bad parameter: cursor must be of type String, received ${getType(params.cursor)}`)
79
82
  }
80
83
 
81
- if (params['per_page'] && !isInt(params['per_page'])) {
82
- throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params['per_page'])}`)
84
+ if (params.per_page && !isInt(params.per_page)) {
85
+ throw new errors.InvalidParameterError(`Bad parameter: per_page must be of type Int, received ${getType(params.per_page)}`)
83
86
  }
84
87
 
85
- const response = await Api.sendRequest(`/usage_snapshots`, 'GET', params, options)
88
+ const response = await Api.sendRequest('/usage_snapshots', 'GET', params, options)
86
89
 
87
-
88
90
  return response?.data?.map(obj => new UsageSnapshot(obj, options)) || []
89
91
  }
90
92