files.com 1.0.272 → 1.0.273

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.272
1
+ 1.0.273
@@ -159,6 +159,7 @@ await Bundle.create({
159
159
  'skip_email': true,
160
160
  'skip_name': true,
161
161
  'skip_company': true,
162
+ 'snapshot_id': 1,
162
163
  })
163
164
  ```
164
165
 
@@ -188,6 +189,7 @@ await Bundle.create({
188
189
  * `skip_email` (boolean): BundleRegistrations can be saved without providing email?
189
190
  * `skip_name` (boolean): BundleRegistrations can be saved without providing name?
190
191
  * `skip_company` (boolean): BundleRegistrations can be saved without providing company?
192
+ * `snapshot_id` (int64): ID of the snapshot containing this bundle's contents.
191
193
  * `watermark_attachment_file` (file): Preview watermark image applied to all bundle items.
192
194
 
193
195
  ---
@@ -17,6 +17,7 @@
17
17
  * `name` (string): A name for the snapshot.
18
18
  * `user_id` (int64): The user that created this snapshot, if applicable.
19
19
  * `bundle_id` (int64): The bundle using this snapshot, if applicable.
20
+ * `paths` (array(string)): An array of paths to add to the snapshot.
20
21
  * `id` (int64): Snapshot ID.
21
22
 
22
23
  ---
@@ -53,10 +54,19 @@ await Snapshot.find(id)
53
54
  ## Create Snapshot
54
55
 
55
56
  ```
56
- await Snapshot.create
57
+ await Snapshot.create({
58
+ 'expires_at': "2000-01-01T01:00:00Z",
59
+ 'name': "My Snapshot",
60
+ })
57
61
  ```
58
62
 
59
63
 
64
+ ### Parameters
65
+
66
+ * `expires_at` (string): When the snapshot expires.
67
+ * `name` (string): A name for the snapshot.
68
+ * `paths` (array(string)): An array of paths to add to the snapshot.
69
+
60
70
  ---
61
71
 
62
72
  ## Update Snapshot
@@ -64,12 +74,18 @@ await Snapshot.create
64
74
  ```
65
75
  const [snapshot] = await Snapshot.list()
66
76
 
