@emilgroup/accounting-sdk-node 1.0.1-beta.2 → 1.0.1-beta.3

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 (60) hide show
  1. package/.openapi-generator/FILES +9 -7
  2. package/README.md +18 -2
  3. package/api/booking-processes-api.ts +169 -0
  4. package/api/financial-accounts-api.ts +4 -4
  5. package/api/{default-api.ts → health-api.ts} +13 -13
  6. package/api.ts +4 -4
  7. package/base.ts +15 -7
  8. package/dist/api/booking-processes-api.d.ts +97 -0
  9. package/dist/api/booking-processes-api.js +228 -0
  10. package/dist/api/financial-accounts-api.d.ts +4 -4
  11. package/dist/api/financial-accounts-api.js +4 -4
  12. package/dist/api/{default-api.d.ts → health-api.d.ts} +10 -10
  13. package/dist/api/{default-api.js → health-api.js} +22 -22
  14. package/dist/api.d.ts +2 -2
  15. package/dist/api.js +2 -2
  16. package/dist/base.d.ts +3 -1
  17. package/dist/base.js +27 -20
  18. package/dist/models/booking-entry-class.d.ts +123 -0
  19. package/dist/models/{entry-data-dto.js → booking-entry-class.js} +19 -0
  20. package/dist/models/booking-process-class.d.ts +94 -0
  21. package/dist/models/booking-process-class.js +29 -0
  22. package/dist/models/create-booking-entry-request-dto.d.ts +93 -0
  23. package/dist/models/create-booking-entry-request-dto.js +34 -0
  24. package/dist/models/create-booking-process-request-dto.d.ts +58 -0
  25. package/dist/models/create-booking-process-request-dto.js +29 -0
  26. package/dist/models/{create-transaction-response-class.d.ts → create-booking-process-response-class.d.ts} +7 -7
  27. package/dist/models/create-financial-account-request-dto.d.ts +5 -5
  28. package/dist/models/create-financial-account-request-dto.js +5 -5
  29. package/dist/models/financial-account-class.d.ts +18 -6
  30. package/dist/models/financial-account-class.js +5 -5
  31. package/dist/models/financial-transaction-class.d.ts +108 -0
  32. package/dist/models/financial-transaction-data-dto.d.ts +65 -0
  33. package/dist/models/{list-transactions-response-class.js → financial-transaction-data-dto.js} +5 -0
  34. package/dist/models/index.d.ts +7 -5
  35. package/dist/models/index.js +7 -5
  36. package/models/booking-entry-class.ts +133 -0
  37. package/models/booking-process-class.ts +104 -0
  38. package/models/create-booking-entry-request-dto.ts +103 -0
  39. package/models/create-booking-process-request-dto.ts +68 -0
  40. package/models/{create-transaction-response-class.ts → create-booking-process-response-class.ts} +7 -7
  41. package/models/create-financial-account-request-dto.ts +5 -5
  42. package/models/financial-account-class.ts +18 -6
  43. package/models/financial-transaction-class.ts +114 -0
  44. package/models/financial-transaction-data-dto.ts +74 -0
  45. package/models/index.ts +7 -5
  46. package/package.json +1 -1
  47. package/api/transactions-api.ts +0 -357
  48. package/dist/api/transactions-api.d.ts +0 -207
  49. package/dist/api/transactions-api.js +0 -357
  50. package/dist/models/create-transaction-request-dto.d.ts +0 -55
  51. package/dist/models/entry-data-dto.d.ts +0 -36
  52. package/dist/models/list-transactions-response-class.d.ts +0 -31
  53. package/dist/models/transaction-class.d.ts +0 -78
  54. package/dist/models/transaction-class.js +0 -15
  55. package/models/create-transaction-request-dto.ts +0 -61
  56. package/models/entry-data-dto.ts +0 -42
  57. package/models/list-transactions-response-class.ts +0 -37
  58. package/models/transaction-class.ts +0 -84
  59. /package/dist/models/{create-transaction-request-dto.js → create-booking-process-response-class.js} +0 -0
  60. /package/dist/models/{create-transaction-response-class.js → financial-transaction-class.js} +0 -0
