fork of hey-api/openapi-ts because I need some additional things
1// This file is auto-generated by @hey-api/openapi-ts
2
3import type { Client, Options as Options2, TDataShape } from './client';
4import { client } from './client.gen';
5import type {
6 AddPetData,
7 AddPetErrors,
8 AddPetResponses,
9 CreateUserData,
10 CreateUserErrors,
11 CreateUserResponses,
12 CreateUsersWithListInputData,
13 CreateUsersWithListInputErrors,
14 CreateUsersWithListInputResponses,
15 DeleteOrderData,
16 DeleteOrderErrors,
17 DeleteOrderResponses,
18 DeletePetData,
19 DeletePetErrors,
20 DeletePetResponses,
21 DeleteUserData,
22 DeleteUserErrors,
23 DeleteUserResponses,
24 FindPetsByStatusData,
25 FindPetsByStatusErrors,
26 FindPetsByStatusResponses,
27 FindPetsByTagsData,
28 FindPetsByTagsErrors,
29 FindPetsByTagsResponses,
30 GetInventoryData,
31 GetInventoryErrors,
32 GetInventoryResponses,
33 GetOrderByIdData,
34 GetOrderByIdErrors,
35 GetOrderByIdResponses,
36 GetPetByIdData,
37 GetPetByIdErrors,
38 GetPetByIdResponses,
39 GetUserByNameData,
40 GetUserByNameErrors,
41 GetUserByNameResponses,
42 LoginUserData,
43 LoginUserErrors,
44 LoginUserResponses,
45 LogoutUserData,
46 LogoutUserErrors,
47 LogoutUserResponses,
48 PlaceOrderData,
49 PlaceOrderErrors,
50 PlaceOrderResponses,
51 UpdatePetData,
52 UpdatePetErrors,
53 UpdatePetResponses,
54 UpdatePetWithFormData,
55 UpdatePetWithFormErrors,
56 UpdatePetWithFormResponses,
57 UpdateUserData,
58 UpdateUserErrors,
59 UpdateUserResponses,
60 UploadFileData,
61 UploadFileErrors,
62 UploadFileResponses,
63} from './types.gen';
64
65export type Options<
66 TData extends TDataShape = TDataShape,
67 ThrowOnError extends boolean = boolean,
68> = Options2<TData, ThrowOnError> & {
69 /**
70 * You can provide a client instance returned by `createClient()` instead of
71 * individual options. This might be also useful if you want to implement a
72 * custom client.
73 */
74 client?: Client;
75 /**
76 * You can pass arbitrary values through the `meta` object. This can be
77 * used to access values that aren't defined as part of the SDK function.
78 */
79 meta?: Record<string, unknown>;
80};
81
82/**
83 * Add a new pet to the store.
84 *
85 * Add a new pet to the store.
86 */
87export const addPet = <ThrowOnError extends boolean = true>(
88 options: Options<AddPetData, ThrowOnError>,
89) =>
90 (options.client ?? client).post<
91 AddPetResponses,
92 AddPetErrors,
93 ThrowOnError,
94 'data'
95 >({
96 responseStyle: 'data',
97 security: [{ scheme: 'bearer', type: 'http' }],
98 url: '/pet',
99 ...options,
100 headers: {
101 'Content-Type': 'application/json',
102 ...options.headers,
103 },
104 });
105
106/**
107 * Update an existing pet.
108 *
109 * Update an existing pet by Id.
110 */
111export const updatePet = <ThrowOnError extends boolean = true>(
112 options: Options<UpdatePetData, ThrowOnError>,
113) =>
114 (options.client ?? client).put<
115 UpdatePetResponses,
116 UpdatePetErrors,
117 ThrowOnError,
118 'data'
119 >({
120 responseStyle: 'data',
121 security: [{ scheme: 'bearer', type: 'http' }],
122 url: '/pet',
123 ...options,
124 headers: {
125 'Content-Type': 'application/json',
126 ...options.headers,
127 },
128 });
129
130/**
131 * Finds Pets by status.
132 *
133 * Multiple status values can be provided with comma separated strings.
134 */
135export const findPetsByStatus = <ThrowOnError extends boolean = true>(
136 options: Options<FindPetsByStatusData, ThrowOnError>,
137) =>
138 (options.client ?? client).get<
139 FindPetsByStatusResponses,
140 FindPetsByStatusErrors,
141 ThrowOnError,
142 'data'
143 >({
144 responseStyle: 'data',
145 security: [{ scheme: 'bearer', type: 'http' }],
146 url: '/pet/findByStatus',
147 ...options,
148 });
149
150/**
151 * Finds Pets by tags.
152 *
153 * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
154 */
155export const findPetsByTags = <ThrowOnError extends boolean = true>(
156 options: Options<FindPetsByTagsData, ThrowOnError>,
157) =>
158 (options.client ?? client).get<
159 FindPetsByTagsResponses,
160 FindPetsByTagsErrors,
161 ThrowOnError,
162 'data'
163 >({
164 responseStyle: 'data',
165 security: [{ scheme: 'bearer', type: 'http' }],
166 url: '/pet/findByTags',
167 ...options,
168 });
169
170/**
171 * Deletes a pet.
172 *
173 * Delete a pet.
174 */
175export const deletePet = <ThrowOnError extends boolean = true>(
176 options: Options<DeletePetData, ThrowOnError>,
177) =>
178 (options.client ?? client).delete<
179 DeletePetResponses,
180 DeletePetErrors,
181 ThrowOnError,
182 'data'
183 >({
184 responseStyle: 'data',
185 security: [{ scheme: 'bearer', type: 'http' }],
186 url: '/pet/{petId}',
187 ...options,
188 });
189
190/**
191 * Find pet by ID.
192 *
193 * Returns a single pet.
194 */
195export const getPetById = <ThrowOnError extends boolean = true>(
196 options: Options<GetPetByIdData, ThrowOnError>,
197) =>
198 (options.client ?? client).get<
199 GetPetByIdResponses,
200 GetPetByIdErrors,
201 ThrowOnError,
202 'data'
203 >({
204 responseStyle: 'data',
205 security: [
206 { name: 'api_key', type: 'apiKey' },
207 { scheme: 'bearer', type: 'http' },
208 ],
209 url: '/pet/{petId}',
210 ...options,
211 });
212
213/**
214 * Updates a pet in the store with form data.
215 *
216 * Updates a pet resource based on the form data.
217 */
218export const updatePetWithForm = <ThrowOnError extends boolean = true>(
219 options: Options<UpdatePetWithFormData, ThrowOnError>,
220) =>
221 (options.client ?? client).post<
222 UpdatePetWithFormResponses,
223 UpdatePetWithFormErrors,
224 ThrowOnError,
225 'data'
226 >({
227 responseStyle: 'data',
228 security: [{ scheme: 'bearer', type: 'http' }],
229 url: '/pet/{petId}',
230 ...options,
231 });
232
233/**
234 * Uploads an image.
235 *
236 * Upload image of the pet.
237 */
238export const uploadFile = <ThrowOnError extends boolean = true>(
239 options: Options<UploadFileData, ThrowOnError>,
240) =>
241 (options.client ?? client).post<
242 UploadFileResponses,
243 UploadFileErrors,
244 ThrowOnError,
245 'data'
246 >({
247 bodySerializer: null,
248 responseStyle: 'data',
249 security: [{ scheme: 'bearer', type: 'http' }],
250 url: '/pet/{petId}/uploadImage',
251 ...options,
252 headers: {
253 'Content-Type': 'application/octet-stream',
254 ...options.headers,
255 },
256 });
257
258/**
259 * Returns pet inventories by status.
260 *
261 * Returns a map of status codes to quantities.
262 */
263export const getInventory = <ThrowOnError extends boolean = true>(
264 options?: Options<GetInventoryData, ThrowOnError>,
265) =>
266 (options?.client ?? client).get<
267 GetInventoryResponses,
268 GetInventoryErrors,
269 ThrowOnError,
270 'data'
271 >({
272 responseStyle: 'data',
273 security: [{ name: 'api_key', type: 'apiKey' }],
274 url: '/store/inventory',
275 ...options,
276 });
277
278/**
279 * Place an order for a pet.
280 *
281 * Place a new order in the store.
282 */
283export const placeOrder = <ThrowOnError extends boolean = true>(
284 options?: Options<PlaceOrderData, ThrowOnError>,
285) =>
286 (options?.client ?? client).post<
287 PlaceOrderResponses,
288 PlaceOrderErrors,
289 ThrowOnError,
290 'data'
291 >({
292 responseStyle: 'data',
293 url: '/store/order',
294 ...options,
295 headers: {
296 'Content-Type': 'application/json',
297 ...options?.headers,
298 },
299 });
300
301/**
302 * Delete purchase order by identifier.
303 *
304 * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors.
305 */
306export const deleteOrder = <ThrowOnError extends boolean = true>(
307 options: Options<DeleteOrderData, ThrowOnError>,
308) =>
309 (options.client ?? client).delete<
310 DeleteOrderResponses,
311 DeleteOrderErrors,
312 ThrowOnError,
313 'data'
314 >({
315 responseStyle: 'data',
316 url: '/store/order/{orderId}',
317 ...options,
318 });
319
320/**
321 * Find purchase order by ID.
322 *
323 * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
324 */
325export const getOrderById = <ThrowOnError extends boolean = true>(
326 options: Options<GetOrderByIdData, ThrowOnError>,
327) =>
328 (options.client ?? client).get<
329 GetOrderByIdResponses,
330 GetOrderByIdErrors,
331 ThrowOnError,
332 'data'
333 >({
334 responseStyle: 'data',
335 url: '/store/order/{orderId}',
336 ...options,
337 });
338
339/**
340 * Create user.
341 *
342 * This can only be done by the logged in user.
343 */
344export const createUser = <ThrowOnError extends boolean = true>(
345 options?: Options<CreateUserData, ThrowOnError>,
346) =>
347 (options?.client ?? client).post<
348 CreateUserResponses,
349 CreateUserErrors,
350 ThrowOnError,
351 'data'
352 >({
353 responseStyle: 'data',
354 url: '/user',
355 ...options,
356 headers: {
357 'Content-Type': 'application/json',
358 ...options?.headers,
359 },
360 });
361
362/**
363 * Creates list of users with given input array.
364 *
365 * Creates list of users with given input array.
366 */
367export const createUsersWithListInput = <ThrowOnError extends boolean = true>(
368 options?: Options<CreateUsersWithListInputData, ThrowOnError>,
369) =>
370 (options?.client ?? client).post<
371 CreateUsersWithListInputResponses,
372 CreateUsersWithListInputErrors,
373 ThrowOnError,
374 'data'
375 >({
376 responseStyle: 'data',
377 url: '/user/createWithList',
378 ...options,
379 headers: {
380 'Content-Type': 'application/json',
381 ...options?.headers,
382 },
383 });
384
385/**
386 * Logs user into the system.
387 *
388 * Log into the system.
389 */
390export const loginUser = <ThrowOnError extends boolean = true>(
391 options?: Options<LoginUserData, ThrowOnError>,
392) =>
393 (options?.client ?? client).get<
394 LoginUserResponses,
395 LoginUserErrors,
396 ThrowOnError,
397 'data'
398 >({
399 responseStyle: 'data',
400 url: '/user/login',
401 ...options,
402 });
403
404/**
405 * Logs out current logged in user session.
406 *
407 * Log user out of the system.
408 */
409export const logoutUser = <ThrowOnError extends boolean = true>(
410 options?: Options<LogoutUserData, ThrowOnError>,
411) =>
412 (options?.client ?? client).get<
413 LogoutUserResponses,
414 LogoutUserErrors,
415 ThrowOnError,
416 'data'
417 >({
418 responseStyle: 'data',
419 url: '/user/logout',
420 ...options,
421 });
422
423/**
424 * Delete user resource.
425 *
426 * This can only be done by the logged in user.
427 */
428export const deleteUser = <ThrowOnError extends boolean = true>(
429 options: Options<DeleteUserData, ThrowOnError>,
430) =>
431 (options.client ?? client).delete<
432 DeleteUserResponses,
433 DeleteUserErrors,
434 ThrowOnError,
435 'data'
436 >({
437 responseStyle: 'data',
438 url: '/user/{username}',
439 ...options,
440 });
441
442/**
443 * Get user by user name.
444 *
445 * Get user detail based on username.
446 */
447export const getUserByName = <ThrowOnError extends boolean = true>(
448 options: Options<GetUserByNameData, ThrowOnError>,
449) =>
450 (options.client ?? client).get<
451 GetUserByNameResponses,
452 GetUserByNameErrors,
453 ThrowOnError,
454 'data'
455 >({
456 responseStyle: 'data',
457 url: '/user/{username}',
458 ...options,
459 });
460
461/**
462 * Update user resource.
463 *
464 * This can only be done by the logged in user.
465 */
466export const updateUser = <ThrowOnError extends boolean = true>(
467 options: Options<UpdateUserData, ThrowOnError>,
468) =>
469 (options.client ?? client).put<
470 UpdateUserResponses,
471 UpdateUserErrors,
472 ThrowOnError,
473 'data'
474 >({
475 responseStyle: 'data',
476 url: '/user/{username}',
477 ...options,
478 headers: {
479 'Content-Type': 'application/json',
480 ...options.headers,
481 },
482 });