@barchart/portfolio-client-js 1.2.30 → 1.2.33

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.
@@ -292,7 +292,7 @@ module.exports = function () {
292
292
  }).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
293
293
 
294
294
  _this._downloadBrokerageReportEndpoint = EndpointBuilder.for('download-brokerage-report', 'download brokerage report').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
295
- pb.withLiteralParameter('reports', 'reports').withLiteralParameter('pdf', 'pdf').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('brokerage', 'brokerage').withLiteralParameter('frames', 'frames').withVariableParameter('frame', 'frame', 'frame', false, function (x) {
295
+ pb.withLiteralParameter('reports', 'reports').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('frames', 'frames').withVariableParameter('frame', 'frame', 'frame', false, function (x) {
296
296
  return x.code;
297
297
  }).withLiteralParameter('date', 'date').withVariableParameter('start', 'start', 'start', false, function (x) {
298
298
  return x.format();
@@ -935,13 +935,13 @@ module.exports = function () {
935
935
  * @public
936
936
  * @param {String=} portfolio
937
937
  * @param {PositionSummaryFrame} frame
938
- * @param {Day} start
938
+ * @param {Day} end
939
939
  * @returns {Promise}
940
940
  */
941
941
 
942
942
  }, {
943
943
  key: 'downloadBrokerageReport',
944
- value: function downloadBrokerageReport(portfolio, frame, start) {
944
+ value: function downloadBrokerageReport(portfolio, frame, end) {
945
945
  var _this21 = this;
946
946
 
947
947
  return Promise.resolve().then(function () {
@@ -949,13 +949,13 @@ module.exports = function () {
949
949
 
950
950
  assert.argumentIsRequired(portfolio, 'portfolio', String);
951
951
  assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
952
- assert.argumentIsRequired(start, 'start', Day, 'Day');
952
+ assert.argumentIsRequired(end, 'end', Day, 'Day');
953
953
 
954
954
  var payload = {};
955
955
 
956
956
  payload.portfolio = portfolio;
957
957
  payload.frame = frame;
958
- payload.start = start;
958
+ payload.start = end;
959
959
 
960
960
  return Gateway.invoke(_this21._downloadBrokerageReportEndpoint, payload);
961
961
  });
@@ -1556,7 +1556,7 @@ module.exports = function () {
1556
1556
  return {
1557
1557
  JwtGateway: JwtGateway,
1558
1558
  PortfolioGateway: PortfolioGateway,
1559
- version: '1.2.30'
1559
+ version: '1.2.32'
1560
1560
  };
1561
1561
  }();
1562
1562
 
@@ -7,9 +7,9 @@ const assert = require('@barchart/common-js/lang/assert'),
7
7
 
8
8
  const TransactionType = require('@barchart/portfolio-api-common/lib/data/TransactionType');
9
9
 
10
- const PortfolioSchema = require('@barchart/portfolio-api-common/lib/serialization/PortfolioSchema'),
10
+ const BrokerageReportAvailabilitySchema = require('@barchart/portfolio-api-common/lib/serialization/reports/BrokerageReportAvailabilitySchema'),
11
+ PortfolioSchema = require('@barchart/portfolio-api-common/lib/serialization/PortfolioSchema'),
11
12
  PositionSummarySchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema'),
12
- PositionSummaryDefinitionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummaryDefinitionSchema'),
13
13
  PositionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSchema'),
14
14
  TransactionSchema = require('@barchart/portfolio-api-common/lib/serialization/TransactionSchema');
15
15
 
@@ -197,26 +197,6 @@ module.exports = (() => {
197
197
  .withErrorInterceptor(ErrorInterceptor.GENERAL)
198
198
  .endpoint;
199
199
 
200
- this._readPositionSummaryDefinitionEndpoint = EndpointBuilder.for('read-position-summary-definitions', 'read position summary definitions')
201
- .withVerb(VerbType.GET)
202
- .withProtocol(protocolType)
203
- .withHost(host)
204
- .withPort(port)
205
- .withPathBuilder((pb) => {
206
- pb.withLiteralParameter('portfolios', 'portfolios')
207
- .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
208
- .withLiteralParameter('summaries', 'summaries')
209
- .withLiteralParameter('ranges', 'ranges');
210
- })
211
- .withQueryBuilder((qb) => {
212
- qb.withVariableParameter('frames', 'frames', 'frames', true, frames => frames.map(f => f.code).join());
213
- })
214
- .withRequestInterceptor(requestInterceptorToUse)
215
- .withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
216
- .withResponseInterceptor(responseInterceptorForPositionSummaryDefinitionDeserialization)
217
- .withErrorInterceptor(ErrorInterceptor.GENERAL)
218
- .endpoint;
219
-
220
200
  this._readTransactionsEndpoint = EndpointBuilder.for('read-transactions', 'read transactions')
221
201
  .withVerb(VerbType.GET)
222
202
  .withProtocol(protocolType)
@@ -348,6 +328,26 @@ module.exports = (() => {
348
328
  .withErrorInterceptor(ErrorInterceptor.GENERAL)
349
329
  .endpoint;
350
330
 
331
+ this._readBrokerageReportAvailabilityEndpoint = EndpointBuilder.for('read-brokerage-report-availability', 'read brokerage report availability')
332
+ .withVerb(VerbType.GET)
333
+ .withProtocol(protocolType)
334
+ .withHost(host)
335
+ .withPort(port)
336
+ .withPathBuilder((pb) => {
337
+ pb.withLiteralParameter('portfolios', 'portfolios')
338
+ .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
339
+ .withLiteralParameter('summaries', 'summaries')
340
+ .withLiteralParameter('ranges', 'ranges');
341
+ })
342
+ .withQueryBuilder((qb) => {
343
+ qb.withVariableParameter('frames', 'frames', 'frames', true, frames => frames.map(f => f.code).join());
344
+ })
345
+ .withRequestInterceptor(requestInterceptorToUse)
346
+ .withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
347
+ .withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization)
348
+ .withErrorInterceptor(ErrorInterceptor.GENERAL)
349
+ .endpoint;
350
+
351
351
  this._downloadBrokerageReportEndpoint = EndpointBuilder.for('download-brokerage-report', 'download brokerage report')
352
352
  .withVerb(VerbType.GET)
353
353
  .withProtocol(protocolType)
@@ -355,9 +355,8 @@ module.exports = (() => {
355
355
  .withPort(port)
356
356
  .withPathBuilder((pb) => {
357
357
  pb.withLiteralParameter('reports', 'reports')
358
- .withLiteralParameter('pdf', 'pdf')
358
+ .withLiteralParameter('portfolios', 'portfolios')
359
359
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
360
- .withLiteralParameter('brokerage', 'brokerage')
361
360
  .withLiteralParameter('frames', 'frames')
362
361
  .withVariableParameter('frame', 'frame', 'frame', false, x => x.code)
363
362
  .withLiteralParameter('date', 'date')
@@ -646,27 +645,6 @@ module.exports = (() => {
646
645
  });
647
646
  }
648
647
 
649
- /**
650
- * Returns all position summary definitions for a portfolio.
651
- *
652
- * @public
653
- * @param {String} portfolio
654
- * @param {Array.<PositionSummaryFrame>} frames
655
- */
656
- readPositionSummaryDefinitions(portfolio, frames) {
657
- return Promise.resolve()
658
- .then(() => {
659
- assert.argumentIsRequired(portfolio, 'portfolio', String);
660
-
661
- const payload = { };
662
-
663
- payload.portfolio = portfolio;
664
- payload.frames = frames;
665
-
666
- return Gateway.invoke(this._readPositionSummaryDefinitionEndpoint, payload);
667
- });
668
- }
669
-
670
648
  /**
671
649
  * Deletes a position.
672
650
  *
@@ -923,27 +901,46 @@ module.exports = (() => {
923
901
  });
924
902
  }
925
903
 
904
+ /**
905
+ * Returns all position summary definitions for a portfolio.
906
+ *
907
+ * @public
908
+ * @param {String} portfolio
909
+ */
910
+ readBrokerageReportAvailability(portfolio) {
911
+ return Promise.resolve()
912
+ .then(() => {
913
+ assert.argumentIsRequired(portfolio, 'portfolio', String);
914
+
915
+ const payload = { };
916
+
917
+ payload.portfolio = portfolio;
918
+
919
+ return Gateway.invoke(this._readBrokerageReportAvailabilityEndpoint, payload);
920
+ });
921
+ }
922
+
926
923
  /**
927
924
  * @public
928
925
  * @param {String=} portfolio
929
926
  * @param {PositionSummaryFrame} frame
930
- * @param {Day} start
927
+ * @param {Day} end
931
928
  * @returns {Promise}
932
929
  */
933
- downloadBrokerageReport(portfolio, frame, start) {
930
+ downloadBrokerageReport(portfolio, frame, end) {
934
931
  return Promise.resolve()
935
932
  .then(() => {
936
933
  checkStart.call(this);
937
934
 
938
935
  assert.argumentIsRequired(portfolio, 'portfolio', String);
939
936
  assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
940
- assert.argumentIsRequired(start, 'start', Day, 'Day');
937
+ assert.argumentIsRequired(end, 'end', Day, 'Day');
941
938
 
942
939
  const payload = { };
943
940
 
944
941
  payload.portfolio = portfolio;
945
942
  payload.frame = frame;
946
- payload.start = start;
943
+ payload.start = end;
947
944
 
948
945
  return Gateway.invoke(this._downloadBrokerageReportEndpoint, payload);
949
946
  });
@@ -1103,11 +1100,11 @@ module.exports = (() => {
1103
1100
  }
1104
1101
  });
1105
1102
 
1106
- const responseInterceptorForPositionSummaryDefinitionDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
1103
+ const responseInterceptorForBrokerageReportAvailabilityDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
1107
1104
  try {
1108
- return JSON.parse(response.data, PositionSummaryDefinitionSchema.COMPLETE.schema.getReviver());
1105
+ return JSON.parse(response.data, BrokerageReportAvailabilitySchema.COMPLETE.schema.getReviver());
1109
1106
  } catch (e) {
1110
- console.log('Error deserializing position summary definition', e);
1107
+ console.log('Error deserializing brokerage report availability definition', e);
1111
1108
  }
1112
1109
  });
1113
1110
 
package/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtGateway: JwtGateway,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '1.2.30'
10
+ version: '1.2.33'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "1.2.30",
3
+ "version": "1.2.33",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",