Skip to content

Commit 2410551

Browse files
committed
test(@tanstack/query): regenerate examples with queryOptions override
1 parent 67d1918 commit 2410551

1 file changed

Lines changed: 120 additions & 1 deletion

File tree

examples/openapi-ts-tanstack-react-query/src/client/@tanstack/react-query.gen.ts

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3-
import { type DefaultError, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
3+
import {
4+
type DefaultError,
5+
queryOptions,
6+
type UseMutationOptions,
7+
useQuery,
8+
} from '@tanstack/react-query';
49

510
import { client } from '../client.gen';
611
import { type Options, Sdk } from '../sdk.gen';
@@ -152,6 +157,22 @@ export const findPetsByStatusOptions = (options: Options<FindPetsByStatusData>)
152157
queryKey: findPetsByStatusQueryKey(options),
153158
});
154159

160+
/**
161+
* Finds Pets by status.
162+
*
163+
* Multiple status values can be provided with comma separated strings.
164+
*/
165+
export const useFindPetsByStatusQuery = (
166+
options: Options<FindPetsByStatusData> & {
167+
queryOptions?: Partial<
168+
Omit<ReturnType<typeof findPetsByStatusOptions>, 'queryKey' | 'queryFn'>
169+
>;
170+
},
171+
) => {
172+
const { queryOptions, ...sdkOptions } = options;
173+
return useQuery({ ...findPetsByStatusOptions(sdkOptions), ...queryOptions });
174+
};
175+
155176
export const findPetsByTagsQueryKey = (options: Options<FindPetsByTagsData>) =>
156177
createQueryKey('findPetsByTags', options);
157178

@@ -179,6 +200,20 @@ export const findPetsByTagsOptions = (options: Options<FindPetsByTagsData>) =>
179200
queryKey: findPetsByTagsQueryKey(options),
180201
});
181202

203+
/**
204+
* Finds Pets by tags.
205+
*
206+
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
207+
*/
208+
export const useFindPetsByTagsQuery = (
209+
options: Options<FindPetsByTagsData> & {
210+
queryOptions?: Partial<Omit<ReturnType<typeof findPetsByTagsOptions>, 'queryKey' | 'queryFn'>>;
211+
},
212+
) => {
213+
const { queryOptions, ...sdkOptions } = options;
214+
return useQuery({ ...findPetsByTagsOptions(sdkOptions), ...queryOptions });
215+
};
216+
182217
/**
183218
* Deletes a pet.
184219
*
@@ -227,6 +262,20 @@ export const getPetByIdOptions = (options: Options<GetPetByIdData>) =>
227262
queryKey: getPetByIdQueryKey(options),
228263
});
229264

265+
/**
266+
* Find pet by ID.
267+
*
268+
* Returns a single pet.
269+
*/
270+
export const useGetPetByIdQuery = (
271+
options: Options<GetPetByIdData> & {
272+
queryOptions?: Partial<Omit<ReturnType<typeof getPetByIdOptions>, 'queryKey' | 'queryFn'>>;
273+
},
274+
) => {
275+
const { queryOptions, ...sdkOptions } = options;
276+
return useQuery({ ...getPetByIdOptions(sdkOptions), ...queryOptions });
277+
};
278+
230279
/**
231280
* Updates a pet in the store with form data.
232281
*
@@ -304,6 +353,20 @@ export const getInventoryOptions = (options?: Options<GetInventoryData>) =>
304353
queryKey: getInventoryQueryKey(options),
305354
});
306355

356+
/**
357+
* Returns pet inventories by status.
358+
*
359+
* Returns a map of status codes to quantities.
360+
*/
361+
export const useGetInventoryQuery = (
362+
options?: Options<GetInventoryData> & {
363+
queryOptions?: Partial<Omit<ReturnType<typeof getInventoryOptions>, 'queryKey' | 'queryFn'>>;
364+
},
365+
) => {
366+
const { queryOptions, ...sdkOptions } = options ?? {};
367+
return useQuery({ ...getInventoryOptions(sdkOptions), ...queryOptions });
368+
};
369+
307370
/**
308371
* Place an order for a pet.
309372
*
@@ -377,6 +440,20 @@ export const getOrderByIdOptions = (options: Options<GetOrderByIdData>) =>
377440
queryKey: getOrderByIdQueryKey(options),
378441
});
379442

443+
/**
444+
* Find purchase order by ID.
445+
*
446+
* For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
447+
*/
448+
export const useGetOrderByIdQuery = (
449+
options: Options<GetOrderByIdData> & {
450+
queryOptions?: Partial<Omit<ReturnType<typeof getOrderByIdOptions>, 'queryKey' | 'queryFn'>>;
451+
},
452+
) => {
453+
const { queryOptions, ...sdkOptions } = options;
454+
return useQuery({ ...getOrderByIdOptions(sdkOptions), ...queryOptions });
455+
};
456+
380457
/**
381458
* Create user.
382459
*
@@ -458,6 +535,20 @@ export const loginUserOptions = (options?: Options<LoginUserData>) =>
458535
queryKey: loginUserQueryKey(options),
459536
});
460537

538+
/**
539+
* Logs user into the system.
540+
*
541+
* Log into the system.
542+
*/
543+
export const useLoginUserQuery = (
544+
options?: Options<LoginUserData> & {
545+
queryOptions?: Partial<Omit<ReturnType<typeof loginUserOptions>, 'queryKey' | 'queryFn'>>;
546+
},
547+
) => {
548+
const { queryOptions, ...sdkOptions } = options ?? {};
549+
return useQuery({ ...loginUserOptions(sdkOptions), ...queryOptions });
550+
};
551+
461552
export const logoutUserQueryKey = (options?: Options<LogoutUserData>) =>
462553
createQueryKey('logoutUser', options);
463554

@@ -480,6 +571,20 @@ export const logoutUserOptions = (options?: Options<LogoutUserData>) =>
480571
queryKey: logoutUserQueryKey(options),
481572
});
482573

574+
/**
575+
* Logs out current logged in user session.
576+
*
577+
* Log user out of the system.
578+
*/
579+
export const useLogoutUserQuery = (
580+
options?: Options<LogoutUserData> & {
581+
queryOptions?: Partial<Omit<ReturnType<typeof logoutUserOptions>, 'queryKey' | 'queryFn'>>;
582+
},
583+
) => {
584+
const { queryOptions, ...sdkOptions } = options ?? {};
585+
return useQuery({ ...logoutUserOptions(sdkOptions), ...queryOptions });
586+
};
587+
483588
/**
484589
* Delete user resource.
485590
*
@@ -528,6 +633,20 @@ export const getUserByNameOptions = (options: Options<GetUserByNameData>) =>
528633
queryKey: getUserByNameQueryKey(options),
529634
});
530635

636+
/**
637+
* Get user by user name.
638+
*
639+
* Get user detail based on username.
640+
*/
641+
export const useGetUserByNameQuery = (
642+
options: Options<GetUserByNameData> & {
643+
queryOptions?: Partial<Omit<ReturnType<typeof getUserByNameOptions>, 'queryKey' | 'queryFn'>>;
644+
},
645+
) => {
646+
const { queryOptions, ...sdkOptions } = options;
647+
return useQuery({ ...getUserByNameOptions(sdkOptions), ...queryOptions });
648+
};
649+
531650
/**
532651
* Update user resource.
533652
*

0 commit comments

Comments
 (0)