files.com 1.2.42 → 1.2.44

Sign up to get free protection for your applications and to get access to all the features.
package/lib/Files.js CHANGED
@@ -11,7 +11,7 @@ var endpointPrefix = '/api/rest/v1';
11
11
  var apiKey;
12
12
  var baseUrl = 'https://app.files.com';
13
13
  var sessionId = null;
14
- var version = '1.2.42';
14
+ var version = '1.2.44';
15
15
  var userAgent = "Files.com JavaScript SDK v".concat(version);
16
16
  var logLevel = _Logger.LogLevel.INFO;
17
17
  var debugRequest = false;
@@ -296,7 +296,7 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
296
296
  (0, _defineProperty2.default)(this, "setPaths", function (value) {
297
297
  _this.attributes.paths = value;
298
298
  });
299
- // BundlePath # A list of bundlepaths in this bundle. For performance reasons, this is not provided when listing bundles.
299
+ // array # A list of bundlepaths in this bundle. For performance reasons, this is not provided when listing bundles.
300
300
  (0, _defineProperty2.default)(this, "getBundlepaths", function () {
301
301
  return _this.attributes.bundlepaths;
302
302
  });
@@ -82,13 +82,9 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
82
82
  (0, _defineProperty2.default)(this, "setPaths", function (value) {
83
83
  _this.attributes.paths = value;
84
84
  });
85
- // Parameters:
86
- // expires_at - string - When the snapshot expires.
87
- // name - string - A name for the snapshot.
88
- // paths - array(string) - An array of paths to add to the snapshot.
89
- (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
85
+ // Finalize Snapshot
86
+ (0, _defineProperty2.default)(this, "finalize", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
90
87
  var params,
91
- response,
92
88
  _args = arguments;
93
89
  return _regenerator.default.wrap(function _callee$(_context) {
94
90
  while (1) switch (_context.prev = _context.next) {
@@ -112,134 +108,187 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
112
108
  break;
113
109
  }
114
110
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
111
+ case 8:
112
+ if (params.id) {
113
+ _context.next = 14;
114
+ break;
115
+ }
116
+ if (!_this.attributes.id) {
117
+ _context.next = 13;
118
+ break;
119
+ }
120
+ params.id = _this.id;
121
+ _context.next = 14;
122
+ break;
123
+ case 13:
124
+ throw new errors.MissingParameterError('Parameter missing: id');
125
+ case 14:
126
+ _context.next = 16;
127
+ return _Api.default.sendRequest("/snapshots/".concat(encodeURIComponent(params.id), "/finalize"), 'POST', params, _this.options);
128
+ case 16:
129
+ case "end":
130
+ return _context.stop();
131
+ }
132
+ }, _callee);
133
+ })));
134
+ // Parameters:
135
+ // expires_at - string - When the snapshot expires.
136
+ // name - string - A name for the snapshot.
137
+ // paths - array(string) - An array of paths to add to the snapshot.
138
+ (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
139
+ var params,
140
+ response,
141
+ _args2 = arguments;
142
+ return _regenerator.default.wrap(function _callee2$(_context2) {
143
+ while (1) switch (_context2.prev = _context2.next) {
144
+ case 0:
145
+ params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
146
+ if (_this.attributes.id) {
147
+ _context2.next = 3;
148
+ break;
149
+ }
150
+ throw new errors.EmptyPropertyError('Current object has no id');
151
+ case 3:
152
+ if ((0, _utils.isObject)(params)) {
153
+ _context2.next = 5;
154
+ break;
155
+ }
156
+ throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
157
+ case 5:
158
+ params.id = _this.attributes.id;
159
+ if (!(params.id && !(0, _utils.isInt)(params.id))) {
160
+ _context2.next = 8;
161
+ break;
162
+ }
163
+ throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
115
164
  case 8:
116
165
  if (!(params.expires_at && !(0, _utils.isString)(params.expires_at))) {
117
- _context.next = 10;
166
+ _context2.next = 10;
118
167
  break;
119
168
  }
120
169
  throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(params.expires_at)));
121
170
  case 10:
122
171
  if (!(params.name && !(0, _utils.isString)(params.name))) {
123
- _context.next = 12;
172
+ _context2.next = 12;
124
173
  break;
125
174
  }
126
175
  throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
127
176
  case 12:
128
177
  if (!(params.paths && !(0, _utils.isArray)(params.paths))) {
129
- _context.next = 14;
178
+ _context2.next = 14;
130
179
  break;
131
180
  }
132
181
  throw new errors.InvalidParameterError("Bad parameter: paths must be of type Array, received ".concat((0, _utils.getType)(params.paths)));
133
182
  case 14:
134
183
  if (params.id) {
135
- _context.next = 20;
184
+ _context2.next = 20;
136
185
  break;
137
186
  }
138
187
  if (!_this.attributes.id) {
139
- _context.next = 19;
188
+ _context2.next = 19;
140
189
  break;
141
190
  }
142
191
  params.id = _this.id;
143
- _context.next = 20;
192
+ _context2.next = 20;
144
193
  break;
145
194
  case 19:
146
195
  throw new errors.MissingParameterError('Parameter missing: id');
147
196
  case 20:
148
- _context.next = 22;
197
+ _context2.next = 22;
149
198
  return _Api.default.sendRequest("/snapshots/".concat(encodeURIComponent(params.id)), 'PATCH', params, _this.options);
150
199
  case 22:
151
- response = _context.sent;
152
- return _context.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, _this.options));
200
+ response = _context2.sent;
201
+ return _context2.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, _this.options));
153
202
  case 24:
