@emilgroup/public-api-sdk-node 1.29.0 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +1 -0
- package/README.md +2 -2
- package/api/booking-funnels-api.ts +4 -4
- package/api/leads-api.ts +4 -4
- package/base.ts +15 -7
- package/dist/api/booking-funnels-api.d.ts +4 -4
- package/dist/api/booking-funnels-api.js +4 -4
- package/dist/api/leads-api.d.ts +4 -4
- package/dist/api/leads-api.js +4 -4
- package/dist/base.d.ts +3 -1
- package/dist/base.js +27 -20
- package/dist/models/create-estimated-invoice-response-class.d.ts +7 -1
- package/dist/models/create-lead-request-dto.d.ts +6 -11
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/models/link-lead-partner-request-dto.d.ts +36 -0
- package/dist/models/link-lead-partner-request-dto.js +15 -0
- package/models/create-estimated-invoice-response-class.ts +7 -1
- package/models/create-lead-request-dto.ts +6 -11
- package/models/index.ts +1 -0
- package/models/link-lead-partner-request-dto.ts +42 -0
- package/package.json +1 -1
package/.openapi-generator/FILES
CHANGED
|
@@ -71,6 +71,7 @@ models/lead-bank-account-class.ts
|
|
|
71
71
|
models/lead-class.ts
|
|
72
72
|
models/lead-policy-class.ts
|
|
73
73
|
models/lead-policy-object-class.ts
|
|
74
|
+
models/link-lead-partner-request-dto.ts
|
|
74
75
|
models/list-documents-response-class.ts
|
|
75
76
|
models/list-product-documents-response-class.ts
|
|
76
77
|
models/list-products-response-class.ts
|
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/public-api-sdk-node@1.
|
|
20
|
+
npm install @emilgroup/public-api-sdk-node@1.30.0 --save
|
|
21
21
|
```
|
|
22
22
|
or
|
|
23
23
|
```
|
|
24
|
-
yarn add @emilgroup/public-api-sdk-node@1.
|
|
24
|
+
yarn add @emilgroup/public-api-sdk-node@1.30.0
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
And then you can import `PublicApi`.
|
|
@@ -33,7 +33,7 @@ const FormData = require('form-data');
|
|
|
33
33
|
export const BookingFunnelsApiAxiosParamCreator = function (configuration?: Configuration) {
|
|
34
34
|
return {
|
|
35
35
|
/**
|
|
36
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
36
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
37
37
|
* @summary Retrieve the booking funnel
|
|
38
38
|
* @param {string} code Unique identifier for the object.
|
|
39
39
|
* @param {string} [authorization] Bearer Token
|
|
@@ -88,7 +88,7 @@ export const BookingFunnelsApiFp = function(configuration?: Configuration) {
|
|
|
88
88
|
const localVarAxiosParamCreator = BookingFunnelsApiAxiosParamCreator(configuration)
|
|
89
89
|
return {
|
|
90
90
|
/**
|
|
91
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
91
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
92
92
|
* @summary Retrieve the booking funnel
|
|
93
93
|
* @param {string} code Unique identifier for the object.
|
|
94
94
|
* @param {string} [authorization] Bearer Token
|
|
@@ -110,7 +110,7 @@ export const BookingFunnelsApiFactory = function (configuration?: Configuration,
|
|
|
110
110
|
const localVarFp = BookingFunnelsApiFp(configuration)
|
|
111
111
|
return {
|
|
112
112
|
/**
|
|
113
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
113
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
114
114
|
* @summary Retrieve the booking funnel
|
|
115
115
|
* @param {string} code Unique identifier for the object.
|
|
116
116
|
* @param {string} [authorization] Bearer Token
|
|
@@ -152,7 +152,7 @@ export interface BookingFunnelsApiGetBookingFunnelRequest {
|
|
|
152
152
|
*/
|
|
153
153
|
export class BookingFunnelsApi extends BaseAPI {
|
|
154
154
|
/**
|
|
155
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
155
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
156
156
|
* @summary Retrieve the booking funnel
|
|
157
157
|
* @param {BookingFunnelsApiGetBookingFunnelRequest} requestParameters Request parameters.
|
|
158
158
|
* @param {*} [options] Override http request option.
|
package/api/leads-api.ts
CHANGED
|
@@ -186,7 +186,7 @@ export const LeadsApiAxiosParamCreator = function (configuration?: Configuration
|
|
|
186
186
|
};
|
|
187
187
|
},
|
|
188
188
|
/**
|
|
189
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
189
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
190
190
|
* @summary Retrieve the lead
|
|
191
191
|
* @param {string} code Unique identifier for the object.
|
|
192
192
|
* @param {string} [authorization] Bearer Token
|
|
@@ -420,7 +420,7 @@ export const LeadsApiFp = function(configuration?: Configuration) {
|
|
|
420
420
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
421
421
|
},
|
|
422
422
|
/**
|
|
423
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
423
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
424
424
|
* @summary Retrieve the lead
|
|
425
425
|
* @param {string} code Unique identifier for the object.
|
|
426
426
|
* @param {string} [authorization] Bearer Token
|
|
@@ -512,7 +512,7 @@ export const LeadsApiFactory = function (configuration?: Configuration, basePath
|
|
|
512
512
|
return localVarFp.createLeadSync(createLeadRequestDto, authorization, options).then((request) => request(axios, basePath));
|
|
513
513
|
},
|
|
514
514
|
/**
|
|
515
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
515
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
516
516
|
* @summary Retrieve the lead
|
|
517
517
|
* @param {string} code Unique identifier for the object.
|
|
518
518
|
* @param {string} [authorization] Bearer Token
|
|
@@ -757,7 +757,7 @@ export class LeadsApi extends BaseAPI {
|
|
|
757
757
|
}
|
|
758
758
|
|
|
759
759
|
/**
|
|
760
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
760
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
761
761
|
* @summary Retrieve the lead
|
|
762
762
|
* @param {LeadsApiGetLeadRequest} requestParameters Request parameters.
|
|
763
763
|
* @param {*} [options] Override http request option.
|
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;
|
|
@@ -19,7 +19,7 @@ import { GetBookingFunnelResponseClass } from '../models';
|
|
|
19
19
|
*/
|
|
20
20
|
export declare const BookingFunnelsApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
21
21
|
/**
|
|
22
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
22
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
23
23
|
* @summary Retrieve the booking funnel
|
|
24
24
|
* @param {string} code Unique identifier for the object.
|
|
25
25
|
* @param {string} [authorization] Bearer Token
|
|
@@ -34,7 +34,7 @@ export declare const BookingFunnelsApiAxiosParamCreator: (configuration?: Config
|
|
|
34
34
|
*/
|
|
35
35
|
export declare const BookingFunnelsApiFp: (configuration?: Configuration) => {
|
|
36
36
|
/**
|
|
37
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
37
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
38
38
|
* @summary Retrieve the booking funnel
|
|
39
39
|
* @param {string} code Unique identifier for the object.
|
|
40
40
|
* @param {string} [authorization] Bearer Token
|
|
@@ -49,7 +49,7 @@ export declare const BookingFunnelsApiFp: (configuration?: Configuration) => {
|
|
|
49
49
|
*/
|
|
50
50
|
export declare const BookingFunnelsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
|
|
51
51
|
/**
|
|
52
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
52
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
53
53
|
* @summary Retrieve the booking funnel
|
|
54
54
|
* @param {string} code Unique identifier for the object.
|
|
55
55
|
* @param {string} [authorization] Bearer Token
|
|
@@ -85,7 +85,7 @@ export interface BookingFunnelsApiGetBookingFunnelRequest {
|
|
|
85
85
|
*/
|
|
86
86
|
export declare class BookingFunnelsApi extends BaseAPI {
|
|
87
87
|
/**
|
|
88
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
88
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
89
89
|
* @summary Retrieve the booking funnel
|
|
90
90
|
* @param {BookingFunnelsApiGetBookingFunnelRequest} requestParameters Request parameters.
|
|
91
91
|
* @param {*} [options] Override http request option.
|
|
@@ -97,7 +97,7 @@ var BookingFunnelsApiAxiosParamCreator = function (configuration) {
|
|
|
97
97
|
var _this = this;
|
|
98
98
|
return {
|
|
99
99
|
/**
|
|
100
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
100
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
101
101
|
* @summary Retrieve the booking funnel
|
|
102
102
|
* @param {string} code Unique identifier for the object.
|
|
103
103
|
* @param {string} [authorization] Bearer Token
|
|
@@ -155,7 +155,7 @@ var BookingFunnelsApiFp = function (configuration) {
|
|
|
155
155
|
var localVarAxiosParamCreator = (0, exports.BookingFunnelsApiAxiosParamCreator)(configuration);
|
|
156
156
|
return {
|
|
157
157
|
/**
|
|
158
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
158
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
159
159
|
* @summary Retrieve the booking funnel
|
|
160
160
|
* @param {string} code Unique identifier for the object.
|
|
161
161
|
* @param {string} [authorization] Bearer Token
|
|
@@ -186,7 +186,7 @@ var BookingFunnelsApiFactory = function (configuration, basePath, axios) {
|
|
|
186
186
|
var localVarFp = (0, exports.BookingFunnelsApiFp)(configuration);
|
|
187
187
|
return {
|
|
188
188
|
/**
|
|
189
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
189
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
190
190
|
* @summary Retrieve the booking funnel
|
|
191
191
|
* @param {string} code Unique identifier for the object.
|
|
192
192
|
* @param {string} [authorization] Bearer Token
|
|
@@ -211,7 +211,7 @@ var BookingFunnelsApi = /** @class */ (function (_super) {
|
|
|
211
211
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
|
-
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code
|
|
214
|
+
* Retrieves the details of the booking funnel that was previously created. Supply the unique booking funnel code that was returned when you created it and Emil Api will return the corresponding booking funnel information.
|
|
215
215
|
* @summary Retrieve the booking funnel
|
|
216
216
|
* @param {BookingFunnelsApiGetBookingFunnelRequest} requestParameters Request parameters.
|
|
217
217
|
* @param {*} [options] Override http request option.
|
package/dist/api/leads-api.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare const LeadsApiAxiosParamCreator: (configuration?: Configuration)
|
|
|
52
52
|
*/
|
|
53
53
|
createLeadSync: (createLeadRequestDto: CreateLeadRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
|
|
54
54
|
/**
|
|
55
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
55
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
56
56
|
* @summary Retrieve the lead
|
|
57
57
|
* @param {string} code Unique identifier for the object.
|
|
58
58
|
* @param {string} [authorization] Bearer Token
|
|
@@ -122,7 +122,7 @@ export declare const LeadsApiFp: (configuration?: Configuration) => {
|
|
|
122
122
|
*/
|
|
123
123
|
createLeadSync(createLeadRequestDto: CreateLeadRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateLeadResponseClass>>;
|
|
124
124
|
/**
|
|
125
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
125
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
126
126
|
* @summary Retrieve the lead
|
|
127
127
|
* @param {string} code Unique identifier for the object.
|
|
128
128
|
* @param {string} [authorization] Bearer Token
|
|
@@ -192,7 +192,7 @@ export declare const LeadsApiFactory: (configuration?: Configuration, basePath?:
|
|
|
192
192
|
*/
|
|
193
193
|
createLeadSync(createLeadRequestDto: CreateLeadRequestDto, authorization?: string, options?: any): AxiosPromise<CreateLeadResponseClass>;
|
|
194
194
|
/**
|
|
195
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
195
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
196
196
|
* @summary Retrieve the lead
|
|
197
197
|
* @param {string} code Unique identifier for the object.
|
|
198
198
|
* @param {string} [authorization] Bearer Token
|
|
@@ -403,7 +403,7 @@ export declare class LeadsApi extends BaseAPI {
|
|
|
403
403
|
*/
|
|
404
404
|
createLeadSync(requestParameters: LeadsApiCreateLeadSyncRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateLeadResponseClass, any>>;
|
|
405
405
|
/**
|
|
406
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
406
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
407
407
|
* @summary Retrieve the lead
|
|
408
408
|
* @param {LeadsApiGetLeadRequest} requestParameters Request parameters.
|
|
409
409
|
* @param {*} [options] Override http request option.
|
package/dist/api/leads-api.js
CHANGED
|
@@ -244,7 +244,7 @@ var LeadsApiAxiosParamCreator = function (configuration) {
|
|
|
244
244
|
});
|
|
245
245
|
},
|
|
246
246
|
/**
|
|
247
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
247
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
248
248
|
* @summary Retrieve the lead
|
|
249
249
|
* @param {string} code Unique identifier for the object.
|
|
250
250
|
* @param {string} [authorization] Bearer Token
|
|
@@ -515,7 +515,7 @@ var LeadsApiFp = function (configuration) {
|
|
|
515
515
|
});
|
|
516
516
|
},
|
|
517
517
|
/**
|
|
518
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
518
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
519
519
|
* @summary Retrieve the lead
|
|
520
520
|
* @param {string} code Unique identifier for the object.
|
|
521
521
|
* @param {string} [authorization] Bearer Token
|
|
@@ -643,7 +643,7 @@ var LeadsApiFactory = function (configuration, basePath, axios) {
|
|
|
643
643
|
return localVarFp.createLeadSync(createLeadRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
|
|
644
644
|
},
|
|
645
645
|
/**
|
|
646
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
646
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
647
647
|
* @summary Retrieve the lead
|
|
648
648
|
* @param {string} code Unique identifier for the object.
|
|
649
649
|
* @param {string} [authorization] Bearer Token
|
|
@@ -738,7 +738,7 @@ var LeadsApi = /** @class */ (function (_super) {
|
|
|
738
738
|
return (0, exports.LeadsApiFp)(this.configuration).createLeadSync(requestParameters.createLeadRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
739
739
|
};
|
|
740
740
|
/**
|
|
741
|
-
* Retrieves the details of the lead that was previously created. Supply the unique lead code
|
|
741
|
+
* Retrieves the details of the lead that was previously created. Supply the unique lead code that was returned when you created it and Emil Api will return the corresponding lead information.
|
|
742
742
|
* @summary Retrieve the lead
|
|
743
743
|
* @param {LeadsApiGetLeadRequest} requestParameters Request parameters.
|
|
744
744
|
* @param {*} [options] Override http request option.
|
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
|
}
|
|
@@ -18,11 +18,17 @@ import { InvoiceClass } from './invoice-class';
|
|
|
18
18
|
*/
|
|
19
19
|
export interface CreateEstimatedInvoiceResponseClass {
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* The estimated invoice response based on the current policy data. This includes the calculated invoice for the specified billing period (e.g., monthly, quarterly) as defined by the policy. The invoice contains details such as gross amount, net amount, tax amount, and other invoice-related data for the specific period the invoice is generated for.
|
|
22
22
|
* @type {InvoiceClass}
|
|
23
23
|
* @memberof CreateEstimatedInvoiceResponseClass
|
|
24
24
|
*/
|
|
25
25
|
'invoice'?: InvoiceClass;
|
|
26
|
+
/**
|
|
27
|
+
* The estimated yearly invoice response. This represents the invoice recalculated to a yearly format, standardizing the invoice values regardless of the billing frequency defined by the policy (e.g., monthly, quarterly, etc.). This yearly invoice gives an overview of the total cost for the entire year, including recalculated gross amount, net amount, tax amount, and other related invoice data, ensuring that all charges are displayed on a yearly basis. Note: If the original invoice is already set to a yearly billing frequency, the \'yearlyInvoice\' will be identical to the \'invoice\'.
|
|
28
|
+
* @type {InvoiceClass}
|
|
29
|
+
* @memberof CreateEstimatedInvoiceResponseClass
|
|
30
|
+
*/
|
|
31
|
+
'yearlyInvoice'?: InvoiceClass;
|
|
26
32
|
/**
|
|
27
33
|
* In some cases, custom premium calculation needs to be used. In that case, a custom object is returned. It can hold up any kind of information. For more information, check the general documentation.
|
|
28
34
|
* @type {object}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import { CreateAccountRequestDto } from './create-account-request-dto';
|
|
13
13
|
import { CreateBankAccountRequestDto } from './create-bank-account-request-dto';
|
|
14
14
|
import { CreatePaymentMethodRequestDto } from './create-payment-method-request-dto';
|
|
15
|
+
import { LinkLeadPartnerRequestDto } from './link-lead-partner-request-dto';
|
|
15
16
|
import { PolicyObjectRequestDto } from './policy-object-request-dto';
|
|
16
17
|
import { PremiumOverrideRequestDto } from './premium-override-request-dto';
|
|
17
18
|
import { UploadedDocumentDto } from './uploaded-document-dto';
|
|
@@ -89,10 +90,10 @@ export interface CreateLeadRequestDto {
|
|
|
89
90
|
'status'?: string;
|
|
90
91
|
/**
|
|
91
92
|
* Premium Override is utilized to override the premium calculation. The premium formulas will be disregarded when this object is present. The premium override content will be validated if the \'validate\' flag is set to true.
|
|
92
|
-
* @type {
|
|
93
|
+
* @type {PremiumOverrideRequestDto}
|
|
93
94
|
* @memberof CreateLeadRequestDto
|
|
94
95
|
*/
|
|
95
|
-
'premiumOverride'?:
|
|
96
|
+
'premiumOverride'?: PremiumOverrideRequestDto;
|
|
96
97
|
/**
|
|
97
98
|
* Payment method, used to for payment method support, such as SEPA, invoice, etc. The payment method content will be validated if the \'validate\' flag is set to true.
|
|
98
99
|
* @type {CreatePaymentMethodRequestDto}
|
|
@@ -106,15 +107,9 @@ export interface CreateLeadRequestDto {
|
|
|
106
107
|
*/
|
|
107
108
|
'validate'?: boolean;
|
|
108
109
|
/**
|
|
109
|
-
*
|
|
110
|
-
* @type {
|
|
111
|
-
* @memberof CreateLeadRequestDto
|
|
112
|
-
*/
|
|
113
|
-
'partnerCode'?: string;
|
|
114
|
-
/**
|
|
115
|
-
* An optional partner role code to establish a link between a lead and a partner. It must be sent together with the partner code. It will be validated regardless of the value of the \'validate\' flag.
|
|
116
|
-
* @type {string}
|
|
110
|
+
* Optional partner object contains necessary information to link a partner to the policy. The partner content will be validated if the \'validate\' flag is set to true.
|
|
111
|
+
* @type {LinkLeadPartnerRequestDto}
|
|
117
112
|
* @memberof CreateLeadRequestDto
|
|
118
113
|
*/
|
|
119
|
-
'
|
|
114
|
+
'partner'?: LinkLeadPartnerRequestDto;
|
|
120
115
|
}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export * from './lead-bank-account-class';
|
|
|
51
51
|
export * from './lead-class';
|
|
52
52
|
export * from './lead-policy-class';
|
|
53
53
|
export * from './lead-policy-object-class';
|
|
54
|
+
export * from './link-lead-partner-request-dto';
|
|
54
55
|
export * from './list-documents-response-class';
|
|
55
56
|
export * from './list-product-documents-response-class';
|
|
56
57
|
export * from './list-products-response-class';
|
package/dist/models/index.js
CHANGED
|
@@ -67,6 +67,7 @@ __exportStar(require("./lead-bank-account-class"), exports);
|
|
|
67
67
|
__exportStar(require("./lead-class"), exports);
|
|
68
68
|
__exportStar(require("./lead-policy-class"), exports);
|
|
69
69
|
__exportStar(require("./lead-policy-object-class"), exports);
|
|
70
|
+
__exportStar(require("./link-lead-partner-request-dto"), exports);
|
|
70
71
|
__exportStar(require("./list-documents-response-class"), exports);
|
|
71
72
|
__exportStar(require("./list-product-documents-response-class"), exports);
|
|
72
73
|
__exportStar(require("./list-products-response-class"), exports);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emil PublicAPI
|
|
3
|
+
* The Emil Public 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
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface LinkLeadPartnerRequestDto
|
|
16
|
+
*/
|
|
17
|
+
export interface LinkLeadPartnerRequestDto {
|
|
18
|
+
/**
|
|
19
|
+
* The code of the partner with which the lead will be linked.
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof LinkLeadPartnerRequestDto
|
|
22
|
+
*/
|
|
23
|
+
'partnerCode': string;
|
|
24
|
+
/**
|
|
25
|
+
* The code of role that the partner will have in the established link between the lead and the partner.
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof LinkLeadPartnerRequestDto
|
|
28
|
+
*/
|
|
29
|
+
'partnerRoleCode': string;
|
|
30
|
+
/**
|
|
31
|
+
* The date of the start of linking with a partner.
|
|
32
|
+
* @type {string}
|
|
33
|
+
* @memberof LinkLeadPartnerRequestDto
|
|
34
|
+
*/
|
|
35
|
+
'startDate': string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* Emil PublicAPI
|
|
6
|
+
* The Emil Public API description
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0
|
|
9
|
+
* Contact: kontakt@emil.de
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -23,11 +23,17 @@ import { InvoiceClass } from './invoice-class';
|
|
|
23
23
|
*/
|
|
24
24
|
export interface CreateEstimatedInvoiceResponseClass {
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* The estimated invoice response based on the current policy data. This includes the calculated invoice for the specified billing period (e.g., monthly, quarterly) as defined by the policy. The invoice contains details such as gross amount, net amount, tax amount, and other invoice-related data for the specific period the invoice is generated for.
|
|
27
27
|
* @type {InvoiceClass}
|
|
28
28
|
* @memberof CreateEstimatedInvoiceResponseClass
|
|
29
29
|
*/
|
|
30
30
|
'invoice'?: InvoiceClass;
|
|
31
|
+
/**
|
|
32
|
+
* The estimated yearly invoice response. This represents the invoice recalculated to a yearly format, standardizing the invoice values regardless of the billing frequency defined by the policy (e.g., monthly, quarterly, etc.). This yearly invoice gives an overview of the total cost for the entire year, including recalculated gross amount, net amount, tax amount, and other related invoice data, ensuring that all charges are displayed on a yearly basis. Note: If the original invoice is already set to a yearly billing frequency, the \'yearlyInvoice\' will be identical to the \'invoice\'.
|
|
33
|
+
* @type {InvoiceClass}
|
|
34
|
+
* @memberof CreateEstimatedInvoiceResponseClass
|
|
35
|
+
*/
|
|
36
|
+
'yearlyInvoice'?: InvoiceClass;
|
|
31
37
|
/**
|
|
32
38
|
* In some cases, custom premium calculation needs to be used. In that case, a custom object is returned. It can hold up any kind of information. For more information, check the general documentation.
|
|
33
39
|
* @type {object}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import { CreateAccountRequestDto } from './create-account-request-dto';
|
|
17
17
|
import { CreateBankAccountRequestDto } from './create-bank-account-request-dto';
|
|
18
18
|
import { CreatePaymentMethodRequestDto } from './create-payment-method-request-dto';
|
|
19
|
+
import { LinkLeadPartnerRequestDto } from './link-lead-partner-request-dto';
|
|
19
20
|
import { PolicyObjectRequestDto } from './policy-object-request-dto';
|
|
20
21
|
import { PremiumOverrideRequestDto } from './premium-override-request-dto';
|
|
21
22
|
import { UploadedDocumentDto } from './uploaded-document-dto';
|
|
@@ -94,10 +95,10 @@ export interface CreateLeadRequestDto {
|
|
|
94
95
|
'status'?: string;
|
|
95
96
|
/**
|
|
96
97
|
* Premium Override is utilized to override the premium calculation. The premium formulas will be disregarded when this object is present. The premium override content will be validated if the \'validate\' flag is set to true.
|
|
97
|
-
* @type {
|
|
98
|
+
* @type {PremiumOverrideRequestDto}
|
|
98
99
|
* @memberof CreateLeadRequestDto
|
|
99
100
|
*/
|
|
100
|
-
'premiumOverride'?:
|
|
101
|
+
'premiumOverride'?: PremiumOverrideRequestDto;
|
|
101
102
|
/**
|
|
102
103
|
* Payment method, used to for payment method support, such as SEPA, invoice, etc. The payment method content will be validated if the \'validate\' flag is set to true.
|
|
103
104
|
* @type {CreatePaymentMethodRequestDto}
|
|
@@ -111,16 +112,10 @@ export interface CreateLeadRequestDto {
|
|
|
111
112
|
*/
|
|
112
113
|
'validate'?: boolean;
|
|
113
114
|
/**
|
|
114
|
-
*
|
|
115
|
-
* @type {
|
|
116
|
-
* @memberof CreateLeadRequestDto
|
|
117
|
-
*/
|
|
118
|
-
'partnerCode'?: string;
|
|
119
|
-
/**
|
|
120
|
-
* An optional partner role code to establish a link between a lead and a partner. It must be sent together with the partner code. It will be validated regardless of the value of the \'validate\' flag.
|
|
121
|
-
* @type {string}
|
|
115
|
+
* Optional partner object contains necessary information to link a partner to the policy. The partner content will be validated if the \'validate\' flag is set to true.
|
|
116
|
+
* @type {LinkLeadPartnerRequestDto}
|
|
122
117
|
* @memberof CreateLeadRequestDto
|
|
123
118
|
*/
|
|
124
|
-
'
|
|
119
|
+
'partner'?: LinkLeadPartnerRequestDto;
|
|
125
120
|
}
|
|
126
121
|
|
package/models/index.ts
CHANGED
|
@@ -51,6 +51,7 @@ export * from './lead-bank-account-class';
|
|
|
51
51
|
export * from './lead-class';
|
|
52
52
|
export * from './lead-policy-class';
|
|
53
53
|
export * from './lead-policy-object-class';
|
|
54
|
+
export * from './link-lead-partner-request-dto';
|
|
54
55
|
export * from './list-documents-response-class';
|
|
55
56
|
export * from './list-product-documents-response-class';
|
|
56
57
|
export * from './list-products-response-class';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Emil PublicAPI
|
|
5
|
+
* The Emil Public 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
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @interface LinkLeadPartnerRequestDto
|
|
21
|
+
*/
|
|
22
|
+
export interface LinkLeadPartnerRequestDto {
|
|
23
|
+
/**
|
|
24
|
+
* The code of the partner with which the lead will be linked.
|
|
25
|
+
* @type {string}
|
|
26
|
+
* @memberof LinkLeadPartnerRequestDto
|
|
27
|
+
*/
|
|
28
|
+
'partnerCode': string;
|
|
29
|
+
/**
|
|
30
|
+
* The code of role that the partner will have in the established link between the lead and the partner.
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof LinkLeadPartnerRequestDto
|
|
33
|
+
*/
|
|
34
|
+
'partnerRoleCode': string;
|
|
35
|
+
/**
|
|
36
|
+
* The date of the start of linking with a partner.
|
|
37
|
+
* @type {string}
|
|
38
|
+
* @memberof LinkLeadPartnerRequestDto
|
|
39
|
+
*/
|
|
40
|
+
'startDate': string;
|
|
41
|
+
}
|
|
42
|
+
|