files.com 1.0.267 → 1.0.268

Sign up to get free protection for your applications and to get access to all the features.
package/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.267
1
+ 1.0.268
@@ -1,5 +1,22 @@
1
1
  # Snapshot
2
2
 
3
+ ## Example Snapshot Object
4
+
5
+ ```
6
+ {
7
+ "expires_at": "2000-01-01T01:00:00Z",
8
+ "finalized_at": "2000-01-01T01:00:00Z",
9
+ "name": "My Snapshot",
10
+ "user_id": 1,
11
+ "bundle_id": 1
12
+ }
13
+ ```
14
+
15
+ * `expires_at` (date-time): When the snapshot expires.
16
+ * `finalized_at` (date-time): When the snapshot was finalized.
17
+ * `name` (string): A name for the snapshot.
18
+ * `user_id` (int64): The user that created this snapshot, if applicable.
19
+ * `bundle_id` (int64): The bundle using this snapshot, if applicable.
3
20
  * `id` (int64): Snapshot ID.
4
21
 
5
22
  ---
@@ -54,6 +71,17 @@ await snapshot.update()
54
71
 
55
72
  * `id` (int64): Required - Snapshot ID.
56
73
 
74
+ ### Example Response
75
+
76
+ ```json
77
+ {
78
+ "expires_at": "2000-01-01T01:00:00Z",
79
+ "finalized_at": "2000-01-01T01:00:00Z",
80
+ "name": "My Snapshot",
81
+ "user_id": 1,
82
+ "bundle_id": 1
83
+ }
84
+ ```
57
85
 
58
86
  ---
59
87
 
@@ -31,6 +31,41 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
31
31
  (0, _defineProperty2.default)(this, "isLoaded", function () {
32
32
  return !!_this.attributes.id;
33
33
  });
34
+ // date-time # When the snapshot expires.
35
+ (0, _defineProperty2.default)(this, "getExpiresAt", function () {
36
+ return _this.attributes.expires_at;
37
+ });
38
+ (0, _defineProperty2.default)(this, "setExpiresAt", function (value) {
39
+ _this.attributes.expires_at = value;
40
+ });
41
+ // date-time # When the snapshot was finalized.
42
+ (0, _defineProperty2.default)(this, "getFinalizedAt", function () {
43
+ return _this.attributes.finalized_at;
44
+ });
45
+ (0, _defineProperty2.default)(this, "setFinalizedAt", function (value) {
46
+ _this.attributes.finalized_at = value;
47
+ });
48
+ // string # A name for the snapshot.
49
+ (0, _defineProperty2.default)(this, "getName", function () {
50
+ return _this.attributes.name;
51
+ });
52
+ (0, _defineProperty2.default)(this, "setName", function (value) {
53
+ _this.attributes.name = value;
54
+ });
55
+ // int64 # The user that created this snapshot, if applicable.
56
+ (0, _defineProperty2.default)(this, "getUserId", function () {
57
+ return _this.attributes.user_id;
58
+ });
59
+ (0, _defineProperty2.default)(this, "setUserId", function (value) {
60
+ _this.attributes.user_id = value;
61
+ });
62
+ // int64 # The bundle using this snapshot, if applicable.
63
+ (0, _defineProperty2.default)(this, "getBundleId", function () {
64
+ return _this.attributes.bundle_id;
65
+ });
66
+ (0, _defineProperty2.default)(this, "setBundleId", function (value) {
67
+ _this.attributes.bundle_id = value;
68
+ });
34
69
  // int64 # Snapshot ID.
35
70
  (0, _defineProperty2.default)(this, "getId", function () {
36
71
  return _this.attributes.id;
@@ -83,7 +118,7 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
83
118
  return _Api.default.sendRequest("/snapshots/".concat(encodeURIComponent(params['id'])), 'PATCH', params, _this.options);
84
119
  case 16:
85
120
  response = _context.sent;
86
- return _context.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
121
+ return _context.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, _this.options));
87
122
  case 18:
88
123
  case "end":
89
124
  return _context.stop();
@@ -172,6 +207,7 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
172
207
  // 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.
173
208
  // per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