154
203
  case "end":
155
- return _context.stop();
204
+ return _context2.stop();
156
205
  }
157
- }, _callee);
206
+ }, _callee2);
158
207
  })));
159
- (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
208
+ (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
160
209
  var params,
161
- _args2 = arguments;
162
- return _regenerator.default.wrap(function _callee2$(_context2) {
163
- while (1) switch (_context2.prev = _context2.next) {
210
+ _args3 = arguments;
211
+ return _regenerator.default.wrap(function _callee3$(_context3) {
212
+ while (1) switch (_context3.prev = _context3.next) {
164
213
  case 0:
165
- params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
214
+ params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
166
215
  if (_this.attributes.id) {
167
- _context2.next = 3;
216
+ _context3.next = 3;
168
217
  break;
169
218
  }
170
219
  throw new errors.EmptyPropertyError('Current object has no id');
171
220
  case 3:
172
221
  if ((0, _utils.isObject)(params)) {
173
- _context2.next = 5;
222
+ _context3.next = 5;
174
223
  break;
175
224
  }
176
225
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
177
226
  case 5:
178
227
  params.id = _this.attributes.id;
179
228
  if (!(params.id && !(0, _utils.isInt)(params.id))) {
180
- _context2.next = 8;
229
+ _context3.next = 8;
181
230
  break;
182
231
  }
183
232
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
184
233
  case 8:
185
234
  if (params.id) {
186
- _context2.next = 14;
235
+ _context3.next = 14;
187
236
  break;
188
237
  }
189
238
  if (!_this.attributes.id) {
190
- _context2.next = 13;
239
+ _context3.next = 13;
191
240
  break;
192
241
  }
193
242
  params.id = _this.id;
194
- _context2.next = 14;
243
+ _context3.next = 14;
195
244
  break;
196
245
  case 13:
197
246
  throw new errors.MissingParameterError('Parameter missing: id');
198
247
  case 14:
199
- _context2.next = 16;
248
+ _context3.next = 16;
200
249
  return _Api.default.sendRequest("/snapshots/".concat(encodeURIComponent(params.id)), 'DELETE', params, _this.options);
201
250
  case 16:
202
251
  case "end":
203
- return _context2.stop();
252
+ return _context3.stop();
204
253
  }
205
- }, _callee2);
254
+ }, _callee3);
206
255
  })));
207
256
  (0, _defineProperty2.default)(this, "destroy", function () {
208
257
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
209
258
  return _this.delete(params);
210
259
  });
