@northstake/northstakeapi 1.0.23 → 1.0.24

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.
@@ -2,6 +2,7 @@
2
2
  .openapi-generator-ignore
3
3
  api.ts
4
4
  api/accountApi.ts
5
+ api/accountApiKeysApi.ts
5
6
  api/apis.ts
6
7
  api/depositAddressesApi.ts
7
8
  api/linkedWalletsApi.ts
@@ -26,6 +27,7 @@ model/accountEntity.ts
26
27
  model/addLinkedWalletForUserRequest.ts
27
28
  model/addLinkedWalletRequest.ts
28
29
  model/allManagedUsersResponse.ts
30
+ model/apiKey.ts
29
31
  model/asset.ts
30
32
  model/createManagedUserRequest.ts
31
33
  model/createRFQRequest.ts
@@ -45,6 +47,7 @@ model/ethereumValidatorKeyKeystoreCryptoKdfParams.ts
45
47
  model/exitEstimateBase.ts
46
48
  model/exitEstimateSeller.ts
47
49
  model/exitProposal.ts
50
+ model/generateApiKeyRequest.ts
48
51
  model/getMarketplaceMetadata200Response.ts
49
52
  model/getTransactionsResponse.ts
50
53
  model/getWithdrawalsResponse.ts
@@ -0,0 +1,346 @@
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 { ApiKey } from '../model/apiKey';
19
+ import { ErrorResponse } from '../model/errorResponse';
20
+ import { GenerateApiKeyRequest } from '../model/generateApiKeyRequest';
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 AccountApiKeysApiApiKeys {
34
+ ApiKeyAuth,
35
+ }
36
+
37
+
38
+
39
+ export class AccountApiKeysApi {
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: AccountApiKeysApiApiKeys, value: string) {
90
+ (this.authentications as any)[AccountApiKeysApiApiKeys[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 Delete an API key
104
+ * @param apiKeyId The ID of the API key to delete
105
+ */
106
+
107
+
108
+
109
+
110
+
111
+ public async deleteApiKey (apiKeyId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ body: any, status: number }> {
112
+
113
+ const localVarPath = this.basePath + '/account/apiKeys/{apiKeyId}'
114
+ .replace('{' + 'apiKeyId' + '}', encodeURIComponent(String(apiKeyId)));
115
+
116
+ let localVarQueryParameters: any = {};
117
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
118
+ let localVarFormParams: any = {};
119
+
120
+
121
+ // Verify required parameter 'apiKeyId' is not null or undefined
122
+ if (apiKeyId === null || apiKeyId === undefined) {
123
+ throw new Error('Required parameter "apiKeyId" was null or undefined when calling deleteApiKey.');
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
+ * Allows a user to generate a new API key with specific rights and restrictions.
182
+ * @summary Generate a new API key
183
+ * @param generateApiKeyRequest
184
+ */
185
+
186
+
187
+
188
+
189
+
190
+ public async generateApiKey (generateApiKeyRequest: GenerateApiKeyRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ body: ApiKey, status: number }> {
191
+
192
+ const localVarPath = this.basePath + '/account/apiKeys';
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 'generateApiKeyRequest' is not null or undefined
206
+ if (generateApiKeyRequest === null || generateApiKeyRequest === undefined) {
207
+ throw new Error('Required parameter "generateApiKeyRequest" was null or undefined when calling generateApiKey.');
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(generateApiKeyRequest, "GenerateApiKeyRequest")
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: ApiKey, 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, "ApiKey");
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 List all API keys
269
+ */
270
+
271
+
272
+
273
+
274
+
275
+ public async listApiKeys (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ body: Array<ApiKey>, status: number }> {
276
+
277
+ const localVarPath = this.basePath + '/account/apiKeys';
278
+
279
+ let localVarQueryParameters: any = {};
280
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
281
+ const produces = ['application/json'];
282
+ if (produces.indexOf('application/json') >= 0) {
283
+ localVarHeaderParams.Accept = 'application/json';
284
+ } else {
285
+ localVarHeaderParams.Accept = produces.join(',');
286
+ }
287
+ let localVarFormParams: any = {};
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+ (<any>Object).assign(localVarHeaderParams, options.headers);
298
+
299
+ let localVarUseFormData = false;
300
+
301
+
302
+
303
+ let localVarRequestOptions: localVarRequest.Options = {
304
+ method: 'GET',
305
+ qs: localVarQueryParameters,
306
+ headers: localVarHeaderParams,
307
+ uri: localVarPath,
308
+ useQuerystring: this._useQuerystring,
309
+ json: true,
310
+ };
311
+
312
+ let authenticationPromise = Promise.resolve();
313
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
314
+
315
+ let interceptorPromise = authenticationPromise;
316
+ for (const interceptor of this.interceptors) {
317
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
318
+ }
319
+
320
+ return interceptorPromise.then(() => {
321
+ if (Object.keys(localVarFormParams).length) {
322
+ if (localVarUseFormData) {
323
+ (<any>localVarRequestOptions).formData = localVarFormParams;
324
+ } else {
325
+ localVarRequestOptions.form = localVarFormParams;
326
+ }
327
+ }
328
+ return new Promise<{ body: Array<ApiKey>, status: number }>((resolve, reject) => {
329
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
330
+ if (error) {
331
+ console.error('API call error:', error);
332
+ reject(error);
333
+ } else {
334
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
335
+ body = ObjectSerializer.deserialize(body, "Array<ApiKey>");
336
+ resolve({ body: body, status: response.statusCode });
337
+ } else {
338
+ console.error('API response error:', response.statusCode);
339
+ resolve({ body: body, status: response.statusCode });
340
+ }
341
+ }
342
+ });
343
+ });
344
+ } )
345
+ }
346
+ }
package/api/apis.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from './accountApi';
2
2
  import { AccountApi } from './accountApi';
3
+ export * from './accountApiKeysApi';
4
+ import { AccountApiKeysApi } from './accountApiKeysApi';
3
5
  export * from './depositAddressesApi';
4
6
  import { DepositAddressesApi } from './depositAddressesApi';
5
7
  export * from './linkedWalletsApi';
@@ -45,4 +47,4 @@ export class HttpError extends Error {
45
47
 
46
48
  export { RequestFile } from '../model/models';
47
49
 
48
- export const APIS = [AccountApi, DepositAddressesApi, LinkedWalletsApi, ManagedUsersApi, ManagedUsersDepositAddressesApi, ManagedUsersLinkedWalletsApi, ManagedUsersOrdersApi, ManagedUsersPortfolioApi, ManagedUsersTransactionsApi, ManagedUsersValidatorsApi, OrdersApi, PortfolioApi, TransactionsApi, ValidatorMarketplaceBuyersApi, ValidatorMarketplaceFacilitatorApi, ValidatorMarketplaceSellersApi, ValidatorMarketplaceWebhooksApi, ValidatorsApi];
50
+ export const APIS = [AccountApi, AccountApiKeysApi, DepositAddressesApi, LinkedWalletsApi, ManagedUsersApi, ManagedUsersDepositAddressesApi, ManagedUsersLinkedWalletsApi, ManagedUsersOrdersApi, ManagedUsersPortfolioApi, ManagedUsersTransactionsApi, ManagedUsersValidatorsApi, OrdersApi, PortfolioApi, TransactionsApi, ValidatorMarketplaceBuyersApi, ValidatorMarketplaceFacilitatorApi, ValidatorMarketplaceSellersApi, ValidatorMarketplaceWebhooksApi, ValidatorsApi];
package/api.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  // masterApi.mustache
2
2
  import { JWTAuth } from './model/models';
3
3
  import { AccountApi } from './api/accountApi';
4
+ import { AccountApiKeysApi } from './api/accountApiKeysApi';
4
5
  import { DepositAddressesApi } from './api/depositAddressesApi';
5
6
  import { LinkedWalletsApi } from './api/linkedWalletsApi';
6
7
  import { ManagedUsersApi } from './api/managedUsersApi';
@@ -23,6 +24,7 @@ export * from './model/./accountEntity';
23
24
  export * from './model/./addLinkedWalletForUserRequest';
24
25
  export * from './model/./addLinkedWalletRequest';
25
26
  export * from './model/./allManagedUsersResponse';
27
+ export * from './model/./apiKey';
26
28
  export * from './model/./asset';
27
29
  export * from './model/./createManagedUserRequest';
28
30
  export * from './model/./createRFQRequest';
@@ -42,6 +44,7 @@ export * from './model/./ethereumValidatorKeyKeystoreCryptoKdfParams';
42
44
  export * from './model/./exitEstimateBase';
43
45
  export * from './model/./exitEstimateSeller';
44
46
  export * from './model/./exitProposal';
47
+ export * from './model/./generateApiKeyRequest';
45
48
  export * from './model/./getMarketplaceMetadata200Response';
46
49
  export * from './model/./getTransactionsResponse';
47
50
  export * from './model/./getWithdrawalsResponse';
@@ -124,6 +127,8 @@ export class NorthstakeApi {
124
127
 
125
128
  this.account = new AccountApi(basePath);
126
129
  this.account.setDefaultAuthentication(jwtAuth);
130
+ this.accountApiKeys = new AccountApiKeysApi(basePath);
131
+ this.accountApiKeys.setDefaultAuthentication(jwtAuth);
127
132
  this.depositAddresses = new DepositAddressesApi(basePath);
128
133
  this.depositAddresses.setDefaultAuthentication(jwtAuth);
129
134
  this.linkedWallets = new LinkedWalletsApi(basePath);
@@ -160,6 +165,7 @@ export class NorthstakeApi {
160
165
  this.validators.setDefaultAuthentication(jwtAuth);
161
166
  }
162
167
  public account: AccountApi;
168
+ public accountApiKeys: AccountApiKeysApi;
163
169
  public depositAddresses: DepositAddressesApi;
164
170
  public linkedWallets: LinkedWalletsApi;
165
171
  public managedUsers: ManagedUsersApi;
@@ -0,0 +1,77 @@
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
+ import { ApiKey } from '../model/apiKey';
13
+ import { GenerateApiKeyRequest } from '../model/generateApiKeyRequest';
14
+ import { Authentication, Interceptor } from '../model/models';
15
+ import { HttpBearerAuth, ApiKeyAuth } from '../model/models';
16
+ export declare enum AccountApiKeysApiApiKeys {
17
+ ApiKeyAuth = 0
18
+ }
19
+ export declare class AccountApiKeysApi {
20
+ protected _basePath: string;
21
+ protected _defaultHeaders: any;
22
+ protected _useQuerystring: boolean;
23
+ protected authentications: {
24
+ default: Authentication;
25
+ bearerTokenAuth: HttpBearerAuth;
26
+ ApiKeyAuth: ApiKeyAuth;
27
+ };
28
+ protected interceptors: Interceptor[];
29
+ constructor(basePath?: string);
30
+ set useQuerystring(value: boolean);
31
+ set basePath(basePath: string);
32
+ set defaultHeaders(defaultHeaders: any);
33
+ get defaultHeaders(): any;
34
+ get basePath(): string;
35
+ setDefaultAuthentication(auth: Authentication): void;
36
+ setApiKey(key: AccountApiKeysApiApiKeys, value: string): void;
37
+ set accessToken(accessToken: string | (() => string));
38
+ addInterceptor(interceptor: Interceptor): void;
39
+ /**
40
+ *
41
+ * @summary Delete an API key
42
+ * @param apiKeyId The ID of the API key to delete
43
+ */
44
+ deleteApiKey(apiKeyId: string, options?: {
45
+ headers: {
46
+ [name: string]: string;
47
+ };
48
+ }): Promise<{
49
+ body: any;
50
+ status: number;
51
+ }>;
52
+ /**
53
+ * Allows a user to generate a new API key with specific rights and restrictions.
54
+ * @summary Generate a new API key
55
+ * @param generateApiKeyRequest
56
+ */
57
+ generateApiKey(generateApiKeyRequest: GenerateApiKeyRequest, options?: {
58
+ headers: {
59
+ [name: string]: string;
60
+ };
61
+ }): Promise<{
62
+ body: ApiKey;
63
+ status: number;
64
+ }>;
65
+ /**
66
+ *
67
+ * @summary List all API keys
68
+ */
69
+ listApiKeys(options?: {
70
+ headers: {
71
+ [name: string]: string;
72
+ };
73
+ }): Promise<{
74
+ body: Array<ApiKey>;
75
+ status: number;
76
+ }>;
77
+ }