@barchart/portfolio-client-js 1.2.45 → 1.3.3

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
@@ -8,7 +8,6 @@ The code is documented with [JSDoc](http://usejsdoc.org/). While the output hasn
8
8
  > npm install
9
9
  > gulp document
10
10
 
11
-
12
11
  ## Development
13
12
 
14
13
  Gulp is used to check "linting" and to run unit tests.
@@ -18,7 +17,6 @@ Gulp is used to check "linting" and to run unit tests.
18
17
  > gulp lint
19
18
  > gulp test
20
19
 
21
-
22
20
  ## Build
23
21
 
24
22
  Polyfills for ES6 are required:
@@ -194,37 +194,37 @@ module.exports = function () {
194
194
  }
195
195
 
196
196
  _this._readPortfoliosEndpoint = EndpointBuilder.for('read-portfolios', 'read portfolios').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
197
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
197
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
198
198
  }).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
199
199
 
200
200
  _this._createPortfolioEndpoint = EndpointBuilder.for('create-portfolio', 'create portfolio').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
201
- pb.withLiteralParameter('portfolios', 'portfolios');
201
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios');
202
202
  }).withBody('portfolio').withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(RequestInterceptor.fromDelegate(createPortfolioRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
203
203
 
204
204
  _this._updatePortfolioEndpoint = EndpointBuilder.for('update-portfolio', 'update portfolio').withVerb(VerbType.PUT).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
205
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
205
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
206
206
  }).withBody('portfolio').withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(RequestInterceptor.fromDelegate(updatePortfolioRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
207
207
 
208
208
  _this._deletePortfolioEndpoint = EndpointBuilder.for('delete-portfolio', 'delete portfolio').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
209
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
209
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
210
210
  }).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
211
211
 
212
212
  _this._readPositionsEndpoint = EndpointBuilder.for('read-positions', 'read positions').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
213
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
213
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
214
214
  }).withQueryBuilder(function (qb) {
215
215
  qb.withVariableParameter('includePreviousPrice', 'includePreviousPrice', 'includePreviousPrice', true);
216
216
  }).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForPositionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
217
217
 
218
218
  _this._updatePositionEndpoint = EndpointBuilder.for('update-position', 'update position').withVerb(VerbType.PUT).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
219
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
219
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
220
220
  }).withBody('portfolio').withRequestInterceptor(RequestInterceptor.fromDelegate(updatePositionRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
221
221
 
222
222
  _this._deletePositionEndpoint = EndpointBuilder.for('delete-position', 'delete position').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
223
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
223
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
224
224
  }).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
225
225
 
226
226
  _this._readPositionSummariesEndpoint = EndpointBuilder.for('read-position-summaries', 'read position summaries').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
