files.com 1.0.306 → 1.0.308

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.306
1
+ 1.0.308
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "skip_name": true,
40
40
  "skip_email": true,
41
+ "start_access_on_date": "2000-01-01T01:00:00Z",
41
42
  "skip_company": true,
42
43
  "id": 1,
43
44
  "created_at": "2000-01-01T01:00:00Z",
@@ -81,6 +82,7 @@
81
82
  * `form_field_set` (FormFieldSet): Custom Form to use
82
83
  * `skip_name` (boolean): BundleRegistrations can be saved without providing name?
83
84
  * `skip_email` (boolean): BundleRegistrations can be saved without providing email?
85
+ * `start_access_on_date` (date-time): Date when share will start to be accessible. If `nil` access granted right after create.
84
86
  * `skip_company` (boolean): BundleRegistrations can be saved without providing company?
85
87
  * `id` (int64): Bundle ID
86
88
  * `created_at` (date-time): Bundle created at date/time
@@ -171,6 +173,7 @@ await Bundle.create({
171
173
  'skip_email': true,
172
174
  'skip_name': true,
173
175
  'skip_company': true,
176
+ 'start_access_on_date': "2000-01-01T01:00:00Z",
174
177
  'snapshot_id': 1,
175
178
  })
176
179
  ```
@@ -201,6 +204,7 @@ await Bundle.create({
201
204
  * `skip_email` (boolean): BundleRegistrations can be saved without providing email?
202
205
  * `skip_name` (boolean): BundleRegistrations can be saved without providing name?
203
206
  * `skip_company` (boolean): BundleRegistrations can be saved without providing company?
207
+ * `start_access_on_date` (string): Date when share will start to be accessible. If `nil` access granted right after create.
204
208
  * `snapshot_id` (int64): ID of the snapshot containing this bundle's contents.
205
209
  * `watermark_attachment_file` (file): Preview watermark image applied to all bundle items.
206
210
 
@@ -326,6 +330,7 @@ await bundle.update({
326
330
  },
327
331
  "skip_name": true,
328
332
  "skip_email": true,
333
+ "start_access_on_date": "2000-01-01T01:00:00Z",
329
334
  "skip_company": true,
330
335
  "id": 1,
331
336
  "created_at": "2000-01-01T01:00:00Z",
@@ -20,6 +20,7 @@
20
20
  "bundle_expiration": 1,
21
21
  "bundle_password_required": true,
22
22
  "bundle_registration_notifications": "never",
23
+ "bundle_require_registration": true,
23
24
  "bundle_require_share_recipient": true,
24
25
  "bundle_upload_receipt_notifications": "never",
25
26
  "bundle_watermark_attachment": null,
@@ -237,6 +238,7 @@
237
238
  * `bundle_expiration` (int64): Site-wide Bundle expiration in days
238
239
  * `bundle_password_required` (boolean): Do Bundles require password protection?
239
240
  * `bundle_registration_notifications` (string): Do Bundle owners receive registration notification?
241
+ * `bundle_require_registration` (boolean): Do Bundles require registration?
240
242
  * `bundle_require_share_recipient` (boolean): Do Bundles require recipients for sharing?
241
243
  * `bundle_upload_receipt_notifications` (string): Do Bundle uploaders receive upload confirmation notifications?
242
244
  * `bundle_watermark_attachment` (Image): Preview watermark image applied to all bundle items.
@@ -450,6 +452,7 @@ await Site.update({
450
452
  'immutable_files': true,
451
453
  'session_pinned_by_ip': true,
452
454
  'bundle_password_required': true,
455
+ 'bundle_require_registration': true,
453
456
  'bundle_require_share_recipient': true,
454
457
  'bundle_registration_notifications': "never",
455
458
  'bundle_activity_notifications': "never",
@@ -583,6 +586,7 @@ await Site.update({
583
586
  * `immutable_files` (boolean): Are files protected from modification?
584
587
  * `session_pinned_by_ip` (boolean): Are sessions locked to the same IP? (i.e. do users need to log in again if they change IPs?)
585
588
  * `bundle_password_required` (boolean): Do Bundles require password protection?
589
+ * `bundle_require_registration` (boolean): Do Bundles require registration?
586
590
  * `bundle_require_share_recipient` (boolean): Do Bundles require recipients for sharing?
587
591
  * `bundle_registration_notifications` (string): Do Bundle owners receive registration notification?
588
592
  * `bundle_activity_notifications` (string): Do Bundle owners receive activity notifications?
package/lib/Api.js CHANGED
@@ -128,40 +128,49 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
128
128
  }
129
129
  contentType = headers['content-type'] || '';
130
130
  if (!contentType.includes('application/json')) {
131
- _context2.next = 23;
131
+ _context2.next = 27;
132
132
  break;
133
133
  }
134
- _context2.next = 20;
134
+ if (!(headers['content-length'] === '0')) {
135
+ _context2.next = 22;
136
+ break;
137
+ }
138
+ data = response.body;
139
+ _context2.next = 25;
140
+ break;
141
+ case 22:
142
+ _context2.next = 24;
135
143
  return response.json();
136
- case 20:
144
+ case 24:
137
145
  data = _context2.sent;
138
- _context2.next = 36;
146
+ case 25:
147
+ _context2.next = 40;
139
148
  break;
140
- case 23:
149
+ case 27:
141
150
  if (!contentType.includes('text/')) {
142
- _context2.next = 29;
151
+ _context2.next = 33;
143
152
  break;
144
153
  }
145
- _context2.next = 26;
154
+ _context2.next = 30;
146
155
  return response.text();
147
- case 26:
156
+ case 30:
148
157
  data = _context2.sent;
149
- _context2.next = 36;
158
+ _context2.next = 40;
150
159
  break;
151
- case 29:
160
+ case 33:
152
161
  if (!contentType.includes('multipart/form-data')) {
153
- _context2.next = 35;
162
+ _context2.next = 39;
154
163
  break;
155
164
  }
156
- _context2.next = 32;
165
+ _context2.next = 36;
157
166
  return response.formData();
158
- case 32:
167
+ case 36:
159
168
  data = _context2.sent;
160
- _context2.next = 36;
169
+ _context2.next = 40;
161
170
  break;
162
- case 35:
171
+ case 39:
163
172
  data = response.body;
164
- case 36:
173
+ case 40:
165
174
  normalizedResponse = {
166
175
  status: response.status,
167
176
  reason: response.statusText,
@@ -169,23 +178,23 @@ var Api = /*#__PURE__*/(0, _createClass2.default)(function Api() {
169
178
  data: data
170
179
  };
171
180
  if (response.ok) {
172
- _context2.next = 39;
181
+ _context2.next = 43;
173
182
  break;
174
183
  }
175
184
  throw {
176
185
  response: normalizedResponse
177
186
  };
178
- case 39:
187
+ case 43:
179
188
  return _context2.abrupt("return", normalizedResponse);
180
- case 42:
181
- _context2.prev = 42;
189
+ case 46:
190
+ _context2.prev = 46;
182
191
  _context2.t0 = _context2["catch"](8);
183
192
  errors.handleErrorResponse(_context2.t0);
184
- case 45:
193
+ case 49:
185
194
  case "end":
186
195
  return _context2.stop();
187
196
  }
188
- }, _callee2, null, [[8, 42]]);
197
+ }, _callee2, null, [[8, 46]]);
189
198
  }));
190
199
  return function (_x3, _x4, _x5) {
191
200
  return _ref3.apply(this, arguments);
@@ -164,6 +164,13 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
164
164
  (0, _defineProperty2.default)(this, "setSkipEmail", function (value) {
165
165
  _this.attributes.skip_email = value;
166
166
  });
167
+ // date-time # Date when share will start to be accessible. If `nil` access granted right after create.
168
+ (0, _defineProperty2.default)(this, "getStartAccessOnDate", function () {
169
+ return _this.attributes.start_access_on_date;
170
+ });
171
+ (0, _defineProperty2.default)(this, "setStartAccessOnDate", function (value) {
172
+ _this.attributes.start_access_on_date = value;
173
+ });
167
174
  // boolean # BundleRegistrations can be saved without providing company?
168
175
  (0, _defineProperty2.default)(this, "getSkipCompany", function () {
169
176
  return _this.attributes.skip_company;
@@ -758,6 +765,7 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
758
765
  // skip_email - boolean - BundleRegistrations can be saved without providing email?
759
766
  // skip_name - boolean - BundleRegistrations can be saved without providing name?
760
767
  // skip_company - boolean - BundleRegistrations can be saved without providing company?
768
+ // start_access_on_date - string - Date when share will start to be accessible. If `nil` access granted right after create.
761
769
  // snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
762
770
  // watermark_attachment_file - file - Preview watermark image applied to all bundle items.
763
771
  (0, _defineProperty2.default)(Bundle, "create", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
@@ -854,18 +862,24 @@ var Bundle = /*#__PURE__*/(0, _createClass2.default)(function Bundle() {
854
862
  }
855
863
  throw new errors.InvalidParameterError("Bad parameter: inbox_id must be of type Int, received ".concat((0, _utils.getType)(params['inbox_id'])));
856
864
  case 30:
857
- if (!(params['snapshot_id'] && !(0, _utils.isInt)(params['snapshot_id']))) {
865
+ if (!(params['start_access_on_date'] && !(0, _utils.isString)(params['start_access_on_date']))) {
858
866
  _context6.next = 32;
859
867
  break;
860
868
  }
861
- throw new errors.InvalidParameterError("Bad parameter: snapshot_id must be of type Int, received ".concat((0, _utils.getType)(params['snapshot_id'])));
869
+ throw new errors.InvalidParameterError("Bad parameter: start_access_on_date must be of type String, received ".concat((0, _utils.getType)(params['start_access_on_date'])));
862
870
  case 32:
863
- _context6.next = 34;
864
- return _Api.default.sendRequest("/bundles", 'POST', params, options);
871
+ if (!(params['snapshot_id'] && !(0, _utils.isInt)(params['snapshot_id']))) {
872
+ _context6.next = 34;
873
+ break;
874
+ }
875
+ throw new errors.InvalidParameterError("Bad parameter: snapshot_id must be of type Int, received ".concat((0, _utils.getType)(params['snapshot_id'])));
865
876
  case 34:
877
+ _context6.next = 36;
878
+ return _Api.default.sendRequest("/bundles", 'POST', params, options);
879
+ case 36:
866
880
  response = _context6.sent;
867
881
  return _context6.abrupt("return", new Bundle(response === null || response === void 0 ? void 0 : response.data, options));
868
- case 36:
882
+ case 38:
869
883
  case "end":
870
884
  return _context6.stop();
871
885
  }
@@ -95,6 +95,10 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
95
95
  (0, _defineProperty2.default)(this, "getBundleRegistrationNotifications", function () {
96
96
  return _this.attributes.bundle_registration_notifications;
97
97
  });
98
+ // boolean # Do Bundles require registration?
99
+ (0, _defineProperty2.default)(this, "getBundleRequireRegistration", function () {
100
+ return _this.attributes.bundle_require_registration;
101
+ });
98
102
  // boolean # Do Bundles require recipients for sharing?
99
103
  (0, _defineProperty2.default)(this, "getBundleRequireShareRecipient", function () {
100
104
  return _this.attributes.bundle_require_share_recipient;
@@ -719,6 +723,7 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
719
723
  // immutable_files - boolean - Are files protected from modification?
720
724
  // session_pinned_by_ip - boolean - Are sessions locked to the same IP? (i.e. do users need to log in again if they change IPs?)
721
725
  // bundle_password_required - boolean - Do Bundles require password protection?
726
+ // bundle_require_registration - boolean - Do Bundles require registration?
722
727
  // bundle_require_share_recipient - boolean - Do Bundles require recipients for sharing?
723
728
  // bundle_registration_notifications - string - Do Bundle owners receive registration notification?
724
729
  // bundle_activity_notifications - string - Do Bundle owners receive activity notifications?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.306",
3
+ "version": "1.0.308",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Api.js CHANGED
@@ -88,7 +88,11 @@ class Api {
88
88
  let data
89
89
 
90
90
  if (contentType.includes('application/json')) {
91
- data = await response.json()
91
+ if (headers['content-length'] === '0') {
92
+ data = response.body
93
+ } else {
94
+ data = await response.json()
95
+ }
92
96
  } else if (contentType.includes('text/')) {
93
97
  data = await response.text()
94
98
  } else if (contentType.includes('multipart/form-data')) {
@@ -156,6 +156,13 @@ class Bundle {
156
156
  this.attributes.skip_email = value
157
157
  }
158
158
 
159
+ // date-time # Date when share will start to be accessible. If `nil` access granted right after create.
160
+ getStartAccessOnDate = () => this.attributes.start_access_on_date
161
+
162
+ setStartAccessOnDate = value => {
163
+ this.attributes.start_access_on_date = value
164
+ }
165
+
159
166
  // boolean # BundleRegistrations can be saved without providing company?
160
167
  getSkipCompany = () => this.attributes.skip_company
161
168
 
@@ -564,6 +571,7 @@ class Bundle {
564
571
  // skip_email - boolean - BundleRegistrations can be saved without providing email?
565
572
  // skip_name - boolean - BundleRegistrations can be saved without providing name?
566
573
  // skip_company - boolean - BundleRegistrations can be saved without providing company?
574
+ // start_access_on_date - string - Date when share will start to be accessible. If `nil` access granted right after create.
567
575
  // snapshot_id - int64 - ID of the snapshot containing this bundle's contents.
568
576
  // watermark_attachment_file - file - Preview watermark image applied to all bundle items.
569
577
  static create = async (params = {}, options = {}) => {
@@ -623,6 +631,10 @@ class Bundle {
623
631
  throw new errors.InvalidParameterError(`Bad parameter: inbox_id must be of type Int, received ${getType(params['inbox_id'])}`)
624
632
  }
625
633
 
634
+ if (params['start_access_on_date'] && !isString(params['start_access_on_date'])) {
635
+ throw new errors.InvalidParameterError(`Bad parameter: start_access_on_date must be of type String, received ${getType(params['start_access_on_date'])}`)
636
+ }
637
+
626
638
  if (params['snapshot_id'] && !isInt(params['snapshot_id'])) {
627
639
  throw new errors.InvalidParameterError(`Bad parameter: snapshot_id must be of type Int, received ${getType(params['snapshot_id'])}`)
628
640
  }
@@ -71,6 +71,9 @@ class Site {
71
71
  // string # Do Bundle owners receive registration notification?
72
72
  getBundleRegistrationNotifications = () => this.attributes.bundle_registration_notifications
73
73
 
74
+ // boolean # Do Bundles require registration?
75
+ getBundleRequireRegistration = () => this.attributes.bundle_require_registration
76
+
74
77
  // boolean # Do Bundles require recipients for sharing?
75
78
  getBundleRequireShareRecipient = () => this.attributes.bundle_require_share_recipient
76
79
 
@@ -529,6 +532,7 @@ class Site {
529
532
  // immutable_files - boolean - Are files protected from modification?
530
533
  // session_pinned_by_ip - boolean - Are sessions locked to the same IP? (i.e. do users need to log in again if they change IPs?)
531
534
  // bundle_password_required - boolean - Do Bundles require password protection?
535
+ // bundle_require_registration - boolean - Do Bundles require registration?
532
536
  // bundle_require_share_recipient - boolean - Do Bundles require recipients for sharing?
533
537
  // bundle_registration_notifications - string - Do Bundle owners receive registration notification?
534
538
  // bundle_activity_notifications - string - Do Bundle owners receive activity notifications?