@@ -206,6 +206,7 @@ exports[`v2 should generate: test/generated/v2/core/OpenAPI.ts 1`] = `
206
206
/* tslint:disable */
207
207
/* eslint-disable */
208
208
import type { ApiRequestOptions } from './ApiRequestOptions';
209
+ import { ApiError } from './ApiError';
209
210
210
211
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
211
212
type Headers = Record<string, string>;
@@ -220,6 +221,7 @@ export type OpenAPIConfig = {
220
221
PASSWORD?: string | Resolver<string> | undefined;
221
222
HEADERS?: Headers | Resolver<Headers> | undefined;
222
223
ENCODE_PATH?: ((path: string) => string) | undefined;
224
+ ERROR_CALLBACK?: (error: ApiError) => void;
223
225
};
224
226
225
227
export const OpenAPI: OpenAPIConfig = {
@@ -500,6 +502,10 @@ export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult):
500
502
501
503
const error = errors[result.status];
502
504
if (error) {
505
+ const errorCallback = OpenAPI.ERROR_CALLBACK;
506
+ if (errorCallback) {
507
+ errorCallback(new ApiError(options, result, error));
508
+ }
503
509
throw new ApiError(options, result, error);
504
510
}
505
511
@@ -2821,19 +2827,19 @@ import { OpenAPI } from '../core/OpenAPI';
2821
2827
import { request as __request } from '../core/request';
2822
2828
export class ParametersService {
2823
2829
/**
2824
- * @param parameterHeader This is the parameter that goes into the header
2825
2830
* @param parameterQuery This is the parameter that goes into the query params
2826
2831
* @param parameterForm This is the parameter that goes into the form data
2827
2832
* @param parameterBody This is the parameter that is sent as request body
2828
2833
* @param parameterPath This is the parameter that goes into the path
2834
+ * @param parameterHeader This is the parameter that goes into the header
2829
2835
* @throws ApiError
2830
2836
*/
2831
2837
public static callWithParameters(
2832
- parameterHeader: string,
2833
2838
parameterQuery: string,
2834
2839
parameterForm: string,
2835
2840
parameterBody: string,
2836
2841
parameterPath: string,
2842
+ parameterHeader?: string,
2837
2843
): CancelablePromise<void> {
2838
2844
return __request(OpenAPI, {
2839
2845
method: 'POST',
@@ -2854,25 +2860,25 @@ export class ParametersService {
2854
2860
});
2855
2861
}
2856
2862
/**
2857
- * @param parameterHeader This is the parameter that goes into the request header
2858
2863
* @param parameterQuery This is the parameter that goes into the request query params
2859
2864
* @param parameterForm This is the parameter that goes into the request form data
2860
2865
* @param parameterBody This is the parameter that is sent as request body
2861
2866
* @param parameterPath1 This is the parameter that goes into the path
2862
2867
* @param parameterPath2 This is the parameter that goes into the path
2863
2868
* @param parameterPath3 This is the parameter that goes into the path
2864
2869
* @param _default This is the parameter with a reserved keyword
2870
+ * @param parameterHeader This is the parameter that goes into the request header
2865
2871
* @throws ApiError
2866
2872
*/
2867
2873
public static callWithWeirdParameterNames(
2868
- parameterHeader: string,
2869
2874
parameterQuery: string,
2870
2875
parameterForm: string,
2871
2876
parameterBody: string,
2872
2877
parameterPath1?: string,
2873
2878
parameterPath2?: string,
2874
2879
parameterPath3?: string,
2875
2880
_default?: string,
2881
+ parameterHeader?: string,
2876
2882
): CancelablePromise<void> {
2877
2883
return __request(OpenAPI, {
2878
2884
method: 'POST',
@@ -3299,6 +3305,7 @@ exports[`v3 should generate: test/generated/v3/core/OpenAPI.ts 1`] = `
3299
3305
/* tslint:disable */
3300
3306
/* eslint-disable */
3301
3307
import type { ApiRequestOptions } from './ApiRequestOptions';
3308
+ import { ApiError } from './ApiError';
3302
3309
3303
3310
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
3304
3311
type Headers = Record<string, string>;
@@ -3313,6 +3320,7 @@ export type OpenAPIConfig = {
3313
3320
PASSWORD?: string | Resolver<string> | undefined;
3314
3321
HEADERS?: Headers | Resolver<Headers> | undefined;
3315
3322
ENCODE_PATH?: ((path: string) => string) | undefined;
3323
+ ERROR_CALLBACK?: (error: ApiError) => void;
3316
3324
};
3317
3325
3318
3326
export const OpenAPI: OpenAPIConfig = {
@@ -3593,6 +3601,10 @@ export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult):
3593
3601
3594
3602
const error = errors[result.status];
3595
3603
if (error) {
3604
+ const errorCallback = OpenAPI.ERROR_CALLBACK;
3605
+ if (errorCallback) {
3606
+ errorCallback(new ApiError(options, result, error));
3607
+ }
3596
3608
throw new ApiError(options, result, error);
3597
3609
}
3598
3610
@@ -6621,7 +6633,7 @@ export class DeprecatedService {
6621
6633
* @throws ApiError
6622
6634
*/
6623
6635
public static deprecatedCall(
6624
- parameter: DeprecatedModel | null,
6636
+ parameter? : DeprecatedModel | null,
6625
6637
): CancelablePromise<void> {
6626
6638
return __request(OpenAPI, {
6627
6639
method: 'POST',
@@ -6997,21 +7009,21 @@ import { OpenAPI } from '../core/OpenAPI';
6997
7009
import { request as __request } from '../core/request';
6998
7010
export class ParametersService {
6999
7011
/**
7000
- * @param parameterHeader This is the parameter that goes into the header
7001
7012
* @param parameterQuery This is the parameter that goes into the query params
7002
7013
* @param parameterForm This is the parameter that goes into the form data
7003
7014
* @param parameterCookie This is the parameter that goes into the cookie
7004
7015
* @param parameterPath This is the parameter that goes into the path
7005
7016
* @param requestBody This is the parameter that goes into the body
7017
+ * @param parameterHeader This is the parameter that goes into the header
7006
7018
* @throws ApiError
7007
7019
*/
7008
7020
public static callWithParameters(
7009
- parameterHeader: string | null,
7010
7021
parameterQuery: string | null,
7011
7022
parameterForm: string | null,
7012
7023
parameterCookie: string | null,
7013
7024
parameterPath: string | null,
7014
7025
requestBody: ModelWithString | null,
7026
+ parameterHeader?: string | null,
7015
7027
): CancelablePromise<void> {
7016
7028
return __request(OpenAPI, {
7017
7029
method: 'POST',
@@ -7036,7 +7048,6 @@ export class ParametersService {
7036
7048
});
7037
7049
}
7038
7050
/**
7039
- * @param parameterHeader This is the parameter that goes into the request header
7040
7051
* @param parameterQuery This is the parameter that goes into the request query params
7041
7052
* @param parameterForm This is the parameter that goes into the request form data
7042
7053
* @param parameterCookie This is the parameter that goes into the cookie
@@ -7045,10 +7056,10 @@ export class ParametersService {
7045
7056
* @param parameterPath2 This is the parameter that goes into the path
7046
7057
* @param parameterPath3 This is the parameter that goes into the path
7047
7058
* @param _default This is the parameter with a reserved keyword
7059
+ * @param parameterHeader This is the parameter that goes into the request header
7048
7060
* @throws ApiError
7049
7061
*/
7050
7062
public static callWithWeirdParameterNames(
7051
- parameterHeader: string | null,
7052
7063
parameterQuery: string | null,
7053
7064
parameterForm: string | null,
7054
7065
parameterCookie: string | null,
@@ -7057,6 +7068,7 @@ export class ParametersService {
7057
7068
parameterPath2?: string,
7058
7069
parameterPath3?: string,
7059
7070
_default?: string,
7071
+ parameterHeader?: string | null,
7060
7072
): CancelablePromise<void> {
7061
7073
return __request(OpenAPI, {
7062
7074
method: 'POST',
0 commit comments