227
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('summaries', 'summaries').withVariableParameter('position', 'position', 'position', false);
227
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('summaries', 'summaries').withVariableParameter('position', 'position', 'position', false);
228
228
  }).withQueryBuilder(function (qb) {
229
229
  qb.withVariableParameter('frames', 'frames', 'frames', true, function (frames) {
230
230
  return frames.map(function (f) {
@@ -236,13 +236,13 @@ module.exports = function () {
236
236
  }).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForPositionSummaryDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
237
237
 
238
238
  _this._readTransactionsEndpoint = EndpointBuilder.for('read-transactions', 'read transactions').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
239
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
239
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
240
240
  }).withQueryBuilder(function (qb) {
241
241
  qb.withLiteralParameter('mode', 'mode', 'text');
242
242
  }).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForTransactionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
243
243
 
244
244
  _this._createTransactionEndpoint = EndpointBuilder.for('create-transaction', 'create transaction').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
245
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
245
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
246
246
  }).withQueryBuilder(function (qb) {
247
247
  qb.withVariableParameter('type', 'type', 'type', false, function (x) {
248
248
  return x.code;
@@ -250,11 +250,11 @@ module.exports = function () {
250
250
  }).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
251
251
 
252
252
  _this._batchTransactionEndpoint = EndpointBuilder.for('batch-transactions', 'batch transactions').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
253
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withLiteralParameter('multiple', 'multiple').withLiteralParameter('transactions', 'transactions');
253
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withLiteralParameter('multiple', 'multiple').withLiteralParameter('transactions', 'transactions');
254
254
  }).withBody('transactions').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
255
255
 
256
256
  _this._editTransactionEndpoint = EndpointBuilder.for('edit-transaction', 'edit transaction').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
257
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
257
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
258
258
  }).withQueryBuilder(function (qb) {
259
259
  qb.withVariableParameter('type', 'type', 'type', false, function (x) {
260
260
  return x.code;
@@ -262,7 +262,7 @@ module.exports = function () {
262
262
  }).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
263
263
 
264
264
  _this._deleteTransactionEndpoint = EndpointBuilder.for('delete-transaction', 'delete transaction').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
265
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
265
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
266
266
  }).withQueryBuilder(function (qb) {
267
267
  qb.withVariableParameter('force', 'force', 'force', false).withVariableParameter('echoStart', 'echoStart', 'echoStart', true, function (x) {
268
268
  return x.format();
@@ -272,7 +272,7 @@ module.exports = function () {
272
272
  }).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
273
273
 
274
274
  _this._readTransactionsReportEndpoint = EndpointBuilder.for('read-transaction-report', 'read transaction report').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
275
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', true).withLiteralParameter('transactions', 'transactions').withLiteralParameter('formatted', 'formatted');
275
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', true).withLiteralParameter('transactions', 'transactions').withLiteralParameter('formatted', 'formatted');
276
276
  }).withQueryBuilder(function (qb) {
277
277
  qb.withVariableParameter('start', 'start', 'start', true, function (x) {
278
278
  return x.format();
@@ -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('reports', 'reports').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('availability', 'availability');
285
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('reports', 'reports').withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).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,14 +290,6 @@ 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._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('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('frames', 'frames').withVariableParameter('frame', 'frame', 'frame', false, function (x) {
296
- return x.code;
297
- }).withLiteralParameter('date', 'date').withVariableParameter('start', 'start', 'start', false, function (x) {
298
- return x.format();
299
- });
300
- }).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
301
293
  return _this;
302
294
  }
303
295
 
@@ -318,7 +310,7 @@ module.exports = function () {
318
310
  * containing the current instance.
319
311
  *
320
312
  * @public
321
- * @returns {Promise.<PortfolioGateway>}
313
+ * @returns {Promise<PortfolioGateway>}
322
314
  */
323
315
  value: function start() {
324
316
  var _this2 = this;
@@ -345,7 +337,7 @@ module.exports = function () {
345
337
  *
346
338
  * @public
347
339
  * @param {String=} portfolio
348
- * @returns {Promise.<Portfolio[]>}
340
+ * @returns {Promise<Portfolio[]>}
349
341
  */
350
342
 
351
343
  }, {
@@ -367,7 +359,7 @@ module.exports = function () {
367
359
  *
368
360
  * @public
369
361
  * @param {Object} portfolio
370
- * @returns {Promise.<Portfolio>}
362
+ * @returns {Promise<Portfolio>}
371
363
  */
372
364
 
373
365
  }, {
@@ -389,7 +381,7 @@ module.exports = function () {
389
381
  *
390
382
  * @public
391
383
  * @param {Object} portfolio
392
- * @returns {Promise.<Portfolio>}
384
+ * @returns {Promise<Portfolio>}
393
385
  */
394
386
 
395
387
  }, {
@@ -411,7 +403,7 @@ module.exports = function () {
411
403
  *
412
404
  * @public
413
405
  * @param {Object} portfolio
414
- * @returns {Promise.<Portfolio>}
406
+ * @returns {Promise<Portfolio>}
415
407
  */
416
408
 
417
409
  }, {
@@ -433,7 +425,7 @@ module.exports = function () {
433
425
  *
434
426
  * @public
435
427
  * @param {String} portfolio - ID of the portfolio to update
436
- * @returns {Promise.<Portfolio>}
428
+ * @returns {Promise<Portfolio>}
437
429
  */
438
430
 
439
431
  }, {
@@ -457,7 +449,7 @@ module.exports = function () {
457
449
  * @param {String=} portfolio
458
450
  * @param {String=} position
459
451
  * @param {Boolean=} includePreviousPrice
460
- * @returns {Promise.<Position[]>}
452
+ * @returns {Promise<Position[]>}
461
453
  */
462
454
 
463
455
  }, {
@@ -481,7 +473,7 @@ module.exports = function () {
481
473
  *
482
474
  * @public
483
475
  * @param {Object} position
484
- * @returns {Promise.<Position>}
476
+ * @returns {Promise<Position>}
485
477
  */
486
478
 
487
479
  }, {
@@ -549,10 +541,10 @@ module.exports = function () {
549
541
  * @public
550
542
  * @param {String=} portfolio
551
543
  * @param {String=} position
552
- * @param {Array.<PositionSummaryFrame>=|Array.<String>=} frames
544
+ * @param {Array<PositionSummaryFrame>=|Array<String>=} frames
553
545
  * @param {Number=} periods
554
546
  * @param {Day=|String=} start
555
- * @returns {Promise.<Position[]>}
547
+ * @returns {Promise<Position[]>}
556
548
  */
557
549
 
558
550
  }, {
@@ -624,7 +616,7 @@ module.exports = function () {
624
616
  * @public
625
617
  * @param {String} portfolio
626
618
  * @param {String} position
627
- * @returns {Promise.<Position[]>}
619
+ * @returns {Promise<Position[]>}
628
620
  */
629
621
 
630
622
  }, {
@@ -647,7 +639,7 @@ module.exports = function () {
647
639
  *
648
640
  * @public
649
641
  * @param {Object} transaction
650
- * @returns {Promise.<TransactionMutateResult>}
642
+ * @returns {Promise<TransactionMutateResult>}
651
643
  */
652
644
 
653
645
  }, {
@@ -720,7 +712,7 @@ module.exports = function () {
720
712
  *
721
713
  * @public
722
714
  * @param {Object} transaction
723
- * @returns {Promise.<TransactionMutateResult>}
715
+ * @returns {Promise<TransactionMutateResult>}
724
716
  */
725
717
 
726
718
  }, {
@@ -752,7 +744,7 @@ module.exports = function () {
752
744
  * @param {Boolean=} force
753
745
  * @param {Day=} echoStart
754
746
  * @param {Day=} echoEnd
755
- * @returns {Promise.<TransactionMutateResult>}
747
+ * @returns {Promise<TransactionMutateResult>}
756
748
  */
757
749
 
758
750
  }, {
@@ -795,7 +787,7 @@ module.exports = function () {
795
787
  * @public
796
788
  * @param {String} portfolio
797
789
  * @param {String=} position
798
- * @returns {Promise.<Transaction[]>}
790
+ * @returns {Promise<Transaction[]>}
799
791
  */
800
792
 
801
793
  }, {
@@ -823,7 +815,7 @@ module.exports = function () {
823
815
  * @param {Day=} startDay
824
816
  * @param {Day=} endDay
825
817
  * @oaram {Boolean=} descending
826
- * @returns {Promise.<Object[]>}
818
+ * @returns {Promise<Object[]>}
827
819
  */
828
820
 
829
821
  }, {
@@ -928,18 +920,9 @@ module.exports = function () {
928
920
  return Gateway.invoke(_this20._readBrokerageReportAvailabilityEndpoint, payload);
929
921
  });
930
922
  }
931
-
932
- /**
933
- * @public
934
- * @param {String=} portfolio
935
- * @param {PositionSummaryFrame} frame
936
- * @param {Day} end
937
- * @returns {Promise}
938
- */
939
-
940
923
  }, {
941
- key: 'downloadBrokerageReport',
942
- value: function downloadBrokerageReport(portfolio, frame, end) {
924
+ key: 'getBrokerageReportUrl',
925
+ value: function getBrokerageReportUrl(portfolio, frame, start) {
943
926
  var _this21 = this;
944
927
 
945
928
  return Promise.resolve().then(function () {
@@ -947,15 +930,9 @@ module.exports = function () {
947
930
 
948
931
  assert.argumentIsRequired(portfolio, 'portfolio', String);
949
932
  assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
950
- assert.argumentIsRequired(end, 'end', Day, 'Day');
951
-
952
- var payload = {};
953
-
954
- payload.portfolio = portfolio;
955
- payload.frame = frame;
956
- payload.start = end;
933
+ assert.argumentIsRequired(start, 'start', Day, 'Day');
957
934
 
958
- return Gateway.invoke(_this21._downloadBrokerageReportEndpoint, payload);
935
+ return 'https://portfolio-dev.aws.barchart.com/binary/reports/portfolios/9555fb81-f640-4a95-8766-aa59f38d2abd/frames/MONTHLY/date/2017-06-30';
959
936
  });
960
937
  }
961
938
 
@@ -964,8 +941,8 @@ module.exports = function () {
964
941
  *
965
942
  * @public
966
943
  * @static
967
- * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
968
- * @returns {Promise.<PortfolioGateway>}
944
+ * @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
945
+ * @returns {Promise<PortfolioGateway>}
969
946
  */
970
947
 
971
948
  }, {
@@ -998,8 +975,8 @@ module.exports = function () {
998
975
  *
999
976
  * @public
1000
977
  * @static
1001
- * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
1002
- * @returns {Promise.<PortfolioGateway>}
978
+ * @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
979
+ * @returns {Promise<PortfolioGateway>}
1003
980
  */
1004
981
 
1005
982
  }, {
@@ -1017,8 +994,8 @@ module.exports = function () {
1017
994
  *
1018
995
  * @public
1019
996
  * @static
1020
- * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
1021
- * @returns {Promise.<PortfolioGateway>}
997
+ * @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
998
+ * @returns {Promise<PortfolioGateway>}
1022
999
  */
1023
1000
 
1024
1001
  }, {
@@ -1036,8 +1013,8 @@ module.exports = function () {
1036
1013
  *
1037
1014
  * @public
1038
1015
  * @static
1039
- * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
1040
- * @returns {Promise.<PortfolioGateway>}
1016
+ * @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
1017
+ * @returns {Promise<PortfolioGateway>}
1041
1018
  */
1042
1019
 
1043
1020
  }, {
@@ -1195,8 +1172,8 @@ module.exports = function () {
1195
1172
  *
1196
1173
  * @typedef TransactionMutateResult
1197
1174
  * @type {Object}
1198
- * @property {Array.<Object>} positions - All positions updated as a consequence of processing the transaction.
1199
- * @property {Array.<Object>} summaries - All position summaries updated as a consequence of processing the transaction.
1175
+ * @property {Object[]} positions - All positions updated as a consequence of processing the transaction.
1176
+ * @property {Object[]} summaries - All position summaries updated as a consequence of processing the transaction.
1200
1177
  * @property {Boolean} replaced - If true, the position (and position summaries) need to be replaced.
1201
1178
  */
1202
1179
 
@@ -1267,7 +1244,7 @@ module.exports = function () {
1267
1244
  * containing the current instance
1268
1245
  *
1269
1246
  * @public
1270
- * @returns {Promise.<JwtGateway>}
1247
+ * @returns {Promise<JwtGateway>}
1271
1248
  */
1272
1249
 
1273
1250
 
@@ -1297,7 +1274,7 @@ module.exports = function () {
1297
1274
  * Retrieves a JWT token from the remote server.
1298
1275
  *
1299
1276
  * @public
1300
- * @returns {Promise.<String>}
1277
+ * @returns {Promise<String>}
1301
1278
  */
1302
1279
 
1303
1280
  }, {
@@ -1336,7 +1313,7 @@ module.exports = function () {
1336
1313
  var refreshToken = function refreshToken() {
1337
1314
  var refreshPromise = scheduler.backoff(function () {
1338
1315
  return _this4.readToken();
1339
- }, 100, 'Read JWT token', 3).then(function (token) {
1316
+ }, 0, 'Read JWT token', 3).then(function (token) {
1340
1317
  if (_this4._refreshInterval) {
1341
1318
  cachePromise = refreshPromise;
1342
1319
  }
@@ -1393,7 +1370,7 @@ module.exports = function () {
1393
1370
  * @static
1394
1371
  * @param {String} userId - The identifier of the user to impersonate.
1395
1372
  * @param {String} userLegacyId - The legacy identifier of the user to impersonate.
1396
- * @returns {Promise.<JwtGateway>}
1373
+ * @returns {Promise<JwtGateway>}
1397
1374
  */
1398
1375
 
1399
1376
  }, {
@@ -1418,7 +1395,7 @@ module.exports = function () {
1418
1395
  * @public
1419
1396
  * @static
1420
1397
  * @param {String} userId - The identifier of the user to impersonate.
1421
- * @returns {Promise.<RequestInterceptor>}
1398
+ * @returns {Promise<RequestInterceptor>}
1422
1399
  */
1423
1400
 
1424
1401
  }, {
@@ -1434,8 +1411,8 @@ module.exports = function () {
1434
1411
  *
1435
1412
  * @public
1436
1413
  * @static
1437
- * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
1438
- * @returns {Promise.<JwtGateway>}
1414
+ * @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
1415
+ * @returns {Promise<JwtGateway>}
1439
1416
  */
1440
1417
 
1441
1418
  }, {
@@ -1451,8 +1428,8 @@ module.exports = function () {
1451
1428
  *
1452
1429
  * @public
1453
1430
  * @static
1454
- * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
1455
- * @returns {Promise.<RequestInterceptor>}
1431
+ * @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
1432
+ * @returns {Promise<RequestInterceptor>}
1456
1433
  */
1457
1434
 
1458
1435
  }, {
@@ -1468,8 +1445,8 @@ module.exports = function () {
1468
1445
  *
1469
1446
  * @public
1470
1447
  * @static
1471
- * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
1472
- * @returns {Promise.<JwtGateway>}
1448
+ * @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
1449
+ * @returns {Promise<JwtGateway>}
1473
1450
  */
1474
1451
 
1475
1452
  }, {
@@ -1485,8 +1462,8 @@ module.exports = function () {
1485
1462
  *
1486
1463
  * @public
1487
1464
  * @static
1488
- * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
1489
- * @returns {Promise.<RequestInterceptor>}
1465
+ * @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
1466
+ * @returns {Promise<RequestInterceptor>}
1490
1467
  */
1491
1468
 
1492
1469
  }, {
@@ -1504,7 +1481,7 @@ module.exports = function () {
1504
1481
  * @static
1505
1482
  * @param {String} userId - The identifier of the user to impersonate.
1506
1483
  * @param {String} userLegacyId - The legacy identifier of the user to impersonate.
1507
- * @returns {Promise.<JwtGateway>}
1484
+ * @returns {Promise<JwtGateway>}
1508
1485
  */
1509
1486
 
1510
1487
  }, {
@@ -1519,7 +1496,7 @@ module.exports = function () {
1519
1496
  * @public
1520
1497
  * @static
1521
1498
  * @param {String} userId - The identifier of the user to impersonate.
1522
- * @returns {Promise.<RequestInterceptor>}
1499
+ * @returns {Promise<RequestInterceptor>}
1523
1500
  */
1524
1501
 
1525
1502
  }, {
@@ -1552,7 +1529,7 @@ module.exports = function () {
1552
1529
 
1553
1530
  function _forDevelopment(userId, legacyUserId) {
1554
1531
  return EndpointBuilder.for('read-jwt-token-for-development', 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.developmentHost).withPathBuilder(function (pb) {
1555
- pb.withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
1532
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
1556
1533
  }).withQueryBuilder(function (qb) {
1557
1534
  qb.withLiteralParameter('user', 'userId', userId).withLiteralParameter('legacy user', 'userLegacyId', legacyUserId).withLiteralParameter('user context', 'userContext', 'TGAM').withLiteralParameter('user permission level', 'userPermissions', 'registered');
1558
1535
  }).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
@@ -1560,19 +1537,19 @@ module.exports = function () {
1560
1537
 
1561
1538
  function _forStaging(externalRequestInterceptor) {
1562
1539
  return EndpointBuilder.for('translate-jwt-token-for-staging', 'lookup Barchart user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.stagingHost).withPathBuilder(function (pb) {
1563
- return pb.withLiteralParameter('token', 'token').withLiteralParameter('system', 'tgam').withLiteralParameter('converter', 'converter');
1540
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('token', 'token').withLiteralParameter('system', 'tgam').withLiteralParameter('converter', 'converter');
1564
1541
  }).withRequestInterceptor(externalRequestInterceptor).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
1565
1542
  }
1566
1543
 
1567
1544
  function _forProduction(externalRequestInterceptor) {
1568
1545
  return EndpointBuilder.for('translate-jwt-token-for-production', 'lookup Barchart user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.productionHost).withPathBuilder(function (pb) {
1569
- return pb.withLiteralParameter('token', 'token').withLiteralParameter('system', 'tgam').withLiteralParameter('converter', 'converter');
1546
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('token', 'token').withLiteralParameter('system', 'tgam').withLiteralParameter('converter', 'converter');
1570
1547
  }).withRequestInterceptor(externalRequestInterceptor).withResponseInterceptor(ResponseInterceptor.DATA).endpoint;
1571
1548
  }
1572
1549
 
1573
1550
  function _forAdmin(userId, legacyUserId) {
1574
1551
  return EndpointBuilder.for('read-jwt-token-for-admin', 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHost(Configuration.adminHost).withPathBuilder(function (pb) {
1575
- pb.withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
1552
+ pb.withLiteralParameter('json', 'json').withLiteralParameter('token', 'token').withLiteralParameter('barchart', 'barchart').withLiteralParameter('generator', 'generator');
1576
1553
  }).withQueryBuilder(function (qb) {
1577
1554
  if (userId) {
1578
1555
  qb.withLiteralParameter('user', 'userId', userId);
@@ -1601,7 +1578,7 @@ module.exports = function () {
1601
1578
  return {
1602
1579
  JwtGateway: JwtGateway,
1603
1580
  PortfolioGateway: PortfolioGateway,
1604
- version: '1.2.45'
1581
+ version: '1.3.3'
1605
1582
  };
1606
1583
  }();
1607
1584
 
@@ -65,7 +65,8 @@ module.exports = (() => {
65
65
  .withHost(host)
66
66
  .withPort(port)
67
67
  .withPathBuilder((pb) => {
68
- pb.withLiteralParameter('portfolios', 'portfolios')
68
+ pb.withLiteralParameter('json', 'json')
69
+ .withLiteralParameter('portfolios', 'portfolios')
69
70
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
70
71
  })
71
72
  .withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
@@ -80,7 +81,8 @@ module.exports = (() => {
80
81
  .withHost(host)
81
82
  .withPort(port)
82
83
  .withPathBuilder((pb) => {
83
- pb.withLiteralParameter('portfolios', 'portfolios');
84
+ pb.withLiteralParameter('json', 'json')
85
+ .withLiteralParameter('portfolios', 'portfolios');
84
86
  })
85
87
  .withBody('portfolio')
86
88
  .withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
@@ -96,7 +98,8 @@ module.exports = (() => {
96
98
  .withHost(host)
97
99
  .withPort(port)
98
100
  .withPathBuilder((pb) => {
99
- pb.withLiteralParameter('portfolios', 'portfolios')
101
+ pb.withLiteralParameter('json', 'json')
102
+ .withLiteralParameter('portfolios', 'portfolios')
100
103
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
101
104
  })
102
105
  .withBody('portfolio')
@@ -113,7 +116,8 @@ module.exports = (() => {
113
116
  .withHost(host)
114
117
  .withPort(port)
115
118
  .withPathBuilder((pb) => {
116
- pb.withLiteralParameter('portfolios', 'portfolios')
119
+ pb.withLiteralParameter('json', 'json')
120
+ .withLiteralParameter('portfolios', 'portfolios')
117
121
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
118
122
  })
119
123
  .withRequestInterceptor(requestInterceptorToUse)
@@ -126,7 +130,8 @@ module.exports = (() => {
126
130
  .withHost(host)
127
131
  .withPort(port)
128
132
  .withPathBuilder((pb) => {
129
- pb.withLiteralParameter('portfolios', 'portfolios')
133
+ pb.withLiteralParameter('json', 'json')
134
+ .withLiteralParameter('portfolios', 'portfolios')
130
135
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
131
136
  .withLiteralParameter('positions', 'positions')
132
137
  .withVariableParameter('position', 'position', 'position', false);
@@ -146,7 +151,8 @@ module.exports = (() => {
146
151
  .withHost(host)
147
152
  .withPort(port)
148
153
  .withPathBuilder((pb) => {
149
- pb.withLiteralParameter('portfolios', 'portfolios')
154
+ pb.withLiteralParameter('json', 'json')
155
+ .withLiteralParameter('portfolios', 'portfolios')
150
156
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
151
157
  .withLiteralParameter('positions', 'positions')
152
158
  .withVariableParameter('position', 'position', 'position', false);
@@ -164,7 +170,8 @@ module.exports = (() => {
164
170
  .withHost(host)
165
171
  .withPort(port)
166
172
  .withPathBuilder((pb) => {
167
- pb.withLiteralParameter('portfolios', 'portfolios')
173
+ pb.withLiteralParameter('json', 'json')
174
+ .withLiteralParameter('portfolios', 'portfolios')
168
175
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
169
176
  .withLiteralParameter('positions', 'positions')
170
177
  .withVariableParameter('position', 'position', 'position', false);
@@ -181,7 +188,8 @@ module.exports = (() => {
181
188
  .withHost(host)
182
189
  .withPort(port)
183
190
  .withPathBuilder((pb) => {
184
- pb.withLiteralParameter('portfolios', 'portfolios')
191
+ pb.withLiteralParameter('json', 'json')
192
+ .withLiteralParameter('portfolios', 'portfolios')
185
193
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
186
194
  .withLiteralParameter('summaries', 'summaries')
187
195
  .withVariableParameter('position', 'position', 'position', false);
@@ -203,7 +211,8 @@ module.exports = (() => {
203
211
  .withHost(host)
204
212
  .withPort(port)
205
213
  .withPathBuilder((pb) => {
206
- pb.withLiteralParameter('portfolios', 'portfolios')
214
+ pb.withLiteralParameter('json', 'json')
215
+ .withLiteralParameter('portfolios', 'portfolios')
207
216
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
208
217
  .withLiteralParameter('positions', 'positions')
209
218
  .withVariableParameter('position', 'position', 'position', false)
@@ -224,7 +233,8 @@ module.exports = (() => {
224
233
  .withHost(host)
225
234
  .withPort(port)
226
235
  .withPathBuilder((pb) => {
227
- pb.withLiteralParameter('portfolios', 'portfolios')
236
+ pb.withLiteralParameter('json', 'json')
237
+ .withLiteralParameter('portfolios', 'portfolios')
228
238
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
229
239
  .withLiteralParameter('positions', 'positions')
230
240
  .withVariableParameter('position', 'position', 'position', false)
@@ -245,7 +255,8 @@ module.exports = (() => {
245
255
  .withHost(host)
246
256
  .withPort(port)
247
257
  .withPathBuilder((pb) => {
248
- pb.withLiteralParameter('portfolios', 'portfolios')
258
+ pb.withLiteralParameter('json', 'json')
259
+ .withLiteralParameter('portfolios', 'portfolios')
249
260
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
250
261
  .withLiteralParameter('positions', 'positions')
251
262
  .withLiteralParameter('multiple', 'multiple')
@@ -263,7 +274,8 @@ module.exports = (() => {
263
274
  .withHost(host)
264
275
  .withPort(port)
265
276
  .withPathBuilder((pb) => {
266
- pb.withLiteralParameter('portfolios', 'portfolios')
277
+ pb.withLiteralParameter('json', 'json')
278
+ .withLiteralParameter('portfolios', 'portfolios')
267
279
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
268
280
  .withLiteralParameter('positions', 'positions')
269
281
  .withVariableParameter('position', 'position', 'position', false)
@@ -285,7 +297,8 @@ module.exports = (() => {
285
297
  .withHost(host)
286
298
  .withPort(port)
287
299
  .withPathBuilder((pb) => {
288
- pb.withLiteralParameter('portfolios', 'portfolios')
300
+ pb.withLiteralParameter('json', 'json')
301
+ .withLiteralParameter('portfolios', 'portfolios')
289
302
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
290
303
  .withLiteralParameter('positions', 'positions')
291
304
  .withVariableParameter('position', 'position', 'position', false)
@@ -308,7 +321,8 @@ module.exports = (() => {
308
321
  .withHost(host)
309
322
  .withPort(port)
310
323
  .withPathBuilder((pb) => {
311
- pb.withLiteralParameter('portfolios', 'portfolios')
324
+ pb.withLiteralParameter('json', 'json')
325
+ .withLiteralParameter('portfolios', 'portfolios')
312
326
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
313
327
  .withLiteralParameter('positions', 'positions')
314
328
  .withVariableParameter('position', 'position', 'position', true)
@@ -334,7 +348,8 @@ module.exports = (() => {
334
348
  .withHost(host)
335
349
  .withPort(port)
336
350
  .withPathBuilder((pb) => {
337
- pb.withLiteralParameter('reports', 'reports')
351
+ pb.withLiteralParameter('json', 'json')
352
+ .withLiteralParameter('reports', 'reports')
338
353
  .withLiteralParameter('portfolios', 'portfolios')
339
354
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
340
355
  .withLiteralParameter('availability', 'availability');
@@ -347,24 +362,6 @@ module.exports = (() => {
347
362
  .withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization)
348
363
  .withErrorInterceptor(ErrorInterceptor.GENERAL)
349
364
  .endpoint;
350
-
351
- this._downloadBrokerageReportEndpoint = EndpointBuilder.for('download-brokerage-report', 'download brokerage report')
352
- .withVerb(VerbType.GET)
353
- .withProtocol(protocolType)
354
- .withHost(host)
355
- .withPort(port)
356
- .withPathBuilder((pb) => {
357
- pb.withLiteralParameter('reports', 'reports')
358
- .withLiteralParameter('portfolios', 'portfolios')
359
- .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
360
- .withLiteralParameter('frames', 'frames')
361
- .withVariableParameter('frame', 'frame', 'frame', false, x => x.code)
362
- .withLiteralParameter('date', 'date')
363
- .withVariableParameter('start', 'start', 'start', false, x => x.format());
364
- })
365
- .withRequestInterceptor(requestInterceptorToUse)
366
- .withErrorInterceptor(ErrorInterceptor.GENERAL)
367
- .endpoint;
368
365
  }
369
366
 
370
367
  /**
@@ -382,7 +379,7 @@ module.exports = (() => {
382
379
  * containing the current instance.
383
380
  *
384
381
  * @public
385
- * @returns {Promise.<PortfolioGateway>}
382
+ * @returns {Promise<PortfolioGateway>}
386
383
  */
387
384
  start() {
388
385
  return Promise.resolve()
@@ -409,7 +406,7 @@ module.exports = (() => {
409
406
  *
410
407
  * @public
411
408
  * @param {String=} portfolio
412
- * @returns {Promise.<Portfolio[]>}
409
+ * @returns {Promise<Portfolio[]>}
413
410
  */
414
411
  readPortfolios(portfolio) {
415
412
  return Promise.resolve()
@@ -427,7 +424,7 @@ module.exports = (() => {
427
424
  *
428
425
  * @public
429
426
  * @param {Object} portfolio
430
- * @returns {Promise.<Portfolio>}
427
+ * @returns {Promise<Portfolio>}
431
428
  */
432
429
  createPortfolio(portfolio) {
433
430
  return Promise.resolve()
@@ -445,7 +442,7 @@ module.exports = (() => {
445
442
  *
446
443
  * @public
447
444
  * @param {Object} portfolio
448
- * @returns {Promise.<Portfolio>}
445
+ * @returns {Promise<Portfolio>}
449
446
  */
450
447
  importPortfolio(portfolio, transactions) {
451
448
  return Promise.resolve()
@@ -464,7 +461,7 @@ module.exports = (() => {
464
461
  *
465
462
  * @public
466
463
  * @param {Object} portfolio
467
- * @returns {Promise.<Portfolio>}
464
+ * @returns {Promise<Portfolio>}
468
465
  */
469
466
  updatePortfolio(portfolio) {
470
467
  return Promise.resolve()
@@ -482,7 +479,7 @@ module.exports = (() => {
482
479
  *
483
480
  * @public
484
481
  * @param {String} portfolio - ID of the portfolio to update
485
- * @returns {Promise.<Portfolio>}
482
+ * @returns {Promise<Portfolio>}
486
483
  */
487
484
  deletePortfolio(portfolio) {
488
485
  return Promise.resolve()
@@ -502,7 +499,7 @@ module.exports = (() => {
502
499
  * @param {String=} portfolio
503
500
  * @param {String=} position
504
501
  * @param {Boolean=} includePreviousPrice
505
- * @returns {Promise.<Position[]>}
502
+ * @returns {Promise<Position[]>}
506
503
  */
507
504
  readPositions(portfolio, position, includePreviousPrice) {
508
505
  return Promise.resolve()
@@ -522,7 +519,7 @@ module.exports = (() => {
522
519
  *
523
520
  * @public
524
521
  * @param {Object} position
525
- * @returns {Promise.<Position>}
522
+ * @returns {Promise<Position>}
526
523
  */
527
524
  updatePosition(position) {
528
525
  return Promise.resolve()
@@ -580,10 +577,10 @@ module.exports = (() => {
580
577
  * @public
581
578
  * @param {String=} portfolio
582
579
  * @param {String=} position
583
- * @param {Array.<PositionSummaryFrame>=|Array.<String>=} frames
580
+ * @param {Array<PositionSummaryFrame>=|Array<String>=} frames
584
581
  * @param {Number=} periods
585
582
  * @param {Day=|String=} start
586
- * @returns {Promise.<Position[]>}
583
+ * @returns {Promise<Position[]>}
587
584
  */
588
585
  readPositionSummaries(portfolio, position, frames, periods, start) {
589
586
  return Promise.resolve()
@@ -651,7 +648,7 @@ module.exports = (() => {
651
648
  * @public
652
649
  * @param {String} portfolio
653
650
  * @param {String} position
654
- * @returns {Promise.<Position[]>}
651
+ * @returns {Promise<Position[]>}
655
652
  */
656
653
  deletePosition(portfolio, position) {
657
654
  return Promise.resolve()
@@ -670,7 +667,7 @@ module.exports = (() => {
670
667
  *
671
668
  * @public
672
669
  * @param {Object} transaction
673
- * @returns {Promise.<TransactionMutateResult>}
670
+ * @returns {Promise<TransactionMutateResult>}
674
671
  */
675
672
  createTransaction(transaction) {
676
673
  return Promise.resolve()
@@ -735,7 +732,7 @@ module.exports = (() => {
735
732
  *
736
733
  * @public
737
734
  * @param {Object} transaction
738
- * @returns {Promise.<TransactionMutateResult>}
735
+ * @returns {Promise<TransactionMutateResult>}
739
736
  */
740
737
  editTransaction(transaction) {
741
738
  return Promise.resolve()
@@ -763,7 +760,7 @@ module.exports = (() => {
763
760
  * @param {Boolean=} force
764
761
  * @param {Day=} echoStart
765
762
  * @param {Day=} echoEnd
766
- * @returns {Promise.<TransactionMutateResult>}
763
+ * @returns {Promise<TransactionMutateResult>}
767
764
  */
768
765
  deleteTransaction(portfolio, position, sequence, force, echoStart, echoEnd) {
769
766
  return Promise.resolve()
@@ -802,7 +799,7 @@ module.exports = (() => {
802
799
  * @public
803
800
  * @param {String} portfolio
804
801
  * @param {String=} position
805
- * @returns {Promise.<Transaction[]>}
802
+ * @returns {Promise<Transaction[]>}
806
803
  */
807
804
  readTransactions(portfolio, position) {
808
805
  return Promise.resolve()
@@ -826,7 +823,7 @@ module.exports = (() => {
826
823
  * @param {Day=} startDay
827
824
  * @param {Day=} endDay
828
825
  * @oaram {Boolean=} descending
829
- * @returns {Promise.<Object[]>}
826
+ * @returns {Promise<Object[]>}
830
827
  */
831
828
  readTransactionsFormatted(portfolio, position, startDay, endDay, descending) {
832
829
  return Promise.resolve()
@@ -909,40 +906,27 @@ module.exports = (() => {
909
906
  */
910
907
  readBrokerageReportAvailability(portfolio) {
911
908
  return Promise.resolve()
912
- .then(() => {
913
- assert.argumentIsRequired(portfolio, 'portfolio', String);
909
+ .then(() => {
910
+ assert.argumentIsRequired(portfolio, 'portfolio', String);
914
911
 
915
- const payload = { };
912
+ const payload = { };
916
913
 
917
- payload.portfolio = portfolio;
914
+ payload.portfolio = portfolio;
918
915
 
919
- return Gateway.invoke(this._readBrokerageReportAvailabilityEndpoint, payload);
920
- });
916
+ return Gateway.invoke(this._readBrokerageReportAvailabilityEndpoint, payload);
917
+ });
921
918
  }
922
919
 
923
- /**
924
- * @public
925
- * @param {String=} portfolio
926
- * @param {PositionSummaryFrame} frame
927
- * @param {Day} end
928
- * @returns {Promise}
929
- */
930
- downloadBrokerageReport(portfolio, frame, end) {
920
+ getBrokerageReportUrl(portfolio, frame, start) {
931
921
  return Promise.resolve()
932
922
  .then(() => {
933
923
  checkStart.call(this);
934
-
924
+
935
925
  assert.argumentIsRequired(portfolio, 'portfolio', String);
936
926
  assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
937
- assert.argumentIsRequired(end, 'end', Day, 'Day');
938
-
939
- const payload = { };
940
-
941
- payload.portfolio = portfolio;
942
- payload.frame = frame;
943
- payload.start = end;
944
-
945
- return Gateway.invoke(this._downloadBrokerageReportEndpoint, payload);
927
+ assert.argumentIsRequired(start, 'start', Day, 'Day');
928
+
929
+ return 'https://portfolio-dev.aws.barchart.com/binary/reports/portfolios/9555fb81-f640-4a95-8766-aa59f38d2abd/frames/MONTHLY/date/2017-06-30';
946
930
  });
947
931
  }
948
932
 
@@ -951,8 +935,8 @@ module.exports = (() => {
951
935
  *
952
936
  * @public
953
937
  * @static
954
- * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
955
- * @returns {Promise.<PortfolioGateway>}
938
+ * @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
939
+ * @returns {Promise<PortfolioGateway>}
956
940
  */
957
941
  static forDevelopment(requestInterceptor) {
958
942
  return Promise.resolve(requestInterceptor)
@@ -968,8 +952,8 @@ module.exports = (() => {
968
952
  *
969
953
  * @public
970
954
  * @static
971
- * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
972
- * @returns {Promise.<PortfolioGateway>}
955
+ * @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
956
+ * @returns {Promise<PortfolioGateway>}
973
957
  */
974
958
  static forStaging(requestInterceptor) {
975
959
  return Promise.resolve(requestInterceptor)
@@ -985,8 +969,8 @@ module.exports = (() => {
985
969
  *
986
970
  * @public
987
971
  * @static
988
- * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
989
- * @returns {Promise.<PortfolioGateway>}
972
+ * @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
973
+ * @returns {Promise<PortfolioGateway>}
990
974
  */
991
975
  static forProduction(requestInterceptor) {
992
976
  return Promise.resolve(requestInterceptor)
@@ -1002,8 +986,8 @@ module.exports = (() => {
1002
986
  *
1003
987
  * @public
1004
988
  * @static
1005
- * @param {RequestInterceptor=|Promise.<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
1006
- * @returns {Promise.<PortfolioGateway>}
989
+ * @param {RequestInterceptor=|Promise<RequestInterceptor>=} requestInterceptor - A request interceptor used with each request (typically used to inject JWT tokens).
990
+ * @returns {Promise<PortfolioGateway>}
1007
991
  */
1008
992
  static forAdmin(requestInterceptor) {
1009
993
  return Promise.resolve(requestInterceptor)
@@ -1162,8 +1146,8 @@ module.exports = (() => {
1162
1146
  *
1163
1147
  * @typedef TransactionMutateResult
1164
1148
  * @type {Object}
1165
- * @property {Array.<Object>} positions - All positions updated as a consequence of processing the transaction.
1166
- * @property {Array.<Object>} summaries - All position summaries updated as a consequence of processing the transaction.
1149
+ * @property {Object[]} positions - All positions updated as a consequence of processing the transaction.
1150
+ * @property {Object[]} summaries - All position summaries updated as a consequence of processing the transaction.
1167
1151
  * @property {Boolean} replaced - If true, the position (and position summaries) need to be replaced.
1168
1152
  */
1169
1153
 
@@ -45,7 +45,7 @@ module.exports = (() => {
45
45
  * containing the current instance
46
46
  *
47
47
  * @public
48
- * @returns {Promise.<JwtGateway>}
48
+ * @returns {Promise<JwtGateway>}
49
49
  */
50
50
  start() {
51
51
  return Promise.resolve()
@@ -71,7 +71,7 @@ module.exports = (() => {
71
71
  * Retrieves a JWT token from the remote server.
72
72
  *
73
73
  * @public
74
- * @returns {Promise.<String>}
74
+ * @returns {Promise<String>}
75
75
  */
76
76
  readToken() {
77
77
  return Promise.resolve()
@@ -101,7 +101,7 @@ module.exports = (() => {
101
101
  let cacheDisposable = null;
102
102
 
103
103
  const refreshToken = () => {
104
- const refreshPromise = scheduler.backoff(() => this.readToken(), 100, 'Read JWT token', 3)
104
+ const refreshPromise = scheduler.backoff(() => this.readToken(), 0, 'Read JWT token', 3)
105
105
  .then((token) => {
106
106
  if (this._refreshInterval) {
107
107
  cachePromise = refreshPromise;
@@ -159,7 +159,7 @@ module.exports = (() => {
159
159
  * @static
160
160
  * @param {String} userId - The identifier of the user to impersonate.
161
161
  * @param {String} userLegacyId - The legacy identifier of the user to impersonate.
162
- * @returns {Promise.<JwtGateway>}
162
+ * @returns {Promise<JwtGateway>}
163
163
  */
164
164
  static forDevelopment(userId, userLegacyId) {
165
165
  return start(new JwtGateway(forDevelopment(userId, userLegacyId), 180000));
@@ -171,7 +171,7 @@ module.exports = (() => {
171
171
  * @public
172
172
  * @static
173
173
  * @param {String} userId - The identifier of the user to impersonate.
174
- * @returns {Promise.<RequestInterceptor>}
174
+ * @returns {Promise<RequestInterceptor>}
175
175
  */
176
176
  static forDevelopmentClient(userId, userLegacyId) {
177
177
  return JwtGateway.forDevelopment(userId, userLegacyId)
@@ -185,8 +185,8 @@ module.exports = (() => {
185
185
  *
186
186
  * @public
187
187
  * @static
188
- * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
189
- * @returns {Promise.<JwtGateway>}
188
+ * @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
189
+ * @returns {Promise<JwtGateway>}
190
190
  */
191
191
  static forStaging(externalRequestInterceptorPromise) {
192
192
  return externalRequestInterceptorPromise.then((externalRequestInterceptor) => {
@@ -199,8 +199,8 @@ module.exports = (() => {
199
199
  *
200
200
  * @public
201
201
  * @static
202
- * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
203
- * @returns {Promise.<RequestInterceptor>}
202
+ * @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
203
+ * @returns {Promise<RequestInterceptor>}
204
204
  */
205
205
  static forStagingClient(externalRequestInterceptorPromise) {
206
206
  return JwtGateway.forStaging(externalRequestInterceptorPromise)
@@ -214,8 +214,8 @@ module.exports = (() => {
214
214
  *
215
215
  * @public
216
216
  * @static
217
- * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
218
- * @returns {Promise.<JwtGateway>}
217
+ * @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
218
+ * @returns {Promise<JwtGateway>}
219
219
  */
220
220
  static forProduction(externalRequestInterceptorPromise) {
221
221
  return externalRequestInterceptorPromise.then((externalRequestInterceptor) => {
@@ -228,8 +228,8 @@ module.exports = (() => {
228
228
  *
229
229
  * @public
230
230
  * @static
231
- * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
232
- * @returns {Promise.<RequestInterceptor>}
231
+ * @param {Promise<RequestInterceptor>} externalRequestInterceptorPromise
232
+ * @returns {Promise<RequestInterceptor>}
233
233
  */
234
234
  static forProductionClient(externalRequestInterceptorPromise) {
235
235
  return JwtGateway.forProduction(externalRequestInterceptorPromise)
@@ -245,7 +245,7 @@ module.exports = (() => {
245
245
  * @static
246
246
  * @param {String} userId - The identifier of the user to impersonate.
247
247
  * @param {String} userLegacyId - The legacy identifier of the user to impersonate.
248
- * @returns {Promise.<JwtGateway>}
248
+ * @returns {Promise<JwtGateway>}
249
249
  */
250
250
  static forAdmin(userId, userLegacyId) {
251
251
  return start(new JwtGateway(forAdmin(userId, userLegacyId), 180000));
@@ -257,7 +257,7 @@ module.exports = (() => {
257
257
  * @public
258
258
  * @static
259
259
  * @param {String} userId - The identifier of the user to impersonate.
260
- * @returns {Promise.<RequestInterceptor>}
260
+ * @returns {Promise<RequestInterceptor>}
261
261
  */
262
262
  static forAdminClient(userId, userLegacyId) {
263
263
  return JwtGateway.forAdmin(userId, userLegacyId)
@@ -298,7 +298,8 @@ module.exports = (() => {
298
298
  .withProtocol(ProtocolType.HTTPS)
299
299
  .withHost(Configuration.developmentHost)
300
300
  .withPathBuilder((pb) => {
301
- pb.withLiteralParameter('token', 'token')
301
+ pb.withLiteralParameter('json', 'json')
302
+ .withLiteralParameter('token', 'token')
302
303
  .withLiteralParameter('barchart', 'barchart')
303
304
  .withLiteralParameter('generator', 'generator');
304
305
  })
@@ -317,7 +318,12 @@ module.exports = (() => {
317
318
  .withVerb(VerbType.GET)
318
319
  .withProtocol(ProtocolType.HTTPS)
319
320
  .withHost(Configuration.stagingHost)
320
- .withPathBuilder((pb) => pb.withLiteralParameter('token', 'token').withLiteralParameter('system', 'tgam').withLiteralParameter('converter', 'converter'))
321
+ .withPathBuilder((pb) => {
322
+ pb.withLiteralParameter('json', 'json')
323
+ .withLiteralParameter('token', 'token')
324
+ .withLiteralParameter('system', 'tgam')
325
+ .withLiteralParameter('converter', 'converter');
326
+ })
321
327
  .withRequestInterceptor(externalRequestInterceptor)
322
328
  .withResponseInterceptor(ResponseInterceptor.DATA)
323
329
  .endpoint;
@@ -328,7 +334,12 @@ module.exports = (() => {
328
334
  .withVerb(VerbType.GET)
329
335
  .withProtocol(ProtocolType.HTTPS)
330
336
  .withHost(Configuration.productionHost)
331
- .withPathBuilder((pb) => pb.withLiteralParameter('token', 'token').withLiteralParameter('system', 'tgam').withLiteralParameter('converter', 'converter'))
337
+ .withPathBuilder((pb) => {
338
+ pb.withLiteralParameter('json', 'json')
339
+ .withLiteralParameter('token', 'token')
340
+ .withLiteralParameter('system', 'tgam')
341
+ .withLiteralParameter('converter', 'converter');
342
+ })
332
343
  .withRequestInterceptor(externalRequestInterceptor)
333
344
  .withResponseInterceptor(ResponseInterceptor.DATA)
334
345
  .endpoint;
@@ -340,7 +351,8 @@ module.exports = (() => {
340
351
  .withProtocol(ProtocolType.HTTPS)
341
352
  .withHost(Configuration.adminHost)
342
353
  .withPathBuilder((pb) => {
343
- pb.withLiteralParameter('token', 'token')
354
+ pb.withLiteralParameter('json', 'json')
355
+ .withLiteralParameter('token', 'token')
344
356
  .withLiteralParameter('barchart', 'barchart')
345
357
  .withLiteralParameter('generator', 'generator');
346
358
  })
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.45'
10
+ version: '1.3.3'
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.45",
3
+ "version": "1.3.3",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+ssh://git@github.com/barchart/barchart/watchlist-client-js.git"
15
+ "url": "git+ssh://git@github.com/barchart/barchart/portfolio-client-js.git"
16
16
  },
17
17
  "keywords": [
18
18
  "Barchart",
@@ -21,9 +21,9 @@
21
21
  "API"
22
22
  ],
23
23
  "dependencies": {
24
- "@barchart/common-js": "~3.2.0",
25
- "@barchart/tgam-jwt-js": "~1.0.0",
26
- "@barchart/portfolio-api-common": "~1.2.0"
24
+ "@barchart/common-js": "~3.3.0",
25
+ "@barchart/tgam-jwt-js": "~1.3.0",
26
+ "@barchart/portfolio-api-common": "~1.3.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "babel-core": "^6.26.0",