File tree Expand file tree Collapse file tree 14 files changed +78
-13
lines changed
modules/openapi-generator/src/main/resources/typescript-fetch
samples/client/petstore/typescript-fetch/builds
prefix-parameter-interfaces/src
without-runtime-checks/src Expand file tree Collapse file tree 14 files changed +78
-13
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ export class BaseAPI {
105
105
protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response > {
106
106
const { url, init } = await this.createFetchParams(context, initOverrides);
107
107
const response = await this.fetchApi(url, init);
108
- if (response.status >= 200 && response.status < 300) {
108
+ if (response && (response .status >= 200 && response.status < 300) ) {
109
109
return response;
110
110
}
111
111
throw new ResponseError(response, 'Response returned an error code');
Original file line number Diff line number Diff line change
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Example
5
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
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
+ import { exists , mapValues } from '../runtime' ;
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface ClubOwner
20
+ */
21
+ export interface ClubOwner {
22
+ /**
23
+ *
24
+ * @type {string }
25
+ * @memberof ClubOwner
26
+ */
27
+ name ?: string ;
28
+ }
29
+
30
+ /**
31
+ * Check if a given object implements the ClubOwner interface.
32
+ */
33
+ export function instanceOfClubOwner ( value : object ) : boolean {
34
+ let isInstance = true ;
35
+
36
+ return isInstance ;
37
+ }
38
+
39
+ export function ClubOwnerFromJSON ( json : any ) : ClubOwner {
40
+ return ClubOwnerFromJSONTyped ( json , false ) ;
41
+ }
42
+
43
+ export function ClubOwnerFromJSONTyped ( json : any , ignoreDiscriminator : boolean ) : ClubOwner {
44
+ if ( ( json === undefined ) || ( json === null ) ) {
45
+ return json ;
46
+ }
47
+ return {
48
+
49
+ 'name' : ! exists ( json , 'name' ) ? undefined : json [ 'name' ] ,
50
+ } ;
51
+ }
52
+
53
+ export function ClubOwnerToJSON ( value ?: ClubOwner | null ) : any {
54
+ if ( value === undefined ) {
55
+ return undefined ;
56
+ }
57
+ if ( value === null ) {
58
+ return null ;
59
+ }
60
+ return {
61
+
62
+ 'name' : value . name ,
63
+ } ;
64
+ }
65
+
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class BaseAPI {
116
116
protected async request ( context : RequestOpts , initOverrides ?: RequestInit | InitOverrideFunction ) : Promise < Response > {
117
117
const { url, init } = await this . createFetchParams ( context , initOverrides ) ;
118
118
const response = await this . fetchApi ( url , init ) ;
119
- if ( response . status >= 200 && response . status < 300 ) {
119
+ if ( response && ( response . status >= 200 && response . status < 300 ) ) {
120
120
return response ;
121
121
}
122
122
throw new ResponseError ( response , 'Response returned an error code' ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class BaseAPI {
116
116
protected async request ( context : RequestOpts , initOverrides ?: RequestInit | InitOverrideFunction ) : Promise < Response > {
117
117
const { url, init } = await this . createFetchParams ( context , initOverrides ) ;
118
118
const response = await this . fetchApi ( url , init ) ;
119
- if ( response . status >= 200 && response . status < 300 ) {
119
+ if ( response && ( response . status >= 200 && response . status < 300 ) ) {
120
120
return response ;
121
121
}
122
122
throw new ResponseError ( response , 'Response returned an error code' ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class BaseAPI {
116
116
protected async request ( context : RequestOpts , initOverrides ?: RequestInit | InitOverrideFunction ) : Promise < Response > {
117
117
const { url, init } = await this . createFetchParams ( context , initOverrides ) ;
118
118
const response = await this . fetchApi ( url , init ) ;
119
- if ( response . status >= 200 && response . status < 300 ) {
119
+ if ( response && ( response . status >= 200 && response . status < 300 ) ) {
120
120
return response ;
121
121
}
122
122
throw new ResponseError ( response , 'Response returned an error code' ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class BaseAPI {
116
116
protected async request ( context : RequestOpts , initOverrides ?: RequestInit | InitOverrideFunction ) : Promise < Response > {
117
117
const { url, init } = await this . createFetchParams ( context , initOverrides ) ;
118
118
const response = await this . fetchApi ( url , init ) ;
119
- if ( response . status >= 200 && response . status < 300 ) {
119
+ if ( response && ( response . status >= 200 && response . status < 300 ) ) {
120
120
return response ;
121
121
}
122
122
throw new ResponseError ( response , 'Response returned an error code' ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class BaseAPI {
116
116
protected async request ( context : RequestOpts , initOverrides ?: RequestInit | InitOverrideFunction ) : Promise < Response > {
117
117
const { url, init } = await this . createFetchParams ( context , initOverrides ) ;
118
118
const response = await this . fetchApi ( url , init ) ;
119
- if ( response . status >= 200 && response . status < 300 ) {
119
+ if ( response && ( response . status >= 200 && response . status < 300 ) ) {
120
120
return response ;
121
121
}
122
122
throw new ResponseError ( response , 'Response returned an error code' ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class BaseAPI {
116
116
protected async request ( context : RequestOpts , initOverrides ?: RequestInit | InitOverrideFunction ) : Promise < Response > {
117
117
const { url, init } = await this . createFetchParams ( context , initOverrides ) ;
118
118
const response = await this . fetchApi ( url , init ) ;
119
- if ( response . status >= 200 && response . status < 300 ) {
119
+ if ( response && ( response . status >= 200 && response . status < 300 ) ) {
120
120
return response ;
121
121
}
122
122
throw new ResponseError ( response , 'Response returned an error code' ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class BaseAPI {
116
116
protected async request ( context : RequestOpts , initOverrides ?: RequestInit | InitOverrideFunction ) : Promise < Response > {
117
117
const { url, init } = await this . createFetchParams ( context , initOverrides ) ;
118
118
const response = await this . fetchApi ( url , init ) ;
119
- if ( response . status >= 200 && response . status < 300 ) {
119
+ if ( response && ( response . status >= 200 && response . status < 300 ) ) {
120
120
return response ;
121
121
}
122
122
throw new ResponseError ( response , 'Response returned an error code' ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ export class BaseAPI {
116
116
protected async request ( context : RequestOpts , initOverrides ?: RequestInit | InitOverrideFunction ) : Promise < Response > {
117
117
const { url, init } = await this . createFetchParams ( context , initOverrides ) ;
118
118
const response = await this . fetchApi ( url , init ) ;
119
- if ( response . status >= 200 && response . status < 300 ) {
119
+ if ( response && ( response . status >= 200 && response . status < 300 ) ) {
120
120
return response ;
121
121
}
122
122
throw new ResponseError ( response , 'Response returned an error code' ) ;
You can’t perform that action at this time.
0 commit comments