···11+// This file is auto-generated by @hey-api/openapi-ts
22+export * from './schemas.gen';
33+export * from './services.gen';
44+export * from './types.gen';
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+import type { CancelablePromise } from '@hey-api/client-axios';
44+import { OpenAPI } from '@hey-api/client-axios';
55+import { request as __request } from '@hey-api/client-axios';
66+77+import type { $OpenApiTs } from './types.gen';
88+99+export class PetService {
1010+ /**
1111+ * Add a new pet to the store
1212+ * Add a new pet to the store
1313+ * @param data The data for the request.
1414+ * @param data.requestBody Create a new pet in the store
1515+ * @returns Pet Successful operation
1616+ * @throws ApiError
1717+ */
1818+ public static addPet(
1919+ data: $OpenApiTs['/pet']['post']['req'],
2020+ ): CancelablePromise<$OpenApiTs['/pet']['post']['res'][200]> {
2121+ return __request(OpenAPI, {
2222+ body: data.requestBody,
2323+ errors: {
2424+ 405: 'Invalid input',
2525+ },
2626+ mediaType: 'application/json',
2727+ method: 'POST',
2828+ url: '/pet',
2929+ });
3030+ }
3131+3232+ /**
3333+ * Update an existing pet
3434+ * Update an existing pet by Id
3535+ * @param data The data for the request.
3636+ * @param data.requestBody Update an existent pet in the store
3737+ * @returns Pet Successful operation
3838+ * @throws ApiError
3939+ */
4040+ public static updatePet(
4141+ data: $OpenApiTs['/pet']['put']['req'],
4242+ ): CancelablePromise<$OpenApiTs['/pet']['put']['res'][200]> {
4343+ return __request(OpenAPI, {
4444+ body: data.requestBody,
4545+ errors: {
4646+ 400: 'Invalid ID supplied',
4747+ 404: 'Pet not found',
4848+ 405: 'Validation exception',
4949+ },
5050+ mediaType: 'application/json',
5151+ method: 'PUT',
5252+ url: '/pet',
5353+ });
5454+ }
5555+5656+ /**
5757+ * Finds Pets by status
5858+ * Multiple status values can be provided with comma separated strings
5959+ * @param data The data for the request.
6060+ * @param data.status Status values that need to be considered for filter
6161+ * @returns Pet successful operation
6262+ * @throws ApiError
6363+ */
6464+ public static findPetsByStatus(
6565+ data: $OpenApiTs['/pet/findByStatus']['get']['req'] = {},
6666+ ): CancelablePromise<$OpenApiTs['/pet/findByStatus']['get']['res'][200]> {
6767+ return __request(OpenAPI, {
6868+ errors: {
6969+ 400: 'Invalid status value',
7070+ },
7171+ method: 'GET',
7272+ query: {
7373+ status: data.status,
7474+ },
7575+ url: '/pet/findByStatus',
7676+ });
7777+ }
7878+7979+ /**
8080+ * Finds Pets by tags
8181+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
8282+ * @param data The data for the request.
8383+ * @param data.tags Tags to filter by
8484+ * @returns Pet successful operation
8585+ * @throws ApiError
8686+ */
8787+ public static findPetsByTags(
8888+ data: $OpenApiTs['/pet/findByTags']['get']['req'] = {},
8989+ ): CancelablePromise<$OpenApiTs['/pet/findByTags']['get']['res'][200]> {
9090+ return __request(OpenAPI, {
9191+ errors: {
9292+ 400: 'Invalid tag value',
9393+ },
9494+ method: 'GET',
9595+ query: {
9696+ tags: data.tags,
9797+ },
9898+ url: '/pet/findByTags',
9999+ });
100100+ }
101101+102102+ /**
103103+ * Find pet by ID
104104+ * Returns a single pet
105105+ * @param data The data for the request.
106106+ * @param data.petId ID of pet to return
107107+ * @returns Pet successful operation
108108+ * @throws ApiError
109109+ */
110110+ public static getPetById(
111111+ data: $OpenApiTs['/pet/{petId}']['get']['req'],
112112+ ): CancelablePromise<$OpenApiTs['/pet/{petId}']['get']['res'][200]> {
113113+ return __request(OpenAPI, {
114114+ errors: {
115115+ 400: 'Invalid ID supplied',
116116+ 404: 'Pet not found',
117117+ },
118118+ method: 'GET',
119119+ path: {
120120+ petId: data.petId,
121121+ },
122122+ url: '/pet/{petId}',
123123+ });
124124+ }
125125+126126+ /**
127127+ * Updates a pet in the store with form data
128128+ * @param data The data for the request.
129129+ * @param data.petId ID of pet that needs to be updated
130130+ * @param data.name Name of pet that needs to be updated
131131+ * @param data.status Status of pet that needs to be updated
132132+ * @throws ApiError
133133+ */
134134+ public static updatePetWithForm(
135135+ data: $OpenApiTs['/pet/{petId}']['post']['req'],
136136+ ): CancelablePromise<void> {
137137+ return __request(OpenAPI, {
138138+ errors: {
139139+ 405: 'Invalid input',
140140+ },
141141+ method: 'POST',
142142+ path: {
143143+ petId: data.petId,
144144+ },
145145+ query: {
146146+ name: data.name,
147147+ status: data.status,
148148+ },
149149+ url: '/pet/{petId}',
150150+ });
151151+ }
152152+153153+ /**
154154+ * Deletes a pet
155155+ * @param data The data for the request.
156156+ * @param data.petId Pet id to delete
157157+ * @param data.apiKey
158158+ * @throws ApiError
159159+ */
160160+ public static deletePet(
161161+ data: $OpenApiTs['/pet/{petId}']['delete']['req'],
162162+ ): CancelablePromise<void> {
163163+ return __request(OpenAPI, {
164164+ errors: {
165165+ 400: 'Invalid pet value',
166166+ },
167167+ headers: {
168168+ api_key: data.apiKey,
169169+ },
170170+ method: 'DELETE',
171171+ path: {
172172+ petId: data.petId,
173173+ },
174174+ url: '/pet/{petId}',
175175+ });
176176+ }
177177+178178+ /**
179179+ * uploads an image
180180+ * @param data The data for the request.
181181+ * @param data.petId ID of pet to update
182182+ * @param data.additionalMetadata Additional Metadata
183183+ * @param data.requestBody
184184+ * @returns ApiResponse successful operation
185185+ * @throws ApiError
186186+ */
187187+ public static uploadFile(
188188+ data: $OpenApiTs['/pet/{petId}/uploadImage']['post']['req'],
189189+ ): CancelablePromise<
190190+ $OpenApiTs['/pet/{petId}/uploadImage']['post']['res'][200]
191191+ > {
192192+ return __request(OpenAPI, {
193193+ body: data.requestBody,
194194+ mediaType: 'application/octet-stream',
195195+ method: 'POST',
196196+ path: {
197197+ petId: data.petId,
198198+ },
199199+ query: {
200200+ additionalMetadata: data.additionalMetadata,
201201+ },
202202+ url: '/pet/{petId}/uploadImage',
203203+ });
204204+ }
205205+}
206206+207207+export class StoreService {
208208+ /**
209209+ * Returns pet inventories by status
210210+ * Returns a map of status codes to quantities
211211+ * @returns number successful operation
212212+ * @throws ApiError
213213+ */
214214+ public static getInventory(): CancelablePromise<
215215+ $OpenApiTs['/store/inventory']['get']['res'][200]
216216+ > {
217217+ return __request(OpenAPI, {
218218+ method: 'GET',
219219+ url: '/store/inventory',
220220+ });
221221+ }
222222+223223+ /**
224224+ * Place an order for a pet
225225+ * Place a new order in the store
226226+ * @param data The data for the request.
227227+ * @param data.requestBody
228228+ * @returns Order successful operation
229229+ * @throws ApiError
230230+ */
231231+ public static placeOrder(
232232+ data: $OpenApiTs['/store/order']['post']['req'] = {},
233233+ ): CancelablePromise<$OpenApiTs['/store/order']['post']['res'][200]> {
234234+ return __request(OpenAPI, {
235235+ body: data.requestBody,
236236+ errors: {
237237+ 405: 'Invalid input',
238238+ },
239239+ mediaType: 'application/json',
240240+ method: 'POST',
241241+ url: '/store/order',
242242+ });
243243+ }
244244+245245+ /**
246246+ * Find purchase order by ID
247247+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
248248+ * @param data The data for the request.
249249+ * @param data.orderId ID of order that needs to be fetched
250250+ * @returns Order successful operation
251251+ * @throws ApiError
252252+ */
253253+ public static getOrderById(
254254+ data: $OpenApiTs['/store/order/{orderId}']['get']['req'],
255255+ ): CancelablePromise<
256256+ $OpenApiTs['/store/order/{orderId}']['get']['res'][200]
257257+ > {
258258+ return __request(OpenAPI, {
259259+ errors: {
260260+ 400: 'Invalid ID supplied',
261261+ 404: 'Order not found',
262262+ },
263263+ method: 'GET',
264264+ path: {
265265+ orderId: data.orderId,
266266+ },
267267+ url: '/store/order/{orderId}',
268268+ });
269269+ }
270270+271271+ /**
272272+ * Delete purchase order by ID
273273+ * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
274274+ * @param data The data for the request.
275275+ * @param data.orderId ID of the order that needs to be deleted
276276+ * @throws ApiError
277277+ */
278278+ public static deleteOrder(
279279+ data: $OpenApiTs['/store/order/{orderId}']['delete']['req'],
280280+ ): CancelablePromise<void> {
281281+ return __request(OpenAPI, {
282282+ errors: {
283283+ 400: 'Invalid ID supplied',
284284+ 404: 'Order not found',
285285+ },
286286+ method: 'DELETE',
287287+ path: {
288288+ orderId: data.orderId,
289289+ },
290290+ url: '/store/order/{orderId}',
291291+ });
292292+ }
293293+}
294294+295295+export class UserService {
296296+ /**
297297+ * Create user
298298+ * This can only be done by the logged in user.
299299+ * @param data The data for the request.
300300+ * @param data.requestBody Created user object
301301+ * @returns User successful operation
302302+ * @throws ApiError
303303+ */
304304+ public static createUser(
305305+ data: $OpenApiTs['/user']['post']['req'] = {},
306306+ ): CancelablePromise<$OpenApiTs['/user']['post']['res'][200]> {
307307+ return __request(OpenAPI, {
308308+ body: data.requestBody,
309309+ mediaType: 'application/json',
310310+ method: 'POST',
311311+ url: '/user',
312312+ });
313313+ }
314314+315315+ /**
316316+ * Creates list of users with given input array
317317+ * Creates list of users with given input array
318318+ * @param data The data for the request.
319319+ * @param data.requestBody
320320+ * @returns User Successful operation
321321+ * @returns unknown successful operation
322322+ * @throws ApiError
323323+ */
324324+ public static createUsersWithListInput(
325325+ data: $OpenApiTs['/user/createWithList']['post']['req'] = {},
326326+ ): CancelablePromise<
327327+ | $OpenApiTs['/user/createWithList']['post']['res'][200]
328328+ | $OpenApiTs['/user/createWithList']['post']['res'][200]
329329+ > {
330330+ return __request(OpenAPI, {
331331+ body: data.requestBody,
332332+ mediaType: 'application/json',
333333+ method: 'POST',
334334+ url: '/user/createWithList',
335335+ });
336336+ }
337337+338338+ /**
339339+ * Logs user into the system
340340+ * @param data The data for the request.
341341+ * @param data.username The user name for login
342342+ * @param data.password The password for login in clear text
343343+ * @returns string successful operation
344344+ * @throws ApiError
345345+ */
346346+ public static loginUser(
347347+ data: $OpenApiTs['/user/login']['get']['req'] = {},
348348+ ): CancelablePromise<$OpenApiTs['/user/login']['get']['res'][200]> {
349349+ return __request(OpenAPI, {
350350+ errors: {
351351+ 400: 'Invalid username/password supplied',
352352+ },
353353+ method: 'GET',
354354+ query: {
355355+ password: data.password,
356356+ username: data.username,
357357+ },
358358+ url: '/user/login',
359359+ });
360360+ }
361361+362362+ /**
363363+ * Logs out current logged in user session
364364+ * @returns unknown successful operation
365365+ * @throws ApiError
366366+ */
367367+ public static logoutUser(): CancelablePromise<
368368+ $OpenApiTs['/user/logout']['get']['res'][200]
369369+ > {
370370+ return __request(OpenAPI, {
371371+ method: 'GET',
372372+ url: '/user/logout',
373373+ });
374374+ }
375375+376376+ /**
377377+ * Get user by user name
378378+ * @param data The data for the request.
379379+ * @param data.username The name that needs to be fetched. Use user1 for testing.
380380+ * @returns User successful operation
381381+ * @throws ApiError
382382+ */
383383+ public static getUserByName(
384384+ data: $OpenApiTs['/user/{username}']['get']['req'],
385385+ ): CancelablePromise<$OpenApiTs['/user/{username}']['get']['res'][200]> {
386386+ return __request(OpenAPI, {
387387+ errors: {
388388+ 400: 'Invalid username supplied',
389389+ 404: 'User not found',
390390+ },
391391+ method: 'GET',
392392+ path: {
393393+ username: data.username,
394394+ },
395395+ url: '/user/{username}',
396396+ });
397397+ }
398398+399399+ /**
400400+ * Update user
401401+ * This can only be done by the logged in user.
402402+ * @param data The data for the request.
403403+ * @param data.username name that needs to be updated
404404+ * @param data.requestBody Update an existent user in the store
405405+ * @returns unknown successful operation
406406+ * @throws ApiError
407407+ */
408408+ public static updateUser(
409409+ data: $OpenApiTs['/user/{username}']['put']['req'],
410410+ ): CancelablePromise<$OpenApiTs['/user/{username}']['put']['res'][200]> {
411411+ return __request(OpenAPI, {
412412+ body: data.requestBody,
413413+ mediaType: 'application/json',
414414+ method: 'PUT',
415415+ path: {
416416+ username: data.username,
417417+ },
418418+ url: '/user/{username}',
419419+ });
420420+ }
421421+422422+ /**
423423+ * Delete user
424424+ * This can only be done by the logged in user.
425425+ * @param data The data for the request.
426426+ * @param data.username The name that needs to be deleted
427427+ * @throws ApiError
428428+ */
429429+ public static deleteUser(
430430+ data: $OpenApiTs['/user/{username}']['delete']['req'],
431431+ ): CancelablePromise<void> {
432432+ return __request(OpenAPI, {
433433+ errors: {
434434+ 400: 'Invalid username supplied',
435435+ 404: 'User not found',
436436+ },
437437+ method: 'DELETE',
438438+ path: {
439439+ username: data.username,
440440+ },
441441+ url: '/user/{username}',
442442+ });
443443+ }
444444+}
+433
examples/openapi-ts-axios/src/client/types.gen.ts
···11+// This file is auto-generated by @hey-api/openapi-ts
22+33+export type Order = {
44+ id?: number;
55+ petId?: number;
66+ quantity?: number;
77+ shipDate?: string;
88+ /**
99+ * Order Status
1010+ */
1111+ status?: 'placed' | 'approved' | 'delivered';
1212+ complete?: boolean;
1313+};
1414+1515+export type Customer = {
1616+ id?: number;
1717+ username?: string;
1818+ address?: Array<Address>;
1919+};
2020+2121+export type Address = {
2222+ street?: string;
2323+ city?: string;
2424+ state?: string;
2525+ zip?: string;
2626+};
2727+2828+export type Category = {
2929+ id?: number;
3030+ name?: string;
3131+};
3232+3333+export type User = {
3434+ id?: number;
3535+ username?: string;
3636+ firstName?: string;
3737+ lastName?: string;
3838+ email?: string;
3939+ password?: string;
4040+ phone?: string;
4141+ /**
4242+ * User Status
4343+ */
4444+ userStatus?: number;
4545+};
4646+4747+export type Tag = {
4848+ id?: number;
4949+ name?: string;
5050+};
5151+5252+export type Pet = {
5353+ id?: number;
5454+ name: string;
5555+ category?: Category;
5656+ photoUrls: Array<string>;
5757+ tags?: Array<Tag>;
5858+ /**
5959+ * pet status in the store
6060+ */
6161+ status?: 'available' | 'pending' | 'sold';
6262+};
6363+6464+export type ApiResponse = {
6565+ code?: number;
6666+ type?: string;
6767+ message?: string;
6868+};
6969+7070+export type $OpenApiTs = {
7171+ '/pet': {
7272+ post: {
7373+ req: {
7474+ /**
7575+ * Create a new pet in the store
7676+ */
7777+ requestBody: Pet;
7878+ };
7979+ res: {
8080+ /**
8181+ * Successful operation
8282+ */
8383+ 200: Pet;
8484+ /**
8585+ * Invalid input
8686+ */
8787+ 405: unknown;
8888+ };
8989+ };
9090+ put: {
9191+ req: {
9292+ /**
9393+ * Update an existent pet in the store
9494+ */
9595+ requestBody: Pet;
9696+ };
9797+ res: {
9898+ /**
9999+ * Successful operation
100100+ */
101101+ 200: Pet;
102102+ /**
103103+ * Invalid ID supplied
104104+ */
105105+ 400: unknown;
106106+ /**
107107+ * Pet not found
108108+ */
109109+ 404: unknown;
110110+ /**
111111+ * Validation exception
112112+ */
113113+ 405: unknown;
114114+ };
115115+ };
116116+ };
117117+ '/pet/findByStatus': {
118118+ get: {
119119+ req: {
120120+ /**
121121+ * Status values that need to be considered for filter
122122+ */
123123+ status?: 'available' | 'pending' | 'sold';
124124+ };
125125+ res: {
126126+ /**
127127+ * successful operation
128128+ */
129129+ 200: Array<Pet>;
130130+ /**
131131+ * Invalid status value
132132+ */
133133+ 400: unknown;
134134+ };
135135+ };
136136+ };
137137+ '/pet/findByTags': {
138138+ get: {
139139+ req: {
140140+ /**
141141+ * Tags to filter by
142142+ */
143143+ tags?: Array<string>;
144144+ };
145145+ res: {
146146+ /**
147147+ * successful operation
148148+ */
149149+ 200: Array<Pet>;
150150+ /**
151151+ * Invalid tag value
152152+ */
153153+ 400: unknown;
154154+ };
155155+ };
156156+ };
157157+ '/pet/{petId}': {
158158+ get: {
159159+ req: {
160160+ /**
161161+ * ID of pet to return
162162+ */
163163+ petId: number;
164164+ };
165165+ res: {
166166+ /**
167167+ * successful operation
168168+ */
169169+ 200: Pet;
170170+ /**
171171+ * Invalid ID supplied
172172+ */
173173+ 400: unknown;
174174+ /**
175175+ * Pet not found
176176+ */
177177+ 404: unknown;
178178+ };
179179+ };
180180+ post: {
181181+ req: {
182182+ /**
183183+ * Name of pet that needs to be updated
184184+ */
185185+ name?: string;
186186+ /**
187187+ * ID of pet that needs to be updated
188188+ */
189189+ petId: number;
190190+ /**
191191+ * Status of pet that needs to be updated
192192+ */
193193+ status?: string;
194194+ };
195195+ res: {
196196+ /**
197197+ * Invalid input
198198+ */
199199+ 405: unknown;
200200+ };
201201+ };
202202+ delete: {
203203+ req: {
204204+ apiKey?: string;
205205+ /**
206206+ * Pet id to delete
207207+ */
208208+ petId: number;
209209+ };
210210+ res: {
211211+ /**
212212+ * Invalid pet value
213213+ */
214214+ 400: unknown;
215215+ };
216216+ };
217217+ };
218218+ '/pet/{petId}/uploadImage': {
219219+ post: {
220220+ req: {
221221+ /**
222222+ * Additional Metadata
223223+ */
224224+ additionalMetadata?: string;
225225+ /**
226226+ * ID of pet to update
227227+ */
228228+ petId: number;
229229+ requestBody?: Blob | File;
230230+ };
231231+ res: {
232232+ /**
233233+ * successful operation
234234+ */
235235+ 200: ApiResponse;
236236+ };
237237+ };
238238+ };
239239+ '/store/inventory': {
240240+ get: {
241241+ res: {
242242+ /**
243243+ * successful operation
244244+ */
245245+ 200: {
246246+ [key: string]: number;
247247+ };
248248+ };
249249+ };
250250+ };
251251+ '/store/order': {
252252+ post: {
253253+ req: {
254254+ requestBody?: Order;
255255+ };
256256+ res: {
257257+ /**
258258+ * successful operation
259259+ */
260260+ 200: Order;
261261+ /**
262262+ * Invalid input
263263+ */
264264+ 405: unknown;
265265+ };
266266+ };
267267+ };
268268+ '/store/order/{orderId}': {
269269+ get: {
270270+ req: {
271271+ /**
272272+ * ID of order that needs to be fetched
273273+ */
274274+ orderId: number;
275275+ };
276276+ res: {
277277+ /**
278278+ * successful operation
279279+ */
280280+ 200: Order;
281281+ /**
282282+ * Invalid ID supplied
283283+ */
284284+ 400: unknown;
285285+ /**
286286+ * Order not found
287287+ */
288288+ 404: unknown;
289289+ };
290290+ };
291291+ delete: {
292292+ req: {
293293+ /**
294294+ * ID of the order that needs to be deleted
295295+ */
296296+ orderId: number;
297297+ };
298298+ res: {
299299+ /**
300300+ * Invalid ID supplied
301301+ */
302302+ 400: unknown;
303303+ /**
304304+ * Order not found
305305+ */
306306+ 404: unknown;
307307+ };
308308+ };
309309+ };
310310+ '/user': {
311311+ post: {
312312+ req: {
313313+ /**
314314+ * Created user object
315315+ */
316316+ requestBody?: User;
317317+ };
318318+ res: {
319319+ /**
320320+ * successful operation
321321+ */
322322+ 200: User;
323323+ };
324324+ };
325325+ };
326326+ '/user/createWithList': {
327327+ post: {
328328+ req: {
329329+ requestBody?: Array<User>;
330330+ };
331331+ res: {
332332+ /**
333333+ * successful operation
334334+ */
335335+ 200: unknown;
336336+ };
337337+ };
338338+ };
339339+ '/user/login': {
340340+ get: {
341341+ req: {
342342+ /**
343343+ * The password for login in clear text
344344+ */
345345+ password?: string;
346346+ /**
347347+ * The user name for login
348348+ */
349349+ username?: string;
350350+ };
351351+ res: {
352352+ /**
353353+ * successful operation
354354+ */
355355+ 200: string;
356356+ /**
357357+ * Invalid username/password supplied
358358+ */
359359+ 400: unknown;
360360+ };
361361+ };
362362+ };
363363+ '/user/logout': {
364364+ get: {
365365+ res: {
366366+ /**
367367+ * successful operation
368368+ */
369369+ 200: unknown;
370370+ };
371371+ };
372372+ };
373373+ '/user/{username}': {
374374+ get: {
375375+ req: {
376376+ /**
377377+ * The name that needs to be fetched. Use user1 for testing.
378378+ */
379379+ username: string;
380380+ };
381381+ res: {
382382+ /**
383383+ * successful operation
384384+ */
385385+ 200: User;
386386+ /**
387387+ * Invalid username supplied
388388+ */
389389+ 400: unknown;
390390+ /**
391391+ * User not found
392392+ */
393393+ 404: unknown;
394394+ };
395395+ };
396396+ put: {
397397+ req: {
398398+ /**
399399+ * Update an existent user in the store
400400+ */
401401+ requestBody?: User;
402402+ /**
403403+ * name that needs to be updated
404404+ */
405405+ username: string;
406406+ };
407407+ res: {
408408+ /**
409409+ * successful operation
410410+ */
411411+ 200: unknown;
412412+ };
413413+ };
414414+ delete: {
415415+ req: {
416416+ /**
417417+ * The name that needs to be deleted
418418+ */
419419+ username: string;
420420+ };
421421+ res: {
422422+ /**
423423+ * Invalid username supplied
424424+ */
425425+ 400: unknown;
426426+ /**
427427+ * User not found
428428+ */
429429+ 404: unknown;
430430+ };
431431+ };
432432+ };
433433+};