@emilgroup/account-sdk-node 1.27.0 → 1.27.1-beta.1
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/README.md +2 -2
- package/api/accounts-api.ts +8 -8
- package/api/default-api.ts +4 -4
- package/base.ts +15 -7
- package/dist/api/accounts-api.d.ts +8 -8
- package/dist/api/accounts-api.js +8 -8
- package/dist/api/default-api.d.ts +4 -4
- package/dist/api/default-api.js +4 -4
- package/dist/base.d.ts +3 -1
- package/dist/base.js +27 -20
- package/dist/models/account-class.d.ts +12 -0
- package/models/account-class.ts +12 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
|
|
|
17
17
|
Navigate to the folder of your consuming project and run one of the following commands:
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
npm install @emilgroup/account-sdk-node@1.27.
|
|
20
|
+
npm install @emilgroup/account-sdk-node@1.27.1-beta.1 --save
|
|
21
21
|
```
|
|
22
22
|
or
|
|
23
23
|
```
|
|
24
|
-
yarn add @emilgroup/account-sdk-node@1.27.
|
|
24
|
+
yarn add @emilgroup/account-sdk-node@1.27.1-beta.1
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
And then you can import `AccountsApi`.
|
package/api/accounts-api.ts
CHANGED
|
@@ -135,7 +135,7 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
135
135
|
};
|
|
136
136
|
},
|
|
137
137
|
/**
|
|
138
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
138
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
139
139
|
* @summary Retrieve the account
|
|
140
140
|
* @param {string} code Unique identifier for the object.
|
|
141
141
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -185,7 +185,7 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
|
|
|
185
185
|
};
|
|
186
186
|
},
|
|
187
187
|
/**
|
|
188
|
-
* Returns a list of accounts you have previously created.
|
|
188
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
189
189
|
* @summary List accounts
|
|
190
190
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
191
191
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -346,7 +346,7 @@ export const AccountsApiFp = function(configuration?: Configuration) {
|
|
|
346
346
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
347
347
|
},
|
|
348
348
|
/**
|
|
349
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
349
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
350
350
|
* @summary Retrieve the account
|
|
351
351
|
* @param {string} code Unique identifier for the object.
|
|
352
352
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -359,7 +359,7 @@ export const AccountsApiFp = function(configuration?: Configuration) {
|
|
|
359
359
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
360
360
|
},
|
|
361
361
|
/**
|
|
362
|
-
* Returns a list of accounts you have previously created.
|
|
362
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
363
363
|
* @summary List accounts
|
|
364
364
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
365
365
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -422,7 +422,7 @@ export const AccountsApiFactory = function (configuration?: Configuration, baseP
|
|
|
422
422
|
return localVarFp.deleteAccount(code, authorization, options).then((request) => request(axios, basePath));
|
|
423
423
|
},
|
|
424
424
|
/**
|
|
425
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
425
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
426
426
|
* @summary Retrieve the account
|
|
427
427
|
* @param {string} code Unique identifier for the object.
|
|
428
428
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -434,7 +434,7 @@ export const AccountsApiFactory = function (configuration?: Configuration, baseP
|
|
|
434
434
|
return localVarFp.getAccount(code, authorization, expand, options).then((request) => request(axios, basePath));
|
|
435
435
|
},
|
|
436
436
|
/**
|
|
437
|
-
* Returns a list of accounts you have previously created.
|
|
437
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
438
438
|
* @summary List accounts
|
|
439
439
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
440
440
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -658,7 +658,7 @@ export class AccountsApi extends BaseAPI {
|
|
|
658
658
|
}
|
|
659
659
|
|
|
660
660
|
/**
|
|
661
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
661
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
662
662
|
* @summary Retrieve the account
|
|
663
663
|
* @param {AccountsApiGetAccountRequest} requestParameters Request parameters.
|
|
664
664
|
* @param {*} [options] Override http request option.
|
|
@@ -670,7 +670,7 @@ export class AccountsApi extends BaseAPI {
|
|
|
670
670
|
}
|
|
671
671
|
|
|
672
672
|
/**
|
|
673
|
-
* Returns a list of accounts you have previously created.
|
|
673
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
674
674
|
* @summary List accounts
|
|
675
675
|
* @param {AccountsApiListAccountsRequest} requestParameters Request parameters.
|
|
676
676
|
* @param {*} [options] Override http request option.
|
package/api/default-api.ts
CHANGED
|
@@ -35,7 +35,7 @@ const FormData = require('form-data');
|
|
|
35
35
|
export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
|
|
36
36
|
return {
|
|
37
37
|
/**
|
|
38
|
-
* Returns the health status of the account service.
|
|
38
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
39
39
|
* @summary Health Check
|
|
40
40
|
* @param {*} [options] Override http request option.
|
|
41
41
|
* @throws {RequiredError}
|
|
@@ -77,7 +77,7 @@ export const DefaultApiFp = function(configuration?: Configuration) {
|
|
|
77
77
|
const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
|
|
78
78
|
return {
|
|
79
79
|
/**
|
|
80
|
-
* Returns the health status of the account service.
|
|
80
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
81
81
|
* @summary Health Check
|
|
82
82
|
* @param {*} [options] Override http request option.
|
|
83
83
|
* @throws {RequiredError}
|
|
@@ -97,7 +97,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
|
|
|
97
97
|
const localVarFp = DefaultApiFp(configuration)
|
|
98
98
|
return {
|
|
99
99
|
/**
|
|
100
|
-
* Returns the health status of the account service.
|
|
100
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
101
101
|
* @summary Health Check
|
|
102
102
|
* @param {*} [options] Override http request option.
|
|
103
103
|
* @throws {RequiredError}
|
|
@@ -116,7 +116,7 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
|
|
|
116
116
|
*/
|
|
117
117
|
export class DefaultApi extends BaseAPI {
|
|
118
118
|
/**
|
|
119
|
-
* Returns the health status of the account service.
|
|
119
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
120
120
|
* @summary Health Check
|
|
121
121
|
* @param {*} [options] Override http request option.
|
|
122
122
|
* @throws {RequiredError}
|
package/base.ts
CHANGED
|
@@ -79,6 +79,7 @@ export class BaseAPI {
|
|
|
79
79
|
protected configuration: Configuration;
|
|
80
80
|
private username?: string;
|
|
81
81
|
private password?: string;
|
|
82
|
+
private permissions: Array<string> = [];
|
|
82
83
|
|
|
83
84
|
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
84
85
|
if (configuration) {
|
|
@@ -149,6 +150,10 @@ export class BaseAPI {
|
|
|
149
150
|
this.configuration.basePath = env;
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
getPermissions(): Array<string> {
|
|
154
|
+
return this.permissions;
|
|
155
|
+
}
|
|
156
|
+
|
|
152
157
|
async authorize(username: string, password: string): Promise<void> {
|
|
153
158
|
const options: AxiosRequestConfig = {
|
|
154
159
|
method: 'POST',
|
|
@@ -163,20 +168,21 @@ export class BaseAPI {
|
|
|
163
168
|
|
|
164
169
|
const response = await globalAxios.request<LoginClass>(options);
|
|
165
170
|
|
|
166
|
-
const { data: { accessToken } } = response;
|
|
171
|
+
const { data: { accessToken, permissions } } = response;
|
|
167
172
|
this.configuration.username = username;
|
|
168
173
|
this.configuration.accessToken = `Bearer ${accessToken}`;
|
|
174
|
+
this.permissions = permissions;
|
|
169
175
|
|
|
170
176
|
const refreshToken = this.extractRefreshToken(response)
|
|
171
177
|
this.configuration.refreshToken = refreshToken;
|
|
172
178
|
}
|
|
173
179
|
|
|
174
|
-
async refreshTokenInternal(): Promise<
|
|
180
|
+
async refreshTokenInternal(): Promise<LoginClass> {
|
|
175
181
|
const { username, refreshToken } = this.configuration;
|
|
176
182
|
|
|
177
183
|
|
|
178
184
|
if (!username || !refreshToken) {
|
|
179
|
-
|
|
185
|
+
throw new Error('Failed to refresh token.');
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
const options: AxiosRequestConfig = {
|
|
@@ -190,9 +196,9 @@ export class BaseAPI {
|
|
|
190
196
|
withCredentials: true,
|
|
191
197
|
};
|
|
192
198
|
|
|
193
|
-
const
|
|
199
|
+
const response = await globalAxios.request<LoginClass>(options);
|
|
194
200
|
|
|
195
|
-
return
|
|
201
|
+
return response.data;
|
|
196
202
|
}
|
|
197
203
|
|
|
198
204
|
private extractRefreshToken(response: AxiosResponse): string {
|
|
@@ -221,8 +227,9 @@ export class BaseAPI {
|
|
|
221
227
|
if (err.response.status === 401 && !originalConfig._retry) {
|
|
222
228
|
originalConfig._retry = true;
|
|
223
229
|
try {
|
|
224
|
-
const tokenString = await this.refreshTokenInternal();
|
|
230
|
+
const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
|
|
225
231
|
const accessToken = `Bearer ${tokenString}`;
|
|
232
|
+
this.permissions = permissions;
|
|
226
233
|
|
|
227
234
|
originalConfig.headers['Authorization'] = `Bearer ${accessToken}`
|
|
228
235
|
|
|
@@ -246,8 +253,9 @@ export class BaseAPI {
|
|
|
246
253
|
){
|
|
247
254
|
_retry_count++;
|
|
248
255
|
try {
|
|
249
|
-
const tokenString = await this.refreshTokenInternal();
|
|
256
|
+
const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
|
|
250
257
|
const accessToken = `Bearer ${tokenString}`;
|
|
258
|
+
this.permissions = permissions;
|
|
251
259
|
|
|
252
260
|
_retry = true;
|
|
253
261
|
originalConfig.headers['Authorization'] = accessToken;
|
|
@@ -42,7 +42,7 @@ export declare const AccountsApiAxiosParamCreator: (configuration?: Configuratio
|
|
|
42
42
|
*/
|
|
43
43
|
deleteAccount: (code: string, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
44
44
|
/**
|
|
45
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
45
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
46
46
|
* @summary Retrieve the account
|
|
47
47
|
* @param {string} code Unique identifier for the object.
|
|
48
48
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -52,7 +52,7 @@ export declare const AccountsApiAxiosParamCreator: (configuration?: Configuratio
|
|
|
52
52
|
*/
|
|
53
53
|
getAccount: (code: string, authorization?: string, expand?: 'policies', options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
54
54
|
/**
|
|
55
|
-
* Returns a list of accounts you have previously created.
|
|
55
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
56
56
|
* @summary List accounts
|
|
57
57
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
58
58
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -101,7 +101,7 @@ export declare const AccountsApiFp: (configuration?: Configuration) => {
|
|
|
101
101
|
*/
|
|
102
102
|
deleteAccount(code: string, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>>;
|
|
103
103
|
/**
|
|
104
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
104
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
105
105
|
* @summary Retrieve the account
|
|
106
106
|
* @param {string} code Unique identifier for the object.
|
|
107
107
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -111,7 +111,7 @@ export declare const AccountsApiFp: (configuration?: Configuration) => {
|
|
|
111
111
|
*/
|
|
112
112
|
getAccount(code: string, authorization?: string, expand?: 'policies', options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetAccountResponseClass>>;
|
|
113
113
|
/**
|
|
114
|
-
* Returns a list of accounts you have previously created.
|
|
114
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
115
115
|
* @summary List accounts
|
|
116
116
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
117
117
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -160,7 +160,7 @@ export declare const AccountsApiFactory: (configuration?: Configuration, basePat
|
|
|
160
160
|
*/
|
|
161
161
|
deleteAccount(code: string, authorization?: string, options?: any): AxiosPromise<void>;
|
|
162
162
|
/**
|
|
163
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
163
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
164
164
|
* @summary Retrieve the account
|
|
165
165
|
* @param {string} code Unique identifier for the object.
|
|
166
166
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -170,7 +170,7 @@ export declare const AccountsApiFactory: (configuration?: Configuration, basePat
|
|
|
170
170
|
*/
|
|
171
171
|
getAccount(code: string, authorization?: string, expand?: 'policies', options?: any): AxiosPromise<GetAccountResponseClass>;
|
|
172
172
|
/**
|
|
173
|
-
* Returns a list of accounts you have previously created.
|
|
173
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
174
174
|
* @summary List accounts
|
|
175
175
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
176
176
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -364,7 +364,7 @@ export declare class AccountsApi extends BaseAPI {
|
|
|
364
364
|
*/
|
|
365
365
|
deleteAccount(requestParameters: AccountsApiDeleteAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any>>;
|
|
366
366
|
/**
|
|
367
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
367
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
368
368
|
* @summary Retrieve the account
|
|
369
369
|
* @param {AccountsApiGetAccountRequest} requestParameters Request parameters.
|
|
370
370
|
* @param {*} [options] Override http request option.
|
|
@@ -373,7 +373,7 @@ export declare class AccountsApi extends BaseAPI {
|
|
|
373
373
|
*/
|
|
374
374
|
getAccount(requestParameters: AccountsApiGetAccountRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<GetAccountResponseClass, any>>;
|
|
375
375
|
/**
|
|
376
|
-
* Returns a list of accounts you have previously created.
|
|
376
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
377
377
|
* @summary List accounts
|
|
378
378
|
* @param {AccountsApiListAccountsRequest} requestParameters Request parameters.
|
|
379
379
|
* @param {*} [options] Override http request option.
|
package/dist/api/accounts-api.js
CHANGED
|
@@ -194,7 +194,7 @@ var AccountsApiAxiosParamCreator = function (configuration) {
|
|
|
194
194
|
});
|
|
195
195
|
},
|
|
196
196
|
/**
|
|
197
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
197
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
198
198
|
* @summary Retrieve the account
|
|
199
199
|
* @param {string} code Unique identifier for the object.
|
|
200
200
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -246,7 +246,7 @@ var AccountsApiAxiosParamCreator = function (configuration) {
|
|
|
246
246
|
});
|
|
247
247
|
},
|
|
248
248
|
/**
|
|
249
|
-
* Returns a list of accounts you have previously created.
|
|
249
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
250
250
|
* @summary List accounts
|
|
251
251
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
252
252
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -423,7 +423,7 @@ var AccountsApiFp = function (configuration) {
|
|
|
423
423
|
});
|
|
424
424
|
},
|
|
425
425
|
/**
|
|
426
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
426
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
427
427
|
* @summary Retrieve the account
|
|
428
428
|
* @param {string} code Unique identifier for the object.
|
|
429
429
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -445,7 +445,7 @@ var AccountsApiFp = function (configuration) {
|
|
|
445
445
|
});
|
|
446
446
|
},
|
|
447
447
|
/**
|
|
448
|
-
* Returns a list of accounts you have previously created.
|
|
448
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
449
449
|
* @summary List accounts
|
|
450
450
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
451
451
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -526,7 +526,7 @@ var AccountsApiFactory = function (configuration, basePath, axios) {
|
|
|
526
526
|
return localVarFp.deleteAccount(code, authorization, options).then(function (request) { return request(axios, basePath); });
|
|
527
527
|
},
|
|
528
528
|
/**
|
|
529
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
529
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
530
530
|
* @summary Retrieve the account
|
|
531
531
|
* @param {string} code Unique identifier for the object.
|
|
532
532
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
@@ -538,7 +538,7 @@ var AccountsApiFactory = function (configuration, basePath, axios) {
|
|
|
538
538
|
return localVarFp.getAccount(code, authorization, expand, options).then(function (request) { return request(axios, basePath); });
|
|
539
539
|
},
|
|
540
540
|
/**
|
|
541
|
-
* Returns a list of accounts you have previously created.
|
|
541
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
542
542
|
* @summary List accounts
|
|
543
543
|
* @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
|
|
544
544
|
* @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
|
|
@@ -605,7 +605,7 @@ var AccountsApi = /** @class */ (function (_super) {
|
|
|
605
605
|
return (0, exports.AccountsApiFp)(this.configuration).deleteAccount(requestParameters.code, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
606
606
|
};
|
|
607
607
|
/**
|
|
608
|
-
* Retrieves the details of the account that was previously created. Supply the unique account code
|
|
608
|
+
* Retrieves the details of the account that was previously created. Supply the unique account code that was returned when you created it and Emil Api will return the corresponding account information.
|
|
609
609
|
* @summary Retrieve the account
|
|
610
610
|
* @param {AccountsApiGetAccountRequest} requestParameters Request parameters.
|
|
611
611
|
* @param {*} [options] Override http request option.
|
|
@@ -617,7 +617,7 @@ var AccountsApi = /** @class */ (function (_super) {
|
|
|
617
617
|
return (0, exports.AccountsApiFp)(this.configuration).getAccount(requestParameters.code, requestParameters.authorization, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
618
618
|
};
|
|
619
619
|
/**
|
|
620
|
-
* Returns a list of accounts you have previously created.
|
|
620
|
+
* Returns a list of accounts you have previously created. The accounts are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
|
|
621
621
|
* @summary List accounts
|
|
622
622
|
* @param {AccountsApiListAccountsRequest} requestParameters Request parameters.
|
|
623
623
|
* @param {*} [options] Override http request option.
|
|
@@ -19,7 +19,7 @@ import { InlineResponse200 } from '../models';
|
|
|
19
19
|
*/
|
|
20
20
|
export declare const DefaultApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
21
21
|
/**
|
|
22
|
-
* Returns the health status of the account service.
|
|
22
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
23
23
|
* @summary Health Check
|
|
24
24
|
* @param {*} [options] Override http request option.
|
|
25
25
|
* @throws {RequiredError}
|
|
@@ -32,7 +32,7 @@ export declare const DefaultApiAxiosParamCreator: (configuration?: Configuration
|
|
|
32
32
|
*/
|
|
33
33
|
export declare const DefaultApiFp: (configuration?: Configuration) => {
|
|
34
34
|
/**
|
|
35
|
-
* Returns the health status of the account service.
|
|
35
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
36
36
|
* @summary Health Check
|
|
37
37
|
* @param {*} [options] Override http request option.
|
|
38
38
|
* @throws {RequiredError}
|
|
@@ -45,7 +45,7 @@ export declare const DefaultApiFp: (configuration?: Configuration) => {
|
|
|
45
45
|
*/
|
|
46
46
|
export declare const DefaultApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
|
|
47
47
|
/**
|
|
48
|
-
* Returns the health status of the account service.
|
|
48
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
49
49
|
* @summary Health Check
|
|
50
50
|
* @param {*} [options] Override http request option.
|
|
51
51
|
* @throws {RequiredError}
|
|
@@ -60,7 +60,7 @@ export declare const DefaultApiFactory: (configuration?: Configuration, basePath
|
|
|
60
60
|
*/
|
|
61
61
|
export declare class DefaultApi extends BaseAPI {
|
|
62
62
|
/**
|
|
63
|
-
* Returns the health status of the account service.
|
|
63
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
64
64
|
* @summary Health Check
|
|
65
65
|
* @param {*} [options] Override http request option.
|
|
66
66
|
* @throws {RequiredError}
|
package/dist/api/default-api.js
CHANGED
|
@@ -97,7 +97,7 @@ var DefaultApiAxiosParamCreator = function (configuration) {
|
|
|
97
97
|
var _this = this;
|
|
98
98
|
return {
|
|
99
99
|
/**
|
|
100
|
-
* Returns the health status of the account service.
|
|
100
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
101
101
|
* @summary Health Check
|
|
102
102
|
* @param {*} [options] Override http request option.
|
|
103
103
|
* @throws {RequiredError}
|
|
@@ -137,7 +137,7 @@ var DefaultApiFp = function (configuration) {
|
|
|
137
137
|
var localVarAxiosParamCreator = (0, exports.DefaultApiAxiosParamCreator)(configuration);
|
|
138
138
|
return {
|
|
139
139
|
/**
|
|
140
|
-
* Returns the health status of the account service.
|
|
140
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
141
141
|
* @summary Health Check
|
|
142
142
|
* @param {*} [options] Override http request option.
|
|
143
143
|
* @throws {RequiredError}
|
|
@@ -166,7 +166,7 @@ var DefaultApiFactory = function (configuration, basePath, axios) {
|
|
|
166
166
|
var localVarFp = (0, exports.DefaultApiFp)(configuration);
|
|
167
167
|
return {
|
|
168
168
|
/**
|
|
169
|
-
* Returns the health status of the account service.
|
|
169
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
170
170
|
* @summary Health Check
|
|
171
171
|
* @param {*} [options] Override http request option.
|
|
172
172
|
* @throws {RequiredError}
|
|
@@ -189,7 +189,7 @@ var DefaultApi = /** @class */ (function (_super) {
|
|
|
189
189
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
|
-
* Returns the health status of the account service.
|
|
192
|
+
* Returns the health status of the account service. This endpoint is used to monitor the operational status of the account service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
|
|
193
193
|
* @summary Health Check
|
|
194
194
|
* @param {*} [options] Override http request option.
|
|
195
195
|
* @throws {RequiredError}
|
package/dist/base.d.ts
CHANGED
|
@@ -53,14 +53,16 @@ export declare class BaseAPI {
|
|
|
53
53
|
protected configuration: Configuration;
|
|
54
54
|
private username?;
|
|
55
55
|
private password?;
|
|
56
|
+
private permissions;
|
|
56
57
|
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
57
58
|
initialize(env?: Environment): Promise<void>;
|
|
58
59
|
private loadCredentials;
|
|
59
60
|
private readConfigFile;
|
|
60
61
|
private readEnvVariables;
|
|
61
62
|
selectEnvironment(env: Environment): void;
|
|
63
|
+
getPermissions(): Array<string>;
|
|
62
64
|
authorize(username: string, password: string): Promise<void>;
|
|
63
|
-
refreshTokenInternal(): Promise<
|
|
65
|
+
refreshTokenInternal(): Promise<LoginClass>;
|
|
64
66
|
private extractRefreshToken;
|
|
65
67
|
getConfiguration(): Configuration;
|
|
66
68
|
private attachInterceptor;
|
package/dist/base.js
CHANGED
|
@@ -150,6 +150,7 @@ var BaseAPI = /** @class */ (function () {
|
|
|
150
150
|
if (axios === void 0) { axios = axios_1.default; }
|
|
151
151
|
this.basePath = basePath;
|
|
152
152
|
this.axios = axios;
|
|
153
|
+
this.permissions = [];
|
|
153
154
|
if (configuration) {
|
|
154
155
|
this.configuration = configuration;
|
|
155
156
|
this.basePath = configuration.basePath || this.basePath;
|
|
@@ -242,11 +243,14 @@ var BaseAPI = /** @class */ (function () {
|
|
|
242
243
|
BaseAPI.prototype.selectEnvironment = function (env) {
|
|
243
244
|
this.configuration.basePath = env;
|
|
244
245
|
};
|
|
246
|
+
BaseAPI.prototype.getPermissions = function () {
|
|
247
|
+
return this.permissions;
|
|
248
|
+
};
|
|
245
249
|
BaseAPI.prototype.authorize = function (username, password) {
|
|
246
250
|
return __awaiter(this, void 0, void 0, function () {
|
|
247
|
-
var options, response, accessToken, refreshToken;
|
|
248
|
-
return __generator(this, function (
|
|
249
|
-
switch (
|
|
251
|
+
var options, response, _a, accessToken, permissions, refreshToken;
|
|
252
|
+
return __generator(this, function (_b) {
|
|
253
|
+
switch (_b.label) {
|
|
250
254
|
case 0:
|
|
251
255
|
options = {
|
|
252
256
|
method: 'POST',
|
|
@@ -260,10 +264,11 @@ var BaseAPI = /** @class */ (function () {
|
|
|
260
264
|
};
|
|
261
265
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
262
266
|
case 1:
|
|
263
|
-
response =
|
|
264
|
-
|
|
267
|
+
response = _b.sent();
|
|
268
|
+
_a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
|
|
265
269
|
this.configuration.username = username;
|
|
266
270
|
this.configuration.accessToken = "Bearer ".concat(accessToken);
|
|
271
|
+
this.permissions = permissions;
|
|
267
272
|
refreshToken = this.extractRefreshToken(response);
|
|
268
273
|
this.configuration.refreshToken = refreshToken;
|
|
269
274
|
return [2 /*return*/];
|
|
@@ -273,13 +278,13 @@ var BaseAPI = /** @class */ (function () {
|
|
|
273
278
|
};
|
|
274
279
|
BaseAPI.prototype.refreshTokenInternal = function () {
|
|
275
280
|
return __awaiter(this, void 0, void 0, function () {
|
|
276
|
-
var _a, username, refreshToken, options,
|
|
281
|
+
var _a, username, refreshToken, options, response;
|
|
277
282
|
return __generator(this, function (_b) {
|
|
278
283
|
switch (_b.label) {
|
|
279
284
|
case 0:
|
|
280
285
|
_a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
|
|
281
286
|
if (!username || !refreshToken) {
|
|
282
|
-
|
|
287
|
+
throw new Error('Failed to refresh token.');
|
|
283
288
|
}
|
|
284
289
|
options = {
|
|
285
290
|
method: 'POST',
|
|
@@ -293,8 +298,8 @@ var BaseAPI = /** @class */ (function () {
|
|
|
293
298
|
};
|
|
294
299
|
return [4 /*yield*/, axios_1.default.request(options)];
|
|
295
300
|
case 1:
|
|
296
|
-
|
|
297
|
-
return [2 /*return*/,
|
|
301
|
+
response = _b.sent();
|
|
302
|
+
return [2 /*return*/, response.data];
|
|
298
303
|
}
|
|
299
304
|
});
|
|
300
305
|
});
|
|
@@ -314,26 +319,27 @@ var BaseAPI = /** @class */ (function () {
|
|
|
314
319
|
axios.interceptors.response.use(function (res) {
|
|
315
320
|
return res;
|
|
316
321
|
}, function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
317
|
-
var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
|
|
318
|
-
return __generator(this, function (
|
|
319
|
-
switch (
|
|
322
|
+
var originalConfig, _a, tokenString, permissions, accessToken, _error_1, _b, tokenString, permissions, accessToken, _error_2;
|
|
323
|
+
return __generator(this, function (_c) {
|
|
324
|
+
switch (_c.label) {
|
|
320
325
|
case 0:
|
|
321
326
|
originalConfig = err.config;
|
|
322
327
|
if (!err.response) return [3 /*break*/, 5];
|
|
323
328
|
if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
|
|
324
329
|
originalConfig._retry = true;
|
|
325
|
-
|
|
330
|
+
_c.label = 1;
|
|
326
331
|
case 1:
|
|
327
|
-
|
|
332
|
+
_c.trys.push([1, 3, , 4]);
|
|
328
333
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
329
334
|
case 2:
|
|
330
|
-
|
|
335
|
+
_a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
|
|
331
336
|
accessToken = "Bearer ".concat(tokenString);
|
|
337
|
+
this.permissions = permissions;
|
|
332
338
|
originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
|
|
333
339
|
this.configuration.accessToken = accessToken;
|
|
334
340
|
return [2 /*return*/, axios.request(originalConfig)];
|
|
335
341
|
case 3:
|
|
336
|
-
_error_1 =
|
|
342
|
+
_error_1 = _c.sent();
|
|
337
343
|
if (_error_1.response && _error_1.response.data) {
|
|
338
344
|
return [2 /*return*/, Promise.reject(_error_1.response.data)];
|
|
339
345
|
}
|
|
@@ -349,19 +355,20 @@ var BaseAPI = /** @class */ (function () {
|
|
|
349
355
|
&& originalConfig.headers.hasOwnProperty('Authorization')
|
|
350
356
|
&& _retry_count < 4)) return [3 /*break*/, 9];
|
|
351
357
|
_retry_count++;
|
|
352
|
-
|
|
358
|
+
_c.label = 6;
|
|
353
359
|
case 6:
|
|
354
|
-
|
|
360
|
+
_c.trys.push([6, 8, , 9]);
|
|
355
361
|
return [4 /*yield*/, this.refreshTokenInternal()];
|
|
356
362
|
case 7:
|
|
357
|
-
|
|
363
|
+
_b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
|
|
358
364
|
accessToken = "Bearer ".concat(tokenString);
|
|
365
|
+
this.permissions = permissions;
|
|
359
366
|
_retry = true;
|
|
360
367
|
originalConfig.headers['Authorization'] = accessToken;
|
|
361
368
|
this.configuration.accessToken = accessToken;
|
|
362
369
|
return [2 /*return*/, axios.request(__assign({}, originalConfig))];
|
|
363
370
|
case 8:
|
|
364
|
-
_error_2 =
|
|
371
|
+
_error_2 = _c.sent();
|
|
365
372
|
if (_error_2.response && _error_2.response.data) {
|
|
366
373
|
return [2 /*return*/, Promise.reject(_error_2.response.data)];
|
|
367
374
|
}
|
|
@@ -154,6 +154,18 @@ export interface AccountClass {
|
|
|
154
154
|
* @memberof AccountClass
|
|
155
155
|
*/
|
|
156
156
|
'ern': string;
|
|
157
|
+
/**
|
|
158
|
+
* Identifier of the user who created the record.
|
|
159
|
+
* @type {string}
|
|
160
|
+
* @memberof AccountClass
|
|
161
|
+
*/
|
|
162
|
+
'createdBy': string;
|
|
163
|
+
/**
|
|
164
|
+
* Identifier of the user who last updated the record.
|
|
165
|
+
* @type {string}
|
|
166
|
+
* @memberof AccountClass
|
|
167
|
+
*/
|
|
168
|
+
'updatedBy': string;
|
|
157
169
|
}
|
|
158
170
|
export declare const AccountClassTitleEnum: {
|
|
159
171
|
readonly Empty: "";
|
package/models/account-class.ts
CHANGED
|
@@ -159,6 +159,18 @@ export interface AccountClass {
|
|
|
159
159
|
* @memberof AccountClass
|
|
160
160
|
*/
|
|
161
161
|
'ern': string;
|
|
162
|
+
/**
|
|
163
|
+
* Identifier of the user who created the record.
|
|
164
|
+
* @type {string}
|
|
165
|
+
* @memberof AccountClass
|
|
166
|
+
*/
|
|
167
|
+
'createdBy': string;
|
|
168
|
+
/**
|
|
169
|
+
* Identifier of the user who last updated the record.
|
|
170
|
+
* @type {string}
|
|
171
|
+
* @memberof AccountClass
|
|
172
|
+
*/
|
|
173
|
+
'updatedBy': string;
|
|
162
174
|
}
|
|
163
175
|
|
|
164
176
|
export const AccountClassTitleEnum = {
|