snaptrade-typescript-sdk 4.0.0 → 6.0.0
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/.konfig/generate-id.txt +1 -1
- package/README.md +2 -2
- package/api/account-information-api.ts +136 -120
- package/api/api-disclaimer-api.ts +14 -19
- package/api/authentication-api.ts +37 -43
- package/api/connections-api.ts +46 -40
- package/api/error-logs-api.ts +12 -10
- package/api/options-api.ts +104 -108
- package/api/portfolio-management-api.ts +259 -253
- package/api/reference-data-api.ts +49 -53
- package/api/trading-api.ts +172 -185
- package/api/transactions-and-reporting-api.ts +64 -60
- package/client.ts +2 -0
- package/common.ts +2 -2
- package/configuration.ts +1 -1
- package/dist/api/account-information-api.d.ts +112 -112
- package/dist/api/api-disclaimer-api.d.ts +10 -16
- package/dist/api/api-disclaimer-api.js +1 -1
- package/dist/api/authentication-api.d.ts +27 -40
- package/dist/api/authentication-api.js +2 -2
- package/dist/api/connections-api.d.ts +38 -38
- package/dist/api/error-logs-api.d.ts +10 -10
- package/dist/api/options-api.d.ts +82 -94
- package/dist/api/options-api.js +2 -2
- package/dist/api/portfolio-management-api.d.ts +214 -256
- package/dist/api/portfolio-management-api.js +7 -7
- package/dist/api/reference-data-api.d.ts +37 -50
- package/dist/api/reference-data-api.js +2 -2
- package/dist/api/trading-api.d.ts +131 -160
- package/dist/api/trading-api.js +10 -10
- package/dist/api/transactions-and-reporting-api.d.ts +52 -52
- package/dist/common.js +2 -2
- package/dist/configuration.js +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/target-asset.d.ts +4 -2
- package/dist/models/trading-cancel-user-account-order-request.d.ts +24 -0
- package/dist/models/trading-cancel-user-account-order-request.js +15 -0
- package/dist/pagination/page-types.d.ts +27 -0
- package/dist/pagination/page-types.js +13 -0
- package/dist/pagination/page.d.ts +6 -1
- package/dist/pagination/page.js +3 -0
- package/dist/pagination/pageable.d.ts +8 -3
- package/dist/pagination/pageable.js +5 -6
- package/dist/pagination/paginate.d.ts +2 -2
- package/docs/AccountInformationApi.md +72 -88
- package/docs/ApiDisclaimerApi.md +8 -12
- package/docs/ApiStatusApi.md +6 -7
- package/docs/AuthenticationApi.md +41 -55
- package/docs/ConnectionsApi.md +26 -32
- package/docs/ErrorLogsApi.md +8 -10
- package/docs/OptionsApi.md +60 -67
- package/docs/PortfolioManagementApi.md +246 -326
- package/docs/ReferenceDataApi.md +68 -95
- package/docs/TradingApi.md +107 -136
- package/docs/TransactionsAndReportingApi.md +26 -28
- package/index.test.ts +2 -4
- package/models/index.ts +1 -0
- package/models/target-asset.ts +2 -2
- package/models/trading-cancel-user-account-order-request.ts +29 -0
- package/package.json +1 -1
- package/pagination/page-types.ts +34 -0
- package/pagination/page.ts +9 -1
- package/pagination/pageable.ts +16 -10
- package/pagination/paginate.ts +3 -2
- package/tsconfig.json +1 -0
- package/dist/index.test.d.ts +0 -1
- package/dist/index.test.js +0 -175
package/dist/api/trading-api.js
CHANGED
|
@@ -96,11 +96,11 @@ var TradingApiAxiosParamCreator = function (configuration) {
|
|
|
96
96
|
* @param {string} userId
|
|
97
97
|
* @param {string} userSecret
|
|
98
98
|
* @param {string} accountId The ID of the account get positions.
|
|
99
|
-
* @param {
|
|
99
|
+
* @param {TradingCancelUserAccountOrderRequest} tradingCancelUserAccountOrderRequest The Order ID to be canceled
|
|
100
100
|
* @param {*} [options] Override http request option.
|
|
101
101
|
* @throws {RequiredError}
|
|
102
102
|
*/
|
|
103
|
-
cancelUserAccountOrder: function (userId, userSecret, accountId,
|
|
103
|
+
cancelUserAccountOrder: function (userId, userSecret, accountId, tradingCancelUserAccountOrderRequest, options) {
|
|
104
104
|
if (options === void 0) { options = {}; }
|
|
105
105
|
return __awaiter(_this, void 0, void 0, function () {
|
|
106
106
|
var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
|
|
@@ -113,8 +113,8 @@ var TradingApiAxiosParamCreator = function (configuration) {
|
|
|
113
113
|
(0, common_1.assertParamExists)('cancelUserAccountOrder', 'userSecret', userSecret);
|
|
114
114
|
// verify required parameter 'accountId' is not null or undefined
|
|
115
115
|
(0, common_1.assertParamExists)('cancelUserAccountOrder', 'accountId', accountId);
|
|
116
|
-
// verify required parameter '
|
|
117
|
-
(0, common_1.assertParamExists)('cancelUserAccountOrder', '
|
|
116
|
+
// verify required parameter 'tradingCancelUserAccountOrderRequest' is not null or undefined
|
|
117
|
+
(0, common_1.assertParamExists)('cancelUserAccountOrder', 'tradingCancelUserAccountOrderRequest', tradingCancelUserAccountOrderRequest);
|
|
118
118
|
localVarPath = "/accounts/{accountId}/orders/cancel"
|
|
119
119
|
.replace("{".concat("accountId", "}"), encodeURIComponent(String(accountId)));
|
|
120
120
|
localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
@@ -152,7 +152,7 @@ var TradingApiAxiosParamCreator = function (configuration) {
|
|
|
152
152
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
153
153
|
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
154
154
|
localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
|
155
|
-
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(
|
|
155
|
+
localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(tradingCancelUserAccountOrderRequest, localVarRequestOptions, configuration);
|
|
156
156
|
(0, requestBeforeHook_1.requestBeforeHook)({
|
|
157
157
|
queryParameters: localVarQueryParameter,
|
|
158
158
|
requestConfig: localVarRequestOptions,
|
|
@@ -839,7 +839,7 @@ var TradingApiFp = function (configuration) {
|
|
|
839
839
|
var localVarAxiosArgs;
|
|
840
840
|
return __generator(this, function (_a) {
|
|
841
841
|
switch (_a.label) {
|
|
842
|
-
case 0: return [4 /*yield*/, localVarAxiosParamCreator.cancelUserAccountOrder(requestParameters.userId, requestParameters.userSecret, requestParameters.accountId, requestParameters
|
|
842
|
+
case 0: return [4 /*yield*/, localVarAxiosParamCreator.cancelUserAccountOrder(requestParameters.userId, requestParameters.userSecret, requestParameters.accountId, requestParameters, options)];
|
|
843
843
|
case 1:
|
|
844
844
|
localVarAxiosArgs = _a.sent();
|
|
845
845
|
return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
|
|
@@ -899,7 +899,7 @@ var TradingApiFp = function (configuration) {
|
|
|
899
899
|
var localVarAxiosArgs;
|
|
900
900
|
return __generator(this, function (_a) {
|
|
901
901
|
switch (_a.label) {
|
|
902
|
-
case 0: return [4 /*yield*/, localVarAxiosParamCreator.getOrderImpact(requestParameters.userId, requestParameters.userSecret, requestParameters
|
|
902
|
+
case 0: return [4 /*yield*/, localVarAxiosParamCreator.getOrderImpact(requestParameters.userId, requestParameters.userSecret, requestParameters, options)];
|
|
903
903
|
case 1:
|
|
904
904
|
localVarAxiosArgs = _a.sent();
|
|
905
905
|
return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
|
|
@@ -939,7 +939,7 @@ var TradingApiFp = function (configuration) {
|
|
|
939
939
|
var localVarAxiosArgs;
|
|
940
940
|
return __generator(this, function (_a) {
|
|
941
941
|
switch (_a.label) {
|
|
942
|
-
case 0: return [4 /*yield*/, localVarAxiosParamCreator.modifyCalculatedTradeById(requestParameters.portfolioGroupId, requestParameters.calculatedTradeId, requestParameters.tradeId, requestParameters
|
|
942
|
+
case 0: return [4 /*yield*/, localVarAxiosParamCreator.modifyCalculatedTradeById(requestParameters.portfolioGroupId, requestParameters.calculatedTradeId, requestParameters.tradeId, requestParameters, options)];
|
|
943
943
|
case 1:
|
|
944
944
|
localVarAxiosArgs = _a.sent();
|
|
945
945
|
return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
|
|
@@ -979,7 +979,7 @@ var TradingApiFp = function (configuration) {
|
|
|
979
979
|
var localVarAxiosArgs;
|
|
980
980
|
return __generator(this, function (_a) {
|
|
981
981
|
switch (_a.label) {
|
|
982
|
-
case 0: return [4 /*yield*/, localVarAxiosParamCreator.placeForceOrder(requestParameters.userId, requestParameters.userSecret, requestParameters
|
|
982
|
+
case 0: return [4 /*yield*/, localVarAxiosParamCreator.placeForceOrder(requestParameters.userId, requestParameters.userSecret, requestParameters, options)];
|
|
983
983
|
case 1:
|
|
984
984
|
localVarAxiosArgs = _a.sent();
|
|
985
985
|
return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
|
|
@@ -999,7 +999,7 @@ var TradingApiFp = function (configuration) {
|
|
|
999
999
|
var localVarAxiosArgs;
|
|
1000
1000
|
return __generator(this, function (_a) {
|
|
1001
1001
|
switch (_a.label) {
|
|
1002
|
-
case 0: return [4 /*yield*/, localVarAxiosParamCreator.placeOCOOrder(requestParameters.userId, requestParameters.userSecret, requestParameters
|
|
1002
|
+
case 0: return [4 /*yield*/, localVarAxiosParamCreator.placeOCOOrder(requestParameters.userId, requestParameters.userSecret, requestParameters, options)];
|
|
1003
1003
|
case 1:
|
|
1004
1004
|
localVarAxiosArgs = _a.sent();
|
|
1005
1005
|
return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
|
|
@@ -95,87 +95,87 @@ export declare const TransactionsAndReportingApiFactory: (configuration?: Config
|
|
|
95
95
|
* @export
|
|
96
96
|
* @interface TransactionsAndReportingApiGetActivitiesRequest
|
|
97
97
|
*/
|
|
98
|
-
export
|
|
98
|
+
export type TransactionsAndReportingApiGetActivitiesRequest = {
|
|
99
99
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
*
|
|
101
|
+
* @type {string}
|
|
102
|
+
* @memberof TransactionsAndReportingApiGetActivities
|
|
103
|
+
*/
|
|
104
104
|
readonly userId: string;
|
|
105
105
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
*
|
|
107
|
+
* @type {string}
|
|
108
|
+
* @memberof TransactionsAndReportingApiGetActivities
|
|
109
|
+
*/
|
|
110
110
|
readonly userSecret: string;
|
|
111
111
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
*
|
|
113
|
+
* @type {string}
|
|
114
|
+
* @memberof TransactionsAndReportingApiGetActivities
|
|
115
|
+
*/
|
|
116
116
|
readonly startDate?: string;
|
|
117
117
|
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
*
|
|
119
|
+
* @type {string}
|
|
120
|
+
* @memberof TransactionsAndReportingApiGetActivities
|
|
121
|
+
*/
|
|
122
122
|
readonly endDate?: string;
|
|
123
123
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
* Optional comma seperated list of account IDs used to filter the request on specific accounts
|
|
125
|
+
* @type {string}
|
|
126
|
+
* @memberof TransactionsAndReportingApiGetActivities
|
|
127
|
+
*/
|
|
128
128
|
readonly accounts?: string;
|
|
129
|
-
}
|
|
129
|
+
};
|
|
130
130
|
/**
|
|
131
131
|
* Request parameters for getReportingCustomRange operation in TransactionsAndReportingApi.
|
|
132
132
|
* @export
|
|
133
133
|
* @interface TransactionsAndReportingApiGetReportingCustomRangeRequest
|
|
134
134
|
*/
|
|
135
|
-
export
|
|
135
|
+
export type TransactionsAndReportingApiGetReportingCustomRangeRequest = {
|
|
136
136
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
*
|
|
138
|
+
* @type {string}
|
|
139
|
+
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
140
|
+
*/
|
|
141
141
|
readonly startDate: string;
|
|
142
142
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
*
|
|
144
|
+
* @type {string}
|
|
145
|
+
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
146
|
+
*/
|
|
147
147
|
readonly endDate: string;
|
|
148
148
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
*
|
|
150
|
+
* @type {string}
|
|
151
|
+
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
152
|
+
*/
|
|
153
153
|
readonly userId: string;
|
|
154
154
|
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
*
|
|
156
|
+
* @type {string}
|
|
157
|
+
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
158
|
+
*/
|
|
159
159
|
readonly userSecret: string;
|
|
160
160
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
* Optional comma seperated list of account IDs used to filter the request on specific accounts
|
|
162
|
+
* @type {string}
|
|
163
|
+
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
164
|
+
*/
|
|
165
165
|
readonly accounts?: string;
|
|
166
166
|
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
* Optional, increases frequency of data points for the total value and contribution charts if set to true
|
|
168
|
+
* @type {boolean}
|
|
169
|
+
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
170
|
+
*/
|
|
171
171
|
readonly detailed?: boolean;
|
|
172
172
|
/**
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
* Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.
|
|
174
|
+
* @type {string}
|
|
175
|
+
* @memberof TransactionsAndReportingApiGetReportingCustomRange
|
|
176
|
+
*/
|
|
177
177
|
readonly frequency?: string;
|
|
178
|
-
}
|
|
178
|
+
};
|
|
179
179
|
/**
|
|
180
180
|
* TransactionsAndReportingApi - object-oriented interface
|
|
181
181
|
* @export
|
package/dist/common.js
CHANGED
|
@@ -96,11 +96,11 @@ var setApiKeyToObject = function (object, keyParamName, configuration) {
|
|
|
96
96
|
return [4 /*yield*/, configuration.apiKey(keyParamName)];
|
|
97
97
|
case 1:
|
|
98
98
|
_a[_b] = _c.sent();
|
|
99
|
-
|
|
99
|
+
return [3 /*break*/, 3];
|
|
100
100
|
case 2:
|
|
101
101
|
if (typeof configuration.apiKey === "string")
|
|
102
102
|
object[keyParamName] = configuration.apiKey;
|
|
103
|
-
if (typeof configuration.apiKey === "object") {
|
|
103
|
+
else if (typeof configuration.apiKey === "object") {
|
|
104
104
|
if (keyParamName in configuration.apiKey)
|
|
105
105
|
object[keyParamName] = configuration.apiKey[keyParamName];
|
|
106
106
|
}
|
package/dist/configuration.js
CHANGED
|
@@ -33,7 +33,7 @@ var Configuration = /** @class */ (function () {
|
|
|
33
33
|
this.accessToken = param.accessToken;
|
|
34
34
|
this.basePath = param.basePath;
|
|
35
35
|
this.baseOptions = param.baseOptions;
|
|
36
|
-
this.userAgent = param.userAgent === undefined ? "Konfig/
|
|
36
|
+
this.userAgent = param.userAgent === undefined ? "Konfig/6.0.0/typescript" : param.userAgent;
|
|
37
37
|
this.formDataCtor = param.formDataCtor;
|
|
38
38
|
}
|
|
39
39
|
/**
|
package/dist/models/index.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ export * from './time-in-force';
|
|
|
91
91
|
export * from './trade';
|
|
92
92
|
export * from './trade-execution-status';
|
|
93
93
|
export * from './trade-impact';
|
|
94
|
+
export * from './trading-cancel-user-account-order-request';
|
|
94
95
|
export * from './trading-place-ocoorder-request';
|
|
95
96
|
export * from './usexchange';
|
|
96
97
|
export * from './underlying-symbol';
|
package/dist/models/index.js
CHANGED
|
@@ -107,6 +107,7 @@ __exportStar(require("./time-in-force"), exports);
|
|
|
107
107
|
__exportStar(require("./trade"), exports);
|
|
108
108
|
__exportStar(require("./trade-execution-status"), exports);
|
|
109
109
|
__exportStar(require("./trade-impact"), exports);
|
|
110
|
+
__exportStar(require("./trading-cancel-user-account-order-request"), exports);
|
|
110
111
|
__exportStar(require("./trading-place-ocoorder-request"), exports);
|
|
111
112
|
__exportStar(require("./usexchange"), exports);
|
|
112
113
|
__exportStar(require("./underlying-symbol"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SnapTrade
|
|
3
|
+
* Connect brokerage accounts to your app for live positions and trading
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
* Contact: api@snaptrade.com
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This file is auto generated by Konfig (https://konfigthis.com).
|
|
9
|
+
* https://konfigthis.com
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface TradingCancelUserAccountOrderRequest
|
|
16
|
+
*/
|
|
17
|
+
export interface TradingCancelUserAccountOrderRequest {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof TradingCancelUserAccountOrderRequest
|
|
22
|
+
*/
|
|
23
|
+
'brokerage_order_id'?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* SnapTrade
|
|
6
|
+
* Connect brokerage accounts to your app for live positions and trading
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
* Contact: api@snaptrade.com
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This file is auto generated by Konfig (https://konfigthis.com).
|
|
12
|
+
* https://konfigthis.com
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SnapTrade
|
|
3
|
+
* Connect brokerage accounts to your app for live positions and trading
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
* Contact: api@snaptrade.com
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This file is auto generated by Konfig (https://konfigthis.com).
|
|
9
|
+
* https://konfigthis.com
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import { Pageable, PageParametersBase } from "./pageable";
|
|
13
|
+
/**
|
|
14
|
+
* The set of parameters that appear in a paginated operation (requestBody or parameters)
|
|
15
|
+
*/
|
|
16
|
+
export type PageParameterProperties = {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
19
|
+
export type PageParameters = PageParametersBase<PageParameterProperties>;
|
|
20
|
+
/**
|
|
21
|
+
* The set of properties that appear in a paginated operation's response
|
|
22
|
+
*/
|
|
23
|
+
export interface PageInfo {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
export interface PageBase<Data extends PageInfo, Parameters extends PageParameters> extends Pageable<Data, Parameters> {
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SnapTrade
|
|
4
|
+
* Connect brokerage accounts to your app for live positions and trading
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
* Contact: api@snaptrade.com
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This file is auto generated by Konfig (https://konfigthis.com).
|
|
10
|
+
* https://konfigthis.com
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* https://konfigthis.com
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import { Pageable, PageParametersBase } from "./pageable";
|
|
12
|
+
import { Pageable, PageParametersBase, PageRequest } from "./pageable";
|
|
13
13
|
/**
|
|
14
14
|
* The set of parameters that appear in a paginated operation (requestBody or parameters)
|
|
15
15
|
*/
|
|
@@ -24,6 +24,11 @@ export interface PageInfo {
|
|
|
24
24
|
[key: string]: any;
|
|
25
25
|
}
|
|
26
26
|
export declare class Page<Data extends PageInfo, Parameters extends PageParameters> extends Pageable<Data, Parameters> {
|
|
27
|
+
make(parameters: {
|
|
28
|
+
data: Data;
|
|
29
|
+
initialParameters: Parameters;
|
|
30
|
+
request: PageRequest<Data, Parameters>;
|
|
31
|
+
}): Pageable<Data, Parameters>;
|
|
27
32
|
protected get previousParameters(): PageParameterProperties | null;
|
|
28
33
|
protected get nextParameters(): PageParameterProperties | null;
|
|
29
34
|
hasPrevious(): boolean;
|
package/dist/pagination/page.js
CHANGED
|
@@ -33,6 +33,9 @@ var Page = /** @class */ (function (_super) {
|
|
|
33
33
|
function Page() {
|
|
34
34
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
35
35
|
}
|
|
36
|
+
Page.prototype.make = function (parameters) {
|
|
37
|
+
throw new Error("Method not implemented.");
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(Page.prototype, "previousParameters", {
|
|
37
40
|
get: function () {
|
|
38
41
|
throw Error("Stub");
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import { AxiosPromise } from "axios";
|
|
13
|
-
import {
|
|
13
|
+
import { PageBase, PageInfo, PageParameterProperties, PageParameters } from "./page-types";
|
|
14
14
|
export type PageParametersBase<Parameters> = Parameters & {
|
|
15
15
|
requestBody?: Parameters;
|
|
16
16
|
};
|
|
@@ -19,8 +19,8 @@ export declare abstract class Pageable<Data extends PageInfo, Parameters extends
|
|
|
19
19
|
readonly data: Data;
|
|
20
20
|
protected readonly initialParameters: Parameters;
|
|
21
21
|
private readonly _request;
|
|
22
|
-
previous(): Promise<
|
|
23
|
-
next(): Promise<
|
|
22
|
+
previous(): Promise<PageBase<Data, Parameters>>;
|
|
23
|
+
next(): Promise<PageBase<Data, Parameters>>;
|
|
24
24
|
/**
|
|
25
25
|
* Generate minimal set of parameters needed to get the previous page
|
|
26
26
|
*/
|
|
@@ -50,4 +50,9 @@ export declare abstract class Pageable<Data extends PageInfo, Parameters extends
|
|
|
50
50
|
initialParameters: Parameters;
|
|
51
51
|
request: PageRequest<Data, Parameters>;
|
|
52
52
|
});
|
|
53
|
+
abstract make(parameters: {
|
|
54
|
+
data: Data;
|
|
55
|
+
initialParameters: Parameters;
|
|
56
|
+
request: PageRequest<Data, Parameters>;
|
|
57
|
+
}): Pageable<Data, Parameters>;
|
|
53
58
|
}
|
|
@@ -59,7 +59,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
59
59
|
};
|
|
60
60
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
61
|
exports.Pageable = void 0;
|
|
62
|
-
var Page_1 = require("./Page");
|
|
63
62
|
var Pageable = /** @class */ (function () {
|
|
64
63
|
function Pageable(_a) {
|
|
65
64
|
var data = _a.data, initialParameters = _a.initialParameters, request = _a.request;
|
|
@@ -74,9 +73,9 @@ var Pageable = /** @class */ (function () {
|
|
|
74
73
|
switch (_a.label) {
|
|
75
74
|
case 0:
|
|
76
75
|
if (!this.hasPrevious())
|
|
77
|
-
return [2 /*return*/,
|
|
76
|
+
return [2 /*return*/, this];
|
|
78
77
|
if (this.previousParameters === null)
|
|
79
|
-
return [2 /*return*/,
|
|
78
|
+
return [2 /*return*/, this];
|
|
80
79
|
return [4 /*yield*/, this.makeRequest(this.previousParameters)];
|
|
81
80
|
case 1:
|
|
82
81
|
response = _a.sent();
|
|
@@ -92,9 +91,9 @@ var Pageable = /** @class */ (function () {
|
|
|
92
91
|
switch (_a.label) {
|
|
93
92
|
case 0:
|
|
94
93
|
if (!this.hasNext())
|
|
95
|
-
return [2 /*return*/,
|
|
94
|
+
return [2 /*return*/, this];
|
|
96
95
|
if (this.nextParameters === null)
|
|
97
|
-
return [2 /*return*/,
|
|
96
|
+
return [2 /*return*/, this];
|
|
98
97
|
return [4 /*yield*/, this.makeRequest(this.nextParameters)];
|
|
99
98
|
case 1:
|
|
100
99
|
response = _a.sent();
|
|
@@ -117,7 +116,7 @@ var Pageable = /** @class */ (function () {
|
|
|
117
116
|
* Helper for creating new page
|
|
118
117
|
*/
|
|
119
118
|
Pageable.prototype.withData = function (data) {
|
|
120
|
-
return
|
|
119
|
+
return this.make({
|
|
121
120
|
data: data,
|
|
122
121
|
initialParameters: this.initialParameters,
|
|
123
122
|
request: this._request,
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* https://konfigthis.com
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import { PageInfo, PageParameters
|
|
12
|
+
import { PageBase, PageInfo, PageParameters } from "./page-types";
|
|
13
13
|
import { PageRequest } from "./pageable";
|
|
14
14
|
export declare const paginate: <Data extends PageInfo, Parameters_1 extends PageParameters>({ request, initialParameters, }: {
|
|
15
15
|
request: PageRequest<Data, Parameters_1>;
|
|
16
16
|
initialParameters: Parameters_1;
|
|
17
|
-
}) => Promise<
|
|
17
|
+
}) => Promise<PageBase<Data, Parameters_1>>;
|