@barchart/portfolio-client-js 1.1.42 → 1.1.45
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/example/example.js +11 -8
- package/lib/gateway/PortfolioGateway.js +10 -7
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/example/example.js
CHANGED
|
@@ -203,7 +203,7 @@ module.exports = function () {
|
|
|
203
203
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
204
204
|
}).withBody('portfolio').withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(RequestInterceptor.fromDelegate(updatePortfolioRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
205
205
|
|
|
206
|
-
_this._deletePortfolioEndpoint = EndpointBuilder.for('delete-portfolio', 'delete
|
|
206
|
+
_this._deletePortfolioEndpoint = EndpointBuilder.for('delete-portfolio', 'delete portfolio').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
207
207
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
208
208
|
}).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
209
209
|
|
|
@@ -213,7 +213,7 @@ module.exports = function () {
|
|
|
213
213
|
qb.withVariableParameter('includePreviousPrice', 'includePreviousPrice', 'includePreviousPrice', true);
|
|
214
214
|
}).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForPositionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
215
215
|
|
|
216
|
-
_this._deletePositionEndpoint = EndpointBuilder.for('delete-
|
|
216
|
+
_this._deletePositionEndpoint = EndpointBuilder.for('delete-position', 'delete position').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
217
217
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
|
|
218
218
|
}).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
219
219
|
|
|
@@ -243,11 +243,11 @@ module.exports = function () {
|
|
|
243
243
|
});
|
|
244
244
|
}).withBody('portfolio data').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForTransactionCreateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
245
245
|
|
|
246
|
-
_this.
|
|
246
|
+
_this._deleteTransactionEndpoint = EndpointBuilder.for('delete-transaction', 'delete transaction').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
247
247
|
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);
|
|
248
248
|
}).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
249
249
|
|
|
250
|
-
_this._readTransactionsReportEndpoint = EndpointBuilder.for('read-
|
|
250
|
+
_this._readTransactionsReportEndpoint = EndpointBuilder.for('read-transaction-report', 'read transaction report').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
251
251
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', true).withLiteralParameter('transactions', 'transactions').withLiteralParameter('formatted', 'formatted');
|
|
252
252
|
}).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
253
253
|
return _this;
|
|
@@ -554,12 +554,13 @@ module.exports = function () {
|
|
|
554
554
|
* @param {String} portfolio
|
|
555
555
|
* @param {String} position
|
|
556
556
|
* @param {Number} transaction
|
|
557
|
+
* @param {Boolean=} force
|
|
557
558
|
* @returns {Promise.<Transaction[]>}
|
|
558
559
|
*/
|
|
559
560
|
|
|
560
561
|
}, {
|
|
561
562
|
key: 'deleteTransaction',
|
|
562
|
-
value: function deleteTransaction(portfolio, position,
|
|
563
|
+
value: function deleteTransaction(portfolio, position, sequence, force) {
|
|
563
564
|
var _this11 = this;
|
|
564
565
|
|
|
565
566
|
return Promise.resolve().then(function () {
|
|
@@ -568,8 +569,9 @@ module.exports = function () {
|
|
|
568
569
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
569
570
|
assert.argumentIsRequired(position, 'position', String);
|
|
570
571
|
assert.argumentIsRequired(sequence, 'sequence', Number);
|
|
572
|
+
assert.argumentIsOptional(force, 'force', Boolean);
|
|
571
573
|
|
|
572
|
-
return Gateway.invoke(_this11.
|
|
574
|
+
return Gateway.invoke(_this11._deleteTransactionEndpoint, { portfolio: portfolio, position: position, sequence: sequence, force: is.boolean(force) && force });
|
|
573
575
|
});
|
|
574
576
|
}
|
|
575
577
|
|
|
@@ -769,7 +771,8 @@ module.exports = function () {
|
|
|
769
771
|
|
|
770
772
|
return {
|
|
771
773
|
positions: positions,
|
|
772
|
-
summaries: summaries
|
|
774
|
+
summaries: summaries,
|
|
775
|
+
replaced: response.data.replaced
|
|
773
776
|
};
|
|
774
777
|
} catch (e) {
|
|
775
778
|
console.error('Error serializing transaction data', e);
|
|
@@ -1155,7 +1158,7 @@ module.exports = function () {
|
|
|
1155
1158
|
return {
|
|
1156
1159
|
JwtGateway: JwtGateway,
|
|
1157
1160
|
PortfolioGateway: PortfolioGateway,
|
|
1158
|
-
version: '1.1.
|
|
1161
|
+
version: '1.1.45'
|
|
1159
1162
|
};
|
|
1160
1163
|
}();
|
|
1161
1164
|
|
|
@@ -105,7 +105,7 @@ module.exports = (() => {
|
|
|
105
105
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
106
106
|
.endpoint;
|
|
107
107
|
|
|
108
|
-
this._deletePortfolioEndpoint = EndpointBuilder.for('delete-portfolio', 'delete
|
|
108
|
+
this._deletePortfolioEndpoint = EndpointBuilder.for('delete-portfolio', 'delete portfolio')
|
|
109
109
|
.withVerb(VerbType.DELETE)
|
|
110
110
|
.withProtocol(protocolType)
|
|
111
111
|
.withHost(host)
|
|
@@ -138,7 +138,7 @@ module.exports = (() => {
|
|
|
138
138
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
139
139
|
.endpoint;
|
|
140
140
|
|
|
141
|
-
this._deletePositionEndpoint = EndpointBuilder.for('delete-
|
|
141
|
+
this._deletePositionEndpoint = EndpointBuilder.for('delete-position', 'delete position')
|
|
142
142
|
.withVerb(VerbType.DELETE)
|
|
143
143
|
.withProtocol(protocolType)
|
|
144
144
|
.withHost(host)
|
|
@@ -217,7 +217,7 @@ module.exports = (() => {
|
|
|
217
217
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
218
218
|
.endpoint;
|
|
219
219
|
|
|
220
|
-
this.
|
|
220
|
+
this._deleteTransactionEndpoint = EndpointBuilder.for('delete-transaction', 'delete transaction')
|
|
221
221
|
.withVerb(VerbType.DELETE)
|
|
222
222
|
.withProtocol(protocolType)
|
|
223
223
|
.withHost(host)
|
|
@@ -234,7 +234,7 @@ module.exports = (() => {
|
|
|
234
234
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
235
235
|
.endpoint;
|
|
236
236
|
|
|
237
|
-
this._readTransactionsReportEndpoint = EndpointBuilder.for('read-
|
|
237
|
+
this._readTransactionsReportEndpoint = EndpointBuilder.for('read-transaction-report', 'read transaction report')
|
|
238
238
|
.withVerb(VerbType.GET)
|
|
239
239
|
.withProtocol(protocolType)
|
|
240
240
|
.withHost(host)
|
|
@@ -520,9 +520,10 @@ module.exports = (() => {
|
|
|
520
520
|
* @param {String} portfolio
|
|
521
521
|
* @param {String} position
|
|
522
522
|
* @param {Number} transaction
|
|
523
|
+
* @param {Boolean=} force
|
|
523
524
|
* @returns {Promise.<Transaction[]>}
|
|
524
525
|
*/
|
|
525
|
-
deleteTransaction(portfolio, position,
|
|
526
|
+
deleteTransaction(portfolio, position, sequence, force) {
|
|
526
527
|
return Promise.resolve()
|
|
527
528
|
.then(() => {
|
|
528
529
|
checkStart.call(this);
|
|
@@ -530,8 +531,9 @@ module.exports = (() => {
|
|
|
530
531
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
531
532
|
assert.argumentIsRequired(position, 'position', String);
|
|
532
533
|
assert.argumentIsRequired(sequence, 'sequence', Number);
|
|
534
|
+
assert.argumentIsOptional(force, 'force', Boolean);
|
|
533
535
|
|
|
534
|
-
return Gateway.invoke(this.
|
|
536
|
+
return Gateway.invoke(this._deleteTransactionEndpoint, { portfolio: portfolio, position: position, sequence: sequence, force: is.boolean(force) && force });
|
|
535
537
|
});
|
|
536
538
|
}
|
|
537
539
|
|
|
@@ -705,7 +707,8 @@ module.exports = (() => {
|
|
|
705
707
|
|
|
706
708
|
return {
|
|
707
709
|
positions: positions,
|
|
708
|
-
summaries: summaries
|
|
710
|
+
summaries: summaries,
|
|
711
|
+
replaced: response.data.replaced
|
|
709
712
|
};
|
|
710
713
|
} catch (e) {
|
|
711
714
|
console.error('Error serializing transaction data', e);
|
package/lib/index.js
CHANGED