files.com 1.0.166 → 1.0.169

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/README.md +9 -5
  2. package/_VERSION +1 -1
  3. package/lib/models/ActionWebhookFailure.js +8 -2
  4. package/lib/models/ApiKey.js +16 -4
  5. package/lib/models/As2Partner.js +48 -14
  6. package/lib/models/As2Station.js +52 -12
  7. package/lib/models/Automation.js +16 -4
  8. package/lib/models/Behavior.js +16 -4
  9. package/lib/models/Bundle.js +24 -6
  10. package/lib/models/Clickwrap.js +16 -4
  11. package/lib/models/File.js +309 -311
  12. package/lib/models/FileComment.js +16 -4
  13. package/lib/models/FileCommentReaction.js +8 -2
  14. package/lib/models/FormFieldSet.js +16 -4
  15. package/lib/models/Group.js +16 -4
  16. package/lib/models/GroupUser.js +16 -4
  17. package/lib/models/Lock.js +8 -2
  18. package/lib/models/Message.js +16 -4
  19. package/lib/models/MessageComment.js +16 -4
  20. package/lib/models/MessageCommentReaction.js +8 -2
  21. package/lib/models/MessageReaction.js +8 -2
  22. package/lib/models/Notification.js +16 -4
  23. package/lib/models/Permission.js +8 -2
  24. package/lib/models/Project.js +16 -4
  25. package/lib/models/PublicKey.js +16 -4
  26. package/lib/models/RemoteServer.js +16 -4
  27. package/lib/models/Request.js +8 -2
  28. package/lib/models/SsoStrategy.js +8 -2
  29. package/lib/models/Style.js +16 -4
  30. package/lib/models/User.js +40 -10
  31. package/lib/models/UserRequest.js +8 -2
  32. package/package.json +1 -1
  33. package/src/models/ActionWebhookFailure.js +3 -1
  34. package/src/models/ApiKey.js +6 -2
  35. package/src/models/As2OutgoingMessage.js +1 -1
  36. package/src/models/As2Partner.js +22 -2
  37. package/src/models/As2Station.js +29 -2
  38. package/src/models/Automation.js +6 -2
  39. package/src/models/Behavior.js +6 -2
  40. package/src/models/Bundle.js +9 -3
  41. package/src/models/Clickwrap.js +6 -2
  42. package/src/models/File.js +26 -19
  43. package/src/models/FileComment.js +6 -2
  44. package/src/models/FileCommentReaction.js +3 -1
  45. package/src/models/FormFieldSet.js +6 -2
  46. package/src/models/Group.js +6 -2
  47. package/src/models/GroupUser.js +6 -2
  48. package/src/models/Lock.js +3 -1
  49. package/src/models/Message.js +6 -2
  50. package/src/models/MessageComment.js +6 -2
  51. package/src/models/MessageCommentReaction.js +3 -1
  52. package/src/models/MessageReaction.js +3 -1
  53. package/src/models/Notification.js +6 -2
  54. package/src/models/Permission.js +3 -1
  55. package/src/models/Project.js +6 -2
  56. package/src/models/PublicKey.js +6 -2
  57. package/src/models/RemoteServer.js +6 -2
  58. package/src/models/Request.js +3 -1
  59. package/src/models/SsoStrategy.js +3 -1
  60. package/src/models/Style.js +6 -2
  61. package/src/models/User.js +15 -5
  62. package/src/models/UserRequest.js +3 -1
  63. package/test/src/index.js +7 -3
@@ -172,6 +172,7 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
172
172
  });