67
- await snapshot.update()
77
+ await snapshot.update({
78
+ 'expires_at': "2000-01-01T01:00:00Z",
79
+ 'name': "My Snapshot",
80
+ })
68
81
  ```
69
82
 
70
83
  ### Parameters
71
84
 
72
85
  * `id` (int64): Required - Snapshot ID.
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.
73
89
 
74
90
  ### Example Response
75
91
 
@@ -716,6 +716,7 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
716
716
  // skip_email - boolean - BundleRegistrations can be saved without providing email?
717
717
  // skip_name - boolean - BundleRegistrations can be saved without providing name?
718
718
  // skip_company - boolean - BundleRegistrations can be saved without providing company?
719
+ // snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
719
720
  // watermark_attachment_file - file - Preview watermark image applied to all bundle items.
720
721
  (0, _defineProperty2.default)(Bundle, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
721
722
  var params,
@@ -811,12 +812,18 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
811
812
  }
812
813
  throw new errors.InvalidParameterError("Bad parameter: inbox_id must be of type Int, received ".concat((0, _utils.getType)(params['inbox_id'])));
813
814
  case 30:
814
- _context6.next = 32;
815
- return _Api.default.sendRequest("/bundles", 'POST', params, options);
815
+ if (!(params['snapshot_id'] && !(0, _utils.isInt)(params['snapshot_id']))) {
816
+ _context6.next = 32;
817
+ break;
818
+ }
819
+ throw new errors.InvalidParameterError("Bad parameter: snapshot_id must be of type Int, received ".concat((0, _utils.getType)(params['snapshot_id'])));
816
820
  case 32:
821
+ _context6.next = 34;
822
+ return _Api.default.sendRequest("/bundles", 'POST', params, options);
823
+ case 34:
817
824
  response = _context6.sent;
818
825
  return _context6.abrupt("return", new Bundle(response === null || response === void 0 ? void 0 : response.data, options));
819
- case 34:
826
+ case 36:
820
827
  case "end":
821
828
  return _context6.stop();
822
829
  }
@@ -66,6 +66,13 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
66
66
  (0, _defineProperty2.default)(this, "setBundleId", function (value) {
67
67
  _this.attributes.bundle_id = value;
68
68
  });
69
+ // array(string) # An array of paths to add to the snapshot.
70
+ (0, _defineProperty2.default)(this, "getPaths", function () {
71
+ return _this.attributes.paths;
72
+ });
73
+ (0, _defineProperty2.default)(this, "setPaths", function (value) {
74
+ _this.attributes.paths = value;
75
+ });
69
76
  // int64 # Snapshot ID.
70
77
  (0, _defineProperty2.default)(this, "getId", function () {
71
78
  return _this.attributes.id;
@@ -73,6 +80,10 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
73
80
  (0, _defineProperty2.default)(this, "setId", function (value) {
74
81
  _this.attributes.id = value;
75
82
  });
83
+ // Parameters:
84
+ // expires_at - string - When the snapshot expires.
85
+ // name - string - A name for the snapshot.
86
+ // paths - array(string) - An array of paths to add to the snapshot.
76
87
  (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
77
88
  var params,
78
89
  response,
@@ -100,26 +111,44 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
100
111
  }
101
112
  throw new errors.InvalidParameterError("Bad parameter: id must be of type Int, received ".concat((0, _utils.getType)(id)));
102
113
  case 8:
103
- if (params['id']) {
114
+ if (!(params['expires_at'] && !(0, _utils.isString)(params['expires_at']))) {
115
+ _context.next = 10;
116
+ break;
117
+ }
118
+ throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(expires_at)));
119
+ case 10:
120
+ if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
121
+ _context.next = 12;
122
+ break;
123
+ }
124
+ throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(name)));
125
+ case 12:
126
+ if (!(params['paths'] && !(0, _utils.isArray)(params['paths']))) {
104
127
  _context.next = 14;
105
128
  break;
106
129
  }
130
+ throw new errors.InvalidParameterError("Bad parameter: paths must be of type Array, received ".concat((0, _utils.getType)(paths)));
131
+ case 14:
132
+ if (params['id']) {
133
+ _context.next = 20;
134
+ break;
135
+ }
107
136
  if (!_this.attributes.id) {
108
- _context.next = 13;
137
+ _context.next = 19;
109
138
  break;
110
139
  }
111
140
  params['id'] = _this.id;
112
- _context.next = 14;
141
+ _context.next = 20;
113
142
  break;
114
- case 13:
143
+ case 19:
115
144
  throw new errors.MissingParameterError('Parameter missing: id');
116
- case 14:
117
- _context.next = 16;
145
+ case 20:
146
+ _context.next = 22;
118
147
  return _Api.default.sendRequest("/snapshots/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
119
- case 16:
148
+ case 22:
120
149
  response = _context.sent;
121
150
  return _context.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, _this.options));
122
- case 18:
151
+ case 24:
123
152
  case "end":
124
153
  return _context.stop();
125
154
  }
@@ -299,20 +328,44 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
299
328
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
300
329
  return Snapshot.find(id, params, options);
301
330
  });
331
+ // Parameters:
332
+ // expires_at - string - When the snapshot expires.
333
+ // name - string - A name for the snapshot.
334
+ // paths - array(string) - An array of paths to add to the snapshot.
302
335
  (0, _defineProperty2.default)(Snapshot, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
303
- var options,
336
+ var params,
337
+ options,
304
338
  response,
305
339
  _args5 = arguments;
306
340
  return _regenerator.default.wrap(function _callee5$(_context5) {
307
341
  while (1) switch (_context5.prev = _context5.next) {
308
342
  case 0:
309
- options = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
310
- _context5.next = 3;
311
- return _Api.default.sendRequest("/snapshots", 'POST', {}, options);
312
- case 3:
343
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
344
+ options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
345
+ if (!(params['expires_at'] && !(0, _utils.isString)(params['expires_at']))) {
346
+ _context5.next = 4;
347
+ break;
348
+ }
349
+ throw new errors.InvalidParameterError("Bad parameter: expires_at must be of type String, received ".concat((0, _utils.getType)(params['expires_at'])));
350
+ case 4:
351
+ if (!(params['name'] && !(0, _utils.isString)(params['name']))) {
352
+ _context5.next = 6;
353
+ break;
354
+ }
355
+ throw new errors.InvalidParameterError("Bad parameter: name must be of type String, received ".concat((0, _utils.getType)(params['name'])));
356
+ case 6:
357
+ if (!(params['paths'] && !(0, _utils.isArray)(params['paths']))) {
358
+ _context5.next = 8;
359
+ break;
360
+ }
361
+ throw new errors.InvalidParameterError("Bad parameter: paths must be of type Array, received ".concat((0, _utils.getType)(params['paths'])));
362
+ case 8:
363
+ _context5.next = 10;
364
+ return _Api.default.sendRequest("/snapshots", 'POST', params, options);
365
+ case 10:
313
366
  response = _context5.sent;
314
367
  return _context5.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, options));
315
- case 5:
368
+ case 12:
316
369
  case "end":
317
370
  return _context5.stop();
318
371
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.272",
3
+ "version": "1.0.273",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
@@ -522,6 +522,7 @@ class Bundle {
522
522
  // skip_email - boolean - BundleRegistrations can be saved without providing email?
523
523
  // skip_name - boolean - BundleRegistrations can be saved without providing name?
524
524
  // skip_company - boolean - BundleRegistrations can be saved without providing company?
525
+ // snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
525
526
  // watermark_attachment_file - file - Preview watermark image applied to all bundle items.
526
527
  static create = async (params = {}, options = {}) => {
527
528
  if (!params['paths']) {
@@ -580,6 +581,10 @@ class Bundle {
580
581
  throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params['inbox_id'])}`)
