@@ -70,85 +70,103 @@ export class PetServiceResources {
70
70
* Add a new pet to the store.
71
71
*/
72
72
public addPet < ThrowOnError extends boolean = false > (
73
- options : ( ) => Options < AddPetData , ThrowOnError > ,
73
+ options : ( ) => Options < AddPetData , ThrowOnError > | undefined ,
74
74
) {
75
- return httpResource < AddPetResponse > ( ( ) => addPetRequest ( options ( ) ) ) ;
75
+ return httpResource < AddPetResponse > ( ( ) => {
76
+ const opts = options ? options ( ) : undefined ;
77
+ return opts ? addPetRequest ( opts ) : undefined ;
78
+ } ) ;
76
79
}
77
80
78
81
/**
79
82
* Update an existing pet.
80
83
* Update an existing pet by Id.
81
84
*/
82
85
public updatePet < ThrowOnError extends boolean = false > (
83
- options : ( ) => Options < UpdatePetData , ThrowOnError > ,
86
+ options : ( ) => Options < UpdatePetData , ThrowOnError > | undefined ,
84
87
) {
85
- return httpResource < UpdatePetResponse > ( ( ) => updatePetRequest ( options ( ) ) ) ;
88
+ return httpResource < UpdatePetResponse > ( ( ) => {
89
+ const opts = options ? options ( ) : undefined ;
90
+ return opts ? updatePetRequest ( opts ) : undefined ;
91
+ } ) ;
86
92
}
87
93
88
94
/**
89
95
* Finds Pets by status.
90
96
* Multiple status values can be provided with comma separated strings.
91
97
*/
92
98
public findPetsByStatus < ThrowOnError extends boolean = false > (
93
- options : ( ) => Options < FindPetsByStatusData , ThrowOnError > ,
99
+ options : ( ) => Options < FindPetsByStatusData , ThrowOnError > | undefined ,
94
100
) {
95
- return httpResource < FindPetsByStatusResponse > ( ( ) =>
96
- findPetsByStatusRequest ( options ( ) ) ,
97
- ) ;
101
+ return httpResource < FindPetsByStatusResponse > ( ( ) => {
102
+ const opts = options ? options ( ) : undefined ;
103
+ return opts ? findPetsByStatusRequest ( opts ) : undefined ;
104
+ } ) ;
98
105
}
99
106
100
107
/**
101
108
* Finds Pets by tags.
102
109
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
103
110
*/
104
111
public findPetsByTags < ThrowOnError extends boolean = false > (
105
- options : ( ) => Options < FindPetsByTagsData , ThrowOnError > ,
112
+ options : ( ) => Options < FindPetsByTagsData , ThrowOnError > | undefined ,
106
113
) {
107
- return httpResource < FindPetsByTagsResponse > ( ( ) =>
108
- findPetsByTagsRequest ( options ( ) ) ,
109
- ) ;
114
+ return httpResource < FindPetsByTagsResponse > ( ( ) => {
115
+ const opts = options ? options ( ) : undefined ;
116
+ return opts ? findPetsByTagsRequest ( opts ) : undefined ;
117
+ } ) ;
110
118
}
111
119
112
120
/**
113
121
* Deletes a pet.
114
122
* Delete a pet.
115
123
*/
116
124
public deletePet < ThrowOnError extends boolean = false > (
117
- options : ( ) => Options < DeletePetData , ThrowOnError > ,
125
+ options : ( ) => Options < DeletePetData , ThrowOnError > | undefined ,
118
126
) {
119
- return httpResource < unknown > ( ( ) => deletePetRequest ( options ( ) ) ) ;
127
+ return httpResource < unknown > ( ( ) => {
128
+ const opts = options ? options ( ) : undefined ;
129
+ return opts ? deletePetRequest ( opts ) : undefined ;
130
+ } ) ;
120
131
}
121
132
122
133
/**
123
134
* Find pet by ID.
124
135
* Returns a single pet.
125
136
*/
126
137
public getPetById < ThrowOnError extends boolean = false > (
127
- options : ( ) => Options < GetPetByIdData , ThrowOnError > ,
138
+ options : ( ) => Options < GetPetByIdData , ThrowOnError > | undefined ,
128
139
) {
129
- return httpResource < GetPetByIdResponse > ( ( ) => getPetByIdRequest ( options ( ) ) ) ;
140
+ return httpResource < GetPetByIdResponse > ( ( ) => {
141
+ const opts = options ? options ( ) : undefined ;
142
+ return opts ? getPetByIdRequest ( opts ) : undefined ;
143
+ } ) ;
130
144
}
131
145
132
146
/**
133
147
* Updates a pet in the store with form data.
134
148
* Updates a pet resource based on the form data.
135
149
*/
136
150
public updatePetWithForm < ThrowOnError extends boolean = false > (
137
- options : ( ) => Options < UpdatePetWithFormData , ThrowOnError > ,
151
+ options : ( ) => Options < UpdatePetWithFormData , ThrowOnError > | undefined ,
138
152
) {
139
- return httpResource < UpdatePetWithFormResponse > ( ( ) =>
140
- updatePetWithFormRequest ( options ( ) ) ,
141
- ) ;
153
+ return httpResource < UpdatePetWithFormResponse > ( ( ) => {
154
+ const opts = options ? options ( ) : undefined ;
155
+ return opts ? updatePetWithFormRequest ( opts ) : undefined ;
156
+ } ) ;
142
157
}
143
158
144
159
/**
145
160
* Uploads an image.
146
161
* Upload image of the pet.
147
162
*/
148
163
public uploadFile < ThrowOnError extends boolean = false > (
149
- options : ( ) => Options < UploadFileData , ThrowOnError > ,
164
+ options : ( ) => Options < UploadFileData , ThrowOnError > | undefined ,
150
165
) {
151
- return httpResource < UploadFileResponse > ( ( ) => uploadFileRequest ( options ( ) ) ) ;
166
+ return httpResource < UploadFileResponse > ( ( ) => {
167
+ const opts = options ? options ( ) : undefined ;
168
+ return opts ? uploadFileRequest ( opts ) : undefined ;
169
+ } ) ;
152
170
}
153
171
}
154
172
@@ -161,45 +179,51 @@ export class StoreServiceResources {
161
179
* Returns a map of status codes to quantities.
162
180
*/
163
181
public getInventory < ThrowOnError extends boolean = false > (
164
- options ?: ( ) => Options < GetInventoryData , ThrowOnError > ,
182
+ options ?: ( ) => Options < GetInventoryData , ThrowOnError > | undefined ,
165
183
) {
166
- return httpResource < GetInventoryResponse > ( ( ) =>
167
- getInventoryRequest ( options ? options ( ) : undefined ) ,
168
- ) ;
184
+ return httpResource < GetInventoryResponse > ( ( ) => {
185
+ const opts = options ? options ( ) : undefined ;
186
+ return opts ? getInventoryRequest ( opts ) : undefined ;
187
+ } ) ;
169
188
}
170
189
171
190
/**
172
191
* Place an order for a pet.
173
192
* Place a new order in the store.
174
193
*/
175
194
public placeOrder < ThrowOnError extends boolean = false > (
176
- options ?: ( ) => Options < PlaceOrderData , ThrowOnError > ,
195
+ options ?: ( ) => Options < PlaceOrderData , ThrowOnError > | undefined ,
177
196
) {
178
- return httpResource < PlaceOrderResponse > ( ( ) =>
179
- placeOrderRequest ( options ? options ( ) : undefined ) ,
180
- ) ;
197
+ return httpResource < PlaceOrderResponse > ( ( ) => {
198
+ const opts = options ? options ( ) : undefined ;
199
+ return opts ? placeOrderRequest ( opts ) : undefined ;
200
+ } ) ;
181
201
}
182
202
183
203
/**
184
204
* Delete purchase order by identifier.
185
205
* For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.
186
206
*/
187
207
public deleteOrder < ThrowOnError extends boolean = false > (
188
- options : ( ) => Options < DeleteOrderData , ThrowOnError > ,
208
+ options : ( ) => Options < DeleteOrderData , ThrowOnError > | undefined ,
189
209
) {
190
- return httpResource < unknown > ( ( ) => deleteOrderRequest ( options ( ) ) ) ;
210
+ return httpResource < unknown > ( ( ) => {
211
+ const opts = options ? options ( ) : undefined ;
212
+ return opts ? deleteOrderRequest ( opts ) : undefined ;
213
+ } ) ;
191
214
}
192
215
193
216
/**
194
217
* Find purchase order by ID.
195
218
* For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
196
219
*/
197
220
public getOrderById < ThrowOnError extends boolean = false > (
198
- options : ( ) => Options < GetOrderByIdData , ThrowOnError > ,
221
+ options : ( ) => Options < GetOrderByIdData , ThrowOnError > | undefined ,
199
222
) {
200
- return httpResource < GetOrderByIdResponse > ( ( ) =>
201
- getOrderByIdRequest ( options ( ) ) ,
202
- ) ;
223
+ return httpResource < GetOrderByIdResponse > ( ( ) => {
224
+ const opts = options ? options ( ) : undefined ;
225
+ return opts ? getOrderByIdRequest ( opts ) : undefined ;
226
+ } ) ;
203
227
}
204
228
}
205
229
@@ -212,78 +236,91 @@ export class UserServiceResources {
212
236
* This can only be done by the logged in user.
213
237
*/
214
238
public createUser < ThrowOnError extends boolean = false > (
215
- options ?: ( ) => Options < CreateUserData , ThrowOnError > ,
239
+ options ?: ( ) => Options < CreateUserData , ThrowOnError > | undefined ,
216
240
) {
217
- return httpResource < CreateUserResponse > ( ( ) =>
218
- createUserRequest ( options ? options ( ) : undefined ) ,
219
- ) ;
241
+ return httpResource < CreateUserResponse > ( ( ) => {
242
+ const opts = options ? options ( ) : undefined ;
243
+ return opts ? createUserRequest ( opts ) : undefined ;
244
+ } ) ;
220
245
}
221
246
222
247
/**
223
248
* Creates list of users with given input array.
224
249
* Creates list of users with given input array.
225
250
*/
226
251
public createUsersWithListInput < ThrowOnError extends boolean = false > (
227
- options ?: ( ) => Options < CreateUsersWithListInputData , ThrowOnError > ,
252
+ options ?: ( ) =>
253
+ | Options < CreateUsersWithListInputData , ThrowOnError >
254
+ | undefined ,
228
255
) {
229
- return httpResource < CreateUsersWithListInputResponse > ( ( ) =>
230
- createUsersWithListInputRequest ( options ? options ( ) : undefined ) ,
231
- ) ;
256
+ return httpResource < CreateUsersWithListInputResponse > ( ( ) => {
257
+ const opts = options ? options ( ) : undefined ;
258
+ return opts ? createUsersWithListInputRequest ( opts ) : undefined ;
259
+ } ) ;
232
260
}
233
261
234
262
/**
235
263
* Logs user into the system.
236
264
* Log into the system.
237
265
*/
238
266
public loginUser < ThrowOnError extends boolean = false > (
239
- options ?: ( ) => Options < LoginUserData , ThrowOnError > ,
267
+ options ?: ( ) => Options < LoginUserData , ThrowOnError > | undefined ,
240
268
) {
241
- return httpResource < LoginUserResponse > ( ( ) =>
242
- loginUserRequest ( options ? options ( ) : undefined ) ,
243
- ) ;
269
+ return httpResource < LoginUserResponse > ( ( ) => {
270
+ const opts = options ? options ( ) : undefined ;
271
+ return opts ? loginUserRequest ( opts ) : undefined ;
272
+ } ) ;
244
273
}
245
274
246
275
/**
247
276
* Logs out current logged in user session.
248
277
* Log user out of the system.
249
278
*/
250
279
public logoutUser < ThrowOnError extends boolean = false > (
251
- options ?: ( ) => Options < LogoutUserData , ThrowOnError > ,
280
+ options ?: ( ) => Options < LogoutUserData , ThrowOnError > | undefined ,
252
281
) {
253
- return httpResource < unknown > ( ( ) =>
254
- logoutUserRequest ( options ? options ( ) : undefined ) ,
255
- ) ;
282
+ return httpResource < unknown > ( ( ) => {
283
+ const opts = options ? options ( ) : undefined ;
284
+ return opts ? logoutUserRequest ( opts ) : undefined ;
285
+ } ) ;
256
286
}
257
287
258
288
/**
259
289
* Delete user resource.
260
290
* This can only be done by the logged in user.
261
291
*/
262
292
public deleteUser < ThrowOnError extends boolean = false > (
263
- options : ( ) => Options < DeleteUserData , ThrowOnError > ,
293
+ options : ( ) => Options < DeleteUserData , ThrowOnError > | undefined ,
264
294
) {
265
- return httpResource < unknown > ( ( ) => deleteUserRequest ( options ( ) ) ) ;
295
+ return httpResource < unknown > ( ( ) => {
296
+ const opts = options ? options ( ) : undefined ;
297
+ return opts ? deleteUserRequest ( opts ) : undefined ;
298
+ } ) ;
266
299
}
267
300
268
301
/**
269
302
* Get user by user name.
270
303
* Get user detail based on username.
271
304
*/
272
305
public getUserByName < ThrowOnError extends boolean = false > (
273
- options : ( ) => Options < GetUserByNameData , ThrowOnError > ,
306
+ options : ( ) => Options < GetUserByNameData , ThrowOnError > | undefined ,
274
307
) {
275
- return httpResource < GetUserByNameResponse > ( ( ) =>
276
- getUserByNameRequest ( options ( ) ) ,
277
- ) ;
308
+ return httpResource < GetUserByNameResponse > ( ( ) => {
309
+ const opts = options ? options ( ) : undefined ;
310
+ return opts ? getUserByNameRequest ( opts ) : undefined ;
311
+ } ) ;
278
312
}
279
313
280
314
/**
281
315
* Update user resource.
282
316
* This can only be done by the logged in user.
283
317
*/
284
318
public updateUser < ThrowOnError extends boolean = false > (
285
- options : ( ) => Options < UpdateUserData , ThrowOnError > ,
319
+ options : ( ) => Options < UpdateUserData , ThrowOnError > | undefined ,
286
320
) {
287
- return httpResource < unknown > ( ( ) => updateUserRequest ( options ( ) ) ) ;
321
+ return httpResource < unknown > ( ( ) => {
322
+ const opts = options ? options ( ) : undefined ;
323
+ return opts ? updateUserRequest ( opts ) : undefined ;
324
+ } ) ;
288
325
}
289
326
}
0 commit comments