173
173
  (0, _defineProperty2.default)(this, "sync", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
174
174
  var params,
175
+ response,
175
176
  _args = arguments;
176
177
  return _regenerator.default.wrap(function _callee$(_context) {
177
178
  while (1) {
@@ -223,9 +224,14 @@ var SsoStrategy = /*#__PURE__*/(0, _createClass2.default)(function SsoStrategy()
223
224
  throw new Error('Parameter missing: id');
224
225
 
225
226
  case 14:
226
- return _context.abrupt("return", _Api.default.sendRequest("/sso_strategies/".concat(params['id'], "/sync"), 'POST', params, _this.options));
227
+ _context.next = 16;
228
+ return _Api.default.sendRequest("/sso_strategies/".concat(params['id'], "/sync"), 'POST', params, _this.options);
229
+
230
+ case 16:
231
+ response = _context.sent;
232
+ return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
227
233
 
228
- case 15:
234
+ case 18:
229
235
  case "end":
230
236
  return _context.stop();
231
237
  }
@@ -73,6 +73,7 @@ var Style = /*#__PURE__*/(0, _createClass2.default)(function Style() {
73
73
  });
74
74
  (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
75
75
  var params,
76
+ response,
76
77
  _args = arguments;
77
78
  return _regenerator.default.wrap(function _callee$(_context) {
78
79
  while (1) {
@@ -142,9 +143,14 @@ var Style = /*#__PURE__*/(0, _createClass2.default)(function Style() {
142
143
  throw new Error('Parameter missing: file');
143
144
 
144
145
  case 20:
145
- return _context.abrupt("return", _Api.default.sendRequest("/styles/".concat(params['path']), 'PATCH', params, _this.options));
146
+ _context.next = 22;
147
+ return _Api.default.sendRequest("/styles/".concat(params['path']), 'PATCH', params, _this.options);
148
+
149
+ case 22:
150
+ response = _context.sent;
151
+ return _context.abrupt("return", new Style(response === null || response === void 0 ? void 0 : response.data, _this.options));
146
152
 
147
- case 21:
153
+ case 24:
148
154
  case "end":
149
155
  return _context.stop();
150
156
  }
@@ -153,6 +159,7 @@ var Style = /*#__PURE__*/(0, _createClass2.default)(function Style() {
153
159
  })));
154
160
  (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
155
161
  var params,
162
+ response,
156
163
  _args2 = arguments;
157
164
  return _regenerator.default.wrap(function _callee2$(_context2) {
158
165
  while (1) {
@@ -204,9 +211,14 @@ var Style = /*#__PURE__*/(0, _createClass2.default)(function Style() {
204
211
  throw new Error('Parameter missing: path');
205
212
 
206
213
  case 14:
207
- return _context2.abrupt("return", _Api.default.sendRequest("/styles/".concat(params['path']), 'DELETE', params, _this.options));
214
+ _context2.next = 16;
215
+ return _Api.default.sendRequest("/styles/".concat(params['path']), 'DELETE', params, _this.options);
216
+
217
+ case 16:
218
+ response = _context2.sent;
219
+ return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
208
220
 
209
- case 15:
221
+ case 18:
210
222
  case "end":
211
223
  return _context2.stop();
212
224
  }
@@ -388,6 +388,7 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
388
388
  });
389
389
  (0, _defineProperty2.default)(this, "unlock", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
390
390
  var params,
391
+ response,
391
392
  _args = arguments;
392
393
  return _regenerator.default.wrap(function _callee$(_context) {
393
394
  while (1) {
@@ -439,9 +440,14 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
439
440
  throw new Error('Parameter missing: id');
440
441
 
441
442
  case 14:
442
- return _context.abrupt("return", _Api.default.sendRequest("/users/".concat(params['id'], "/unlock"), 'POST', params, _this.options));
443
+ _context.next = 16;
444
+ return _Api.default.sendRequest("/users/".concat(params['id'], "/unlock"), 'POST', params, _this.options);
445
+
446
+ case 16:
447
+ response = _context.sent;
448
+ return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
443
449
 
444
- case 15:
450
+ case 18:
445
451
  case "end":
446
452
  return _context.stop();
447
453
  }
@@ -450,6 +456,7 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
450
456
  })));
451
457
  (0, _defineProperty2.default)(this, "resendWelcomeEmail", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
452
458
  var params,
459
+ response,
453
460
  _args2 = arguments;
454
461
  return _regenerator.default.wrap(function _callee2$(_context2) {
455
462
  while (1) {
@@ -501,9 +508,14 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
501
508
  throw new Error('Parameter missing: id');
502
509
 
503
510
  case 14:
504
- return _context2.abrupt("return", _Api.default.sendRequest("/users/".concat(params['id'], "/resend_welcome_email"), 'POST', params, _this.options));
511
+ _context2.next = 16;
512
+ return _Api.default.sendRequest("/users/".concat(params['id'], "/resend_welcome_email"), 'POST', params, _this.options);
505
513
 
506
- case 15:
514
+ case 16:
515
+ response = _context2.sent;
516
+ return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
517
+
518
+ case 18:
507
519
  case "end":
508
520
  return _context2.stop();
509
521
  }
@@ -512,6 +524,7 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
512
524
  })));
513
525
  (0, _defineProperty2.default)(this, "user2faReset", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
514
526
  var params,
527
+ response,
515
528
  _args3 = arguments;
516
529
  return _regenerator.default.wrap(function _callee3$(_context3) {
517
530
  while (1) {
@@ -563,9 +576,14 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
563
576
  throw new Error('Parameter missing: id');
564
577
 
565
578
  case 14:
566
- return _context3.abrupt("return", _Api.default.sendRequest("/users/".concat(params['id'], "/2fa/reset"), 'POST', params, _this.options));
579
+ _context3.next = 16;
580
+ return _Api.default.sendRequest("/users/".concat(params['id'], "/2fa/reset"), 'POST', params, _this.options);
567
581
 
568
- case 15:
582
+ case 16:
583
+ response = _context3.sent;
584
+ return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
585
+
586
+ case 18:
569
587
  case "end":
570
588
  return _context3.stop();
571
589
  }
@@ -574,6 +592,7 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
574
592
  })));
575
593
  (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
576
594
  var params,
595
+ response,
577
596
  _args4 = arguments;
578
597
  return _regenerator.default.wrap(function _callee4$(_context4) {
579
598
  while (1) {
@@ -825,9 +844,14 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
825
844
  throw new Error('Parameter missing: id');
826
845
 
827
846
  case 64:
828
- return _context4.abrupt("return", _Api.default.sendRequest("/users/".concat(params['id']), 'PATCH', params, _this.options));
847
+ _context4.next = 66;
848
+ return _Api.default.sendRequest("/users/".concat(params['id']), 'PATCH', params, _this.options);
849
+
850
+ case 66:
851
+ response = _context4.sent;
852
+ return _context4.abrupt("return", new User(response === null || response === void 0 ? void 0 : response.data, _this.options));
829
853
 
830
- case 65:
854
+ case 68:
831
855
  case "end":
832
856
  return _context4.stop();
833
857
  }
@@ -836,6 +860,7 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
836
860
  })));
837
861
  (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
838
862
  var params,
863
+ response,
839
864
  _args5 = arguments;
840
865
  return _regenerator.default.wrap(function _callee5$(_context5) {
841
866
  while (1) {
@@ -887,9 +912,14 @@ var User = /*#__PURE__*/(0, _createClass2.default)(function User() {
887
912
  throw new Error('Parameter missing: id');
888
913
 
889
914
  case 14:
890
- return _context5.abrupt("return", _Api.default.sendRequest("/users/".concat(params['id']), 'DELETE', params, _this.options));
915
+ _context5.next = 16;
916
+ return _Api.default.sendRequest("/users/".concat(params['id']), 'DELETE', params, _this.options);
917
+
918
+ case 16:
919
+ response = _context5.sent;
920
+ return _context5.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
891
921
 
892
- case 15:
922
+ case 18:
893
923
  case "end":
894
924
  return _context5.stop();
895
925
  }
@@ -67,6 +67,7 @@ var UserRequest = /*#__PURE__*/(0, _createClass2.default)(function UserRequest()
67
67
  });
68
68
  (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
69
69
  var params,
70
+ response,
70
71
  _args = arguments;
71
72
  return _regenerator.default.wrap(function _callee$(_context) {
72
73
  while (1) {
@@ -118,9 +119,14 @@ var UserRequest = /*#__PURE__*/(0, _createClass2.default)(function UserRequest()
118
119
  throw new Error('Parameter missing: id');
119
120
 
120
121
  case 14:
121
- return _context.abrupt("return", _Api.default.sendRequest("/user_requests/".concat(params['id']), 'DELETE', params, _this.options));
122
+ _context.next = 16;
123
+ return _Api.default.sendRequest("/user_requests/".concat(params['id']), 'DELETE', params, _this.options);
124
+
125
+ case 16:
126
+ response = _context.sent;
127
+ return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
122
128
 
123
- case 15:
129
+ case 18:
124
130
  case "end":
125
131
  return _context.stop();
126
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.166",
3
+ "version": "1.0.169",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
@@ -46,7 +46,9 @@ class ActionWebhookFailure {
46
46
  }
47
47
  }
48
48
 
49
- return Api.sendRequest(`/action_webhook_failures/${params['id']}/retry`, 'POST', params, this.options)
49
+ const response = await Api.sendRequest(`/action_webhook_failures/${params['id']}/retry`, 'POST', params, this.options)
50
+
51
+ return response?.data
50
52
  }
51
53
  }
52
54
 
@@ -131,7 +131,9 @@ class ApiKey {
131
131
  }
132
132
  }
133
133
 
134
- return Api.sendRequest(`/api_keys/${params['id']}`, 'PATCH', params, this.options)
134
+ const response = await Api.sendRequest(`/api_keys/${params['id']}`, 'PATCH', params, this.options)
135
+
136
+ return new ApiKey(response?.data, this.options)
135
137
  }
136
138
 
137
139
  delete = async (params = {}) => {
@@ -156,7 +158,9 @@ class ApiKey {
156
158
  }
157
159
  }
158
160
 
159
- return Api.sendRequest(`/api_keys/${params['id']}`, 'DELETE', params, this.options)
161
+ const response = await Api.sendRequest(`/api_keys/${params['id']}`, 'DELETE', params, this.options)
162
+
163
+ return response?.data
160
164
  }
161
165
 
162
166
  destroy = (params = {}) =>
@@ -37,7 +37,7 @@ class As2OutgoingMessage {
37
37
  // string # JSON Structure of the activity log.
38
38
  getActivityLog = () => this.attributes.activity_log
39
39
 
40
- // string # Result of processing. Valid values: `send_failed`, `send_success`
40
+ // string # Result of processing. Valid values: `send_failed`, `send_success`, `send_no_mdn`
41
41
  getProcessingResult = () => this.attributes.processing_result
42
42
 
43
43
  // string # AS2 Message Integrity Check
@@ -50,6 +50,13 @@ class As2Partner {
50
50
  this.attributes.uri = value
51
51
  }
52
52
 
53
+ // string # Remote server certificate security setting
54
+ getServerCertificate = () => this.attributes.server_certificate
55
+
56
+ setServerCertificate = value => {
57
+ this.attributes.server_certificate = value
58
+ }
59
+
53
60
  // string # MD5 hash of public certificate used for message security.
54
61
  getPublicCertificateMd5 = () => this.attributes.public_certificate_md5
55
62
 
@@ -103,6 +110,7 @@ class As2Partner {
103
110
  // Parameters:
104
111
  // name - string - AS2 Name
105
112
  // uri - string - URL base for AS2 responses
113
+ // server_certificate - string - Remote server certificate security setting
106
114
  // public_certificate - string
107
115
  update = async (params = {}) => {
108
116
  if (!this.attributes.id) {
@@ -123,6 +131,9 @@ class As2Partner {
123
131
  if (params['uri'] && !isString(params['uri'])) {
124
132
  throw new Error(`Bad parameter: uri must be of type String, received ${getType(uri)}`)
125
133
  }
134
+ if (params['server_certificate'] && !isString(params['server_certificate'])) {
135
+ throw new Error(`Bad parameter: server_certificate must be of type String, received ${getType(server_certificate)}`)
136
+ }
126
137
  if (params['public_certificate'] && !isString(params['public_certificate'])) {
127
138
  throw new Error(`Bad parameter: public_certificate must be of type String, received ${getType(public_certificate)}`)
128
139
  }
@@ -135,7 +146,9 @@ class As2Partner {
135
146
  }
136
147
  }
137
148
 
138
- return Api.sendRequest(`/as2_partners/${params['id']}`, 'PATCH', params, this.options)
149
+ const response = await Api.sendRequest(`/as2_partners/${params['id']}`, 'PATCH', params, this.options)
150
+
151
+ return new As2Partner(response?.data, this.options)
139
152
  }
140
153
 
141
154
  delete = async (params = {}) => {
@@ -160,7 +173,9 @@ class As2Partner {
160
173
  }
161
174
  }
162
175
 
163
- return Api.sendRequest(`/as2_partners/${params['id']}`, 'DELETE', params, this.options)
176
+ const response = await Api.sendRequest(`/as2_partners/${params['id']}`, 'DELETE', params, this.options)
177
+
178
+ return response?.data
164
179
  }
165
180
 
166
181
  destroy = (params = {}) =>
@@ -226,6 +241,7 @@ class As2Partner {
226
241
  // uri (required) - string - URL base for AS2 responses
227
242
  // public_certificate (required) - string
228
243
  // as2_station_id (required) - int64 - Id of As2Station for this partner
244
+ // server_certificate - string - Remote server certificate security setting
229
245
  static create = async (params = {}, options = {}) => {
230
246
  if (!params['name']) {
231
247
  throw new Error('Parameter missing: name')
@@ -259,6 +275,10 @@ class As2Partner {
259
275
  throw new Error(`Bad parameter: as2_station_id must be of type Int, received ${getType(as2_station_id)}`)
260
276
  }
261
277
 
278
+ if (params['server_certificate'] && !isString(params['server_certificate'])) {
279
+ throw new Error(`Bad parameter: server_certificate must be of type String, received ${getType(server_certificate)}`)
280
+ }
281
+
262
282
  const response = await Api.sendRequest(`/as2_partners`, 'POST', params, options)
263
283
 
264
284
  return new As2Partner(response?.data, options)
@@ -99,6 +99,13 @@ class As2Station {
99
99
  this.attributes.public_certificate_not_after = value
100
100
  }
101
101
 
102
+ // string # MD5 hash of private key password used for message security.
103
+ getPrivateKeyPasswordMd5 = () => this.attributes.private_key_password_md5
104
+
105
+ setPrivateKeyPasswordMd5 = value => {
106
+ this.attributes.private_key_password_md5 = value
107
+ }
108
+
102
109
  // string
103
110
  getPublicCertificate = () => this.attributes.public_certificate
104
111
 
@@ -113,11 +120,19 @@ class As2Station {
113
120
  this.attributes.private_key = value
114
121
  }
115
122
 
123
+ // string
124
+ getPrivateKeyPassword = () => this.attributes.private_key_password
125
+
126
+ setPrivateKeyPassword = value => {
127
+ this.attributes.private_key_password = value
128
+ }
129
+
116
130
 
117
131
  // Parameters:
118
132
  // name - string - AS2 Name
119
133
  // public_certificate - string
120
134
  // private_key - string
135
+ // private_key_password - string
121
136
  update = async (params = {}) => {
122
137
  if (!this.attributes.id) {
123
138
  throw new Error('Current object has no id')
@@ -140,6 +155,9 @@ class As2Station {
140
155
  if (params['private_key'] && !isString(params['private_key'])) {
141
156
  throw new Error(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
142
157
  }
158
+ if (params['private_key_password'] && !isString(params['private_key_password'])) {
159
+ throw new Error(`Bad parameter: private_key_password must be of type String, received ${getType(private_key_password)}`)
160
+ }
143
161
 
144
162
  if (!params['id']) {
145
163
  if (this.attributes.id) {
@@ -149,7 +167,9 @@ class As2Station {
149
167
  }
150
168
  }
151
169
 
152
- return Api.sendRequest(`/as2_stations/${params['id']}`, 'PATCH', params, this.options)
170
+ const response = await Api.sendRequest(`/as2_stations/${params['id']}`, 'PATCH', params, this.options)
171
+
172
+ return new As2Station(response?.data, this.options)
153
173
  }
154
174
 
155
175
  delete = async (params = {}) => {
@@ -174,7 +194,9 @@ class As2Station {
174
194
  }
175
195
  }
176
196
 
177
- return Api.sendRequest(`/as2_stations/${params['id']}`, 'DELETE', params, this.options)
197
+ const response = await Api.sendRequest(`/as2_stations/${params['id']}`, 'DELETE', params, this.options)
198
+
199
+ return response?.data
178
200
  }
179
201
 
180
202
  destroy = (params = {}) =>
@@ -239,6 +261,7 @@ class As2Station {
239
261
  // name (required) - string - AS2 Name
240
262
  // public_certificate (required) - string
241
263
  // private_key (required) - string
264
+ // private_key_password - string
242
265
  static create = async (params = {}, options = {}) => {
243
266
  if (!params['name']) {
244
267
  throw new Error('Parameter missing: name')
@@ -264,6 +287,10 @@ class As2Station {
264
287
  throw new Error(`Bad parameter: private_key must be of type String, received ${getType(private_key)}`)
265
288
  }
266
289
 
290
+ if (params['private_key_password'] && !isString(params['private_key_password'])) {
291
+ throw new Error(`Bad parameter: private_key_password must be of type String, received ${getType(private_key_password)}`)
292
+ }
293
+
267
294
  const response = await Api.sendRequest(`/as2_stations`, 'POST', params, options)
268
295
 
269
296
  return new As2Station(response?.data, options)
@@ -245,7 +245,9 @@ class Automation {
245
245
  }
246
246
  }
247
247
 
248
- return Api.sendRequest(`/automations/${params['id']}`, 'PATCH', params, this.options)
248
+ const response = await Api.sendRequest(`/automations/${params['id']}`, 'PATCH', params, this.options)
249
+
250
+ return new Automation(response?.data, this.options)
249
251
  }
250
252
 
251
253
  delete = async (params = {}) => {
@@ -270,7 +272,9 @@ class Automation {
270
272
  }
271
273
  }
272
274
 
273
- return Api.sendRequest(`/automations/${params['id']}`, 'DELETE', params, this.options)
275
+ const response = await Api.sendRequest(`/automations/${params['id']}`, 'DELETE', params, this.options)
276
+
277
+ return response?.data
274
278
  }
275
279
 
276
280
  destroy = (params = {}) =>
@@ -131,7 +131,9 @@ class Behavior {
131
131
  }
132
132
  }
133
133
 
134
- return Api.sendRequest(`/behaviors/${params['id']}`, 'PATCH', params, this.options)
134
+ const response = await Api.sendRequest(`/behaviors/${params['id']}`, 'PATCH', params, this.options)
135
+
136
+ return new Behavior(response?.data, this.options)
135
137
  }
136
138
 
137
139
  delete = async (params = {}) => {
@@ -156,7 +158,9 @@ class Behavior {
156
158
  }
157
159
  }
158
160
 
159
- return Api.sendRequest(`/behaviors/${params['id']}`, 'DELETE', params, this.options)
161
+ const response = await Api.sendRequest(`/behaviors/${params['id']}`, 'DELETE', params, this.options)
162
+
163
+ return response?.data
160
164
  }
161
165
 
162
166
  destroy = (params = {}) =>
@@ -238,7 +238,9 @@ class Bundle {
238
238
  }
239
239
  }
240
240
 
241
- return Api.sendRequest(`/bundles/${params['id']}/share`, 'POST', params, this.options)
241
+ const response = await Api.sendRequest(`/bundles/${params['id']}/share`, 'POST', params, this.options)
242
+
243
+ return response?.data
242
244
  }
243
245
 
244
246
  // Parameters:
@@ -309,7 +311,9 @@ class Bundle {
309
311
  }
310
312
  }
311
313
 
312
- return Api.sendRequest(`/bundles/${params['id']}`, 'PATCH', params, this.options)
314
+ const response = await Api.sendRequest(`/bundles/${params['id']}`, 'PATCH', params, this.options)
315
+
316
+ return new Bundle(response?.data, this.options)
313
317
  }
314
318
 
315
319
  delete = async (params = {}) => {
@@ -334,7 +338,9 @@ class Bundle {
334
338
  }
335
339
  }
336
340
 
337
- return Api.sendRequest(`/bundles/${params['id']}`, 'DELETE', params, this.options)
341
+ const response = await Api.sendRequest(`/bundles/${params['id']}`, 'DELETE', params, this.options)
342
+
343
+ return response?.data
338
344
  }
339
345
 
340
346
  destroy = (params = {}) =>
@@ -108,7 +108,9 @@ class Clickwrap {
108
108
  }
109
109
  }
110
110
 
111
- return Api.sendRequest(`/clickwraps/${params['id']}`, 'PATCH', params, this.options)
111
+ const response = await Api.sendRequest(`/clickwraps/${params['id']}`, 'PATCH', params, this.options)
112
+
113
+ return new Clickwrap(response?.data, this.options)
112
114
  }
113
115
 
114
116
  delete = async (params = {}) => {
@@ -133,7 +135,9 @@ class Clickwrap {
133
135
  }
134
136
  }
135
137
 
136
- return Api.sendRequest(`/clickwraps/${params['id']}`, 'DELETE', params, this.options)
138
+ const response = await Api.sendRequest(`/clickwraps/${params['id']}`, 'DELETE', params, this.options)
139
+
140
+ return response?.data
137
141
  }
138
142
 
139
143
  destroy = (params = {}) =>
@@ -157,12 +157,14 @@ class File {
157
157
  throw new Error('Stream downloads are only available in a NodeJS environment')
158
158
  }
159
159
 
160
- if (!this.download_uri) {
160
+ const downloadUri = this.getDownloadUri()
161
+
162
+ if (!downloadUri) {
161
163
  throw new Error('Current object has no download URI')
162
164
  }
163
165
 
164
166
  const { saveUrlToStream } = require('../isomorphic/File.node.js')
165
- return saveUrlToStream(this.download_uri, writableStream)
167
+ return saveUrlToStream(downloadUri, writableStream)
166
168
  }
167
169
 
168
170
  downloadToFile = async destinationPath => {
@@ -170,21 +172,14 @@ class File {
170
172
  throw new Error('Disk file downloads are only available in a NodeJS environment')
171
173
  }
172
174
 
173
- if (!this.download_uri) {
175
+ const downloadUri = this.getDownloadUri()
176
+
177
+ if (!downloadUri) {
174
178
  throw new Error('Current object has no download URI')
175
179
  }
176
180
 
177
181
  const { saveUrlToFile } = require('../isomorphic/File.node.js')
178
- return saveUrlToFile(this.download_uri, destinationPath)
179
- }
180
-
181
- static findDownload = async path => {
182
- const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'GET')
183
- return new File(response.data)
184
- }
185
-
186
- get = async path => {
187
- return File.find(path)
182
+ return saveUrlToFile(downloadUri, destinationPath)
188
183
  }
189
184
 
190
185
  copyTo = async destinationFilePath => {
@@ -408,7 +403,9 @@ class File {
408
403
  }
409
404
  }
410
405
 
411
- return Api.sendRequest(`/files/${params['path']}`, 'GET', params, this.options)
406
+ const response = await Api.sendRequest(`/files/${params['path']}`, 'GET', params, this.options)
407
+
408
+ return new File(response?.data, this.options)
412
409
  }
413
410
 
414
411
  // Parameters:
@@ -442,7 +439,9 @@ class File {
442
439
  }
443
440
  }
444
441
 
445
- return Api.sendRequest(`/files/${params['path']}`, 'PATCH', params, this.options)
442
+ const response = await Api.sendRequest(`/files/${params['path']}`, 'PATCH', params, this.options)
443
+
444
+ return new File(response?.data, this.options)
446
445
  }
447
446
 
448
447
  // Parameters:
@@ -469,7 +468,9 @@ class File {
469
468
  }
470
469
  }
471
470
 
472
- return Api.sendRequest(`/files/${params['path']}`, 'DELETE', params, this.options)
471
+ const response = await Api.sendRequest(`/files/${params['path']}`, 'DELETE', params, this.options)
472
+
473
+ return response?.data
473
474
  }
474
475
 
475
476
  destroy = (params = {}) =>
@@ -513,7 +514,9 @@ class File {
513
514
  }
514
515
  }