211
- (0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
260
+ (0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
212
261
  var _newObject, newObject;
213
- return _regenerator.default.wrap(function _callee3$(_context3) {
214
- while (1) switch (_context3.prev = _context3.next) {
262
+ return _regenerator.default.wrap(function _callee4$(_context4) {
263
+ while (1) switch (_context4.prev = _context4.next) {
215
264
  case 0:
216
265
  if (!_this.attributes.id) {
217
- _context3.next = 6;
266
+ _context4.next = 6;
218
267
  break;
219
268
  }
220
- _context3.next = 3;
269
+ _context4.next = 3;
221
270
  return _this.update(_this.attributes);
222
271
  case 3:
223
- _newObject = _context3.sent;
272
+ _newObject = _context4.sent;
224
273
  _this.attributes = _objectSpread({}, _newObject.attributes);
225
- return _context3.abrupt("return", true);
274
+ return _context4.abrupt("return", true);
226
275
  case 6:
227
- _context3.next = 8;
276
+ _context4.next = 8;
228
277
  return Snapshot.create(_this.attributes, _this.options);
229
278
  case 8:
230
- newObject = _context3.sent;
279
+ newObject = _context4.sent;
231
280
  _this.attributes = _objectSpread({}, newObject.attributes);
232
- return _context3.abrupt("return", true);
281
+ return _context4.abrupt("return", true);
233
282
  case 11:
234
283
  case "end":
235
- return _context3.stop();
284
+ return _context4.stop();
236
285
  }
237
- }, _callee3);
286
+ }, _callee4);
238
287
  })));
239
- Object.entries(attributes).forEach(function (_ref4) {
240
- var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
241
- key = _ref5[0],
242
- value = _ref5[1];
288
+ Object.entries(attributes).forEach(function (_ref5) {
289
+ var _ref6 = (0, _slicedToArray2.default)(_ref5, 2),
290
+ key = _ref6[0],
291
+ value = _ref6[1];
243
292
  var normalizedKey = key.replace('?', '');
244
293
  _this.attributes[normalizedKey] = value;
245
294
  Object.defineProperty(_this, normalizedKey, {
@@ -253,41 +302,41 @@ _Snapshot = Snapshot;
253
302
  // Parameters:
254
303
  // 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.
255
304
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
256
- (0, _defineProperty2.default)(Snapshot, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
305
+ (0, _defineProperty2.default)(Snapshot, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
257
306
  var _response$data;
258
307
  var params,
259
308
  options,
260
309
  response,
261
- _args4 = arguments;
262
- return _regenerator.default.wrap(function _callee4$(_context4) {
263
- while (1) switch (_context4.prev = _context4.next) {
310
+ _args5 = arguments;
311
+ return _regenerator.default.wrap(function _callee5$(_context5) {
312
+ while (1) switch (_context5.prev = _context5.next) {
264
313
  case 0:
265
- params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
266
- options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
314
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
315
+ options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
267
316
  if (!(params.cursor && !(0, _utils.isString)(params.cursor))) {
268
- _context4.next = 4;
317
+ _context5.next = 4;
269
318
  break;
270
319
  }
271
320
  throw new errors.InvalidParameterError("Bad parameter: cursor must be of type String, received ".concat((0, _utils.getType)(params.cursor)));
272
321
  case 4:
273
322
  if (!(params.per_page && !(0, _utils.isInt)(params.per_page))) {
274
- _context4.next = 6;
323
+ _context5.next = 6;
275
324
  break;
276
325
  }
277
326
  throw new errors.InvalidParameterError("Bad parameter: per_page must be of type Int, received ".concat((0, _utils.getType)(params.per_page)));
278
327
  case 6:
279
- _context4.next = 8;
328
+ _context5.next = 8;
280
329
  return _Api.default.sendRequest('/snapshots', 'GET', params, options);
281
330
  case 8:
282
- response = _context4.sent;
283
- return _context4.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
331
+ response = _context5.sent;
332
+ return _context5.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
284
333
  return new _Snapshot(obj, options);
285
334
  })) || []);
286
335
  case 10:
287
336
  case "end":
288
- return _context4.stop();
337
+ return _context5.stop();
289
338
  }
290
- }, _callee4);
339
+ }, _callee5);
291
340
  })));
292
341
  (0, _defineProperty2.default)(Snapshot, "all", function () {
293
342
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -297,48 +346,48 @@ _Snapshot = Snapshot;
297
346
  // Parameters:
298
347
  // id (required) - int64 - Snapshot ID.
299
348
  (0, _defineProperty2.default)(Snapshot, "find", /*#__PURE__*/function () {
300
- var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id) {
349
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(id) {
301
350
  var params,
302
351
  options,
303
352
  response,
304
- _args5 = arguments;
305
- return _regenerator.default.wrap(function _callee5$(_context5) {
306
- while (1) switch (_context5.prev = _context5.next) {
353
+ _args6 = arguments;
354
+ return _regenerator.default.wrap(function _callee6$(_context6) {
355
+ while (1) switch (_context6.prev = _context6.next) {
307
356
  case 0:
308
- params = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
309
- options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
357
+ params = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
358
+ options = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
310
359
  if ((0, _utils.isObject)(params)) {
311
- _context5.next = 4;
360
+ _context6.next = 4;
312
361
  break;
313
362
  }
314
363
  throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
315
364
  case 4:
316
365
  params.id = id;
317
366
  if (params.id) {
318
- _context5.next = 7;
367
+ _context6.next = 7;
319
368
  break;
320
369
  }
321
370
  throw new errors.MissingParameterError('Parameter missing: id');
322
371
  case 7:
323
372
  if (!(params.id && !(0, _utils.isInt)(params.id))) {
324
- _context5.next = 9;
373
+ _context6.next = 9;
325
374
  break;
326
375
  }
327
376
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(params.id)));
328
377
  case 9:
329
- _context5.next = 11;
378
+ _context6.next = 11;
330
379
  return _Api.default.sendRequest("/snapshots/".concat(encodeURIComponent(params.id)), 'GET', params, options);
331
380
  case 11:
332
- response = _context5.sent;
333
- return _context5.abrupt("return", new _Snapshot(response === null || response === void 0 ? void 0 : response.data, options));
381
+ response = _context6.sent;
382
+ return _context6.abrupt("return", new _Snapshot(response === null || response === void 0 ? void 0 : response.data, options));
334
383
  case 13:
335
384
  case "end":
336
- return _context5.stop();
385
+ return _context6.stop();
337
386
  }
338
- }, _callee5);
387
+ }, _callee6);
339
388
  }));
340
389
  return function (_x) {
341
- return _ref7.apply(this, arguments);
390
+ return _ref8.apply(this, arguments);
342
391
  };
343
392
  }());
