1
1
// This file is auto-generated by @hey-api/openapi-ts
2
2
3
3
import type { Options as ClientOptions , TDataShape , Client } from '@hey-api/client-fetch' ;
4
- import type { ServiceWithEmptyTagData , PatchApiVbyApiVersionNoTagData , PatchApiVbyApiVersionNoTagResponses , FooWowData , FooWowResponses , DeleteCallWithoutParametersAndResponseData , GetCallWithoutParametersAndResponseData , HeadCallWithoutParametersAndResponseData , OptionsCallWithoutParametersAndResponseData , PatchCallWithoutParametersAndResponseData , PostCallWithoutParametersAndResponseData , PutCallWithoutParametersAndResponseData , CallWithDescriptionsData , CallWithParametersData , CallWithWeirdParameterNamesData , CallWithDefaultParametersData , CallWithDefaultOptionalParametersData , CallToTestOrderOfParamsData , DuplicateNameData , DuplicateName2Data , DuplicateName3Data , DuplicateName4Data , CallWithNoContentResponseData , CallWithNoContentResponseResponses , CallWithResponseAndNoContentResponseData , CallWithResponseAndNoContentResponseResponses , DummyAData , DummyAResponses , DummyBData , DummyBResponses , CallWithResponseData , CallWithResponseResponses , CallWithDuplicateResponsesData , CallWithDuplicateResponsesResponses , CallWithDuplicateResponsesErrors , CallWithResponsesData , CallWithResponsesResponses , CallWithResponsesErrors , CollectionFormatData , TypesData , TypesResponses , ComplexTypesData , ComplexTypesResponses , ComplexTypesErrors , CallWithResultFromHeaderData , CallWithResultFromHeaderResponses , CallWithResultFromHeaderErrors , TestErrorCodeData , TestErrorCodeResponses , TestErrorCodeErrors , NonAsciiæøåÆøÅöôêÊ字符串Data , NonAsciiæøåÆøÅöôêÊ字符串Responses , PostApiVbyApiVersionBodyData , PostApiVbyApiVersionBodyResponses , PostApiVbyApiVersionBodyErrors } from './types.gen' ;
4
+ import type { FooPostData , FooPostResponses , FooPutData , FooPutResponses , FooBarPostData , FooBarPostResponses , FooBarPutData , FooBarPutResponses } from './types.gen' ;
5
5
import { client as _heyApiClient } from './client.gen' ;
6
6
7
7
export type Options < TData extends TDataShape = TDataShape , ThrowOnError extends boolean = boolean > = ClientOptions < TData , ThrowOnError > & {
@@ -18,272 +18,51 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
18
18
meta ?: Record < string , unknown > ;
19
19
} ;
20
20
21
- export class Sdk {
22
- client : Client = _heyApiClient ;
21
+ class _HeyApiClient {
22
+ protected _client : Client = _heyApiClient ;
23
23
24
- constructor ( { client } : {
24
+ constructor ( args ? : {
25
25
client ?: Client ;
26
26
} ) {
27
- if ( client ) {
28
- this . client = client ;
27
+ if ( args ?. client ) {
28
+ this . _client = args . client ;
29
29
}
30
30
}
31
-
32
- public serviceWithEmptyTag < ThrowOnError extends boolean = false > ( options ?: Options < ServiceWithEmptyTagData , ThrowOnError > ) {
33
- return ( options ?. client ?? this . client ) . get < unknown , unknown , ThrowOnError > ( {
34
- url : '/api/v{api-version}/no+tag' ,
35
- ...options
36
- } ) ;
37
- }
38
-
39
- public patchApiVbyApiVersionNoTag < ThrowOnError extends boolean = false > ( options ?: Options < PatchApiVbyApiVersionNoTagData , ThrowOnError > ) {
40
- return ( options ?. client ?? this . client ) . patch < PatchApiVbyApiVersionNoTagResponses , unknown , ThrowOnError > ( {
41
- url : '/api/v{api-version}/no+tag' ,
42
- ...options
43
- } ) ;
44
- }
45
-
46
- public fooWow < ThrowOnError extends boolean = false > ( options ?: Options < FooWowData , ThrowOnError > ) {
47
- return ( options ?. client ?? this . client ) . put < FooWowResponses , unknown , ThrowOnError > ( {
48
- url : '/api/v{api-version}/no+tag' ,
49
- ...options
50
- } ) ;
51
- }
52
-
53
- public deleteCallWithoutParametersAndResponse < ThrowOnError extends boolean = false > ( options ?: Options < DeleteCallWithoutParametersAndResponseData , ThrowOnError > ) {
54
- return ( options ?. client ?? this . client ) . delete < unknown , unknown , ThrowOnError > ( {
55
- url : '/api/v{api-version}/simple' ,
56
- ...options
57
- } ) ;
58
- }
59
-
60
- public getCallWithoutParametersAndResponse < ThrowOnError extends boolean = false > ( options ?: Options < GetCallWithoutParametersAndResponseData , ThrowOnError > ) {
61
- return ( options ?. client ?? this . client ) . get < unknown , unknown , ThrowOnError > ( {
62
- url : '/api/v{api-version}/simple' ,
63
- ...options
64
- } ) ;
65
- }
66
-
67
- public headCallWithoutParametersAndResponse < ThrowOnError extends boolean = false > ( options ?: Options < HeadCallWithoutParametersAndResponseData , ThrowOnError > ) {
68
- return ( options ?. client ?? this . client ) . head < unknown , unknown , ThrowOnError > ( {
69
- url : '/api/v{api-version}/simple' ,
70
- ...options
71
- } ) ;
72
- }
73
-
74
- public optionsCallWithoutParametersAndResponse < ThrowOnError extends boolean = false > ( options ?: Options < OptionsCallWithoutParametersAndResponseData , ThrowOnError > ) {
75
- return ( options ?. client ?? this . client ) . options < unknown , unknown , ThrowOnError > ( {
76
- url : '/api/v{api-version}/simple' ,
77
- ...options
78
- } ) ;
79
- }
80
-
81
- public patchCallWithoutParametersAndResponse < ThrowOnError extends boolean = false > ( options ?: Options < PatchCallWithoutParametersAndResponseData , ThrowOnError > ) {
82
- return ( options ?. client ?? this . client ) . patch < unknown , unknown , ThrowOnError > ( {
83
- url : '/api/v{api-version}/simple' ,
84
- ...options
85
- } ) ;
86
- }
87
-
88
- public postCallWithoutParametersAndResponse < ThrowOnError extends boolean = false > ( options ?: Options < PostCallWithoutParametersAndResponseData , ThrowOnError > ) {
89
- return ( options ?. client ?? this . client ) . post < unknown , unknown , ThrowOnError > ( {
90
- url : '/api/v{api-version}/simple' ,
91
- ...options
92
- } ) ;
93
- }
94
-
95
- public putCallWithoutParametersAndResponse < ThrowOnError extends boolean = false > ( options ?: Options < PutCallWithoutParametersAndResponseData , ThrowOnError > ) {
96
- return ( options ?. client ?? this . client ) . put < unknown , unknown , ThrowOnError > ( {
97
- url : '/api/v{api-version}/simple' ,
98
- ...options
99
- } ) ;
100
- }
101
-
102
- public callWithDescriptions < ThrowOnError extends boolean = false > ( options ?: Options < CallWithDescriptionsData , ThrowOnError > ) {
103
- return ( options ?. client ?? this . client ) . post < unknown , unknown , ThrowOnError > ( {
104
- url : '/api/v{api-version}/descriptions/' ,
105
- ...options
106
- } ) ;
107
- }
108
-
109
- public callWithParameters < ThrowOnError extends boolean = false > ( options : Options < CallWithParametersData , ThrowOnError > ) {
110
- return ( options . client ?? this . client ) . post < unknown , unknown , ThrowOnError > ( {
111
- url : '/api/v{api-version}/parameters/{parameterPath}' ,
112
- ...options
113
- } ) ;
114
- }
115
-
116
- public callWithWeirdParameterNames < ThrowOnError extends boolean = false > ( options : Options < CallWithWeirdParameterNamesData , ThrowOnError > ) {
117
- return ( options . client ?? this . client ) . post < unknown , unknown , ThrowOnError > ( {
118
- url : '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}' ,
119
- ...options
120
- } ) ;
121
- }
122
-
123
- public callWithDefaultParameters < ThrowOnError extends boolean = false > ( options : Options < CallWithDefaultParametersData , ThrowOnError > ) {
124
- return ( options . client ?? this . client ) . get < unknown , unknown , ThrowOnError > ( {
125
- url : '/api/v{api-version}/defaults' ,
126
- ...options
127
- } ) ;
128
- }
129
-
130
- public callWithDefaultOptionalParameters < ThrowOnError extends boolean = false > ( options ?: Options < CallWithDefaultOptionalParametersData , ThrowOnError > ) {
131
- return ( options ?. client ?? this . client ) . post < unknown , unknown , ThrowOnError > ( {
132
- url : '/api/v{api-version}/defaults' ,
133
- ...options
134
- } ) ;
135
- }
136
-
137
- public callToTestOrderOfParams < ThrowOnError extends boolean = false > ( options : Options < CallToTestOrderOfParamsData , ThrowOnError > ) {
138
- return ( options . client ?? this . client ) . put < unknown , unknown , ThrowOnError > ( {
139
- url : '/api/v{api-version}/defaults' ,
140
- ...options
141
- } ) ;
142
- }
143
-
144
- public duplicateName < ThrowOnError extends boolean = false > ( options ?: Options < DuplicateNameData , ThrowOnError > ) {
145
- return ( options ?. client ?? this . client ) . delete < unknown , unknown , ThrowOnError > ( {
146
- url : '/api/v{api-version}/duplicate' ,
147
- ...options
148
- } ) ;
149
- }
150
-
151
- public duplicateName2 < ThrowOnError extends boolean = false > ( options ?: Options < DuplicateName2Data , ThrowOnError > ) {
152
- return ( options ?. client ?? this . client ) . get < unknown , unknown , ThrowOnError > ( {
153
- url : '/api/v{api-version}/duplicate' ,
154
- ...options
155
- } ) ;
156
- }
157
-
158
- public duplicateName3 < ThrowOnError extends boolean = false > ( options ?: Options < DuplicateName3Data , ThrowOnError > ) {
159
- return ( options ?. client ?? this . client ) . post < unknown , unknown , ThrowOnError > ( {
160
- url : '/api/v{api-version}/duplicate' ,
161
- ...options
162
- } ) ;
163
- }
164
-
165
- public duplicateName4 < ThrowOnError extends boolean = false > ( options ?: Options < DuplicateName4Data , ThrowOnError > ) {
166
- return ( options ?. client ?? this . client ) . put < unknown , unknown , ThrowOnError > ( {
167
- url : '/api/v{api-version}/duplicate' ,
168
- ...options
169
- } ) ;
170
- }
171
-
172
- public callWithNoContentResponse < ThrowOnError extends boolean = false > ( options ?: Options < CallWithNoContentResponseData , ThrowOnError > ) {
173
- return ( options ?. client ?? this . client ) . get < CallWithNoContentResponseResponses , unknown , ThrowOnError > ( {
174
- url : '/api/v{api-version}/no-content' ,
175
- ...options
176
- } ) ;
177
- }
178
-
179
- public callWithResponseAndNoContentResponse < ThrowOnError extends boolean = false > ( options ?: Options < CallWithResponseAndNoContentResponseData , ThrowOnError > ) {
180
- return ( options ?. client ?? this . client ) . get < CallWithResponseAndNoContentResponseResponses , unknown , ThrowOnError > ( {
181
- url : '/api/v{api-version}/multiple-tags/response-and-no-content' ,
182
- ...options
183
- } ) ;
184
- }
185
-
186
- public dummyA < ThrowOnError extends boolean = false > ( options ?: Options < DummyAData , ThrowOnError > ) {
187
- return ( options ?. client ?? this . client ) . get < DummyAResponses , unknown , ThrowOnError > ( {
188
- url : '/api/v{api-version}/multiple-tags/a' ,
189
- ...options
190
- } ) ;
191
- }
192
-
193
- public dummyB < ThrowOnError extends boolean = false > ( options ?: Options < DummyBData , ThrowOnError > ) {
194
- return ( options ?. client ?? this . client ) . get < DummyBResponses , unknown , ThrowOnError > ( {
195
- url : '/api/v{api-version}/multiple-tags/b' ,
196
- ...options
197
- } ) ;
198
- }
199
-
200
- public callWithResponse < ThrowOnError extends boolean = false > ( options ?: Options < CallWithResponseData , ThrowOnError > ) {
201
- return ( options ?. client ?? this . client ) . get < CallWithResponseResponses , unknown , ThrowOnError > ( {
202
- url : '/api/v{api-version}/response' ,
203
- ...options
204
- } ) ;
205
- }
206
-
207
- public callWithDuplicateResponses < ThrowOnError extends boolean = false > ( options ?: Options < CallWithDuplicateResponsesData , ThrowOnError > ) {
208
- return ( options ?. client ?? this . client ) . post < CallWithDuplicateResponsesResponses , CallWithDuplicateResponsesErrors , ThrowOnError > ( {
209
- url : '/api/v{api-version}/response' ,
210
- ...options
211
- } ) ;
212
- }
213
-
214
- public callWithResponses < ThrowOnError extends boolean = false > ( options ?: Options < CallWithResponsesData , ThrowOnError > ) {
215
- return ( options ?. client ?? this . client ) . put < CallWithResponsesResponses , CallWithResponsesErrors , ThrowOnError > ( {
216
- url : '/api/v{api-version}/response' ,
217
- ...options
218
- } ) ;
219
- }
220
-
221
- public collectionFormat < ThrowOnError extends boolean = false > ( options : Options < CollectionFormatData , ThrowOnError > ) {
222
- return ( options . client ?? this . client ) . get < unknown , unknown , ThrowOnError > ( {
223
- querySerializer : {
224
- array : {
225
- explode : false ,
226
- style : 'form'
227
- }
228
- } ,
229
- url : '/api/v{api-version}/collectionFormat' ,
230
- ...options
231
- } ) ;
232
- }
233
-
234
- public types < ThrowOnError extends boolean = false > ( options : Options < TypesData , ThrowOnError > ) {
235
- return ( options . client ?? this . client ) . get < TypesResponses , unknown , ThrowOnError > ( {
236
- querySerializer : {
237
- array : {
238
- explode : false ,
239
- style : 'form'
240
- }
241
- } ,
242
- url : '/api/v{api-version}/types' ,
243
- ...options
244
- } ) ;
245
- }
246
-
247
- public complexTypes < ThrowOnError extends boolean = false > ( options : Options < ComplexTypesData , ThrowOnError > ) {
248
- return ( options . client ?? this . client ) . get < ComplexTypesResponses , ComplexTypesErrors , ThrowOnError > ( {
249
- url : '/api/v{api-version}/complex' ,
31
+ }
32
+
33
+ class Foo extends _HeyApiClient {
34
+ public post < ThrowOnError extends boolean = false > ( options ?: Options < FooPostData , ThrowOnError > ) {
35
+ return ( options ?. client ?? this . _client ) . post < FooPostResponses , unknown , ThrowOnError > ( {
36
+ url : '/foo' ,
250
37
...options
251
38
} ) ;
252
39
}
253
40
254
- public callWithResultFromHeader < ThrowOnError extends boolean = false > ( options ?: Options < CallWithResultFromHeaderData , ThrowOnError > ) {
255
- return ( options ?. client ?? this . client ) . post < CallWithResultFromHeaderResponses , CallWithResultFromHeaderErrors , ThrowOnError > ( {
256
- url : '/api/v{api-version}/header ' ,
41
+ public put < ThrowOnError extends boolean = false > ( options ?: Options < FooPutData , ThrowOnError > ) {
42
+ return ( options ?. client ?? this . _client ) . put < FooPutResponses , unknown , ThrowOnError > ( {
43
+ url : '/foo ' ,
257
44
...options
258
45
} ) ;
259
46
}
260
-
261
- public testErrorCode < ThrowOnError extends boolean = false > ( options : Options < TestErrorCodeData , ThrowOnError > ) {
262
- return ( options . client ?? this . client ) . post < TestErrorCodeResponses , TestErrorCodeErrors , ThrowOnError > ( {
263
- url : '/api/v{api-version}/error' ,
47
+ bar = new Bar ( { client : this . _client } ) ;
48
+ }
49
+
50
+ class Bar extends _HeyApiClient {
51
+ public post < ThrowOnError extends boolean = false > ( options ?: Options < FooBarPostData , ThrowOnError > ) {
52
+ return ( options ?. client ?? this . _client ) . post < FooBarPostResponses , unknown , ThrowOnError > ( {
53
+ url : '/foo/bar' ,
264
54
...options
265
55
} ) ;
266
56
}
267
57
268
- public nonAsciiæøåÆøÅöôêÊ字符串 < ThrowOnError extends boolean = false > ( options : Options < NonAsciiæøåÆøÅöôêÊ字符串Data , ThrowOnError > ) {
269
- return ( options . client ?? this . client ) . post < NonAsciiæøåÆøÅöôêÊ字符串Responses , unknown , ThrowOnError > ( {
270
- url : '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串 ' ,
58
+ public put < ThrowOnError extends boolean = false > ( options ? : Options < FooBarPutData , ThrowOnError > ) {
59
+ return ( options ? .client ?? this . _client ) . put < FooBarPutResponses , unknown , ThrowOnError > ( {
60
+ url : '/foo/bar ' ,
271
61
...options
272
62
} ) ;
273
63
}
274
-
275
- /**
276
- * Body should not be unknown
277
- * Body should not be unknown
278
- */
279
- public postApiVbyApiVersionBody < ThrowOnError extends boolean = false > ( options : Options < PostApiVbyApiVersionBodyData , ThrowOnError > ) {
280
- return ( options . client ?? this . client ) . post < PostApiVbyApiVersionBodyResponses , PostApiVbyApiVersionBodyErrors , ThrowOnError > ( {
281
- url : '/api/v{api-version}/body' ,
282
- ...options ,
283
- headers : {
284
- 'Content-Type' : 'application/json' ,
285
- ...options . headers
286
- }
287
- } ) ;
288
- }
64
+ }
65
+
66
+ export class Sdk extends _HeyApiClient {
67
+ foo = new Foo ( { client : this . _client } ) ;
289
68
}
0 commit comments