@@ -117,33 +117,10 @@ export const create = (factory: TsGenerator.Factory.Type, list: CodeGenerator.Pa
117
117
] ,
118
118
} ) ;
119
119
120
- const httpMethod = factory . ParameterDeclaration . create ( {
121
- name : "httpMethod " ,
120
+ const requestArgs = factory . ParameterDeclaration . create ( {
121
+ name : "requestArgs " ,
122
122
type : factory . TypeReferenceNode . create ( {
123
- name : "HttpMethod" ,
124
- } ) ,
125
- } ) ;
126
- const url = factory . ParameterDeclaration . create ( {
127
- name : "url" ,
128
- type : factory . TypeNode . create ( { type : "string" } ) ,
129
- } ) ;
130
- const headers = factory . ParameterDeclaration . create ( {
131
- name : "headers" ,
132
- type : objectLikeOrAnyType ,
133
- } ) ;
134
- const requestBody = factory . ParameterDeclaration . create ( {
135
- name : "requestBody" ,
136
- type : objectLikeOrAnyType ,
137
- } ) ;
138
- const queryParameters = factory . ParameterDeclaration . create ( {
139
- name : "queryParameters" ,
140
- type : factory . UnionTypeNode . create ( {
141
- typeNodes : [
142
- factory . TypeReferenceNode . create ( {
143
- name : "QueryParameters" ,
144
- } ) ,
145
- factory . TypeNode . create ( { type : "undefined" } ) ,
146
- ] ,
123
+ name : "RequestArgs" ,
147
124
} ) ,
148
125
} ) ;
149
126
const options = factory . ParameterDeclaration . create ( {
@@ -186,7 +163,7 @@ export const create = (factory: TsGenerator.Factory.Type, list: CodeGenerator.Pa
186
163
} ) ,
187
164
} ) ,
188
165
] ,
189
- parameters : [ httpMethod , url , headers , requestBody , queryParameters , options ] ,
166
+ parameters : [ requestArgs , options ] ,
190
167
type : returnType ,
191
168
} ) ;
192
169
@@ -196,12 +173,53 @@ export const create = (factory: TsGenerator.Factory.Type, list: CodeGenerator.Pa
196
173
type : functionType ,
197
174
} ) ;
198
175
176
+ const requestArgsInterfaceDeclaration = factory . InterfaceDeclaration . create ( {
177
+ export : true ,
178
+ name : "RequestArgs" ,
179
+ members : [
180
+ factory . PropertySignature . create ( {
181
+ name : `httpMethod` ,
182
+ optional : false ,
183
+ type : factory . TypeReferenceNode . create ( { name : "HttpMethod" } ) ,
184
+ } ) ,
185
+ factory . PropertySignature . create ( {
186
+ name : `url` ,
187
+ optional : false ,
188
+ type : factory . TypeReferenceNode . create ( { name : "string" } ) ,
189
+ } ) ,
190
+ factory . PropertySignature . create ( {
191
+ name : `headers` ,
192
+ optional : false ,
193
+ type : objectLikeOrAnyType ,
194
+ } ) ,
195
+ factory . PropertySignature . create ( {
196
+ name : `requestBody` ,
197
+ optional : false ,
198
+ type : objectLikeOrAnyType ,
199
+ } ) ,
200
+ factory . PropertySignature . create ( {
201
+ name : `queryParameters` ,
202
+ optional : false ,
203
+ type : factory . UnionTypeNode . create ( {
204
+ typeNodes : [
205
+ factory . TypeReferenceNode . create ( {
206
+ name : "QueryParameters" ,
207
+ } ) ,
208
+ factory . TypeNode . create ( { type : "undefined" } ) ,
209
+ ] ,
210
+ } ) ,
211
+ } ) ,
212
+ ] ,
213
+ typeParameters : [ ] ,
214
+ } ) ;
215
+
199
216
return [
200
217
createHttpMethod ( factory ) ,
201
218
createObjectLikeInterface ( factory ) ,
202
219
...createQueryParamsDeclarations ( factory ) ,
203
220
createSuccessResponseTypeAlias ( "SuccessResponses" , factory , successResponseNames ) ,
204
221
errorResponseNamespace ,
222
+ requestArgsInterfaceDeclaration ,
205
223
factory . InterfaceDeclaration . create ( {
206
224
export : true ,
207
225
name : "ApiClient" ,
0 commit comments