344
393
  (0, _defineProperty2.default)(Snapshot, "get", function (id) {
@@ -350,44 +399,44 @@ _Snapshot = Snapshot;
350
399
  // expires_at - string - When the snapshot expires.
351
400
  // name - string - A name for the snapshot.
352
401
  // paths - array(string) - An array of paths to add to the snapshot.
353
- (0, _defineProperty2.default)(Snapshot, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
402
+ (0, _defineProperty2.default)(Snapshot, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
354
403
  var params,
355
404
  options,
356
405
  response,
357
- _args6 = arguments;
358
- return _regenerator.default.wrap(function _callee6$(_context6) {
359
- while (1) switch (_context6.prev = _context6.next) {
406
+ _args7 = arguments;
407
+ return _regenerator.default.wrap(function _callee7$(_context7) {
408
+ while (1) switch (_context7.prev = _context7.next) {
360
409
  case 0:
361
- params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
362
- options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
410
+ params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
411
+ options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
363
412
  if (!(params.expires_at && !(0, _utils.isString)(params.expires_at))) {
364
- _context6.next = 4;
413
+ _context7.next = 4;
365
414
  break;
366
415
  }
367
416
  throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(params.expires_at)));
368
417
  case 4:
369
418
  if (!(params.name && !(0, _utils.isString)(params.name))) {
370
- _context6.next = 6;
419
+ _context7.next = 6;
371
420
  break;
372
421
  }
373
422
  throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params.name)));
374
423
  case 6:
375
424
  if (!(params.paths && !(0, _utils.isArray)(params.paths))) {
376
- _context6.next = 8;
425
+ _context7.next = 8;
377
426
  break;
378
427
  }
379
428
  throw new errors.InvalidParameterError("Bad parameter: paths must be of type Array, received ".concat((0, _utils.getType)(params.paths)));
380
429
  case 8:
381
- _context6.next = 10;
430
+ _context7.next = 10;
382
431
  return _Api.default.sendRequest('/snapshots', 'POST', params, options);
383
432
  case 10:
384
- response = _context6.sent;
385
- return _context6.abrupt("return", new _Snapshot(response === null || response === void 0 ? void 0 : response.data, options));
433
+ response = _context7.sent;
434
+ return _context7.abrupt("return", new _Snapshot(response === null || response === void 0 ? void 0 : response.data, options));
386
435
  case 12:
387
436
  case "end":
388
- return _context6.stop();
437
+ return _context7.stop();
389
438
  }
390
- }, _callee6);
439
+ }, _callee7);
391
440
  })));
392
441
  var _default = exports.default = Snapshot;
393
442
  module.exports = Snapshot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.2.42",
