@barchart/portfolio-client-js 1.3.2 → 1.3.5

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.
@@ -65,8 +65,7 @@ module.exports = (() => {
65
65
  .withHost(host)
66
66
  .withPort(port)
67
67
  .withPathBuilder((pb) => {
68
- pb.withLiteralParameter('json', 'json')
69
- .withLiteralParameter('portfolios', 'portfolios')
68
+ pb.withLiteralParameter('portfolios', 'portfolios')
70
69
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
71
70
  })
72
71
  .withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
@@ -81,8 +80,7 @@ module.exports = (() => {
81
80
  .withHost(host)
82
81
  .withPort(port)
83
82
  .withPathBuilder((pb) => {
84
- pb.withLiteralParameter('json', 'json')
85
- .withLiteralParameter('portfolios', 'portfolios');
83
+ pb.withLiteralParameter('portfolios', 'portfolios');
86
84
  })
87
85
  .withBody('portfolio')
88
86
  .withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
@@ -98,8 +96,7 @@ module.exports = (() => {
98
96
  .withHost(host)
99
97
  .withPort(port)
100
98
  .withPathBuilder((pb) => {
101
- pb.withLiteralParameter('json', 'json')
102
- .withLiteralParameter('portfolios', 'portfolios')
99
+ pb.withLiteralParameter('portfolios', 'portfolios')
103
100
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
104
101
  })
105
102
  .withBody('portfolio')
@@ -116,8 +113,7 @@ module.exports = (() => {
116
113
  .withHost(host)
117
114
  .withPort(port)
118
115
  .withPathBuilder((pb) => {
119
- pb.withLiteralParameter('json', 'json')
120
- .withLiteralParameter('portfolios', 'portfolios')
116
+ pb.withLiteralParameter('portfolios', 'portfolios')
121
117
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
122
118
  })
123
119
  .withRequestInterceptor(requestInterceptorToUse)
@@ -130,8 +126,7 @@ module.exports = (() => {
130
126
  .withHost(host)
131
127
  .withPort(port)
132
128
  .withPathBuilder((pb) => {
133
- pb.withLiteralParameter('json', 'json')
134
- .withLiteralParameter('portfolios', 'portfolios')
129
+ pb.withLiteralParameter('portfolios', 'portfolios')
135
130
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
136
131
  .withLiteralParameter('positions', 'positions')
137
132
  .withVariableParameter('position', 'position', 'position', false);
@@ -151,8 +146,7 @@ module.exports = (() => {
151
146
  .withHost(host)
152
147
  .withPort(port)
153
148
  .withPathBuilder((pb) => {
154
- pb.withLiteralParameter('json', 'json')
155
- .withLiteralParameter('portfolios', 'portfolios')
149
+ pb.withLiteralParameter('portfolios', 'portfolios')
156
150
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
157
151
  .withLiteralParameter('positions', 'positions')
158
152
  .withVariableParameter('position', 'position', 'position', false);
@@ -170,8 +164,7 @@ module.exports = (() => {
170
164
  .withHost(host)
171
165
  .withPort(port)
172
166
  .withPathBuilder((pb) => {
173
- pb.withLiteralParameter('json', 'json')
174
- .withLiteralParameter('portfolios', 'portfolios')
167
+ pb.withLiteralParameter('portfolios', 'portfolios')
175
168
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
176
169
  .withLiteralParameter('positions', 'positions')
177
170
  .withVariableParameter('position', 'position', 'position', false);
@@ -188,8 +181,7 @@ module.exports = (() => {
188
181
  .withHost(host)
189
182
  .withPort(port)
190
183
  .withPathBuilder((pb) => {
191
- pb.withLiteralParameter('json', 'json')
192
- .withLiteralParameter('portfolios', 'portfolios')
184
+ pb.withLiteralParameter('portfolios', 'portfolios')
193
185
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
194
186
  .withLiteralParameter('summaries', 'summaries')
195
187
  .withVariableParameter('position', 'position', 'position', false);
@@ -211,8 +203,7 @@ module.exports = (() => {
211
203
  .withHost(host)
212
204
  .withPort(port)
213
205
  .withPathBuilder((pb) => {
214
- pb.withLiteralParameter('json', 'json')
215
- .withLiteralParameter('portfolios', 'portfolios')
206
+ pb.withLiteralParameter('portfolios', 'portfolios')
216
207
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
217
208
  .withLiteralParameter('positions', 'positions')
218
209
  .withVariableParameter('position', 'position', 'position', false)
@@ -233,8 +224,7 @@ module.exports = (() => {
233
224
  .withHost(host)
234
225
  .withPort(port)
235
226
  .withPathBuilder((pb) => {
236
- pb.withLiteralParameter('json', 'json')
237
- .withLiteralParameter('portfolios', 'portfolios')
227
+ pb.withLiteralParameter('portfolios', 'portfolios')
238
228
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
239
229
  .withLiteralParameter('positions', 'positions')
240
230
  .withVariableParameter('position', 'position', 'position', false)
@@ -255,8 +245,7 @@ module.exports = (() => {
255
245
  .withHost(host)
256
246
  .withPort(port)
257
247
  .withPathBuilder((pb) => {
258
- pb.withLiteralParameter('json', 'json')
259
- .withLiteralParameter('portfolios', 'portfolios')
248
+ pb.withLiteralParameter('portfolios', 'portfolios')
260
249
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
261
250
  .withLiteralParameter('positions', 'positions')
262
251
  .withLiteralParameter('multiple', 'multiple')
@@ -274,8 +263,7 @@ module.exports = (() => {
274
263
  .withHost(host)
275
264
  .withPort(port)
276
265
  .withPathBuilder((pb) => {
277
- pb.withLiteralParameter('json', 'json')
278
- .withLiteralParameter('portfolios', 'portfolios')
266
+ pb.withLiteralParameter('portfolios', 'portfolios')
279
267
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
280
268
  .withLiteralParameter('positions', 'positions')
281
269
  .withVariableParameter('position', 'position', 'position', false)
@@ -297,8 +285,7 @@ module.exports = (() => {
297
285
  .withHost(host)
298
286
  .withPort(port)
299
287
  .withPathBuilder((pb) => {
300
- pb.withLiteralParameter('json', 'json')
301
- .withLiteralParameter('portfolios', 'portfolios')
288
+ pb.withLiteralParameter('portfolios', 'portfolios')
302
289
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
303
290
  .withLiteralParameter('positions', 'positions')
304
291
  .withVariableParameter('position', 'position', 'position', false)
@@ -321,8 +308,7 @@ module.exports = (() => {
321
308
  .withHost(host)
322
309
  .withPort(port)
323
310
  .withPathBuilder((pb) => {
324
- pb.withLiteralParameter('json', 'json')
325
- .withLiteralParameter('portfolios', 'portfolios')
311
+ pb.withLiteralParameter('portfolios', 'portfolios')
326
312
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
327
313
  .withLiteralParameter('positions', 'positions')
328
314
  .withVariableParameter('position', 'position', 'position', true)
@@ -348,10 +334,10 @@ module.exports = (() => {
348
334
  .withHost(host)
349
335
  .withPort(port)
350
336
  .withPathBuilder((pb) => {
351
- pb.withLiteralParameter('json', 'json')
352
- .withLiteralParameter('reports', 'reports')
353
- .withLiteralParameter('portfolios', 'portfolios')
337
+ pb.withLiteralParameter('portfolios', 'portfolios')
354
338
  .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
339
+ .withLiteralParameter('reports', 'reports')
340
+ .withLiteralParameter('brokerage', 'brokerage')
355
341
  .withLiteralParameter('availability', 'availability');
356
342
  })
357
343
  .withQueryBuilder((qb) => {
@@ -362,6 +348,10 @@ module.exports = (() => {
362
348
  .withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization)
363
349
  .withErrorInterceptor(ErrorInterceptor.GENERAL)
364
350
  .endpoint;
351
+
352
+ this._brokerageReportUrlGenerator = (user, portfolio, frame, end) => {
353
+ return `https://${host}/binary/reports/portfolios/${portfolio}/frames/${frame.code}/date/${end.format()}/${user}`;
354
+ };
365
355
  }
366
356
 
367
357
  /**
@@ -906,15 +896,39 @@ module.exports = (() => {
906
896
  */
907
897
  readBrokerageReportAvailability(portfolio) {
908
898
  return Promise.resolve()
909
- .then(() => {
910
- assert.argumentIsRequired(portfolio, 'portfolio', String);
899
+ .then(() => {
900
+ assert.argumentIsRequired(portfolio, 'portfolio', String);
911
901
 
912
- const payload = { };
902
+ const payload = { };
913
903
 
914
- payload.portfolio = portfolio;
904
+ payload.portfolio = portfolio;
915
905
 
916
- return Gateway.invoke(this._readBrokerageReportAvailabilityEndpoint, payload);
917
- });
906
+ return Gateway.invoke(this._readBrokerageReportAvailabilityEndpoint, payload);
907
+ });
908
+ }
909
+
910
+ /**
911
+ * Generates a URL suitable for downloading a brokerage report (as a PDF).
912
+ *
913
+ * @public
914
+ * @param {String} user
915
+ * @param {String} portfolio
916
+ * @param {PositionSummaryFrame} frame
917
+ * @param {Day} end
918
+ * @return {Promise<String>}
919
+ */
920
+ getBrokerageReportUrl(user, portfolio, frame, end) {
921
+ return Promise.resolve()
922
+ .then(() => {
923
+ checkStart.call(this);
924
+
925
+ assert.argumentIsRequired(user, 'user', String);
926
+ assert.argumentIsRequired(portfolio, 'portfolio', String);
927
+ assert.argumentIsRequired(frame, 'frame', PositionSummaryFrame, 'PositionSummaryFrame');
928
+ assert.argumentIsRequired(end, 'end', Day, 'Day');
929
+
930
+ return this._brokerageReportUrlGenerator(user, portfolio, frame, end);
931
+ });
918
932
  }
919
933
 
920
934
  /**
@@ -298,8 +298,7 @@ module.exports = (() => {
298
298
  .withProtocol(ProtocolType.HTTPS)
299
299
  .withHost(Configuration.developmentHost)
300
300
  .withPathBuilder((pb) => {
301
- pb.withLiteralParameter('json', 'json')
302
- .withLiteralParameter('token', 'token')
301
+ pb.withLiteralParameter('token', 'token')
303
302
  .withLiteralParameter('barchart', 'barchart')
304
303
  .withLiteralParameter('generator', 'generator');
305
304
  })
@@ -319,8 +318,7 @@ module.exports = (() => {
319
318
  .withProtocol(ProtocolType.HTTPS)
320
319
  .withHost(Configuration.stagingHost)
321
320
  .withPathBuilder((pb) => {
322
- pb.withLiteralParameter('json', 'json')
323
- .withLiteralParameter('token', 'token')
321
+ pb.withLiteralParameter('token', 'token')
324
322
  .withLiteralParameter('system', 'tgam')
325
323
  .withLiteralParameter('converter', 'converter');
326
324
  })
@@ -335,8 +333,7 @@ module.exports = (() => {
335
333
  .withProtocol(ProtocolType.HTTPS)
336
334
  .withHost(Configuration.productionHost)
337
335
  .withPathBuilder((pb) => {
338
- pb.withLiteralParameter('json', 'json')
339
- .withLiteralParameter('token', 'token')
336
+ pb.withLiteralParameter('token', 'token')
340
337
  .withLiteralParameter('system', 'tgam')
341
338
  .withLiteralParameter('converter', 'converter');
342
339
  })
@@ -351,8 +348,7 @@ module.exports = (() => {
351
348
  .withProtocol(ProtocolType.HTTPS)
352
349
  .withHost(Configuration.adminHost)
353
350
  .withPathBuilder((pb) => {
354
- pb.withLiteralParameter('json', 'json')
355
- .withLiteralParameter('token', 'token')
351
+ pb.withLiteralParameter('token', 'token')
356
352
  .withLiteralParameter('barchart', 'barchart')
357
353
  .withLiteralParameter('generator', 'generator');
358
354
  })
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.2'
10
+ version: '1.3.5'
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.2",
3
+ "version": "1.3.5",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",