581
582
  }
582
583
 
584
+ if (params['snapshot_id'] && !isInt(params['snapshot_id'])) {
585
+ throw new errors.InvalidParameterError(`Bad parameter: snapshot_id must be of type Int, received ${getType(params['snapshot_id'])}`)
586
+ }
587
+
583
588
  const response = await Api.sendRequest(`/bundles`, 'POST', params, options)
584
589
 
585
590
  return new Bundle(response?.data, options)
@@ -58,6 +58,13 @@ class Snapshot {
58
58
  this.attributes.bundle_id = value
59
59
  }
60
60
 
61
+ // array(string) # An array of paths to add to the snapshot.
62
+ getPaths = () => this.attributes.paths
63
+
64
+ setPaths = value => {
65
+ this.attributes.paths = value
66
+ }
67
+
61
68
  // int64 # Snapshot ID.
62
69
  getId = () => this.attributes.id
63
70
 
@@ -66,6 +73,10 @@ class Snapshot {
66
73
  }
67
74
 
68
75
 
76
+ // Parameters:
77
+ // expires_at - string - When the snapshot expires.
78
+ // name - string - A name for the snapshot.
79
+ // paths - array(string) - An array of paths to add to the snapshot.
69
80
  update = async (params = {}) => {
70
81
  if (!this.attributes.id) {
71
82
  throw new errors.EmptyPropertyError('Current object has no id')
@@ -79,6 +90,15 @@ class Snapshot {
79
90
  if (params['id'] && !isInt(params['id'])) {
80
91
  throw new errors.InvalidParameterError(`Bad parameter: id must be of type Int, received ${getType(id)}`)
81
92
  }
93
+ if (params['expires_at'] && !isString(params['expires_at'])) {
94
+ throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(expires_at)}`)
95
+ }
96
+ if (params['name'] && !isString(params['name'])) {
97
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(name)}`)
98
+ }
99
+ if (params['paths'] && !isArray(params['paths'])) {
100
+ throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(paths)}`)
101
+ }
82
102
 
83
103
  if (!params['id']) {
84
104
  if (this.attributes.id) {
@@ -178,8 +198,24 @@ class Snapshot {
178
198
  static get = (id, params = {}, options = {}) =>
179
199
  Snapshot.find(id, params, options)
180
200
 
181
- static create = async (options = {}) => {
182
- const response = await Api.sendRequest(`/snapshots`, 'POST', {}, options)
201
+ // Parameters:
202
+ // expires_at - string - When the snapshot expires.
203
+ // name - string - A name for the snapshot.
204
+ // paths - array(string) - An array of paths to add to the snapshot.
205
+ static create = async (params = {}, options = {}) => {
206
+ if (params['expires_at'] && !isString(params['expires_at'])) {
207
+ throw new errors.InvalidParameterError(`Bad parameter: expires_at must be of type String, received ${getType(params['expires_at'])}`)
208
+ }
209
+
210
+ if (params['name'] && !isString(params['name'])) {
211
+ throw new errors.InvalidParameterError(`Bad parameter: name must be of type String, received ${getType(params['name'])}`)
212
+ }
213
+
214
+ if (params['paths'] && !isArray(params['paths'])) {
215
+ throw new errors.InvalidParameterError(`Bad parameter: paths must be of type Array, received ${getType(params['paths'])}`)
216
+ }
217
+
218
+ const response = await Api.sendRequest(`/snapshots`, 'POST', params, options)
183
219
 
184
220
  return new Snapshot(response?.data, options)
185
221
  }