@northstake/northstakeapi 1.0.24 → 1.0.26

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.
Files changed (130) hide show
  1. package/.openapi-generator/FILES +6 -36
  2. package/.openapi-generator/VERSION +1 -1
  3. package/api/apis.ts +3 -23
  4. package/api/{managedUsersApi.ts → smartContractsApi.ts} +118 -53
  5. package/api.ts +9 -69
  6. package/dist/api/apis.d.ts +3 -23
  7. package/dist/api/apis.js +3 -23
  8. package/dist/api/smartContractsApi.d.ts +125 -0
  9. package/dist/api/{managedUsersApi.js → smartContractsApi.js} +90 -49
  10. package/dist/api.d.ts +7 -47
  11. package/dist/api.js +8 -58
  12. package/dist/model/{getTransactionsResponse.d.ts → getSmartContractInternalTransactions200Response.d.ts} +7 -7
  13. package/dist/model/{transactionsforUser.js → getSmartContractInternalTransactions200Response.js} +11 -11
  14. package/dist/model/{allManagedUsersResponse.d.ts → getSmartContractMinedBlocks200Response.d.ts} +4 -4
  15. package/dist/model/{allManagedUsersResponse.js → getSmartContractMinedBlocks200Response.js} +9 -9
  16. package/dist/model/{transactionsforUser.d.ts → getSmartContractTransactions200Response.d.ts} +5 -5
  17. package/dist/model/{getTransactionsResponse.js → getSmartContractTransactions200Response.js} +10 -10
  18. package/dist/model/{stakeStep.d.ts → internalTransaction.d.ts} +9 -7
  19. package/dist/model/internalTransaction.js +58 -0
  20. package/dist/model/{managedUser.d.ts → minedBlock.d.ts} +8 -6
  21. package/dist/model/minedBlock.js +43 -0
  22. package/dist/model/models.d.ts +5 -25
  23. package/dist/model/models.js +15 -67
  24. package/dist/model/transaction.d.ts +40 -17
  25. package/dist/model/transaction.js +74 -17
  26. package/dist/model/webhookPayloadData.d.ts +2 -10
  27. package/dist/model/webhookPayloadData.js +2 -12
  28. package/model/{transactionsforUser.ts → getSmartContractInternalTransactions200Response.ts} +13 -13
  29. package/model/{allManagedUsersResponse.ts → getSmartContractMinedBlocks200Response.ts} +8 -8
  30. package/model/{getTransactionsResponse.ts → getSmartContractTransactions200Response.ts} +10 -10
  31. package/model/internalTransaction.ts +70 -0
  32. package/model/{depositAddress.ts → minedBlock.ts} +19 -13
  33. package/model/models.ts +17 -114
  34. package/model/transaction.ts +114 -31
  35. package/model/webhookPayloadData.ts +4 -23
  36. package/package.json +1 -1
  37. package/api/depositAddressesApi.ts +0 -267
  38. package/api/managedUsersDepositAddressesApi.ts +0 -186
  39. package/api/managedUsersLinkedWalletsApi.ts +0 -369
  40. package/api/managedUsersOrdersApi.ts +0 -462
  41. package/api/managedUsersPortfolioApi.ts +0 -186
  42. package/api/managedUsersTransactionsApi.ts +0 -222
  43. package/api/managedUsersValidatorsApi.ts +0 -302
  44. package/api/ordersApi.ts +0 -432
  45. package/api/portfolioApi.ts +0 -180
  46. package/api/transactionsApi.ts +0 -215
  47. package/dist/api/depositAddressesApi.d.ts +0 -64
  48. package/dist/api/depositAddressesApi.js +0 -207
  49. package/dist/api/managedUsersApi.d.ts +0 -94
  50. package/dist/api/managedUsersDepositAddressesApi.d.ts +0 -51
  51. package/dist/api/managedUsersDepositAddressesApi.js +0 -146
  52. package/dist/api/managedUsersLinkedWalletsApi.d.ts +0 -80
  53. package/dist/api/managedUsersLinkedWalletsApi.js +0 -290
  54. package/dist/api/managedUsersOrdersApi.d.ts +0 -94
  55. package/dist/api/managedUsersOrdersApi.js +0 -364
  56. package/dist/api/managedUsersPortfolioApi.d.ts +0 -51
  57. package/dist/api/managedUsersPortfolioApi.js +0 -146
  58. package/dist/api/managedUsersTransactionsApi.d.ts +0 -68
  59. package/dist/api/managedUsersTransactionsApi.js +0 -170
  60. package/dist/api/managedUsersValidatorsApi.d.ts +0 -78
  61. package/dist/api/managedUsersValidatorsApi.js +0 -233
  62. package/dist/api/ordersApi.d.ts +0 -90
  63. package/dist/api/ordersApi.js +0 -333
  64. package/dist/api/portfolioApi.d.ts +0 -50
  65. package/dist/api/portfolioApi.js +0 -140
  66. package/dist/api/transactionsApi.d.ts +0 -66
  67. package/dist/api/transactionsApi.js +0 -164
  68. package/dist/model/addLinkedWalletForUserRequest.d.ts +0 -29
  69. package/dist/model/addLinkedWalletForUserRequest.js +0 -33
  70. package/dist/model/createManagedUserRequest.d.ts +0 -25
  71. package/dist/model/createManagedUserRequest.js +0 -28
  72. package/dist/model/depositAddress.d.ts +0 -35
  73. package/dist/model/depositAddress.js +0 -36
  74. package/dist/model/depositAddressesForUserResponse.d.ts +0 -27
  75. package/dist/model/depositAddressesForUserResponse.js +0 -33
  76. package/dist/model/managedUser.js +0 -36
  77. package/dist/model/managedUserDetails.d.ts +0 -31
  78. package/dist/model/managedUserDetails.js +0 -41
  79. package/dist/model/order.d.ts +0 -42
  80. package/dist/model/order.js +0 -48
  81. package/dist/model/orderDocument.d.ts +0 -50
  82. package/dist/model/orderDocument.js +0 -71
  83. package/dist/model/orderDocumentSteps.d.ts +0 -30
  84. package/dist/model/orderDocumentSteps.js +0 -33
  85. package/dist/model/orderType.d.ts +0 -15
  86. package/dist/model/orderType.js +0 -13
  87. package/dist/model/orderUpdatePayload.d.ts +0 -36
  88. package/dist/model/orderUpdatePayload.js +0 -38
  89. package/dist/model/portfolioEntity.d.ts +0 -33
  90. package/dist/model/portfolioEntity.js +0 -41
  91. package/dist/model/stakeStep.js +0 -33
  92. package/dist/model/stakeStepElement.d.ts +0 -30
  93. package/dist/model/stakeStepElement.js +0 -33
  94. package/dist/model/stepStatus.d.ts +0 -15
  95. package/dist/model/stepStatus.js +0 -13
  96. package/dist/model/transactionEventType.d.ts +0 -15
  97. package/dist/model/transactionEventType.js +0 -13
  98. package/dist/model/unstakeStep.d.ts +0 -32
  99. package/dist/model/unstakeStep.js +0 -33
  100. package/dist/model/unstakeStepElement.d.ts +0 -30
  101. package/dist/model/unstakeStepElement.js +0 -33
  102. package/dist/model/unstakeStepType.d.ts +0 -15
  103. package/dist/model/unstakeStepType.js +0 -13
  104. package/dist/model/withdrawalStep.d.ts +0 -32
  105. package/dist/model/withdrawalStep.js +0 -33
  106. package/dist/model/withdrawalStepElement.d.ts +0 -30
  107. package/dist/model/withdrawalStepElement.js +0 -33
  108. package/dist/model/withdrawalStepType.d.ts +0 -15
  109. package/dist/model/withdrawalStepType.js +0 -13
  110. package/model/addLinkedWalletForUserRequest.ts +0 -40
  111. package/model/createManagedUserRequest.ts +0 -31
  112. package/model/depositAddressesForUserResponse.ts +0 -38
  113. package/model/managedUser.ts +0 -40
  114. package/model/managedUserDetails.ts +0 -47
  115. package/model/order.ts +0 -68
  116. package/model/orderDocument.ts +0 -106
  117. package/model/orderDocumentSteps.ts +0 -44
  118. package/model/orderType.ts +0 -21
  119. package/model/orderUpdatePayload.ts +0 -52
  120. package/model/portfolioEntity.ts +0 -49
  121. package/model/stakeStep.ts +0 -43
  122. package/model/stakeStepElement.ts +0 -41
  123. package/model/stepStatus.ts +0 -21
  124. package/model/transactionEventType.ts +0 -23
  125. package/model/unstakeStep.ts +0 -43
  126. package/model/unstakeStepElement.ts +0 -41
  127. package/model/unstakeStepType.ts +0 -32
  128. package/model/withdrawalStep.ts +0 -43
  129. package/model/withdrawalStepElement.ts +0 -41
  130. package/model/withdrawalStepType.ts +0 -24