3
+ "version": "1.2.44",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Errors.js CHANGED
@@ -200,6 +200,7 @@ export class NotFound_NestedNotFoundError extends NotFoundError { constructor(me
200
200
  export class NotFound_PlanNotFoundError extends NotFoundError { constructor(message, code, errorData) { super(message, code, errorData); this.name = 'NotFound_PlanNotFoundError' } } errorClasses.NotFound_PlanNotFoundError = NotFound_PlanNotFoundError
201
201
  export class NotFound_SiteNotFoundError extends NotFoundError { constructor(message, code, errorData) { super(message, code, errorData); this.name = 'NotFound_SiteNotFoundError' } } errorClasses.NotFound_SiteNotFoundError = NotFound_SiteNotFoundError
202
202
  export class NotFound_UserNotFoundError extends NotFoundError { constructor(message, code, errorData) { super(message, code, errorData); this.name = 'NotFound_UserNotFoundError' } } errorClasses.NotFound_UserNotFoundError = NotFound_UserNotFoundError
203
+ export class ProcessingFailure_AlreadyCompletedError extends ProcessingFailureError { constructor(message, code, errorData) { super(message, code, errorData); this.name = 'ProcessingFailure_AlreadyCompletedError' } } errorClasses.ProcessingFailure_AlreadyCompletedError = ProcessingFailure_AlreadyCompletedError
203
204
  export class ProcessingFailure_AutomationCannotBeRunManuallyError extends ProcessingFailureError { constructor(message, code, errorData) { super(message, code, errorData); this.name = 'ProcessingFailure_AutomationCannotBeRunManuallyError' } } errorClasses.ProcessingFailure_AutomationCannotBeRunManuallyError = ProcessingFailure_AutomationCannotBeRunManuallyError
204
205
  export class ProcessingFailure_BundleOnlyAllowsPreviewsError extends ProcessingFailureError { constructor(message, code, errorData) { super(message, code, errorData); this.name = 'ProcessingFailure_BundleOnlyAllowsPreviewsError' } } errorClasses.ProcessingFailure_BundleOnlyAllowsPreviewsError = ProcessingFailure_BundleOnlyAllowsPreviewsError
205
206
  export class ProcessingFailure_BundleOperationRequiresSubfolderError extends ProcessingFailureError { constructor(message, code, errorData) { super(message, code, errorData); this.name = 'ProcessingFailure_BundleOperationRequiresSubfolderError' } } errorClasses.ProcessingFailure_BundleOperationRequiresSubfolderError = ProcessingFailure_BundleOperationRequiresSubfolderError
package/src/Files.js CHANGED
@@ -5,7 +5,7 @@ const endpointPrefix = '/api/rest/v1'
5
5
  let apiKey
6
6
  let baseUrl = 'https://app.files.com'
7
7
  let sessionId = null
8
- const version = '1.2.42'
8
+ const version = '1.2.44'
9
9
  let userAgent = `Files.com JavaScript SDK v${version}`
10
10
 
11
11
  let logLevel = LogLevel.INFO
@@ -290,7 +290,7 @@ class Bundle {
290
290
  this.attributes.paths = value
291
291
  }
292
292
 
293
- // BundlePath # A list of bundlepaths in this bundle. For performance reasons, this is not provided when listing bundles.
293
+ // array # A list of bundlepaths in this bundle. For performance reasons, this is not provided when listing bundles.
294
294
  getBundlepaths = () => this.attributes.bundlepaths
295
295
 
296
296
  setBundlepaths = value => {
@@ -77,6 +77,32 @@ class Snapshot {
77
77
  this.attributes.paths = value
78
78
  }
79
79
 
80
+ // Finalize Snapshot
81
+ finalize = async (params = {}) => {
82
+ if (!this.attributes.id) {
83
+ throw new errors.EmptyPropertyError('Current object has no id')
84
+ }
85
+
86
+ if (!isObject(params)) {
87
+ throw new errors.InvalidParameterError(`Bad parameter: params must be of type object, received ${getType(params)}`)
88
+ }
89
+
90
+ 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)}`)
93
+ }
94
+
95
+ if (!params.id) {
96
+ if (this.attributes.id) {
97
+ params.id = this.id
98
+ } else {
99
+ throw new errors.MissingParameterError('Parameter missing: id')
100
+ }
101
+ }
102
+
103
+ await Api.sendRequest(`/snapshots/${encodeURIComponent(params.id)}/finalize`, 'POST', params, this.options)
104
+ }
105
+
80
106
  // Parameters:
81
107
  // expires_at - string - When the snapshot expires.
82
108
  // name - string - A name for the snapshot.