@@ -3,26 +3,28 @@
3
3
  .openapi-generator-ignore
4
4
  README.md
5
5
  api.ts
6
- api/default-api.ts
6
+ api/booking-processes-api.ts
7
7
  api/financial-accounts-api.ts
8
- api/transactions-api.ts
8
+ api/health-api.ts
9
9
  base.ts
10
10
  common.ts
11
11
  configuration.ts
12
12
  git_push.sh
13
13
  index.ts
14
+ models/booking-entry-class.ts
15
+ models/booking-process-class.ts
16
+ models/create-booking-entry-request-dto.ts
17
+ models/create-booking-process-request-dto.ts
18
+ models/create-booking-process-response-class.ts
14
19
  models/create-financial-account-request-dto.ts
15
20
  models/create-financial-account-response-class.ts
16
- models/create-transaction-request-dto.ts
17
- models/create-transaction-response-class.ts
18
- models/entry-data-dto.ts
19
21
  models/financial-account-class.ts
22
+ models/financial-transaction-class.ts
23
+ models/financial-transaction-data-dto.ts
20
24
  models/get-financial-account-response-class.ts
21
25
  models/index.ts
22
26
  models/inline-response200.ts
23
27
  models/inline-response503.ts
24
28
  models/list-financial-accounts-response-class.ts
25
- models/list-transactions-response-class.ts
26
- models/transaction-class.ts
27
29
  package.json
28
30
  tsconfig.json
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/accounting-sdk-node@1.0.1-beta.2 --save
20
+ npm install @emilgroup/accounting-sdk-node@1.0.1-beta.3 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/accounting-sdk-node@1.0.1-beta.2
24
+ yarn add @emilgroup/accounting-sdk-node@1.0.1-beta.3
25
25
  ```
26
26
 
27
27
  And then you can import `FinancialAccountsApi`.
@@ -47,6 +47,22 @@ export EMIL_USERNAME=XXXXX@XXXX.XXX
47
47
  export EMIL_PASSWORD=XXXXXXXXXXXXXX
48
48
  ```
49
49
 
50
+ ## Base path
51
+
52
+ To select the basic path for using the API, we can use two approaches. The first is to use one of the predefined environments, and the second is to specify the domain as a string.
53
+
54
+ ```ts
55
+ import { FinancialAccountsApi, Environment } from '@emilgroup/accounting-sdk-node'
56
+
57
+ const financialAccountsApi = new FinancialAccountsApi();
58
+
59
+ // Allows you to simply choose environment. It will usually be Environment.Production.
60
+ financialAccountsApi.selectEnvironment(Environment.Production);
61
+
62
+ // For advanced users, use the custom baseUrl of the website you need to connect to.
63
+ financialAccountsApi.selectBasePath('https://my-custom-domain.com');
64
+ ```
65
+
50
66
  ## Example
51
67
 
52
68
  Here is a basic functionning example:
@@ -0,0 +1,169 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL AccountingService
5
+ * The EMIL AccountingService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
17
+ import { Configuration } from '../configuration';
18
+ // Some imports not used depending on template conditions
19
+ // @ts-ignore
20
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
21
+ // @ts-ignore
22
+ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
23
+ // @ts-ignore
24
+ import { CreateBookingProcessRequestDto } from '../models';
25
+ // @ts-ignore
26
+ import { CreateBookingProcessResponseClass } from '../models';
27
+ // URLSearchParams not necessarily used
28
+ // @ts-ignore
29
+ import { URL, URLSearchParams } from 'url';
30
+ const FormData = require('form-data');
31
+ /**
32
+ * BookingProcessesApi - axios parameter creator
33
+ * @export
34
+ */
35
+ export const BookingProcessesApiAxiosParamCreator = function (configuration?: Configuration) {
36
+ return {
37
+ /**
38
+ * This will create an account in the database. The account will be created with the provided name, type, and account number. Optionally, you can provide a parent account ID to create a sub-account.
39
+ * @summary Create the booking process
40
+ * @param {CreateBookingProcessRequestDto} createBookingProcessRequestDto
41
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
42
+ * @param {*} [options] Override http request option.
43
+ * @throws {RequiredError}
44
+ */
45
+ createBookingProcess: async (createBookingProcessRequestDto: CreateBookingProcessRequestDto, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
46
+ // verify required parameter 'createBookingProcessRequestDto' is not null or undefined
47
+ assertParamExists('createBookingProcess', 'createBookingProcessRequestDto', createBookingProcessRequestDto)
48
+ const localVarPath = `/accountingservice/v1/booking-processes`;
49
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
50
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
51
+ let baseOptions;
52
+ let baseAccessToken;
53
+ if (configuration) {
54
+ baseOptions = configuration.baseOptions;
55
+ baseAccessToken = configuration.accessToken;
56
+ }
57
+
58
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
59
+ const localVarHeaderParameter = {} as any;
60
+ const localVarQueryParameter = {} as any;
61
+
62
+ // authentication bearer required
63
+ // http bearer authentication required
64
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
65
+
66
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
67
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
68
+ }
69
+
70
+
71
+
72
+ localVarHeaderParameter['Content-Type'] = 'application/json';
73
+
74
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
75
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
76
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
77
+ localVarRequestOptions.data = serializeDataIfNeeded(createBookingProcessRequestDto, localVarRequestOptions, configuration)
78
+
79
+ return {
80
+ url: toPathString(localVarUrlObj),
81
+ options: localVarRequestOptions,
82
+ };
83
+ },
84
+ }
85
+ };
86
+
87
+ /**
88
+ * BookingProcessesApi - functional programming interface
89
+ * @export
90
+ */
91
+ export const BookingProcessesApiFp = function(configuration?: Configuration) {
92
+ const localVarAxiosParamCreator = BookingProcessesApiAxiosParamCreator(configuration)
93
+ return {
94
+ /**
95
+ * This will create an account in the database. The account will be created with the provided name, type, and account number. Optionally, you can provide a parent account ID to create a sub-account.
96
+ * @summary Create the booking process
97
+ * @param {CreateBookingProcessRequestDto} createBookingProcessRequestDto
98
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
99
+ * @param {*} [options] Override http request option.
100
+ * @throws {RequiredError}
101
+ */
102
+ async createBookingProcess(createBookingProcessRequestDto: CreateBookingProcessRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateBookingProcessResponseClass>> {
103
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createBookingProcess(createBookingProcessRequestDto, authorization, options);
104
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
105
+ },
106
+ }
107
+ };
108
+
109
+ /**
110
+ * BookingProcessesApi - factory interface
111
+ * @export
112
+ */
113
+ export const BookingProcessesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
114
+ const localVarFp = BookingProcessesApiFp(configuration)
115
+ return {
116
+ /**
117
+ * This will create an account in the database. The account will be created with the provided name, type, and account number. Optionally, you can provide a parent account ID to create a sub-account.
118
+ * @summary Create the booking process
119
+ * @param {CreateBookingProcessRequestDto} createBookingProcessRequestDto
120
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
121
+ * @param {*} [options] Override http request option.
122
+ * @throws {RequiredError}
123
+ */
124
+ createBookingProcess(createBookingProcessRequestDto: CreateBookingProcessRequestDto, authorization?: string, options?: any): AxiosPromise<CreateBookingProcessResponseClass> {
125
+ return localVarFp.createBookingProcess(createBookingProcessRequestDto, authorization, options).then((request) => request(axios, basePath));
126
+ },
127
+ };
128
+ };
129
+
130
+ /**
131
+ * Request parameters for createBookingProcess operation in BookingProcessesApi.
132
+ * @export
133
+ * @interface BookingProcessesApiCreateBookingProcessRequest
134
+ */
135
+ export interface BookingProcessesApiCreateBookingProcessRequest {
136
+ /**
137
+ *
138
+ * @type {CreateBookingProcessRequestDto}
139
+ * @memberof BookingProcessesApiCreateBookingProcess
140
+ */
141
+ readonly createBookingProcessRequestDto: CreateBookingProcessRequestDto
142
+
143
+ /**
144
+ * Bearer Token: provided by the login endpoint under the name accessToken.
145
+ * @type {string}
146
+ * @memberof BookingProcessesApiCreateBookingProcess
147
+ */
148
+ readonly authorization?: string
149
+ }
150
+
151
+ /**
152
+ * BookingProcessesApi - object-oriented interface
153
+ * @export
154
+ * @class BookingProcessesApi
155
+ * @extends {BaseAPI}
156
+ */
157
+ export class BookingProcessesApi extends BaseAPI {
158
+ /**
159
+ * This will create an account in the database. The account will be created with the provided name, type, and account number. Optionally, you can provide a parent account ID to create a sub-account.
160
+ * @summary Create the booking process
161
+ * @param {BookingProcessesApiCreateBookingProcessRequest} requestParameters Request parameters.
162
+ * @param {*} [options] Override http request option.
163
+ * @throws {RequiredError}
164
+ * @memberof BookingProcessesApi
165
+ */
166
+ public createBookingProcess(requestParameters: BookingProcessesApiCreateBookingProcessRequest, options?: AxiosRequestConfig) {
167
+ return BookingProcessesApiFp(this.configuration).createBookingProcess(requestParameters.createBookingProcessRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
168
+ }
169
+ }
@@ -131,7 +131,7 @@ export const FinancialAccountsApiAxiosParamCreator = function (configuration?: C
131
131
  };
132
132
  },