174
209
  (0, _defineProperty2.default)(Snapshot, "list", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
210
+ var _response$data;
175
211
  var params,
176
212
  options,
177
213
  response,
@@ -197,7 +233,9 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
197
233
  return _Api.default.sendRequest("/snapshots", 'GET', params, options);
198
234
  case 8:
199
235
  response = _context3.sent;
200
- return _context3.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
236
+ return _context3.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
237
+ return new Snapshot(obj, options);
238
+ })) || []);
201
239
  case 10:
202
240
  case "end":
203
241
  return _context3.stop();
@@ -245,7 +283,7 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
245
283
  return _Api.default.sendRequest("/snapshots/".concat(encodeURIComponent(params['id'])), 'GET', params, options);
246
284
  case 11:
247
285
  response = _context4.sent;
248
- return _context4.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
286
+ return _context4.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, options));
249
287
  case 13:
250
288
  case "end":
251
289
  return _context4.stop();
@@ -273,7 +311,7 @@ var Snapshot = /*#__PURE__*/(0, _createClass2.default)(function Snapshot() {
273
311
  return _Api.default.sendRequest("/snapshots", 'POST', {}, options);
274
312
  case 3:
275
313
  response = _context5.sent;
276
- return _context5.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
314
+ return _context5.abrupt("return", new Snapshot(response === null || response === void 0 ? void 0 : response.data, options));
277
315
  case 5:
278
316
  case "end":
279
317
  return _context5.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.267",
3
+ "version": "1.0.268",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
@@ -23,6 +23,41 @@ class Snapshot {
23
23
  }
24
24
 
25
25
  isLoaded = () => !!this.attributes.id
26
+ // date-time # When the snapshot expires.
27
+ getExpiresAt = () => this.attributes.expires_at
28
+
29
+ setExpiresAt = value => {
30
+ this.attributes.expires_at = value
31
+ }
32
+
33
+ // date-time # When the snapshot was finalized.
34
+ getFinalizedAt = () => this.attributes.finalized_at
35
+
36
+ setFinalizedAt = value => {
37
+ this.attributes.finalized_at = value
38
+ }
39
+
40
+ // string # A name for the snapshot.
41
+ getName = () => this.attributes.name
42
+
43
+ setName = value => {
44
+ this.attributes.name = value
45
+ }
46
+
47
+ // int64 # The user that created this snapshot, if applicable.
48
+ getUserId = () => this.attributes.user_id
49
+
50
+ setUserId = value => {
51
+ this.attributes.user_id = value
52
+ }
53
+
54
+ // int64 # The bundle using this snapshot, if applicable.
55
+ getBundleId = () => this.attributes.bundle_id
56
+
57
+ setBundleId = value => {
58
+ this.attributes.bundle_id = value
59
+ }
60
+
26
61
  // int64 # Snapshot ID.
27
62
  getId = () => this.attributes.id
28
63
 
@@ -55,7 +90,7 @@ class Snapshot {
55
90
 
56
91
  const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params['id'])}`, 'PATCH', params, this.options)
57
92
 
58
- return response?.data
93
+ return new Snapshot(response?.data, this.options)
59
94
  }
60
95
 
61
96
  delete = async (params = {}) => {
@@ -112,7 +147,7 @@ class Snapshot {
112
147
 
113
148
  const response = await Api.sendRequest(`/snapshots`, 'GET', params, options)
114
149
 
115
- return response?.data
150
+ return response?.data?.map(obj => new Snapshot(obj, options)) || []
116
151
  }
117
152
 
118
153
  static all = (params = {}, options = {}) =>
@@ -137,7 +172,7 @@ class Snapshot {
137
172
 
138
173
  const response = await Api.sendRequest(`/snapshots/${encodeURIComponent(params['id'])}`, 'GET', params, options)
139
174
 
140
- return response?.data
175
+ return new Snapshot(response?.data, options)
141
176
  }
142
177
 
143
178
  static get = (id, params = {}, options = {}) =>
@@ -146,7 +181,7 @@ class Snapshot {
146
181
  static create = async (options = {}) => {
147
182
  const response = await Api.sendRequest(`/snapshots`, 'POST', {}, options)
148
183
 
149
- return response?.data
184
+ return new Snapshot(response?.data, options)
150
185
  }
151
186
  }
152
187