package/api/ordersApi.ts DELETED
@@ -1,432 +0,0 @@
1
- /**
2
- * Northstake
3
- * Northstake api
4
- *
5
- * The version of the OpenAPI document: 1.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
-
13
-
14
- import localVarRequest from 'request';
15
- import http from 'http';
16
-
17
- /* tslint:disable:no-unused-locals */
18
- import { ErrorResponse } from '../model/errorResponse';
19
- import { Order } from '../model/order';
20
- import { OrderDocument } from '../model/orderDocument';
21
-
22
- import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
23
- import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth, JWTAuth } from '../model/models';
24
-
25
- import { HttpError, RequestFile } from './apis';
26
-
27
- let defaultBasePath = 'https://api.northstake.dk/v1';
28
-
29
- // ===============================================
30
- // This file is autogenerated - Please do not edit
31
- // ===============================================
32
-
33
- export enum OrdersApiApiKeys {
34
- ApiKeyAuth,
35
- }
36
-
37
-
38
-
39
- export class OrdersApi {
40
- protected _basePath = defaultBasePath;
41
- protected _defaultHeaders : any = {};
42
- protected _useQuerystring : boolean = false;
43
-
44
- protected authentications = {
45
- 'default': <Authentication>new JWTAuth('your_api_key', 'your_private_key'),
46
- 'bearerTokenAuth': new HttpBearerAuth(),
47
- 'ApiKeyAuth': new ApiKeyAuth('header', 'x-api-key'),
48
- }
49
-
50
- protected interceptors: Interceptor[] = [];
51
-
52
- constructor(basePath?: string);
53
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
54
- if (password) {
55
- if (basePath) {
56
- this.basePath = basePath;
57
- }
58
- } else {
59
- if (basePathOrUsername) {
60
- this.basePath = basePathOrUsername
61
- }
62
- }
63
- }
64
-
65
- set useQuerystring(value: boolean) {
66
- this._useQuerystring = value;
67
- }
68
-
69
- set basePath(basePath: string) {
70
- this._basePath = basePath;
71
- }
72
-
73
- set defaultHeaders(defaultHeaders: any) {
74
- this._defaultHeaders = defaultHeaders;
75
- }
76
-
77
- get defaultHeaders() {
78
- return this._defaultHeaders;
79
- }
80
-
81
- get basePath() {
82
- return this._basePath;
83
- }
84
-
85
- public setDefaultAuthentication(auth: Authentication) {
86
- this.authentications.default = auth;
87
- }
88
-
89
- public setApiKey(key: OrdersApiApiKeys, value: string) {
90
- (this.authentications as any)[OrdersApiApiKeys[key]].apiKey = value;
91
- }
92
-
93
- set accessToken(accessToken: string | (() => string)) {
94
- this.authentications.bearerTokenAuth.accessToken = accessToken;
95
- }
96
-
97
- public addInterceptor(interceptor: Interceptor) {
98
- this.interceptors.push(interceptor);
99
- }
100
-
101
- /**
102
- *
103
- * @summary Cancel a submitted order
104
- * @param orderId Unique identifier for the order
105
- */
106
-
107
-
108
-
109
-
110
-
111
- public async cancelOrderById (orderId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ body: any, status: number }> {
112
-
113
- const localVarPath = this.basePath + '/orders/{orderId}'
114
- .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
115
-
116
- let localVarQueryParameters: any = {};
117
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
118
- let localVarFormParams: any = {};
119
-
120
-
121
- // Verify required parameter 'orderId' is not null or undefined
122
- if (orderId === null || orderId === undefined) {
123
- throw new Error('Required parameter "orderId" was null or undefined when calling cancelOrderById.');
124
- }
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
- (<any>Object).assign(localVarHeaderParams, options.headers);
133
-
134
- let localVarUseFormData = false;
135
-
136
-
137
-
138
- let localVarRequestOptions: localVarRequest.Options = {
139
- method: 'DELETE',
140
- qs: localVarQueryParameters,
141
- headers: localVarHeaderParams,
142
- uri: localVarPath,
143
- useQuerystring: this._useQuerystring,
144
- json: true,
145
- };
146
-
147
- let authenticationPromise = Promise.resolve();
148
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
149
-
150
- let interceptorPromise = authenticationPromise;
151
- for (const interceptor of this.interceptors) {
152
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
153
- }
154
-
155
- return interceptorPromise.then(() => {
156
- if (Object.keys(localVarFormParams).length) {
157
- if (localVarUseFormData) {
158
- (<any>localVarRequestOptions).formData = localVarFormParams;
159
- } else {
160
- localVarRequestOptions.form = localVarFormParams;
161
- }
162
- }
163
- return new Promise<{ body: any, status: number }>((resolve, reject) => {
164
- localVarRequest(localVarRequestOptions, (error, response, body) => {
165
- if (error) {
166
- console.error('API call error:', error);
167
- reject(error);
168
- } else {
169
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
170
- resolve({ body: body, status: response.statusCode });
171
- } else {
172
- console.error('API response error:', response.statusCode);
173
- resolve({ body: body, status: response.statusCode });
174
- }
175
- }
176
- });
177
- });
178
- } )
179
- }
180
- /**
181
- * This endpoint allows the client to create staking, unstaking, or withdrawal orders. One key feature of this endpoint is the ability to include an optional `validatorKey` field when creating a staking order. ### Including a Validator Key By including a `validatorKey` in the staking order, the client specifies a pre-generated and signed Ethereum validator key that should be used for the staking transaction. This key must meet all required security and operational standards, as it will be directly used for staking on the Ethereum blockchain. ### Without a Validator Key If no `validatorKey` is provided, the client must specify the amount to stake. Northstake handles the staking operation internally, requiring the managed user\'s account to have sufficient balance to cover the transaction and any associated fees.
182
- * @summary Create a new order
183
- * @param order
184
- */
185
-
186
-
187
-
188
-
189
-
190
- public async createNewOrder (order: Order, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ body: OrderDocument, status: number }> {
191
-
192
- const localVarPath = this.basePath + '/orders';
193
-
194
- let localVarQueryParameters: any = {};
195
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
196
- const produces = ['application/json'];
197
- if (produces.indexOf('application/json') >= 0) {
198
- localVarHeaderParams.Accept = 'application/json';
199
- } else {
200
- localVarHeaderParams.Accept = produces.join(',');
201
- }
202
- let localVarFormParams: any = {};
203
-
204
-
205
- // Verify required parameter 'order' is not null or undefined
206
- if (order === null || order === undefined) {
207
- throw new Error('Required parameter "order" was null or undefined when calling createNewOrder.');
208
- }
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
- (<any>Object).assign(localVarHeaderParams, options.headers);
217
-
218
- let localVarUseFormData = false;
219
-
220
-
221
-
222
- let localVarRequestOptions: localVarRequest.Options = {
223
- method: 'POST',
224
- qs: localVarQueryParameters,
225
- headers: localVarHeaderParams,
226
- uri: localVarPath,
227
- useQuerystring: this._useQuerystring,
228
- json: true,
229
- body: ObjectSerializer.serialize(order, "Order")
230
- };
231
-
232
- let authenticationPromise = Promise.resolve();
233
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
234
-
235
- let interceptorPromise = authenticationPromise;
236
- for (const interceptor of this.interceptors) {
237
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
238
- }
239
-
240
- return interceptorPromise.then(() => {
241
- if (Object.keys(localVarFormParams).length) {
242
- if (localVarUseFormData) {
243
- (<any>localVarRequestOptions).formData = localVarFormParams;
244
- } else {
245
- localVarRequestOptions.form = localVarFormParams;
246
- }
247
- }
248
- return new Promise<{ body: OrderDocument, status: number }>((resolve, reject) => {
249
- localVarRequest(localVarRequestOptions, (error, response, body) => {
250
- if (error) {
251
- console.error('API call error:', error);
252
- reject(error);
253
- } else {
254
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
255
- body = ObjectSerializer.deserialize(body, "OrderDocument");
256
- resolve({ body: body, status: response.statusCode });
257
- } else {
258
- console.error('API response error:', response.statusCode);
259
- resolve({ body: body, status: response.statusCode });
260
- }
261
- }
262
- });
263
- });
264
- } )
265
- }
266
- /**
267
- *
268
- * @summary Get order details by order ID
269
- * @param orderId Unique identifier for the order
270
- */
271
-
272
-
273
-
274
-
275
-
276
- public async getOrderDetailsById (orderId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ body: OrderDocument, status: number }> {
277
-
278
- const localVarPath = this.basePath + '/orders/{orderId}'
279
- .replace('{' + 'orderId' + '}', encodeURIComponent(String(orderId)));
280
-
281
- let localVarQueryParameters: any = {};
282
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
283
- const produces = ['application/json'];
284
- if (produces.indexOf('application/json') >= 0) {
285
- localVarHeaderParams.Accept = 'application/json';
286
- } else {
287
- localVarHeaderParams.Accept = produces.join(',');
288
- }
289
- let localVarFormParams: any = {};
290
-
291
-
292
- // Verify required parameter 'orderId' is not null or undefined
293
- if (orderId === null || orderId === undefined) {
294
- throw new Error('Required parameter "orderId" was null or undefined when calling getOrderDetailsById.');
295
- }
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
- (<any>Object).assign(localVarHeaderParams, options.headers);
304
-
305
- let localVarUseFormData = false;
306
-
307
-
308
-
309
- let localVarRequestOptions: localVarRequest.Options = {
310
- method: 'GET',
311
- qs: localVarQueryParameters,
312
- headers: localVarHeaderParams,
313
- uri: localVarPath,
314
- useQuerystring: this._useQuerystring,
315
- json: true,
316
- };
317
-
318
- let authenticationPromise = Promise.resolve();
319
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
320
-
321
- let interceptorPromise = authenticationPromise;
322
- for (const interceptor of this.interceptors) {
323
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
324
- }
325
-
326
- return interceptorPromise.then(() => {
327
- if (Object.keys(localVarFormParams).length) {
328
- if (localVarUseFormData) {
329
- (<any>localVarRequestOptions).formData = localVarFormParams;
330
- } else {
331
- localVarRequestOptions.form = localVarFormParams;
332
- }
333
- }
334
- return new Promise<{ body: OrderDocument, status: number }>((resolve, reject) => {
335
- localVarRequest(localVarRequestOptions, (error, response, body) => {
336
- if (error) {
337
- console.error('API call error:', error);
338
- reject(error);
339
- } else {
340
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
341
- body = ObjectSerializer.deserialize(body, "OrderDocument");
342
- resolve({ body: body, status: response.statusCode });
343
- } else {
344
- console.error('API response error:', response.statusCode);
345
- resolve({ body: body, status: response.statusCode });
346
- }
347
- }
348
- });
349
- });
350
- } )
351
- }
352
- /**
353
- *
354
- * @summary Get a list of all orders
355
- */
356
-
357
-
358
-
359
-
360
-
361
- public async listAllOrders (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ body: Array<OrderDocument>, status: number }> {
362
-
363
- const localVarPath = this.basePath + '/orders';
364
-
365
- let localVarQueryParameters: any = {};
366
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
367
- const produces = ['application/json'];
368
- if (produces.indexOf('application/json') >= 0) {
369
- localVarHeaderParams.Accept = 'application/json';
370
- } else {
371
- localVarHeaderParams.Accept = produces.join(',');
372
- }
373
- let localVarFormParams: any = {};
374
-
375
-
376
-
377
-
378
-
379
-
380
-
381
-
382
-
383
- (<any>Object).assign(localVarHeaderParams, options.headers);
384
-
385
- let localVarUseFormData = false;
386
-
387
-
388
-
389
- let localVarRequestOptions: localVarRequest.Options = {
390
- method: 'GET',
391
- qs: localVarQueryParameters,
392
- headers: localVarHeaderParams,
393
- uri: localVarPath,
394
- useQuerystring: this._useQuerystring,
395
- json: true,
396
- };
397
-
398
- let authenticationPromise = Promise.resolve();
399
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
400
-
401
- let interceptorPromise = authenticationPromise;
402
- for (const interceptor of this.interceptors) {
403
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
404
- }
405
-
406
- return interceptorPromise.then(() => {
407
- if (Object.keys(localVarFormParams).length) {
408
- if (localVarUseFormData) {
409
- (<any>localVarRequestOptions).formData = localVarFormParams;
410
- } else {
411
- localVarRequestOptions.form = localVarFormParams;
412
- }
413
- }
414
- return new Promise<{ body: Array<OrderDocument>, status: number }>((resolve, reject) => {
415
- localVarRequest(localVarRequestOptions, (error, response, body) => {
416
- if (error) {
417
- console.error('API call error:', error);
418
- reject(error);
419
- } else {
420
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
421
- body = ObjectSerializer.deserialize(body, "Array<OrderDocument>");
422
- resolve({ body: body, status: response.statusCode });
423
- } else {
424
- console.error('API response error:', response.statusCode);
425
- resolve({ body: body, status: response.statusCode });
426
- }
427
- }
428
- });
429
- });
430
- } )
431
- }
432
- }
@@ -1,180 +0,0 @@
1
- /**
2
- * Northstake
3
- * Northstake api
4
- *
5
- * The version of the OpenAPI document: 1.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
-
13
-
14
- import localVarRequest from 'request';
15
- import http from 'http';
16
-
17
- /* tslint:disable:no-unused-locals */
18
- import { ErrorResponse } from '../model/errorResponse';
19
- import { PortfolioEntity } from '../model/portfolioEntity';
20
-
21
- import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
22
- import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth, JWTAuth } from '../model/models';
23
-
24
- import { HttpError, RequestFile } from './apis';
25
-
26
- let defaultBasePath = 'https://api.northstake.dk/v1';
27
-
28
- // ===============================================
29
- // This file is autogenerated - Please do not edit
30
- // ===============================================
31
-
32
- export enum PortfolioApiApiKeys {
33
- ApiKeyAuth,
34
- }
35
-
36
-
37
-
38
- export class PortfolioApi {
39
- protected _basePath = defaultBasePath;
40
- protected _defaultHeaders : any = {};
41
- protected _useQuerystring : boolean = false;
42
-
43
- protected authentications = {
44
- 'default': <Authentication>new JWTAuth('your_api_key', 'your_private_key'),
45
- 'bearerTokenAuth': new HttpBearerAuth(),
46
- 'ApiKeyAuth': new ApiKeyAuth('header', 'x-api-key'),
47
- }
48
-
49
- protected interceptors: Interceptor[] = [];
50
-
51
- constructor(basePath?: string);
52
- constructor(basePathOrUsername: string, password?: string, basePath?: string) {
53
- if (password) {
54
- if (basePath) {
55
- this.basePath = basePath;
56
- }
57
- } else {
58
- if (basePathOrUsername) {
59
- this.basePath = basePathOrUsername
60
- }
61
- }
62
- }
63
-
64
- set useQuerystring(value: boolean) {
65
- this._useQuerystring = value;
66
- }
67
-
68
- set basePath(basePath: string) {
69
- this._basePath = basePath;
70
- }
71
-
72
- set defaultHeaders(defaultHeaders: any) {
73
- this._defaultHeaders = defaultHeaders;
74
- }
75
-
76
- get defaultHeaders() {
77
- return this._defaultHeaders;
78
- }
79
-
80
- get basePath() {
81
- return this._basePath;
82
- }
83
-
84
- public setDefaultAuthentication(auth: Authentication) {
85
- this.authentications.default = auth;
86
- }
87
-
88
- public setApiKey(key: PortfolioApiApiKeys, value: string) {
89
- (this.authentications as any)[PortfolioApiApiKeys[key]].apiKey = value;
90
- }
91
-
92
- set accessToken(accessToken: string | (() => string)) {
93
- this.authentications.bearerTokenAuth.accessToken = accessToken;
94
- }
95
-
96
- public addInterceptor(interceptor: Interceptor) {
97
- this.interceptors.push(interceptor);
98
- }
99
-
100
- /**
101
- *
102
- * @summary Account portfolio overview
103
- */
104
-
105
-
106
-
107
-
108
-
109
- public async getPortfolio (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ body: Array<PortfolioEntity>, status: number }> {
110
-
111
- const localVarPath = this.basePath + '/portfolio';
112
-
113
- let localVarQueryParameters: any = {};
114
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
115
- const produces = ['application/json'];
116
- if (produces.indexOf('application/json') >= 0) {
117
- localVarHeaderParams.Accept = 'application/json';
118
- } else {
119
- localVarHeaderParams.Accept = produces.join(',');
120
- }
121
- let localVarFormParams: any = {};
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
- (<any>Object).assign(localVarHeaderParams, options.headers);
132
-
133
- let localVarUseFormData = false;
134
-
135
-
136
-
137
- let localVarRequestOptions: localVarRequest.Options = {
138
- method: 'GET',
139
- qs: localVarQueryParameters,
140
- headers: localVarHeaderParams,
141
- uri: localVarPath,
142
- useQuerystring: this._useQuerystring,
143
- json: true,
144
- };
145
-
146
- let authenticationPromise = Promise.resolve();
147
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
148
-
149
- let interceptorPromise = authenticationPromise;
150
- for (const interceptor of this.interceptors) {
151
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
152
- }
153
-
154
- return interceptorPromise.then(() => {
155
- if (Object.keys(localVarFormParams).length) {
156
- if (localVarUseFormData) {
157
- (<any>localVarRequestOptions).formData = localVarFormParams;
158
- } else {
159
- localVarRequestOptions.form = localVarFormParams;
160
- }
161
- }
162
- return new Promise<{ body: Array<PortfolioEntity>, status: number }>((resolve, reject) => {
163
- localVarRequest(localVarRequestOptions, (error, response, body) => {
164
- if (error) {
165
- console.error('API call error:', error);
166
- reject(error);
167
- } else {
168
- if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
169
- body = ObjectSerializer.deserialize(body, "Array<PortfolioEntity>");
170
- resolve({ body: body, status: response.statusCode });
171
- } else {
172
- console.error('API response error:', response.statusCode);
173
- resolve({ body: body, status: response.statusCode });
174
- }
175
- }
176
- });
177
- });
178
- } )
179
- }
180
- }