133
133
  /**
134
- * 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.
134
+ * 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.
135
135
  * @summary Retrieve the account
136
136
  * @param {string} code Unique identifier for the object.
137
137
  * @param {string} expand
@@ -293,7 +293,7 @@ export const FinancialAccountsApiFp = function(configuration?: Configuration) {
293
293
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
294
294
  },
295
295
  /**
296
- * 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.
296
+ * 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.
297
297
  * @summary Retrieve the account
298
298
  * @param {string} code Unique identifier for the object.
299
299
  * @param {string} expand
@@ -356,7 +356,7 @@ export const FinancialAccountsApiFactory = function (configuration?: Configurati
356
356
  return localVarFp.deleteFinancialAccount(code, authorization, options).then((request) => request(axios, basePath));
357
357
  },
358
358
  /**
359
- * 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.
359
+ * 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.
360
360
  * @summary Retrieve the account
361
361
  * @param {string} code Unique identifier for the object.
362
362
  * @param {string} expand
@@ -552,7 +552,7 @@ export class FinancialAccountsApi extends BaseAPI {
552
552
  }
553
553
 
554
554
  /**
555
- * 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.
555
+ * 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.
556
556
  * @summary Retrieve the account
557
557
  * @param {FinancialAccountsApiGetFinancialAccountRequest} requestParameters Request parameters.
558
558
  * @param {*} [options] Override http request option.
@@ -29,10 +29,10 @@ import { InlineResponse503 } from '../models';
29
29
  import { URL, URLSearchParams } from 'url';
30
30
  const FormData = require('form-data');
31
31
  /**
32
- * DefaultApi - axios parameter creator
32
+ * HealthApi - axios parameter creator
33
33
  * @export
34
34
  */
