@barchart/portfolio-client-js 1.3.3 → 1.3.4

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.
@@ -282,7 +282,7 @@ module.exports = function () {
282
282
  }).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
283
283
 
284
284
  _this._readBrokerageReportAvailabilityEndpoint = EndpointBuilder.for('read-brokerage-report-availability', 'read brokerage report availability').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
285
- pb.withLiteralParameter('json', 'json').withLiteralParameter('reports', 'reports').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('availability', 'availability');
285
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('reports', 'reports').withLiteralParameter('brokerage', 'brokerage').withLiteralParameter('availability', 'availability');
286
286
  }).withQueryBuilder(function (qb) {
287
287
  qb.withVariableParameter('frames', 'frames', 'frames', true, function (frames) {
288
288
  return frames.map(function (f) {
@@ -290,6 +290,10 @@ module.exports = function () {
290
290
  }).join();
291
291
  });
292
292
  }).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
293
+
294
+ _this._brokerageReportUrlGenerator = function (portfolio, frame, end) {
295
+ return 'https://' + host + '/binary/reports/portfolios/' + portfolio + '/frames/' + frame.code + '/date/' + end.format();
296
+ };
293
297
  return _this;
294
298
  }
295
299
 
@@ -920,9 +924,20 @@ module.exports = function () {
920
924
  return Gateway.invoke(_this20._readBrokerageReportAvailabilityEndpoint, payload);
921
925
  });
922
926
  }
927
+
928
+ /**
929
+ * Generates a URL suitable for downloading a brokerage report (as a PDF).
930
+ *
931
+ * @public
932
+ * @param {String} portfolio
933
+ * @param {PositionSummaryFrame} frame
934
+ * @param {Day} end
935
+ * @return {Promise<String>}
936
+ */
937
+
923
938
  }, {
924
939
  key: 'getBrokerageReportUrl',
925
- value: function getBrokerageReportUrl(portfolio, frame, start) {
940
+ value: function getBrokerageReportUrl(portfolio, frame, end) {
926
941
  var _this21 = this;
927
942
 
928
943
  return Promise.resolve().then(function () {
@@ -930,9 +945,9 @@ module.exports = function () {
930
945
 
931
946
  assert.argumentIsRequired(portfolio, 'portfolio', String);
932
947
  assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
933
- assert.argumentIsRequired(start, 'start', Day, 'Day');
948
+ assert.argumentIsRequired(end, 'end', Day, 'Day');
934
949
 
935
- return 'https://portfolio-dev.aws.barchart.com/binary/reports/portfolios/9555fb81-f640-4a95-8766-aa59f38d2abd/frames/MONTHLY/date/2017-06-30';
950
+ return _this21._brokerageReportUrlGenerator(portfolio, frame, end);
936
951
  });
937
952
  }
938
953
 
@@ -1578,7 +1593,7 @@ module.exports = function () {
1578
1593
  return {
1579
1594
  JwtGateway: JwtGateway,
1580
1595
  PortfolioGateway: PortfolioGateway,
1581
- version: '1.3.3'
1596
+ version: '1.3.4'
1582
1597
  };
1583
1598
  }();
1584
1599
 
@@ -349,9 +349,10 @@ module.exports = (() => {
349
349
  .withPort(port)
350
350
  .withPathBuilder((pb) => {
351
351
  pb.withLiteralParameter('json', 'json')
352
- .withLiteralParameter('reports', 'reports')
353
352
  .withLiteralParameter('portfolios', 'portfolios')
354
353
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
354
+ .withLiteralParameter('reports', 'reports')
355
+ .withLiteralParameter('brokerage', 'brokerage')
355
356
  .withLiteralParameter('availability', 'availability');
356
357
  })
357
358
  .withQueryBuilder((qb) => {
@@ -362,6 +363,10 @@ module.exports = (() => {
362
363
  .withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization)
363
364
  .withErrorInterceptor(ErrorInterceptor.GENERAL)
364
365
  .endpoint;
366
+
367
+ this._brokerageReportUrlGenerator = (portfolio, frame, end) => {
368
+ return `https://${host}/binary/reports/portfolios/${portfolio}/frames/${frame.code}/date/${end.format()}`;
369
+ };
365
370
  }
366
371
 
367
372
  /**
@@ -917,16 +922,25 @@ module.exports = (() => {
917
922
  });
918
923
  }
919
924
 
920
- getBrokerageReportUrl(portfolio, frame, start) {
925
+ /**
926
+ * Generates a URL suitable for downloading a brokerage report (as a PDF).
927
+ *
928
+ * @public
929
+ * @param {String} portfolio
930
+ * @param {PositionSummaryFrame} frame
931
+ * @param {Day} end
932
+ * @return {Promise<String>}
933
+ */
934
+ getBrokerageReportUrl(portfolio, frame, end) {
921
935
  return Promise.resolve()
922
936
  .then(() => {
923
937
  checkStart.call(this);
924
938
 
925
939
  assert.argumentIsRequired(portfolio, 'portfolio', String);
926
940
  assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
927
- assert.argumentIsRequired(start, 'start', Day, 'Day');
941
+ assert.argumentIsRequired(end, 'end', Day, 'Day');
928
942
 
929
- return 'https://portfolio-dev.aws.barchart.com/binary/reports/portfolios/9555fb81-f640-4a95-8766-aa59f38d2abd/frames/MONTHLY/date/2017-06-30';
943
+ return this._brokerageReportUrlGenerator(portfolio, frame, end);
930
944
  });
931
945
  }
932
946
 
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.3.3'
10
+ version: '1.3.4'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",