wealthica-sdk-js 0.0.11 → 0.0.13

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/README.md CHANGED
@@ -314,7 +314,7 @@ This method removes a single institution from the user.
314
314
  await user.institutions.remove('603522490d2b02001233a5d6');
315
315
  ```
316
316
 
317
- #### user.history.getList({ institutionId, from, to, investments })
317
+ #### user.history.getList({ institutions, from, to, investments })
318
318
 
319
319
  This method retrieves the balance history for an institution.
320
320
 
@@ -322,10 +322,10 @@ Returns data within the last 1 year by default.
322
322
 
323
323
  ```javascript
324
324
  const history = await user.history.getList({
325
- institutionId: '603522490d2b02001233a5d6',
325
+ institutions: ['603522490d2b02001233a5d6'],
326
326
  from: '2021-01-01',
327
327
  to: '2021-09-09',
328
- investment: 'bitcoin:cash:usd',
328
+ investments: ['bitcoin:cash:usd'],
329
329
  });
330
330
  ```
331
331
 
@@ -173,10 +173,10 @@ type Transactions = {
173
173
  }
174
174
 
175
175
  type HistoryListOptions = {
176
- institutionId: string;
176
+ institutions: string[];
177
177
  from?: string;
178
178
  to?: string;
179
- investments?: string;
179
+ investments?: string[];
180
180
  }
181
181
 
182
182
  type BalanceHistory = {
@@ -173,10 +173,10 @@ type Transactions = {
173
173
  }
174
174
 
175
175
  type HistoryListOptions = {
176
- institutionId: string;
176
+ institutions: string[];
177
177
  from?: string;
178
178
  to?: string;
179
- investments?: string;
179
+ investments?: string[];
180
180
  }
181
181
 
182
182
  type BalanceHistory = {
@@ -6550,9 +6550,6 @@ module.exports = new Wealthica();
6550
6550
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6551
6551
 
6552
6552
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
6553
- var _excluded = ["institutionId"];
6554
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6555
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6556
6553
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6557
6554
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6558
6555
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -6572,8 +6569,6 @@ var History = /*#__PURE__*/function () {
6572
6569
  value: function () {
6573
6570
  var _getList = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
6574
6571
  var options,
6575
- institutionId,
6576
- params,
6577
6572
  url,
6578
6573
  query,
6579
6574
  response,
@@ -6583,28 +6578,21 @@ var History = /*#__PURE__*/function () {
6583
6578
  switch (_context.prev = _context.next) {
6584
6579
  case 0:
6585
6580
  options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
6586
- institutionId = options.institutionId, params = _objectWithoutProperties(options, _excluded);
6587
- if (!(!institutionId || typeof institutionId !== 'string')) {
6588
- _context.next = 4;
6589
- break;
6590
- }
6591
- throw new Error('Please provide a valid Wealthica institution id.');
6592
- case 4:
6593
- url = "/institutions/".concat(institutionId, "/history");
6594
- query = getQueryString(params);
6581
+ url = '/history';
6582
+ query = getQueryString(options);
6595
6583
  if (query) url = "".concat(url, "?").concat(query);
6596
- _context.next = 9;
6584
+ _context.next = 6;
6597
6585
  return this.api.get(url);
6598
- case 9:
6586
+ case 6:
6599
6587
  response = _context.sent;
6600
6588
  if (response.ok) {
6601
- _context.next = 12;
6589
+ _context.next = 9;
6602
6590
  break;
6603
6591
  }
6604
6592
  throw response.originalError;
6605
- case 12:
6593
+ case 9:
6606
6594
  return _context.abrupt("return", response.data);
6607
- case 13:
6595
+ case 10:
6608
6596
  case "end":
6609
6597
  return _context.stop();
6610
6598
  }
package/dist/wealthica.js CHANGED
@@ -6540,9 +6540,6 @@ module.exports = new Wealthica();
6540
6540
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6541
6541
 
6542
6542
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
6543
- var _excluded = ["institutionId"];
6544
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6545
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6546
6543
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6547
6544
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6548
6545
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -6562,8 +6559,6 @@ var History = /*#__PURE__*/function () {
6562
6559
  value: function () {
6563
6560
  var _getList = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
6564
6561
  var options,
6565
- institutionId,
6566
- params,
6567
6562
  url,
6568
6563
  query,
6569
6564
  response,
@@ -6573,28 +6568,21 @@ var History = /*#__PURE__*/function () {
6573
6568
  switch (_context.prev = _context.next) {
6574
6569
  case 0:
6575
6570
  options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
6576
- institutionId = options.institutionId, params = _objectWithoutProperties(options, _excluded);
6577
- if (!(!institutionId || typeof institutionId !== 'string')) {
6578
- _context.next = 4;
6579
- break;
6580
- }
6581
- throw new Error('Please provide a valid Wealthica institution id.');
6582
- case 4:
6583
- url = "/institutions/".concat(institutionId, "/history");
6584
- query = getQueryString(params);
6571
+ url = '/history';
6572
+ query = getQueryString(options);
6585
6573
  if (query) url = "".concat(url, "?").concat(query);
6586
- _context.next = 9;
6574
+ _context.next = 6;
6587
6575
  return this.api.get(url);
6588
- case 9:
6576
+ case 6:
6589
6577
  response = _context.sent;
6590
6578
  if (response.ok) {
6591
- _context.next = 12;
6579
+ _context.next = 9;
6592
6580
  break;
6593
6581
  }
6594
6582
  throw response.originalError;
6595
- case 12:
6583
+ case 9:
6596
6584
  return _context.abrupt("return", response.data);
6597
- case 13:
6585
+ case 10:
6598
6586
  case "end":
6599
6587
  return _context.stop();
6600
6588
  }
@@ -173,10 +173,10 @@ type Transactions = {
173
173
  }
174
174
 
175
175
  type HistoryListOptions = {
176
- institutionId: string;
176
+ institutions: string[];
177
177
  from?: string;
178
178
  to?: string;
179
- investments?: string;
179
+ investments?: string[];
180
180
  }
181
181
 
182
182
  type BalanceHistory = {