35
- export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
35
+ export const HealthApiAxiosParamCreator = function (configuration?: Configuration) {
36
36
  return {
37
37
  /**
38
38
  * Returns the health status of the accounting service. This endpoint is used to monitor the operational status of the accounting service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
@@ -70,11 +70,11 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
70
70
  };
71
71
 
72
72
  /**
73
- * DefaultApi - functional programming interface
73
+ * HealthApi - functional programming interface
74
74
  * @export
75
75
  */
76
- export const DefaultApiFp = function(configuration?: Configuration) {
77
- const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
76
+ export const HealthApiFp = function(configuration?: Configuration) {
77
+ const localVarAxiosParamCreator = HealthApiAxiosParamCreator(configuration)
78
78
  return {
79
79
  /**
80
80
  * Returns the health status of the accounting service. This endpoint is used to monitor the operational status of the accounting service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
@@ -90,11 +90,11 @@ export const DefaultApiFp = function(configuration?: Configuration) {
90
90
  };
91
91
 
92
92
  /**
93
- * DefaultApi - factory interface
93
+ * HealthApi - factory interface
94
94
  * @export
95
95
  */
96
- export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
97
- const localVarFp = DefaultApiFp(configuration)
96
+ export const HealthApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
97
+ const localVarFp = HealthApiFp(configuration)
98
98
  return {
99
99
  /**
100
100
  * Returns the health status of the accounting service. This endpoint is used to monitor the operational status of the accounting service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
@@ -109,20 +109,20 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
109
109
  };
110
110
 
111
111
  /**
112
- * DefaultApi - object-oriented interface
112
+ * HealthApi - object-oriented interface
113
113
  * @export
114
- * @class DefaultApi
114
+ * @class HealthApi
115
115
  * @extends {BaseAPI}
116
116
  */
117
- export class DefaultApi extends BaseAPI {
117
+ export class HealthApi extends BaseAPI {
118
118
  /**
119
119
  * Returns the health status of the accounting service. This endpoint is used to monitor the operational status of the accounting 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}
123
- * @memberof DefaultApi
123
+ * @memberof HealthApi
124
124
  */
125
125
  public check(options?: AxiosRequestConfig) {
126
- return DefaultApiFp(this.configuration).check(options).then((request) => request(this.axios, this.basePath));
126
+ return HealthApiFp(this.configuration).check(options).then((request) => request(this.axios, this.basePath));
127
127
  }
128
128
  }
package/api.ts CHANGED
@@ -24,12 +24,12 @@ import FormData from 'form-data'
24
24
  import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
25
25
  // @ts-ignore
26
26
  import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
27
- import { DefaultApi } from './api';
27
+ import { BookingProcessesApi } from './api';
28
28
  import { FinancialAccountsApi } from './api';
29
- import { TransactionsApi } from './api';
29
+ import { HealthApi } from './api';
30
30
 
31
31
 
32
- export * from './api/default-api';
32
+ export * from './api/booking-processes-api';
33
33
  export * from './api/financial-accounts-api';
34
- export * from './api/transactions-api';
34
+ export * from './api/health-api';
35
35
 
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<string> {
180
+ async refreshTokenInternal(): Promise<LoginClass> {
175
181
  const { username, refreshToken } = this.configuration;
176
182
 
177
183
 
178
184
  if (!username || !refreshToken) {
179
- return '';
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 { data: { accessToken } } = await globalAxios.request<LoginClass>(options);
199
+ const response = await globalAxios.request<LoginClass>(options);
194
200
 
195
- return accessToken;
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;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * EMIL AccountingService
3
+ * The EMIL AccountingService API description
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ * Contact: kontakt@emil.de
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 { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
13
+ import { Configuration } from '../configuration';
14
+ import { RequestArgs, BaseAPI } from '../base';
15
+ import { CreateBookingProcessRequestDto } from '../models';
16
+ import { CreateBookingProcessResponseClass } from '../models';
17
+ /**
18
+ * BookingProcessesApi - axios parameter creator
19
+ * @export
20
+ */
21
+ export declare const BookingProcessesApiAxiosParamCreator: (configuration?: Configuration) => {
22
+ /**
23
+ * This will create an account in the database. The account will be created with the provided name, type, and account number. Optionally, you can provide a parent account ID to create a sub-account.
24
+ * @summary Create the booking process
25
+ * @param {CreateBookingProcessRequestDto} createBookingProcessRequestDto
26
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
27
+ * @param {*} [options] Override http request option.
28
+ * @throws {RequiredError}
29
+ */
30
+ createBookingProcess: (createBookingProcessRequestDto: CreateBookingProcessRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
31
+ };
32
+ /**
33
+ * BookingProcessesApi - functional programming interface
34
+ * @export
35
+ */
36
+ export declare const BookingProcessesApiFp: (configuration?: Configuration) => {
37
+ /**
38
+ * This will create an account in the database. The account will be created with the provided name, type, and account number. Optionally, you can provide a parent account ID to create a sub-account.
39
+ * @summary Create the booking process
40
+ * @param {CreateBookingProcessRequestDto} createBookingProcessRequestDto
41
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
42
+ * @param {*} [options] Override http request option.
43
+ * @throws {RequiredError}
44
+ */
45
+ createBookingProcess(createBookingProcessRequestDto: CreateBookingProcessRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateBookingProcessResponseClass>>;
46
+ };
47
+ /**
48
+ * BookingProcessesApi - factory interface
49
+ * @export
50
+ */
51
+ export declare const BookingProcessesApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
52
+ /**
53
+ * This will create an account in the database. The account will be created with the provided name, type, and account number. Optionally, you can provide a parent account ID to create a sub-account.
54
+ * @summary Create the booking process
55
+ * @param {CreateBookingProcessRequestDto} createBookingProcessRequestDto
56
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
57
+ * @param {*} [options] Override http request option.
58
+ * @throws {RequiredError}
59
+ */
60
+ createBookingProcess(createBookingProcessRequestDto: CreateBookingProcessRequestDto, authorization?: string, options?: any): AxiosPromise<CreateBookingProcessResponseClass>;
61
+ };
62
+ /**
63
+ * Request parameters for createBookingProcess operation in BookingProcessesApi.
64
+ * @export
65
+ * @interface BookingProcessesApiCreateBookingProcessRequest
66
+ */
67
+ export interface BookingProcessesApiCreateBookingProcessRequest {
68
+ /**
69
+ *
70
+ * @type {CreateBookingProcessRequestDto}
71
+ * @memberof BookingProcessesApiCreateBookingProcess
72
+ */
73
+ readonly createBookingProcessRequestDto: CreateBookingProcessRequestDto;
74
+ /**
75
+ * Bearer Token: provided by the login endpoint under the name accessToken.
76
+ * @type {string}
77
+ * @memberof BookingProcessesApiCreateBookingProcess
78
+ */
79
+ readonly authorization?: string;
80
+ }
81
+ /**
82
+ * BookingProcessesApi - object-oriented interface
83
+ * @export
84
+ * @class BookingProcessesApi
85
+ * @extends {BaseAPI}
86
+ */
87
+ export declare class BookingProcessesApi extends BaseAPI {
88
+ /**
89
+ * This will create an account in the database. The account will be created with the provided name, type, and account number. Optionally, you can provide a parent account ID to create a sub-account.
90
+ * @summary Create the booking process
91
+ * @param {BookingProcessesApiCreateBookingProcessRequest} requestParameters Request parameters.
92
+ * @param {*} [options] Override http request option.
93
+ * @throws {RequiredError}
94
+ * @memberof BookingProcessesApi
95
+ */
96
+ createBookingProcess(requestParameters: BookingProcessesApiCreateBookingProcessRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateBookingProcessResponseClass, any>>;
97
+ }