515
516
 
516
- return Api.sendRequest(`/file_actions/copy/${params['path']}`, 'POST', params, this.options)
517
+ const response = await Api.sendRequest(`/file_actions/copy/${params['path']}`, 'POST', params, this.options)
518
+
519
+ return new FileAction(response?.data, this.options)
517
520
  }
518
521
 
519
522
  // Move file/folder
@@ -553,7 +556,9 @@ class File {
553
556
  }
554
557
  }
555
558
 
556
- return Api.sendRequest(`/file_actions/move/${params['path']}`, 'POST', params, this.options)
559
+ const response = await Api.sendRequest(`/file_actions/move/${params['path']}`, 'POST', params, this.options)
560
+
561
+ return new FileAction(response?.data, this.options)
557
562
  }
558
563
 
559
564
  // Begin file upload
@@ -603,7 +608,9 @@ class File {
603
608
  }
604
609
  }
605
610
 
606
- return Api.sendRequest(`/file_actions/begin_upload/${params['path']}`, 'POST', params, this.options)
611
+ const response = await Api.sendRequest(`/file_actions/begin_upload/${params['path']}`, 'POST', params, this.options)
612
+
613
+ return response?.data?.map(obj => new FileUploadPart(obj, this.options)) || []
607
614
  }
608
615
 
609
616
  save = () => {
@@ -86,7 +86,9 @@ class FileComment {
86
86
  }
87
87
  }
88
88
 
89
- return Api.sendRequest(`/file_comments/${params['id']}`, 'PATCH', params, this.options)
89
+ const response = await Api.sendRequest(`/file_comments/${params['id']}`, 'PATCH', params, this.options)
90
+
91
+ return new FileComment(response?.data, this.options)
90
92
  }
91
93
 
92
94
  delete = async (params = {}) => {
@@ -111,7 +113,9 @@ class FileComment {
111
113
  }
112
114
  }
113
115
 
114
- return Api.sendRequest(`/file_comments/${params['id']}`, 'DELETE', params, this.options)
116
+ const response = await Api.sendRequest(`/file_comments/${params['id']}`, 'DELETE', params, this.options)
117
+
118
+ return response?.data
115
119
  }
116
120
 
117
121
  destroy = (params = {}) =>