From 52fb48cdd72442ba638d0129eeae37a7d5073fbd Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Thu, 5 Dec 2024 22:31:40 +0100 Subject: [PATCH 1/2] feat: Group API Clients by Path Structure --- .changeset/dirty-doors-move.md | 12 ++ docs/changelog.md | 15 +- .../petController/findPetsByStatusHandler.ts | 2 +- examples/client/kubb.config.ts | 12 ++ examples/client/src/gen/index.ts | 9 +- examples/client/src/gen/tag.ts | 4 + examples/react-query/kubb.config.ts | 3 + examples/react-query/src/App.tsx | 11 +- examples/react-query/src/gen/hooks/index.ts | 120 ++++++++-------- .../react-query/src/gen/hooks/pet/index.ts | 34 +++++ .../src/gen/hooks/{ => pet}/useAddPetHook.ts | 2 +- .../gen/hooks/{ => pet}/useDeletePetHook.ts | 2 +- .../{ => pet}/useFindPetsByStatusHook.ts | 2 +- .../useFindPetsByStatusSuspenseHook.ts | 2 +- .../hooks/{ => pet}/useFindPetsByTagsHook.ts | 2 +- .../useFindPetsByTagsInfiniteHook.ts | 2 +- .../useFindPetsByTagsSuspenseHook.ts | 2 +- .../gen/hooks/{ => pet}/useGetPetByIdHook.ts | 2 +- .../{ => pet}/useGetPetByIdSuspenseHook.ts | 2 +- .../gen/hooks/{ => pet}/useUpdatePetHook.ts | 2 +- .../{ => pet}/useUpdatePetWithFormHook.ts | 2 +- .../useUpdatePetWithFormSuspenseHook.ts | 2 +- .../gen/hooks/{ => pet}/useUploadFileHook.ts | 2 +- .../react-query/src/gen/hooks/store/index.ts | 14 ++ .../hooks/{ => store}/useDeleteOrderHook.ts | 2 +- .../hooks/{ => store}/useGetInventoryHook.ts | 2 +- .../useGetInventorySuspenseHook.ts | 2 +- .../hooks/{ => store}/useGetOrderByIdHook.ts | 2 +- .../useGetOrderByIdSuspenseHook.ts | 2 +- .../hooks/{ => store}/usePlaceOrderHook.ts | 2 +- .../{ => store}/usePlaceOrderPatchHook.ts | 2 +- .../react-query/src/gen/hooks/user/index.ts | 20 +++ .../gen/hooks/{ => user}/useCreateUserHook.ts | 2 +- .../useCreateUsersWithListInputHook.ts | 2 +- .../gen/hooks/{ => user}/useDeleteUserHook.ts | 2 +- .../hooks/{ => user}/useGetUserByNameHook.ts | 2 +- .../useGetUserByNameSuspenseHook.ts | 2 +- .../gen/hooks/{ => user}/useLoginUserHook.ts | 2 +- .../{ => user}/useLoginUserSuspenseHook.ts | 2 +- .../gen/hooks/{ => user}/useLogoutUserHook.ts | 2 +- .../{ => user}/useLogoutUserSuspenseHook.ts | 2 +- .../gen/hooks/{ => user}/useUpdateUserHook.ts | 2 +- examples/react-query/src/gen/index.ts | 132 ++++++++++-------- packages/core/src/types.ts | 2 +- .../src/generators/groupedClientGenerator.tsx | 2 +- packages/plugin-client/src/plugin.ts | 19 ++- .../src/generators/fakerGenerator.tsx | 5 +- packages/plugin-faker/src/plugin.ts | 20 ++- packages/plugin-faker/src/types.ts | 1 + packages/plugin-msw/src/plugin.ts | 20 ++- packages/plugin-msw/src/types.ts | 1 + .../src/hooks/useOperationManager.ts | 27 +++- .../plugin-oas/src/hooks/useSchemaManager.ts | 10 +- packages/plugin-oas/src/types.ts | 2 +- packages/plugin-react-query/src/plugin.ts | 20 ++- packages/plugin-react-query/src/types.ts | 1 + packages/plugin-solid-query/src/plugin.ts | 20 ++- packages/plugin-solid-query/src/types.ts | 1 + packages/plugin-svelte-query/src/plugin.ts | 20 ++- packages/plugin-svelte-query/src/types.ts | 1 + packages/plugin-swr/src/plugin.ts | 20 ++- packages/plugin-swr/src/types.ts | 1 + .../src/generators/typeGenerator.tsx | 5 +- packages/plugin-ts/src/plugin.ts | 20 ++- packages/plugin-ts/src/types.ts | 1 + packages/plugin-vue-query/src/plugin.ts | 20 ++- packages/plugin-vue-query/src/types.ts | 1 + .../src/generators/zodGenerator.tsx | 5 +- packages/plugin-zod/src/plugin.ts | 20 ++- packages/plugin-zod/src/types.ts | 1 + 70 files changed, 476 insertions(+), 238 deletions(-) create mode 100644 .changeset/dirty-doors-move.md create mode 100644 examples/react-query/src/gen/hooks/pet/index.ts rename examples/react-query/src/gen/hooks/{ => pet}/useAddPetHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => pet}/useDeletePetHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => pet}/useFindPetsByStatusHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => pet}/useFindPetsByStatusSuspenseHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => pet}/useFindPetsByTagsHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => pet}/useFindPetsByTagsInfiniteHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => pet}/useFindPetsByTagsSuspenseHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => pet}/useGetPetByIdHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => pet}/useGetPetByIdSuspenseHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => pet}/useUpdatePetHook.ts (95%) rename examples/react-query/src/gen/hooks/{ => pet}/useUpdatePetWithFormHook.ts (98%) rename examples/react-query/src/gen/hooks/{ => pet}/useUpdatePetWithFormSuspenseHook.ts (98%) rename examples/react-query/src/gen/hooks/{ => pet}/useUploadFileHook.ts (95%) create mode 100644 examples/react-query/src/gen/hooks/store/index.ts rename examples/react-query/src/gen/hooks/{ => store}/useDeleteOrderHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => store}/useGetInventoryHook.ts (92%) rename examples/react-query/src/gen/hooks/{ => store}/useGetInventorySuspenseHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => store}/useGetOrderByIdHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => store}/useGetOrderByIdSuspenseHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => store}/usePlaceOrderHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => store}/usePlaceOrderPatchHook.ts (96%) create mode 100644 examples/react-query/src/gen/hooks/user/index.ts rename examples/react-query/src/gen/hooks/{ => user}/useCreateUserHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => user}/useCreateUsersWithListInputHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => user}/useDeleteUserHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => user}/useGetUserByNameHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => user}/useGetUserByNameSuspenseHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => user}/useLoginUserHook.ts (97%) rename examples/react-query/src/gen/hooks/{ => user}/useLoginUserSuspenseHook.ts (98%) rename examples/react-query/src/gen/hooks/{ => user}/useLogoutUserHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => user}/useLogoutUserSuspenseHook.ts (96%) rename examples/react-query/src/gen/hooks/{ => user}/useUpdateUserHook.ts (96%) diff --git a/.changeset/dirty-doors-move.md b/.changeset/dirty-doors-move.md new file mode 100644 index 000000000..8dbcf7d03 --- /dev/null +++ b/.changeset/dirty-doors-move.md @@ -0,0 +1,12 @@ +--- +"@kubb/plugin-svelte-query": minor +"@kubb/plugin-react-query": minor +"@kubb/plugin-solid-query": minor +"@kubb/plugin-vue-query": minor +"@kubb/plugin-client": minor +"@kubb/plugin-faker": minor +"@kubb/plugin-msw": minor +"@kubb/plugin-swr": minor +--- + +Group API clients by path structure diff --git a/docs/changelog.md b/docs/changelog.md index ff5bdffed..9bef1e8d0 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -5,7 +5,20 @@ title: Changelog # Changelog ## 3.1.0 -- [`plugin-msw`](/plugins/plugin-msw): Support dynamic and customizable data in handlers +- [`plugin-react-query`](/plugins/plugin-react-query/): Group API clients by path structure +- [`plugin-svelte-query`](/plugins/plugin-svelte-query/): Group API clients by path structure +- [`plugin-vue-query`](/plugins/plugin-vue-query/): Group API clients by path structure +- [`plugin-solid-query`](/plugins/plugin-solid-query/): Group API clients by path structure +- [`plugin-msw`](/plugins/plugin-msw): Group API clients by path structure +```typescript +group: { + type: 'path', + name: ({ group }) => { + const firstSegment = group.split('/')[1]; + return firstSegment; + } +} +``` ```typescript findPetsByStatusHandler((info) => { const { params } = info diff --git a/examples/advanced/src/gen/msw/petController/findPetsByStatusHandler.ts b/examples/advanced/src/gen/msw/petController/findPetsByStatusHandler.ts index cfeb727a8..0ab50b461 100644 --- a/examples/advanced/src/gen/msw/petController/findPetsByStatusHandler.ts +++ b/examples/advanced/src/gen/msw/petController/findPetsByStatusHandler.ts @@ -1,5 +1,5 @@ -import { http } from 'msw' import type { FindPetsByStatusQueryResponse } from '../../models/ts/petController/FindPetsByStatus.ts' +import { http } from 'msw' export function findPetsByStatusHandler(data?: FindPetsByStatusQueryResponse | ((info: Parameters[1]>[0]) => Response)) { return http.get('*/pet/findByStatus/:step_id', function handler(info) { diff --git a/examples/client/kubb.config.ts b/examples/client/kubb.config.ts index c2f3cf4b9..0866ecc6f 100644 --- a/examples/client/kubb.config.ts +++ b/examples/client/kubb.config.ts @@ -69,6 +69,12 @@ export default defineConfig(() => { pattern: 'store', }, ], + group: { + type: 'tag', + name({ group }) { + return `${group}Controller` + }, + }, dataReturnType: 'full', pathParamsType: 'object', }), @@ -111,6 +117,12 @@ export default defineConfig(() => { pattern: 'store', }, ], + group: { + type: 'tag', + name({ group }) { + return `${group}Controller` + }, + }, transformers: { name(name, type) { if (type === 'function') { diff --git a/examples/client/src/gen/index.ts b/examples/client/src/gen/index.ts index fa0072804..1ad1f89e8 100644 --- a/examples/client/src/gen/index.ts +++ b/examples/client/src/gen/index.ts @@ -148,5 +148,12 @@ export { addPetRequestStatusEnum } from './models/ts/AddPetRequest.js' export { orderStatusEnum, orderHttpStatusEnum } from './models/ts/Order.js' export { petStatusEnum } from './models/ts/Pet.js' export { findPetsByStatusQueryParamsStatusEnum } from './models/ts/petController/FindPetsByStatus.js' -export { getInventoryController, placeOrderController, placeOrderPatchController, getOrderByIdController, deleteOrderController } from './tag.js' +export { + getInventoryController, + placeOrderController, + placeOrderPatchController, + getOrderByIdController, + deleteOrderController, + storeController, +} from './tag.js' export { getInventory, placeOrder, placeOrderPatch, getOrderById, deleteOrder } from './tagObject.js' diff --git a/examples/client/src/gen/tag.ts b/examples/client/src/gen/tag.ts index a7faf64bb..70fa83994 100644 --- a/examples/client/src/gen/tag.ts +++ b/examples/client/src/gen/tag.ts @@ -64,3 +64,7 @@ export async function deleteOrderController(orderId: DeleteOrderPathParams['orde }) return res.data } + +export function storeController() { + return { getInventoryController, placeOrderController, placeOrderPatchController, getOrderByIdController, deleteOrderController } +} diff --git a/examples/react-query/kubb.config.ts b/examples/react-query/kubb.config.ts index 8db408806..5ea87a81d 100644 --- a/examples/react-query/kubb.config.ts +++ b/examples/react-query/kubb.config.ts @@ -36,6 +36,9 @@ export const config = { output: { path: './hooks', }, + group: { + type: 'path', + }, queryKey(props) { const keys = QueryKey.getTransformer(props) return ['"v5"', ...keys] diff --git a/examples/react-query/src/App.tsx b/examples/react-query/src/App.tsx index 6bce992b2..d0873cb52 100644 --- a/examples/react-query/src/App.tsx +++ b/examples/react-query/src/App.tsx @@ -1,10 +1,13 @@ import { QueryClient, QueryClientProvider, useQueries } from '@tanstack/react-query' import { ReactQueryDevtools } from '@tanstack/react-query-devtools' import { useState } from 'react' -import { findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './gen/hooks/useFindPetsByStatusHook.ts' -import { useFindPetsByTagsInfiniteHook } from './gen/hooks/useFindPetsByTagsInfiniteHook.ts' -import { useUpdatePetWithFormHook } from './gen/hooks/useUpdatePetWithFormHook.ts' -import type { FindPetsByStatusQueryParamsStatusEnum } from './gen/models/FindPetsByStatus.ts' +import { + type FindPetsByStatusQueryParamsStatusEnum, + findPetsByStatusQueryOptionsHook, + useFindPetsByStatusHook, + useFindPetsByTagsInfiniteHook, + useUpdatePetWithFormHook, +} from './gen/index.ts' const queryClient = new QueryClient() diff --git a/examples/react-query/src/gen/hooks/index.ts b/examples/react-query/src/gen/hooks/index.ts index 2d940c575..8d9537715 100644 --- a/examples/react-query/src/gen/hooks/index.ts +++ b/examples/react-query/src/gen/hooks/index.ts @@ -1,68 +1,68 @@ -export type { AddPetMutationKey } from './useAddPetHook.ts' -export type { CreateUserMutationKey } from './useCreateUserHook.ts' -export type { CreateUsersWithListInputMutationKey } from './useCreateUsersWithListInputHook.ts' -export type { DeleteOrderMutationKey } from './useDeleteOrderHook.ts' -export type { DeletePetMutationKey } from './useDeletePetHook.ts' -export type { DeleteUserMutationKey } from './useDeleteUserHook.ts' -export type { FindPetsByStatusQueryKey } from './useFindPetsByStatusHook.ts' -export type { FindPetsByStatusSuspenseQueryKey } from './useFindPetsByStatusSuspenseHook.ts' -export type { FindPetsByTagsQueryKey } from './useFindPetsByTagsHook.ts' -export type { FindPetsByTagsInfiniteQueryKey } from './useFindPetsByTagsInfiniteHook.ts' -export type { FindPetsByTagsSuspenseQueryKey } from './useFindPetsByTagsSuspenseHook.ts' -export type { GetInventoryQueryKey } from './useGetInventoryHook.ts' -export type { GetInventorySuspenseQueryKey } from './useGetInventorySuspenseHook.ts' -export type { GetOrderByIdQueryKey } from './useGetOrderByIdHook.ts' -export type { GetOrderByIdSuspenseQueryKey } from './useGetOrderByIdSuspenseHook.ts' -export type { GetPetByIdQueryKey } from './useGetPetByIdHook.ts' -export type { GetPetByIdSuspenseQueryKey } from './useGetPetByIdSuspenseHook.ts' -export type { GetUserByNameQueryKey } from './useGetUserByNameHook.ts' -export type { GetUserByNameSuspenseQueryKey } from './useGetUserByNameSuspenseHook.ts' -export type { LoginUserQueryKey } from './useLoginUserHook.ts' -export type { LoginUserSuspenseQueryKey } from './useLoginUserSuspenseHook.ts' -export type { LogoutUserQueryKey } from './useLogoutUserHook.ts' -export type { LogoutUserSuspenseQueryKey } from './useLogoutUserSuspenseHook.ts' -export type { PlaceOrderMutationKey } from './usePlaceOrderHook.ts' -export type { PlaceOrderPatchMutationKey } from './usePlaceOrderPatchHook.ts' -export type { UpdatePetMutationKey } from './useUpdatePetHook.ts' -export type { UpdatePetWithFormQueryKey } from './useUpdatePetWithFormHook.ts' -export type { UpdatePetWithFormSuspenseQueryKey } from './useUpdatePetWithFormSuspenseHook.ts' -export type { UpdateUserMutationKey } from './useUpdateUserHook.ts' -export type { UploadFileMutationKey } from './useUploadFileHook.ts' -export { addPetMutationKey, useAddPetHook } from './useAddPetHook.ts' -export { createUserMutationKey, useCreateUserHook } from './useCreateUserHook.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './useCreateUsersWithListInputHook.ts' -export { deleteOrderMutationKey, useDeleteOrderHook } from './useDeleteOrderHook.ts' -export { deletePetMutationKey, useDeletePetHook } from './useDeletePetHook.ts' -export { deleteUserMutationKey, useDeleteUserHook } from './useDeleteUserHook.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './useFindPetsByStatusHook.ts' +export type { AddPetMutationKey } from './pet/useAddPetHook.ts' +export type { DeletePetMutationKey } from './pet/useDeletePetHook.ts' +export type { FindPetsByStatusQueryKey } from './pet/useFindPetsByStatusHook.ts' +export type { FindPetsByStatusSuspenseQueryKey } from './pet/useFindPetsByStatusSuspenseHook.ts' +export type { FindPetsByTagsQueryKey } from './pet/useFindPetsByTagsHook.ts' +export type { FindPetsByTagsInfiniteQueryKey } from './pet/useFindPetsByTagsInfiniteHook.ts' +export type { FindPetsByTagsSuspenseQueryKey } from './pet/useFindPetsByTagsSuspenseHook.ts' +export type { GetPetByIdQueryKey } from './pet/useGetPetByIdHook.ts' +export type { GetPetByIdSuspenseQueryKey } from './pet/useGetPetByIdSuspenseHook.ts' +export type { UpdatePetMutationKey } from './pet/useUpdatePetHook.ts' +export type { UpdatePetWithFormQueryKey } from './pet/useUpdatePetWithFormHook.ts' +export type { UpdatePetWithFormSuspenseQueryKey } from './pet/useUpdatePetWithFormSuspenseHook.ts' +export type { UploadFileMutationKey } from './pet/useUploadFileHook.ts' +export type { DeleteOrderMutationKey } from './store/useDeleteOrderHook.ts' +export type { GetInventoryQueryKey } from './store/useGetInventoryHook.ts' +export type { GetInventorySuspenseQueryKey } from './store/useGetInventorySuspenseHook.ts' +export type { GetOrderByIdQueryKey } from './store/useGetOrderByIdHook.ts' +export type { GetOrderByIdSuspenseQueryKey } from './store/useGetOrderByIdSuspenseHook.ts' +export type { PlaceOrderMutationKey } from './store/usePlaceOrderHook.ts' +export type { PlaceOrderPatchMutationKey } from './store/usePlaceOrderPatchHook.ts' +export type { CreateUserMutationKey } from './user/useCreateUserHook.ts' +export type { CreateUsersWithListInputMutationKey } from './user/useCreateUsersWithListInputHook.ts' +export type { DeleteUserMutationKey } from './user/useDeleteUserHook.ts' +export type { GetUserByNameQueryKey } from './user/useGetUserByNameHook.ts' +export type { GetUserByNameSuspenseQueryKey } from './user/useGetUserByNameSuspenseHook.ts' +export type { LoginUserQueryKey } from './user/useLoginUserHook.ts' +export type { LoginUserSuspenseQueryKey } from './user/useLoginUserSuspenseHook.ts' +export type { LogoutUserQueryKey } from './user/useLogoutUserHook.ts' +export type { LogoutUserSuspenseQueryKey } from './user/useLogoutUserSuspenseHook.ts' +export type { UpdateUserMutationKey } from './user/useUpdateUserHook.ts' +export { addPetMutationKey, useAddPetHook } from './pet/useAddPetHook.ts' +export { deletePetMutationKey, useDeletePetHook } from './pet/useDeletePetHook.ts' +export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './pet/useFindPetsByStatusHook.ts' export { findPetsByStatusSuspenseQueryKey, findPetsByStatusSuspenseQueryOptionsHook, useFindPetsByStatusSuspenseHook, -} from './useFindPetsByStatusSuspenseHook.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './useFindPetsByTagsHook.ts' -export { findPetsByTagsInfiniteQueryKey, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook } from './useFindPetsByTagsInfiniteHook.ts' -export { findPetsByTagsSuspenseQueryKey, findPetsByTagsSuspenseQueryOptionsHook, useFindPetsByTagsSuspenseHook } from './useFindPetsByTagsSuspenseHook.ts' -export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './useGetInventoryHook.ts' -export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './useGetInventorySuspenseHook.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './useGetOrderByIdHook.ts' -export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './useGetOrderByIdSuspenseHook.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './useGetPetByIdHook.ts' -export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from './useGetPetByIdSuspenseHook.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './useGetUserByNameHook.ts' -export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from './useGetUserByNameSuspenseHook.ts' -export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './useLoginUserHook.ts' -export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './useLoginUserSuspenseHook.ts' -export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './useLogoutUserHook.ts' -export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './useLogoutUserSuspenseHook.ts' -export { placeOrderMutationKey, usePlaceOrderHook } from './usePlaceOrderHook.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './usePlaceOrderPatchHook.ts' -export { updatePetMutationKey, useUpdatePetHook } from './useUpdatePetHook.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './useUpdatePetWithFormHook.ts' +} from './pet/useFindPetsByStatusSuspenseHook.ts' +export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './pet/useFindPetsByTagsHook.ts' +export { findPetsByTagsInfiniteQueryKey, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook } from './pet/useFindPetsByTagsInfiniteHook.ts' +export { findPetsByTagsSuspenseQueryKey, findPetsByTagsSuspenseQueryOptionsHook, useFindPetsByTagsSuspenseHook } from './pet/useFindPetsByTagsSuspenseHook.ts' +export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './pet/useGetPetByIdHook.ts' +export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from './pet/useGetPetByIdSuspenseHook.ts' +export { updatePetMutationKey, useUpdatePetHook } from './pet/useUpdatePetHook.ts' +export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './pet/useUpdatePetWithFormHook.ts' export { updatePetWithFormSuspenseQueryKey, updatePetWithFormSuspenseQueryOptionsHook, useUpdatePetWithFormSuspenseHook, -} from './useUpdatePetWithFormSuspenseHook.ts' -export { updateUserMutationKey, useUpdateUserHook } from './useUpdateUserHook.ts' -export { uploadFileMutationKey, useUploadFileHook } from './useUploadFileHook.ts' +} from './pet/useUpdatePetWithFormSuspenseHook.ts' +export { uploadFileMutationKey, useUploadFileHook } from './pet/useUploadFileHook.ts' +export { deleteOrderMutationKey, useDeleteOrderHook } from './store/useDeleteOrderHook.ts' +export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './store/useGetInventoryHook.ts' +export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './store/useGetInventorySuspenseHook.ts' +export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './store/useGetOrderByIdHook.ts' +export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './store/useGetOrderByIdSuspenseHook.ts' +export { placeOrderMutationKey, usePlaceOrderHook } from './store/usePlaceOrderHook.ts' +export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './store/usePlaceOrderPatchHook.ts' +export { createUserMutationKey, useCreateUserHook } from './user/useCreateUserHook.ts' +export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './user/useCreateUsersWithListInputHook.ts' +export { deleteUserMutationKey, useDeleteUserHook } from './user/useDeleteUserHook.ts' +export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './user/useGetUserByNameHook.ts' +export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from './user/useGetUserByNameSuspenseHook.ts' +export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './user/useLoginUserHook.ts' +export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './user/useLoginUserSuspenseHook.ts' +export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './user/useLogoutUserHook.ts' +export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './user/useLogoutUserSuspenseHook.ts' +export { updateUserMutationKey, useUpdateUserHook } from './user/useUpdateUserHook.ts' diff --git a/examples/react-query/src/gen/hooks/pet/index.ts b/examples/react-query/src/gen/hooks/pet/index.ts new file mode 100644 index 000000000..216f4d5e3 --- /dev/null +++ b/examples/react-query/src/gen/hooks/pet/index.ts @@ -0,0 +1,34 @@ +export type { AddPetMutationKey } from './useAddPetHook.ts' +export type { DeletePetMutationKey } from './useDeletePetHook.ts' +export type { FindPetsByStatusQueryKey } from './useFindPetsByStatusHook.ts' +export type { FindPetsByStatusSuspenseQueryKey } from './useFindPetsByStatusSuspenseHook.ts' +export type { FindPetsByTagsQueryKey } from './useFindPetsByTagsHook.ts' +export type { FindPetsByTagsInfiniteQueryKey } from './useFindPetsByTagsInfiniteHook.ts' +export type { FindPetsByTagsSuspenseQueryKey } from './useFindPetsByTagsSuspenseHook.ts' +export type { GetPetByIdQueryKey } from './useGetPetByIdHook.ts' +export type { GetPetByIdSuspenseQueryKey } from './useGetPetByIdSuspenseHook.ts' +export type { UpdatePetMutationKey } from './useUpdatePetHook.ts' +export type { UpdatePetWithFormQueryKey } from './useUpdatePetWithFormHook.ts' +export type { UpdatePetWithFormSuspenseQueryKey } from './useUpdatePetWithFormSuspenseHook.ts' +export type { UploadFileMutationKey } from './useUploadFileHook.ts' +export { addPetMutationKey, useAddPetHook } from './useAddPetHook.ts' +export { deletePetMutationKey, useDeletePetHook } from './useDeletePetHook.ts' +export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './useFindPetsByStatusHook.ts' +export { + findPetsByStatusSuspenseQueryKey, + findPetsByStatusSuspenseQueryOptionsHook, + useFindPetsByStatusSuspenseHook, +} from './useFindPetsByStatusSuspenseHook.ts' +export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './useFindPetsByTagsHook.ts' +export { findPetsByTagsInfiniteQueryKey, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook } from './useFindPetsByTagsInfiniteHook.ts' +export { findPetsByTagsSuspenseQueryKey, findPetsByTagsSuspenseQueryOptionsHook, useFindPetsByTagsSuspenseHook } from './useFindPetsByTagsSuspenseHook.ts' +export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './useGetPetByIdHook.ts' +export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from './useGetPetByIdSuspenseHook.ts' +export { updatePetMutationKey, useUpdatePetHook } from './useUpdatePetHook.ts' +export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './useUpdatePetWithFormHook.ts' +export { + updatePetWithFormSuspenseQueryKey, + updatePetWithFormSuspenseQueryOptionsHook, + useUpdatePetWithFormSuspenseHook, +} from './useUpdatePetWithFormSuspenseHook.ts' +export { uploadFileMutationKey, useUploadFileHook } from './useUploadFileHook.ts' diff --git a/examples/react-query/src/gen/hooks/useAddPetHook.ts b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useAddPetHook.ts rename to examples/react-query/src/gen/hooks/pet/useAddPetHook.ts index 6afaf8676..29407c1ba 100644 --- a/examples/react-query/src/gen/hooks/useAddPetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet.ts' +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../models/AddPet.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useDeletePetHook.ts b/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useDeletePetHook.ts rename to examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts index 7eaca92a4..9eb7cfd30 100644 --- a/examples/react-query/src/gen/hooks/useDeletePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet.ts' +import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../models/DeletePet.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useFindPetsByStatusHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useFindPetsByStatusHook.ts rename to examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts index ece98e854..732f7ffd8 100644 --- a/examples/react-query/src/gen/hooks/useFindPetsByStatusHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus.ts' +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../models/FindPetsByStatus.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useFindPetsByStatusSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useFindPetsByStatusSuspenseHook.ts rename to examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts index 5dc63270b..1f02ca60d 100644 --- a/examples/react-query/src/gen/hooks/useFindPetsByStatusSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus.ts' +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../models/FindPetsByStatus.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useFindPetsByTagsHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useFindPetsByTagsHook.ts rename to examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts index 3aed0309e..71f50c2d5 100644 --- a/examples/react-query/src/gen/hooks/useFindPetsByTagsHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags.ts' +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useFindPetsByTagsInfiniteHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useFindPetsByTagsInfiniteHook.ts rename to examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts index 053e5b536..67d63c5fd 100644 --- a/examples/react-query/src/gen/hooks/useFindPetsByTagsInfiniteHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags.ts' +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/client' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query' import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useFindPetsByTagsSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useFindPetsByTagsSuspenseHook.ts rename to examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts index 6c0606ab0..917abc9fa 100644 --- a/examples/react-query/src/gen/hooks/useFindPetsByTagsSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags.ts' +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useGetPetByIdHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useGetPetByIdHook.ts rename to examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts index bfc34bc56..d485796b3 100644 --- a/examples/react-query/src/gen/hooks/useGetPetByIdHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById.ts' +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../models/GetPetById.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useGetPetByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useGetPetByIdSuspenseHook.ts rename to examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts index 0ab994ff2..2459f6183 100644 --- a/examples/react-query/src/gen/hooks/useGetPetByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById.ts' +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../models/GetPetById.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useUpdatePetHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts similarity index 95% rename from examples/react-query/src/gen/hooks/useUpdatePetHook.ts rename to examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts index 426cf0945..949dff978 100644 --- a/examples/react-query/src/gen/hooks/useUpdatePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../models/UpdatePet.ts' +import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../../models/UpdatePet.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useUpdatePetWithFormHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts similarity index 98% rename from examples/react-query/src/gen/hooks/useUpdatePetWithFormHook.ts rename to examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts index 1e8ddc92b..bd1ff8067 100644 --- a/examples/react-query/src/gen/hooks/useUpdatePetWithFormHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts @@ -4,7 +4,7 @@ import type { UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405, -} from '../models/UpdatePetWithForm.ts' +} from '../../models/UpdatePetWithForm.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useUpdatePetWithFormSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts similarity index 98% rename from examples/react-query/src/gen/hooks/useUpdatePetWithFormSuspenseHook.ts rename to examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts index 6344d2ff5..160e7c781 100644 --- a/examples/react-query/src/gen/hooks/useUpdatePetWithFormSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts @@ -4,7 +4,7 @@ import type { UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405, -} from '../models/UpdatePetWithForm.ts' +} from '../../models/UpdatePetWithForm.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useUploadFileHook.ts b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts similarity index 95% rename from examples/react-query/src/gen/hooks/useUploadFileHook.ts rename to examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts index 4dd33fa34..8fbb5dce7 100644 --- a/examples/react-query/src/gen/hooks/useUploadFileHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile.ts' +import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../../models/UploadFile.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/store/index.ts b/examples/react-query/src/gen/hooks/store/index.ts new file mode 100644 index 000000000..2856659e6 --- /dev/null +++ b/examples/react-query/src/gen/hooks/store/index.ts @@ -0,0 +1,14 @@ +export type { DeleteOrderMutationKey } from './useDeleteOrderHook.ts' +export type { GetInventoryQueryKey } from './useGetInventoryHook.ts' +export type { GetInventorySuspenseQueryKey } from './useGetInventorySuspenseHook.ts' +export type { GetOrderByIdQueryKey } from './useGetOrderByIdHook.ts' +export type { GetOrderByIdSuspenseQueryKey } from './useGetOrderByIdSuspenseHook.ts' +export type { PlaceOrderMutationKey } from './usePlaceOrderHook.ts' +export type { PlaceOrderPatchMutationKey } from './usePlaceOrderPatchHook.ts' +export { deleteOrderMutationKey, useDeleteOrderHook } from './useDeleteOrderHook.ts' +export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './useGetInventoryHook.ts' +export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './useGetInventorySuspenseHook.ts' +export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './useGetOrderByIdHook.ts' +export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './useGetOrderByIdSuspenseHook.ts' +export { placeOrderMutationKey, usePlaceOrderHook } from './usePlaceOrderHook.ts' +export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './usePlaceOrderPatchHook.ts' diff --git a/examples/react-query/src/gen/hooks/useDeleteOrderHook.ts b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useDeleteOrderHook.ts rename to examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts index a3e88d7dd..0469eb661 100644 --- a/examples/react-query/src/gen/hooks/useDeleteOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder.ts' +import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../../models/DeleteOrder.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useGetInventoryHook.ts b/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts similarity index 92% rename from examples/react-query/src/gen/hooks/useGetInventoryHook.ts rename to examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts index 886fccb95..be32156ca 100644 --- a/examples/react-query/src/gen/hooks/useGetInventoryHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { GetInventoryQueryResponse } from '../models/GetInventory.ts' +import type { GetInventoryQueryResponse } from '../../models/GetInventory.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import { queryOptions } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useGetInventorySuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useGetInventorySuspenseHook.ts rename to examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts index d895c4cbd..275ccb979 100644 --- a/examples/react-query/src/gen/hooks/useGetInventorySuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { GetInventoryQueryResponse } from '../models/GetInventory.ts' +import type { GetInventoryQueryResponse } from '../../models/GetInventory.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts rename to examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts index fc6080a8a..c7080ac75 100644 --- a/examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById.ts' +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../../models/GetOrderById.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useGetOrderByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useGetOrderByIdSuspenseHook.ts rename to examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts index 07646ee48..243465957 100644 --- a/examples/react-query/src/gen/hooks/useGetOrderByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById.ts' +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../../models/GetOrderById.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/usePlaceOrderHook.ts b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/usePlaceOrderHook.ts rename to examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts index fe5fcc0da..cd58a2434 100644 --- a/examples/react-query/src/gen/hooks/usePlaceOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../models/PlaceOrder.ts' +import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../../models/PlaceOrder.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/usePlaceOrderPatchHook.ts b/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/usePlaceOrderPatchHook.ts rename to examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts index 945bab0a9..b28f96123 100644 --- a/examples/react-query/src/gen/hooks/usePlaceOrderPatchHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from '../models/PlaceOrderPatch.ts' +import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from '../../models/PlaceOrderPatch.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/user/index.ts b/examples/react-query/src/gen/hooks/user/index.ts new file mode 100644 index 000000000..6988fc7a3 --- /dev/null +++ b/examples/react-query/src/gen/hooks/user/index.ts @@ -0,0 +1,20 @@ +export type { CreateUserMutationKey } from './useCreateUserHook.ts' +export type { CreateUsersWithListInputMutationKey } from './useCreateUsersWithListInputHook.ts' +export type { DeleteUserMutationKey } from './useDeleteUserHook.ts' +export type { GetUserByNameQueryKey } from './useGetUserByNameHook.ts' +export type { GetUserByNameSuspenseQueryKey } from './useGetUserByNameSuspenseHook.ts' +export type { LoginUserQueryKey } from './useLoginUserHook.ts' +export type { LoginUserSuspenseQueryKey } from './useLoginUserSuspenseHook.ts' +export type { LogoutUserQueryKey } from './useLogoutUserHook.ts' +export type { LogoutUserSuspenseQueryKey } from './useLogoutUserSuspenseHook.ts' +export type { UpdateUserMutationKey } from './useUpdateUserHook.ts' +export { createUserMutationKey, useCreateUserHook } from './useCreateUserHook.ts' +export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './useCreateUsersWithListInputHook.ts' +export { deleteUserMutationKey, useDeleteUserHook } from './useDeleteUserHook.ts' +export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './useGetUserByNameHook.ts' +export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from './useGetUserByNameSuspenseHook.ts' +export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './useLoginUserHook.ts' +export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './useLoginUserSuspenseHook.ts' +export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './useLogoutUserHook.ts' +export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './useLogoutUserSuspenseHook.ts' +export { updateUserMutationKey, useUpdateUserHook } from './useUpdateUserHook.ts' diff --git a/examples/react-query/src/gen/hooks/useCreateUserHook.ts b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useCreateUserHook.ts rename to examples/react-query/src/gen/hooks/user/useCreateUserHook.ts index df32017d2..5bb722338 100644 --- a/examples/react-query/src/gen/hooks/useCreateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser.ts' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/CreateUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useCreateUsersWithListInputHook.ts b/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useCreateUsersWithListInputHook.ts rename to examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts index 615b92293..8fb9abfc3 100644 --- a/examples/react-query/src/gen/hooks/useCreateUsersWithListInputHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput.ts' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../../models/CreateUsersWithListInput.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useDeleteUserHook.ts b/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useDeleteUserHook.ts rename to examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts index fd6b29af0..8ed31002d 100644 --- a/examples/react-query/src/gen/hooks/useDeleteUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../models/DeleteUser.ts' +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../../models/DeleteUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useGetUserByNameHook.ts b/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useGetUserByNameHook.ts rename to examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts index 2124745d3..c44afdff5 100644 --- a/examples/react-query/src/gen/hooks/useGetUserByNameHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName.ts' +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../../models/GetUserByName.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useGetUserByNameSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useGetUserByNameSuspenseHook.ts rename to examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts index 439cc3bb4..9fb561079 100644 --- a/examples/react-query/src/gen/hooks/useGetUserByNameSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName.ts' +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../../models/GetUserByName.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useLoginUserHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts similarity index 97% rename from examples/react-query/src/gen/hooks/useLoginUserHook.ts rename to examples/react-query/src/gen/hooks/user/useLoginUserHook.ts index e567768dc..392424142 100644 --- a/examples/react-query/src/gen/hooks/useLoginUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser.ts' +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../models/LoginUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useLoginUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts similarity index 98% rename from examples/react-query/src/gen/hooks/useLoginUserSuspenseHook.ts rename to examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts index 71b76a67f..ce9a46528 100644 --- a/examples/react-query/src/gen/hooks/useLoginUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser.ts' +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../models/LoginUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useLogoutUserHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useLogoutUserHook.ts rename to examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts index 6c1206c86..879101dc3 100644 --- a/examples/react-query/src/gen/hooks/useLogoutUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { LogoutUserQueryResponse } from '../models/LogoutUser.ts' +import type { LogoutUserQueryResponse } from '../../models/LogoutUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useLogoutUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useLogoutUserSuspenseHook.ts rename to examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts index 0264b7945..13baebdc5 100644 --- a/examples/react-query/src/gen/hooks/useLogoutUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { LogoutUserQueryResponse } from '../models/LogoutUser.ts' +import type { LogoutUserQueryResponse } from '../../models/LogoutUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/hooks/useUpdateUserHook.ts b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts similarity index 96% rename from examples/react-query/src/gen/hooks/useUpdateUserHook.ts rename to examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts index fe4819fbf..32b20b0d5 100644 --- a/examples/react-query/src/gen/hooks/useUpdateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts @@ -1,5 +1,5 @@ import client from '@kubb/plugin-client/client' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser.ts' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/UpdateUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' diff --git a/examples/react-query/src/gen/index.ts b/examples/react-query/src/gen/index.ts index 278a11ff8..17f6a3417 100644 --- a/examples/react-query/src/gen/index.ts +++ b/examples/react-query/src/gen/index.ts @@ -1,33 +1,33 @@ -export type { AddPetMutationKey } from './hooks/useAddPetHook.ts' -export type { CreateUserMutationKey } from './hooks/useCreateUserHook.ts' -export type { CreateUsersWithListInputMutationKey } from './hooks/useCreateUsersWithListInputHook.ts' -export type { DeleteOrderMutationKey } from './hooks/useDeleteOrderHook.ts' -export type { DeletePetMutationKey } from './hooks/useDeletePetHook.ts' -export type { DeleteUserMutationKey } from './hooks/useDeleteUserHook.ts' -export type { FindPetsByStatusQueryKey } from './hooks/useFindPetsByStatusHook.ts' -export type { FindPetsByStatusSuspenseQueryKey } from './hooks/useFindPetsByStatusSuspenseHook.ts' -export type { FindPetsByTagsQueryKey } from './hooks/useFindPetsByTagsHook.ts' -export type { FindPetsByTagsInfiniteQueryKey } from './hooks/useFindPetsByTagsInfiniteHook.ts' -export type { FindPetsByTagsSuspenseQueryKey } from './hooks/useFindPetsByTagsSuspenseHook.ts' -export type { GetInventoryQueryKey } from './hooks/useGetInventoryHook.ts' -export type { GetInventorySuspenseQueryKey } from './hooks/useGetInventorySuspenseHook.ts' -export type { GetOrderByIdQueryKey } from './hooks/useGetOrderByIdHook.ts' -export type { GetOrderByIdSuspenseQueryKey } from './hooks/useGetOrderByIdSuspenseHook.ts' -export type { GetPetByIdQueryKey } from './hooks/useGetPetByIdHook.ts' -export type { GetPetByIdSuspenseQueryKey } from './hooks/useGetPetByIdSuspenseHook.ts' -export type { GetUserByNameQueryKey } from './hooks/useGetUserByNameHook.ts' -export type { GetUserByNameSuspenseQueryKey } from './hooks/useGetUserByNameSuspenseHook.ts' -export type { LoginUserQueryKey } from './hooks/useLoginUserHook.ts' -export type { LoginUserSuspenseQueryKey } from './hooks/useLoginUserSuspenseHook.ts' -export type { LogoutUserQueryKey } from './hooks/useLogoutUserHook.ts' -export type { LogoutUserSuspenseQueryKey } from './hooks/useLogoutUserSuspenseHook.ts' -export type { PlaceOrderMutationKey } from './hooks/usePlaceOrderHook.ts' -export type { PlaceOrderPatchMutationKey } from './hooks/usePlaceOrderPatchHook.ts' -export type { UpdatePetMutationKey } from './hooks/useUpdatePetHook.ts' -export type { UpdatePetWithFormQueryKey } from './hooks/useUpdatePetWithFormHook.ts' -export type { UpdatePetWithFormSuspenseQueryKey } from './hooks/useUpdatePetWithFormSuspenseHook.ts' -export type { UpdateUserMutationKey } from './hooks/useUpdateUserHook.ts' -export type { UploadFileMutationKey } from './hooks/useUploadFileHook.ts' +export type { AddPetMutationKey } from './hooks/pet/useAddPetHook.ts' +export type { DeletePetMutationKey } from './hooks/pet/useDeletePetHook.ts' +export type { FindPetsByStatusQueryKey } from './hooks/pet/useFindPetsByStatusHook.ts' +export type { FindPetsByStatusSuspenseQueryKey } from './hooks/pet/useFindPetsByStatusSuspenseHook.ts' +export type { FindPetsByTagsQueryKey } from './hooks/pet/useFindPetsByTagsHook.ts' +export type { FindPetsByTagsInfiniteQueryKey } from './hooks/pet/useFindPetsByTagsInfiniteHook.ts' +export type { FindPetsByTagsSuspenseQueryKey } from './hooks/pet/useFindPetsByTagsSuspenseHook.ts' +export type { GetPetByIdQueryKey } from './hooks/pet/useGetPetByIdHook.ts' +export type { GetPetByIdSuspenseQueryKey } from './hooks/pet/useGetPetByIdSuspenseHook.ts' +export type { UpdatePetMutationKey } from './hooks/pet/useUpdatePetHook.ts' +export type { UpdatePetWithFormQueryKey } from './hooks/pet/useUpdatePetWithFormHook.ts' +export type { UpdatePetWithFormSuspenseQueryKey } from './hooks/pet/useUpdatePetWithFormSuspenseHook.ts' +export type { UploadFileMutationKey } from './hooks/pet/useUploadFileHook.ts' +export type { DeleteOrderMutationKey } from './hooks/store/useDeleteOrderHook.ts' +export type { GetInventoryQueryKey } from './hooks/store/useGetInventoryHook.ts' +export type { GetInventorySuspenseQueryKey } from './hooks/store/useGetInventorySuspenseHook.ts' +export type { GetOrderByIdQueryKey } from './hooks/store/useGetOrderByIdHook.ts' +export type { GetOrderByIdSuspenseQueryKey } from './hooks/store/useGetOrderByIdSuspenseHook.ts' +export type { PlaceOrderMutationKey } from './hooks/store/usePlaceOrderHook.ts' +export type { PlaceOrderPatchMutationKey } from './hooks/store/usePlaceOrderPatchHook.ts' +export type { CreateUserMutationKey } from './hooks/user/useCreateUserHook.ts' +export type { CreateUsersWithListInputMutationKey } from './hooks/user/useCreateUsersWithListInputHook.ts' +export type { DeleteUserMutationKey } from './hooks/user/useDeleteUserHook.ts' +export type { GetUserByNameQueryKey } from './hooks/user/useGetUserByNameHook.ts' +export type { GetUserByNameSuspenseQueryKey } from './hooks/user/useGetUserByNameSuspenseHook.ts' +export type { LoginUserQueryKey } from './hooks/user/useLoginUserHook.ts' +export type { LoginUserSuspenseQueryKey } from './hooks/user/useLoginUserSuspenseHook.ts' +export type { LogoutUserQueryKey } from './hooks/user/useLogoutUserHook.ts' +export type { LogoutUserSuspenseQueryKey } from './hooks/user/useLogoutUserSuspenseHook.ts' +export type { UpdateUserMutationKey } from './hooks/user/useUpdateUserHook.ts' export type { AddPet200, AddPet405, AddPetMutationRequest, AddPetMutationResponse, AddPetMutation } from './models/AddPet.ts' export type { AddPetRequestStatusEnum, AddPetRequest } from './models/AddPetRequest.ts' export type { Address } from './models/Address.ts' @@ -119,44 +119,56 @@ export type { } from './models/UploadFile.ts' export type { User } from './models/User.ts' export type { UserArray } from './models/UserArray.ts' -export { addPetMutationKey, useAddPetHook } from './hooks/useAddPetHook.ts' -export { createUserMutationKey, useCreateUserHook } from './hooks/useCreateUserHook.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './hooks/useCreateUsersWithListInputHook.ts' -export { deleteOrderMutationKey, useDeleteOrderHook } from './hooks/useDeleteOrderHook.ts' -export { deletePetMutationKey, useDeletePetHook } from './hooks/useDeletePetHook.ts' -export { deleteUserMutationKey, useDeleteUserHook } from './hooks/useDeleteUserHook.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './hooks/useFindPetsByStatusHook.ts' +export { addPetMutationKey, useAddPetHook } from './hooks/pet/useAddPetHook.ts' +export { deletePetMutationKey, useDeletePetHook } from './hooks/pet/useDeletePetHook.ts' +export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './hooks/pet/useFindPetsByStatusHook.ts' export { findPetsByStatusSuspenseQueryKey, findPetsByStatusSuspenseQueryOptionsHook, useFindPetsByStatusSuspenseHook, -} from './hooks/useFindPetsByStatusSuspenseHook.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './hooks/useFindPetsByTagsHook.ts' -export { findPetsByTagsInfiniteQueryKey, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook } from './hooks/useFindPetsByTagsInfiniteHook.ts' -export { findPetsByTagsSuspenseQueryKey, findPetsByTagsSuspenseQueryOptionsHook, useFindPetsByTagsSuspenseHook } from './hooks/useFindPetsByTagsSuspenseHook.ts' -export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './hooks/useGetInventoryHook.ts' -export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './hooks/useGetInventorySuspenseHook.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './hooks/useGetOrderByIdHook.ts' -export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './hooks/useGetOrderByIdSuspenseHook.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './hooks/useGetPetByIdHook.ts' -export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from './hooks/useGetPetByIdSuspenseHook.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './hooks/useGetUserByNameHook.ts' -export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from './hooks/useGetUserByNameSuspenseHook.ts' -export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './hooks/useLoginUserHook.ts' -export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './hooks/useLoginUserSuspenseHook.ts' -export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './hooks/useLogoutUserHook.ts' -export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './hooks/useLogoutUserSuspenseHook.ts' -export { placeOrderMutationKey, usePlaceOrderHook } from './hooks/usePlaceOrderHook.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './hooks/usePlaceOrderPatchHook.ts' -export { updatePetMutationKey, useUpdatePetHook } from './hooks/useUpdatePetHook.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './hooks/useUpdatePetWithFormHook.ts' +} from './hooks/pet/useFindPetsByStatusSuspenseHook.ts' +export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './hooks/pet/useFindPetsByTagsHook.ts' +export { + findPetsByTagsInfiniteQueryKey, + findPetsByTagsInfiniteQueryOptionsHook, + useFindPetsByTagsInfiniteHook, +} from './hooks/pet/useFindPetsByTagsInfiniteHook.ts' +export { + findPetsByTagsSuspenseQueryKey, + findPetsByTagsSuspenseQueryOptionsHook, + useFindPetsByTagsSuspenseHook, +} from './hooks/pet/useFindPetsByTagsSuspenseHook.ts' +export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './hooks/pet/useGetPetByIdHook.ts' +export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from './hooks/pet/useGetPetByIdSuspenseHook.ts' +export { updatePetMutationKey, useUpdatePetHook } from './hooks/pet/useUpdatePetHook.ts' +export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './hooks/pet/useUpdatePetWithFormHook.ts' export { updatePetWithFormSuspenseQueryKey, updatePetWithFormSuspenseQueryOptionsHook, useUpdatePetWithFormSuspenseHook, -} from './hooks/useUpdatePetWithFormSuspenseHook.ts' -export { updateUserMutationKey, useUpdateUserHook } from './hooks/useUpdateUserHook.ts' -export { uploadFileMutationKey, useUploadFileHook } from './hooks/useUploadFileHook.ts' +} from './hooks/pet/useUpdatePetWithFormSuspenseHook.ts' +export { uploadFileMutationKey, useUploadFileHook } from './hooks/pet/useUploadFileHook.ts' +export { deleteOrderMutationKey, useDeleteOrderHook } from './hooks/store/useDeleteOrderHook.ts' +export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './hooks/store/useGetInventoryHook.ts' +export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './hooks/store/useGetInventorySuspenseHook.ts' +export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './hooks/store/useGetOrderByIdHook.ts' +export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './hooks/store/useGetOrderByIdSuspenseHook.ts' +export { placeOrderMutationKey, usePlaceOrderHook } from './hooks/store/usePlaceOrderHook.ts' +export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './hooks/store/usePlaceOrderPatchHook.ts' +export { createUserMutationKey, useCreateUserHook } from './hooks/user/useCreateUserHook.ts' +export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './hooks/user/useCreateUsersWithListInputHook.ts' +export { deleteUserMutationKey, useDeleteUserHook } from './hooks/user/useDeleteUserHook.ts' +export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './hooks/user/useGetUserByNameHook.ts' +export { + getUserByNameSuspenseQueryKey, + getUserByNameSuspenseQueryOptionsHook, + useGetUserByNameSuspenseHook, +} from './hooks/user/useGetUserByNameSuspenseHook.ts' +export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './hooks/user/useLoginUserHook.ts' +export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './hooks/user/useLoginUserSuspenseHook.ts' +export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './hooks/user/useLogoutUserHook.ts' +export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './hooks/user/useLogoutUserSuspenseHook.ts' +export { updateUserMutationKey, useUpdateUserHook } from './hooks/user/useUpdateUserHook.ts' export { addPetRequestStatusEnum } from './models/AddPetRequest.ts' export { findPetsByStatusQueryParamsStatusEnum } from './models/FindPetsByStatus.ts' export { orderStatusEnum, orderHttpStatusEnum } from './models/Order.ts' diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 9f8744e6d..21410f9d3 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -319,7 +319,7 @@ export type Group = { /** * Define a type where to group the files on */ - type: 'tag' + type: 'tag' | 'path' /** * Return the name of a group based on the group name, this will be used for the file and name generation */ diff --git a/packages/plugin-client/src/generators/groupedClientGenerator.tsx b/packages/plugin-client/src/generators/groupedClientGenerator.tsx index 1ad433a84..cc51919da 100644 --- a/packages/plugin-client/src/generators/groupedClientGenerator.tsx +++ b/packages/plugin-client/src/generators/groupedClientGenerator.tsx @@ -29,7 +29,7 @@ export const groupedClientGenerator = createReactGenerator({ name, extname: '.ts', pluginKey, - options: { tag }, + options: { group: tag }, }) const client = { diff --git a/packages/plugin-client/src/plugin.ts b/packages/plugin-client/src/plugin.ts index 91d89722d..ac8d395b1 100644 --- a/packages/plugin-client/src/plugin.ts +++ b/packages/plugin-client/src/plugin.ts @@ -49,12 +49,6 @@ export const pluginClient = createPlugin((options) => { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -63,6 +57,19 @@ export const pluginClient = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-faker/src/generators/fakerGenerator.tsx b/packages/plugin-faker/src/generators/fakerGenerator.tsx index a7b5c7ac1..59687c93d 100644 --- a/packages/plugin-faker/src/generators/fakerGenerator.tsx +++ b/packages/plugin-faker/src/generators/fakerGenerator.tsx @@ -13,7 +13,7 @@ export const fakerGenerator = createReactGenerator({ const { plugin, pluginManager, mode } = useApp() const oas = useOas() - const { getSchemas, getFile } = useOperationManager() + const { getSchemas, getFile, getGroup } = useOperationManager() const schemaManager = useSchemaManager() const file = getFile(operation) @@ -33,6 +33,7 @@ export const fakerGenerator = createReactGenerator({ const mapOperationSchema = ({ name, schema, description, ...options }: OperationSchemaType, i: number) => { const tree = schemaGenerator.parse({ schema, name }) const imports = schemaManager.getImports(tree) + const group = options.operation ? getGroup(options.operation, plugin.options.group) : undefined const faker = { name: schemaManager.getName(name, { type: 'function' }), @@ -41,7 +42,7 @@ export const fakerGenerator = createReactGenerator({ const type = { name: schemaManager.getName(name, { type: 'type', pluginKey: [pluginTsName] }), - file: schemaManager.getFile(options.operationName || name, { pluginKey: [pluginTsName], tag: options.operation?.getTags()[0]?.name }), + file: schemaManager.getFile(options.operationName || name, { pluginKey: [pluginTsName], group }), } const canOverride = tree.some( diff --git a/packages/plugin-faker/src/plugin.ts b/packages/plugin-faker/src/plugin.ts index fec2a3d07..fd26b8ac0 100644 --- a/packages/plugin-faker/src/plugin.ts +++ b/packages/plugin-faker/src/plugin.ts @@ -42,18 +42,13 @@ export const pluginFaker = createPlugin((options) => { mapper, override, regexGenerator, + group, }, pre: [pluginOasName, pluginTsName], resolvePath(baseName, pathMode, options) { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -62,6 +57,19 @@ export const pluginFaker = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-faker/src/types.ts b/packages/plugin-faker/src/types.ts index 54c084994..f550c0047 100644 --- a/packages/plugin-faker/src/types.ts +++ b/packages/plugin-faker/src/types.ts @@ -80,6 +80,7 @@ export type Options = { type ResolvedOptions = { output: Output + group: Options['group'] override: NonNullable dateType: NonNullable dateParser: NonNullable diff --git a/packages/plugin-msw/src/plugin.ts b/packages/plugin-msw/src/plugin.ts index 5353c51af..bf9eb2ef0 100644 --- a/packages/plugin-msw/src/plugin.ts +++ b/packages/plugin-msw/src/plugin.ts @@ -32,18 +32,13 @@ export const pluginMsw = createPlugin((options) => { options: { output, parser, + group, }, pre: [pluginOasName, pluginTsName, parser === 'faker' ? pluginFakerName : undefined].filter(Boolean), resolvePath(baseName, pathMode, options) { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -52,6 +47,19 @@ export const pluginMsw = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-msw/src/types.ts b/packages/plugin-msw/src/types.ts index aea4a1239..dbd1fa60f 100644 --- a/packages/plugin-msw/src/types.ts +++ b/packages/plugin-msw/src/types.ts @@ -49,6 +49,7 @@ export type Options = { } type ResolvedOptions = { output: Output + group: Options['group'] parser: NonNullable } diff --git a/packages/plugin-oas/src/hooks/useOperationManager.ts b/packages/plugin-oas/src/hooks/useOperationManager.ts index 19576d9a5..a74cd9313 100644 --- a/packages/plugin-oas/src/hooks/useOperationManager.ts +++ b/packages/plugin-oas/src/hooks/useOperationManager.ts @@ -2,7 +2,8 @@ import { useApp, useContext } from '@kubb/react' import { Oas } from '../components/Oas.tsx' -import type { FileMetaBase, Plugin, ResolveNameParams } from '@kubb/core' +import type { FileMetaBase, Group, Plugin, ResolveNameParams } from '@kubb/core' + import type * as KubbFile from '@kubb/fs/types' import type { Operation, Operation as OperationType } from '@kubb/oas' import type { OperationSchemas } from '../types.ts' @@ -10,7 +11,7 @@ import type { OperationSchemas } from '../types.ts' type FileMeta = FileMetaBase & { pluginKey: Plugin['key'] name: string - tag?: string + group?: string } export type SchemaNames = { @@ -41,7 +42,7 @@ type UseOperationManagerResult = { suffix?: string pluginKey?: Plugin['key'] extname?: KubbFile.Extname - tag?: string + group?: string }, ) => KubbFile.File groupSchemasByName: ( @@ -52,6 +53,7 @@ type UseOperationManagerResult = { }, ) => SchemaNames getSchemas: (operation: Operation, params?: { pluginKey?: Plugin['key']; type?: ResolveNameParams['type'] }) => OperationSchemas + getGroup: (operation: Operation, group: Group | undefined) => string | undefined } /** @@ -69,6 +71,16 @@ export function useOperationManager(): UseOperationManagerResult { }) } + const getGroup: UseOperationManagerResult['getGroup'] = (operation, group) => { + if (group?.type === 'tag') { + return operation.getTags().at(0)?.name + } + + if (group?.type === 'path') { + return operation.path + } + } + const getSchemas: UseOperationManagerResult['getSchemas'] = (operation, params) => { if (!generator) { throw new Error(`'generator' is not defined`) @@ -84,17 +96,17 @@ export function useOperationManager(): UseOperationManagerResult { }) } - //TODO replace tag with group const getFile: UseOperationManagerResult['getFile'] = ( operation, - { prefix, suffix, pluginKey = plugin.key, tag = operation.getTags().at(0)?.name, extname = '.ts' } = {}, + { prefix, suffix, pluginKey = plugin.key, group = getGroup(operation, (plugin.options as { group?: Group })?.group), extname = '.ts' } = {}, ) => { const name = getName(operation, { type: 'file', pluginKey, prefix, suffix }) + const file = pluginManager.getFile({ name, extname, pluginKey, - options: { type: 'file', pluginKey, tag }, + options: { type: 'file', pluginKey, group }, }) return { @@ -103,7 +115,7 @@ export function useOperationManager(): UseOperationManagerResult { ...file.meta, name, pluginKey, - tag, + group, }, } } @@ -198,5 +210,6 @@ export function useOperationManager(): UseOperationManagerResult { getFile, getSchemas, groupSchemasByName, + getGroup, } } diff --git a/packages/plugin-oas/src/hooks/useSchemaManager.ts b/packages/plugin-oas/src/hooks/useSchemaManager.ts index 4606b66df..e00ce1dc9 100644 --- a/packages/plugin-oas/src/hooks/useSchemaManager.ts +++ b/packages/plugin-oas/src/hooks/useSchemaManager.ts @@ -9,12 +9,12 @@ import { type Schema, schemaKeywords } from '../SchemaMapper' type FileMeta = FileMetaBase & { pluginKey: Plugin['key'] name: string - tag?: string + group?: string } type UseSchemaManagerResult = { getName: (name: string, params: { pluginKey?: Plugin['key']; type: ResolveNameParams['type'] }) => string - getFile: (name: string, params?: { pluginKey?: Plugin['key']; mode?: Mode; extname?: KubbFile.Extname; tag?: string }) => KubbFile.File + getFile: (name: string, params?: { pluginKey?: Plugin['key']; mode?: Mode; extname?: KubbFile.Extname; group?: string }) => KubbFile.File getImports: (tree: Array) => Array } @@ -31,15 +31,15 @@ export function useSchemaManager(): UseSchemaManagerResult { type, }) } - //TODO replace tag with group - const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginKey = plugin.key, extname = '.ts', tag } = {}) => { + + const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginKey = plugin.key, extname = '.ts', group } = {}) => { const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginKey }) const file = pluginManager.getFile({ name: resolvedName, extname, pluginKey, - options: { type: 'file', pluginKey, tag }, + options: { type: 'file', pluginKey, group }, }) return { diff --git a/packages/plugin-oas/src/types.ts b/packages/plugin-oas/src/types.ts index aee9999c8..7ff77b8b8 100644 --- a/packages/plugin-oas/src/types.ts +++ b/packages/plugin-oas/src/types.ts @@ -8,7 +8,7 @@ import type { GetSchemasProps } from './utils/getSchemas.ts' export type ResolvePathOptions = { pluginKey?: Plugin['key'] - tag?: string + group?: string type?: ResolveNameParams['type'] } diff --git a/packages/plugin-react-query/src/plugin.ts b/packages/plugin-react-query/src/plugin.ts index 14ed6f703..46fafd15b 100644 --- a/packages/plugin-react-query/src/plugin.ts +++ b/packages/plugin-react-query/src/plugin.ts @@ -72,18 +72,13 @@ export const pluginReactQuery = createPlugin((options) => { paramsType, pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, parser, + group, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), resolvePath(baseName, pathMode, options) { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -92,6 +87,19 @@ export const pluginReactQuery = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-react-query/src/types.ts b/packages/plugin-react-query/src/types.ts index 65b50ef48..167b96066 100644 --- a/packages/plugin-react-query/src/types.ts +++ b/packages/plugin-react-query/src/types.ts @@ -148,6 +148,7 @@ export type Options = { type ResolvedOptions = { output: Output + group: Options['group'] client: Required, 'baseURL'>> & { baseURL?: string } parser: Required> pathParamsType: NonNullable diff --git a/packages/plugin-solid-query/src/plugin.ts b/packages/plugin-solid-query/src/plugin.ts index d20259c90..6189410a7 100644 --- a/packages/plugin-solid-query/src/plugin.ts +++ b/packages/plugin-solid-query/src/plugin.ts @@ -53,18 +53,13 @@ export const pluginSolidQuery = createPlugin((options) => { paramsType, pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, parser, + group, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), resolvePath(baseName, pathMode, options) { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -73,6 +68,19 @@ export const pluginSolidQuery = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-solid-query/src/types.ts b/packages/plugin-solid-query/src/types.ts index 5874980f8..60cc0375d 100644 --- a/packages/plugin-solid-query/src/types.ts +++ b/packages/plugin-solid-query/src/types.ts @@ -95,6 +95,7 @@ export type Options = { type ResolvedOptions = { output: Output + group: Options['group'] client: Required, 'baseURL'>> & { baseURL?: string } parser: Required> paramsType: NonNullable diff --git a/packages/plugin-svelte-query/src/plugin.ts b/packages/plugin-svelte-query/src/plugin.ts index 9b6357b9d..a9b3e7af2 100644 --- a/packages/plugin-svelte-query/src/plugin.ts +++ b/packages/plugin-svelte-query/src/plugin.ts @@ -61,18 +61,13 @@ export const pluginSvelteQuery = createPlugin((options) => { paramsType, pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, parser, + group, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), resolvePath(baseName, pathMode, options) { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -81,6 +76,19 @@ export const pluginSvelteQuery = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-svelte-query/src/types.ts b/packages/plugin-svelte-query/src/types.ts index bb86cf463..eb264246e 100644 --- a/packages/plugin-svelte-query/src/types.ts +++ b/packages/plugin-svelte-query/src/types.ts @@ -122,6 +122,7 @@ export type Options = { type ResolvedOptions = { output: Output + group: Options['group'] client: Required, 'baseURL'>> & { baseURL?: string } parser: Required> paramsType: NonNullable diff --git a/packages/plugin-swr/src/plugin.ts b/packages/plugin-swr/src/plugin.ts index 73a586a67..a6bfb75c7 100644 --- a/packages/plugin-swr/src/plugin.ts +++ b/packages/plugin-swr/src/plugin.ts @@ -61,18 +61,13 @@ export const pluginSwr = createPlugin((options) => { parser, paramsType, pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, + group, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), resolvePath(baseName, pathMode, options) { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -81,6 +76,19 @@ export const pluginSwr = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-swr/src/types.ts b/packages/plugin-swr/src/types.ts index 2e54527f9..02b42bd2c 100644 --- a/packages/plugin-swr/src/types.ts +++ b/packages/plugin-swr/src/types.ts @@ -121,6 +121,7 @@ type ResolvedOptions = { mutation: NonNullable> | false paramsType: NonNullable pathParamsType: NonNullable + group: Options['group'] } export type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, never, ResolvePathOptions> diff --git a/packages/plugin-ts/src/generators/typeGenerator.tsx b/packages/plugin-ts/src/generators/typeGenerator.tsx index c0d661f6a..137d967dc 100644 --- a/packages/plugin-ts/src/generators/typeGenerator.tsx +++ b/packages/plugin-ts/src/generators/typeGenerator.tsx @@ -108,7 +108,7 @@ export const typeGenerator = createReactGenerator({ const { plugin, pluginManager, mode } = useApp() const oas = useOas() - const { getSchemas, getFile, getName } = useOperationManager() + const { getSchemas, getFile, getName, getGroup } = useOperationManager() const schemaManager = useSchemaManager() const file = getFile(operation) @@ -130,11 +130,12 @@ export const typeGenerator = createReactGenerator({ const mapOperationSchema = ({ name, schema, description, keysToOmit, ...options }: OperationSchemaType, i: number) => { const tree = schemaGenerator.parse({ schema, name }) const imports = schemaManager.getImports(tree) + const group = options.operation ? getGroup(options.operation, plugin.options.group) : undefined const type = { name: schemaManager.getName(name, { type: 'type' }), typedName: schemaManager.getName(name, { type: 'type' }), - file: schemaManager.getFile(options.operationName || name, { tag: options.operation?.getTags()[0]?.name }), + file: schemaManager.getFile(options.operationName || name, { group }), } return ( diff --git a/packages/plugin-ts/src/plugin.ts b/packages/plugin-ts/src/plugin.ts index c67fcbb65..fd5140d4a 100644 --- a/packages/plugin-ts/src/plugin.ts +++ b/packages/plugin-ts/src/plugin.ts @@ -42,6 +42,7 @@ export const pluginTs = createPlugin((options) => { // keep the used enumnames between SchemaGenerator and OperationGenerator per plugin(pluginKey) usedEnumNames: {}, unknownType, + group, override, mapper, }, @@ -50,12 +51,6 @@ export const pluginTs = createPlugin((options) => { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -64,6 +59,19 @@ export const pluginTs = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-ts/src/types.ts b/packages/plugin-ts/src/types.ts index 6b8d163dd..ebefb2026 100644 --- a/packages/plugin-ts/src/types.ts +++ b/packages/plugin-ts/src/types.ts @@ -82,6 +82,7 @@ export type Options = { type ResolvedOptions = { output: Output + group: Options['group'] override: NonNullable enumType: NonNullable enumSuffix: NonNullable diff --git a/packages/plugin-vue-query/src/plugin.ts b/packages/plugin-vue-query/src/plugin.ts index a3a8b8d8a..b2a8a9c29 100644 --- a/packages/plugin-vue-query/src/plugin.ts +++ b/packages/plugin-vue-query/src/plugin.ts @@ -70,18 +70,13 @@ export const pluginVueQuery = createPlugin((options) => { paramsType, pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, parser, + group, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), resolvePath(baseName, pathMode, options) { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -90,6 +85,19 @@ export const pluginVueQuery = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-vue-query/src/types.ts b/packages/plugin-vue-query/src/types.ts index 8516d0d9c..580933700 100644 --- a/packages/plugin-vue-query/src/types.ts +++ b/packages/plugin-vue-query/src/types.ts @@ -142,6 +142,7 @@ export type Options = { type ResolvedOptions = { output: Output + group: Options['group'] client: Required, 'baseURL'>> & { baseURL?: string } parser: Required> paramsType: NonNullable diff --git a/packages/plugin-zod/src/generators/zodGenerator.tsx b/packages/plugin-zod/src/generators/zodGenerator.tsx index 45e983fdf..426d52eed 100644 --- a/packages/plugin-zod/src/generators/zodGenerator.tsx +++ b/packages/plugin-zod/src/generators/zodGenerator.tsx @@ -13,7 +13,7 @@ export const zodGenerator = createReactGenerator({ const { plugin, pluginManager, mode } = useApp() const oas = useOas() - const { getSchemas, getFile } = useOperationManager() + const { getSchemas, getFile, getGroup } = useOperationManager() const schemaManager = useSchemaManager() const file = getFile(operation) @@ -36,6 +36,7 @@ export const zodGenerator = createReactGenerator({ const optional = !required && !!name.includes('Params') const tree = [...schemaGenerator.parse({ schema, name }), optional ? { keyword: schemaKeywords.optional } : undefined].filter(Boolean) const imports = schemaManager.getImports(tree) + const group = options.operation ? getGroup(options.operation, plugin.options.group) : undefined const zod = { name: schemaManager.getName(name, { type: 'function' }), @@ -45,7 +46,7 @@ export const zodGenerator = createReactGenerator({ const type = { name: schemaManager.getName(name, { type: 'type', pluginKey: [pluginTsName] }), - file: schemaManager.getFile(options.operationName || name, { pluginKey: [pluginTsName], tag: options.operation?.getTags()[0]?.name }), + file: schemaManager.getFile(options.operationName || name, { pluginKey: [pluginTsName], group }), } return ( diff --git a/packages/plugin-zod/src/plugin.ts b/packages/plugin-zod/src/plugin.ts index 7e7fe596d..b38ebe2f2 100644 --- a/packages/plugin-zod/src/plugin.ts +++ b/packages/plugin-zod/src/plugin.ts @@ -49,18 +49,13 @@ export const pluginZod = createPlugin((options) => { coercion, operations, inferred, + group, }, pre: [pluginOasName, typed ? pluginTsName : undefined].filter(Boolean), resolvePath(baseName, pathMode, options) { const root = path.resolve(this.config.root, this.config.output.path) const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path)) - if (options?.tag && group?.type === 'tag') { - const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller` - - return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName) - } - if (mode === 'single') { /** * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend @@ -69,6 +64,19 @@ export const pluginZod = createPlugin((options) => { return path.resolve(root, output.path) } + if (options?.group && group) { + const groupName: Group['name'] = group?.name + ? group.name + : (ctx) => { + if (group?.type === 'path') { + return `${ctx.group.split('/')[1]}` + } + return `${camelCase(ctx.group)}Controller` + } + + return path.resolve(root, output.path, groupName({ group: options.group }), baseName) + } + return path.resolve(root, output.path, baseName) }, resolveName(name, type) { diff --git a/packages/plugin-zod/src/types.ts b/packages/plugin-zod/src/types.ts index fefc651d5..df422a88d 100644 --- a/packages/plugin-zod/src/types.ts +++ b/packages/plugin-zod/src/types.ts @@ -91,6 +91,7 @@ export type Options = { type ResolvedOptions = { output: Output + group: Options['group'] override: NonNullable transformers: NonNullable dateType: NonNullable From 4ad3fe211446696d8e31a17888d77cd4616e57eb Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Thu, 5 Dec 2024 22:47:12 +0100 Subject: [PATCH 2/2] chore: typecheck fix --- examples/react-query/src/App.tsx | 9 +- examples/react-query/src/gen/hooks/index.ts | 128 ++++++------- .../react-query/src/gen/hooks/pet/index.ts | 60 +++--- .../src/gen/hooks/pet/useAddPetHook.ts | 68 +++---- .../src/gen/hooks/pet/useDeletePetHook.ts | 89 ++++----- .../gen/hooks/pet/useFindPetsByStatusHook.ts | 79 ++++---- .../pet/useFindPetsByStatusSuspenseHook.ts | 80 ++++---- .../gen/hooks/pet/useFindPetsByTagsHook.ts | 79 ++++---- .../pet/useFindPetsByTagsInfiniteHook.ts | 91 +++++---- .../pet/useFindPetsByTagsSuspenseHook.ts | 79 ++++---- .../src/gen/hooks/pet/useGetPetByIdHook.ts | 109 +++++------ .../hooks/pet/useGetPetByIdSuspenseHook.ts | 113 +++++------ .../src/gen/hooks/pet/useUpdatePetHook.ts | 73 +++----- .../gen/hooks/pet/useUpdatePetWithFormHook.ts | 98 ++++------ .../pet/useUpdatePetWithFormSuspenseHook.ts | 98 ++++------ .../src/gen/hooks/pet/useUploadFileHook.ts | 96 ++++------ .../react-query/src/gen/hooks/store/index.ts | 28 +-- .../src/gen/hooks/store/useDeleteOrderHook.ts | 83 ++++----- .../gen/hooks/store/useGetInventoryHook.ts | 38 ++-- .../store/useGetInventorySuspenseHook.ts | 78 ++++---- .../gen/hooks/store/useGetOrderByIdHook.ts | 113 +++++------ .../store/useGetOrderByIdSuspenseHook.ts | 113 +++++------ .../src/gen/hooks/store/usePlaceOrderHook.ts | 68 +++---- .../gen/hooks/store/usePlaceOrderPatchHook.ts | 73 +++----- .../react-query/src/gen/hooks/user/index.ts | 40 ++-- .../src/gen/hooks/user/useCreateUserHook.ts | 68 +++---- .../user/useCreateUsersWithListInputHook.ts | 78 +++----- .../src/gen/hooks/user/useDeleteUserHook.ts | 79 ++++---- .../gen/hooks/user/useGetUserByNameHook.ts | 113 +++++------ .../user/useGetUserByNameSuspenseHook.ts | 113 +++++------ .../src/gen/hooks/user/useLoginUserHook.ts | 75 ++++---- .../hooks/user/useLoginUserSuspenseHook.ts | 79 ++++---- .../src/gen/hooks/user/useLogoutUserHook.ts | 74 ++++---- .../hooks/user/useLogoutUserSuspenseHook.ts | 78 ++++---- .../src/gen/hooks/user/useUpdateUserHook.ts | 84 ++++----- examples/react-query/src/gen/index.ts | 175 ------------------ examples/react-query/src/gen/models/AddPet.ts | 50 ++--- .../src/gen/models/AddPetRequest.ts | 70 +++---- .../react-query/src/gen/models/Address.ts | 34 ++-- .../react-query/src/gen/models/ApiResponse.ts | 26 +-- .../react-query/src/gen/models/Category.ts | 18 +- .../react-query/src/gen/models/CreateUser.ts | 26 +-- .../gen/models/CreateUsersWithListInput.ts | 28 +-- .../react-query/src/gen/models/Customer.ts | 30 +-- .../react-query/src/gen/models/DeleteOrder.ts | 36 ++-- .../react-query/src/gen/models/DeletePet.ts | 44 ++--- .../react-query/src/gen/models/DeleteUser.ts | 36 ++-- .../src/gen/models/FindPetsByStatus.ts | 54 +++--- .../src/gen/models/FindPetsByTags.ts | 60 +++--- .../src/gen/models/GetInventory.ts | 16 +- .../src/gen/models/GetOrderById.ts | 46 ++--- .../react-query/src/gen/models/GetPetById.ts | 46 ++--- .../src/gen/models/GetUserByName.ts | 46 ++--- .../react-query/src/gen/models/LoginUser.ts | 46 ++--- .../react-query/src/gen/models/LogoutUser.ts | 14 +- examples/react-query/src/gen/models/Order.ts | 86 ++++----- examples/react-query/src/gen/models/Pet.ts | 70 +++---- .../react-query/src/gen/models/PetNotFound.ts | 18 +- .../react-query/src/gen/models/PlaceOrder.ts | 28 +-- .../src/gen/models/PlaceOrderPatch.ts | 28 +-- examples/react-query/src/gen/models/Tag.ts | 18 +- .../react-query/src/gen/models/UpdatePet.ts | 44 ++--- .../src/gen/models/UpdatePetWithForm.ts | 56 +++--- .../react-query/src/gen/models/UpdateUser.ts | 42 ++--- .../react-query/src/gen/models/UploadFile.ts | 54 +++--- examples/react-query/src/gen/models/User.ts | 68 +++---- .../react-query/src/gen/models/UserArray.ts | 4 +- examples/react-query/src/gen/models/index.ts | 117 ++++-------- examples/vue-query/src/gen/hooks/index.ts | 76 ++++---- examples/vue-query/src/gen/hooks/useAddPet.ts | 81 ++++---- .../vue-query/src/gen/hooks/useCreateUser.ts | 81 ++++---- .../gen/hooks/useCreateUsersWithListInput.ts | 86 ++++----- .../vue-query/src/gen/hooks/useDeleteOrder.ts | 85 ++++----- .../vue-query/src/gen/hooks/useDeletePet.ts | 93 ++++------ .../vue-query/src/gen/hooks/useDeleteUser.ts | 81 ++++---- .../src/gen/hooks/useFindPetsByStatus.ts | 109 +++++------ .../src/gen/hooks/useFindPetsByTags.ts | 109 +++++------ .../src/gen/hooks/useGetInventory.ts | 76 ++++---- .../src/gen/hooks/useGetOrderById.ts | 113 +++++------ .../vue-query/src/gen/hooks/useGetPetById.ts | 113 +++++------ .../src/gen/hooks/useGetUserByName.ts | 117 +++++------- .../vue-query/src/gen/hooks/useLoginUser.ts | 105 +++++------ .../vue-query/src/gen/hooks/useLogoutUser.ts | 76 ++++---- .../vue-query/src/gen/hooks/usePlaceOrder.ts | 81 ++++---- .../vue-query/src/gen/hooks/useUpdatePet.ts | 86 ++++----- .../src/gen/hooks/useUpdatePetWithForm.ts | 93 ++++------ .../vue-query/src/gen/hooks/useUpdateUser.ts | 88 ++++----- .../vue-query/src/gen/hooks/useUploadFile.ts | 102 ++++------ examples/vue-query/src/gen/models/AddPet.ts | 32 ++-- examples/vue-query/src/gen/models/Address.ts | 60 +++--- .../vue-query/src/gen/models/ApiResponse.ts | 26 +-- examples/vue-query/src/gen/models/Category.ts | 18 +- .../vue-query/src/gen/models/CreateUser.ts | 26 +-- .../gen/models/CreateUsersWithListInput.ts | 28 +-- examples/vue-query/src/gen/models/Customer.ts | 30 +-- .../vue-query/src/gen/models/DeleteOrder.ts | 36 ++-- .../vue-query/src/gen/models/DeletePet.ts | 44 ++--- .../vue-query/src/gen/models/DeleteUser.ts | 36 ++-- .../src/gen/models/FindPetsByStatus.ts | 54 +++--- .../src/gen/models/FindPetsByTags.ts | 40 ++-- .../vue-query/src/gen/models/GetInventory.ts | 16 +- .../vue-query/src/gen/models/GetOrderById.ts | 46 ++--- .../vue-query/src/gen/models/GetPetById.ts | 46 ++--- .../vue-query/src/gen/models/GetUserByName.ts | 46 ++--- .../vue-query/src/gen/models/LoginUser.ts | 46 ++--- .../vue-query/src/gen/models/LogoutUser.ts | 14 +- examples/vue-query/src/gen/models/Order.ts | 64 +++---- examples/vue-query/src/gen/models/Pet.ts | 70 +++---- .../vue-query/src/gen/models/PlaceOrder.ts | 28 +-- examples/vue-query/src/gen/models/Tag.ts | 18 +- .../vue-query/src/gen/models/UpdatePet.ts | 44 ++--- .../src/gen/models/UpdatePetWithForm.ts | 56 +++--- .../vue-query/src/gen/models/UpdateUser.ts | 42 ++--- .../vue-query/src/gen/models/UploadFile.ts | 54 +++--- examples/vue-query/src/gen/models/User.ts | 68 +++---- .../vue-query/src/gen/models/UserArray.ts | 4 +- examples/vue-query/src/gen/models/index.ts | 105 ++++------- .../src/generators/clientGenerator.test.tsx | 1 + .../groupedClientGenerator.test.tsx | 1 + .../generators/operationsGenerator.test.tsx | 1 + .../src/generators/fakerGenerator.test.tsx | 2 + .../src/generators/handlersGenerator.test.tsx | 1 + .../src/generators/mswGenerator.test.tsx | 1 + .../infiniteQueryGenerator.test.tsx | 1 + .../src/generators/mutationGenerator.test.tsx | 1 + .../src/generators/queryGenerator.test.tsx | 1 + .../suspenseQueryGenerator.test.tsx | 1 + .../src/generators/queryGenerator.test.tsx | 1 + .../src/generators/mutationGenerator.test.tsx | 1 + .../src/generators/queryGenerator.test.tsx | 1 + .../src/generators/mutationGenerator.test.tsx | 1 + .../src/generators/queryGenerator.test.tsx | 1 + .../src/generators/typeGenerator.test.tsx | 2 + .../infiniteQueryGenerator.test.tsx | 1 + .../src/generators/mutationGenerator.test.tsx | 1 + .../src/generators/queryGenerator.test.tsx | 1 + .../generators/operationsGenerator.test.tsx | 1 + .../src/generators/zodGenerator.test.tsx | 2 + 138 files changed, 3231 insertions(+), 4199 deletions(-) delete mode 100644 examples/react-query/src/gen/index.ts diff --git a/examples/react-query/src/App.tsx b/examples/react-query/src/App.tsx index d0873cb52..14f803ac2 100644 --- a/examples/react-query/src/App.tsx +++ b/examples/react-query/src/App.tsx @@ -1,13 +1,8 @@ import { QueryClient, QueryClientProvider, useQueries } from '@tanstack/react-query' import { ReactQueryDevtools } from '@tanstack/react-query-devtools' import { useState } from 'react' -import { - type FindPetsByStatusQueryParamsStatusEnum, - findPetsByStatusQueryOptionsHook, - useFindPetsByStatusHook, - useFindPetsByTagsInfiniteHook, - useUpdatePetWithFormHook, -} from './gen/index.ts' +import { findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook, useFindPetsByTagsInfiniteHook, useUpdatePetWithFormHook } from './gen/hooks/index.ts' +import type { FindPetsByStatusQueryParamsStatusEnum } from './gen/models' const queryClient = new QueryClient() diff --git a/examples/react-query/src/gen/hooks/index.ts b/examples/react-query/src/gen/hooks/index.ts index 8d9537715..c1eb158a5 100644 --- a/examples/react-query/src/gen/hooks/index.ts +++ b/examples/react-query/src/gen/hooks/index.ts @@ -1,68 +1,60 @@ -export type { AddPetMutationKey } from './pet/useAddPetHook.ts' -export type { DeletePetMutationKey } from './pet/useDeletePetHook.ts' -export type { FindPetsByStatusQueryKey } from './pet/useFindPetsByStatusHook.ts' -export type { FindPetsByStatusSuspenseQueryKey } from './pet/useFindPetsByStatusSuspenseHook.ts' -export type { FindPetsByTagsQueryKey } from './pet/useFindPetsByTagsHook.ts' -export type { FindPetsByTagsInfiniteQueryKey } from './pet/useFindPetsByTagsInfiniteHook.ts' -export type { FindPetsByTagsSuspenseQueryKey } from './pet/useFindPetsByTagsSuspenseHook.ts' -export type { GetPetByIdQueryKey } from './pet/useGetPetByIdHook.ts' -export type { GetPetByIdSuspenseQueryKey } from './pet/useGetPetByIdSuspenseHook.ts' -export type { UpdatePetMutationKey } from './pet/useUpdatePetHook.ts' -export type { UpdatePetWithFormQueryKey } from './pet/useUpdatePetWithFormHook.ts' -export type { UpdatePetWithFormSuspenseQueryKey } from './pet/useUpdatePetWithFormSuspenseHook.ts' -export type { UploadFileMutationKey } from './pet/useUploadFileHook.ts' -export type { DeleteOrderMutationKey } from './store/useDeleteOrderHook.ts' -export type { GetInventoryQueryKey } from './store/useGetInventoryHook.ts' -export type { GetInventorySuspenseQueryKey } from './store/useGetInventorySuspenseHook.ts' -export type { GetOrderByIdQueryKey } from './store/useGetOrderByIdHook.ts' -export type { GetOrderByIdSuspenseQueryKey } from './store/useGetOrderByIdSuspenseHook.ts' -export type { PlaceOrderMutationKey } from './store/usePlaceOrderHook.ts' -export type { PlaceOrderPatchMutationKey } from './store/usePlaceOrderPatchHook.ts' -export type { CreateUserMutationKey } from './user/useCreateUserHook.ts' -export type { CreateUsersWithListInputMutationKey } from './user/useCreateUsersWithListInputHook.ts' -export type { DeleteUserMutationKey } from './user/useDeleteUserHook.ts' -export type { GetUserByNameQueryKey } from './user/useGetUserByNameHook.ts' -export type { GetUserByNameSuspenseQueryKey } from './user/useGetUserByNameSuspenseHook.ts' -export type { LoginUserQueryKey } from './user/useLoginUserHook.ts' -export type { LoginUserSuspenseQueryKey } from './user/useLoginUserSuspenseHook.ts' -export type { LogoutUserQueryKey } from './user/useLogoutUserHook.ts' -export type { LogoutUserSuspenseQueryKey } from './user/useLogoutUserSuspenseHook.ts' -export type { UpdateUserMutationKey } from './user/useUpdateUserHook.ts' -export { addPetMutationKey, useAddPetHook } from './pet/useAddPetHook.ts' -export { deletePetMutationKey, useDeletePetHook } from './pet/useDeletePetHook.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './pet/useFindPetsByStatusHook.ts' -export { - findPetsByStatusSuspenseQueryKey, - findPetsByStatusSuspenseQueryOptionsHook, - useFindPetsByStatusSuspenseHook, -} from './pet/useFindPetsByStatusSuspenseHook.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './pet/useFindPetsByTagsHook.ts' -export { findPetsByTagsInfiniteQueryKey, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook } from './pet/useFindPetsByTagsInfiniteHook.ts' -export { findPetsByTagsSuspenseQueryKey, findPetsByTagsSuspenseQueryOptionsHook, useFindPetsByTagsSuspenseHook } from './pet/useFindPetsByTagsSuspenseHook.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './pet/useGetPetByIdHook.ts' -export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from './pet/useGetPetByIdSuspenseHook.ts' -export { updatePetMutationKey, useUpdatePetHook } from './pet/useUpdatePetHook.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './pet/useUpdatePetWithFormHook.ts' -export { - updatePetWithFormSuspenseQueryKey, - updatePetWithFormSuspenseQueryOptionsHook, - useUpdatePetWithFormSuspenseHook, -} from './pet/useUpdatePetWithFormSuspenseHook.ts' -export { uploadFileMutationKey, useUploadFileHook } from './pet/useUploadFileHook.ts' -export { deleteOrderMutationKey, useDeleteOrderHook } from './store/useDeleteOrderHook.ts' -export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './store/useGetInventoryHook.ts' -export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './store/useGetInventorySuspenseHook.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './store/useGetOrderByIdHook.ts' -export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './store/useGetOrderByIdSuspenseHook.ts' -export { placeOrderMutationKey, usePlaceOrderHook } from './store/usePlaceOrderHook.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './store/usePlaceOrderPatchHook.ts' -export { createUserMutationKey, useCreateUserHook } from './user/useCreateUserHook.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './user/useCreateUsersWithListInputHook.ts' -export { deleteUserMutationKey, useDeleteUserHook } from './user/useDeleteUserHook.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './user/useGetUserByNameHook.ts' -export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from './user/useGetUserByNameSuspenseHook.ts' -export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './user/useLoginUserHook.ts' -export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './user/useLoginUserSuspenseHook.ts' -export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './user/useLogoutUserHook.ts' -export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './user/useLogoutUserSuspenseHook.ts' -export { updateUserMutationKey, useUpdateUserHook } from './user/useUpdateUserHook.ts' +export type { AddPetMutationKey } from "./pet/useAddPetHook"; +export type { DeletePetMutationKey } from "./pet/useDeletePetHook"; +export type { FindPetsByStatusQueryKey } from "./pet/useFindPetsByStatusHook"; +export type { FindPetsByStatusSuspenseQueryKey } from "./pet/useFindPetsByStatusSuspenseHook"; +export type { FindPetsByTagsQueryKey } from "./pet/useFindPetsByTagsHook"; +export type { FindPetsByTagsInfiniteQueryKey } from "./pet/useFindPetsByTagsInfiniteHook"; +export type { FindPetsByTagsSuspenseQueryKey } from "./pet/useFindPetsByTagsSuspenseHook"; +export type { GetPetByIdQueryKey } from "./pet/useGetPetByIdHook"; +export type { GetPetByIdSuspenseQueryKey } from "./pet/useGetPetByIdSuspenseHook"; +export type { UpdatePetMutationKey } from "./pet/useUpdatePetHook"; +export type { UpdatePetWithFormQueryKey } from "./pet/useUpdatePetWithFormHook"; +export type { UpdatePetWithFormSuspenseQueryKey } from "./pet/useUpdatePetWithFormSuspenseHook"; +export type { UploadFileMutationKey } from "./pet/useUploadFileHook"; +export type { DeleteOrderMutationKey } from "./store/useDeleteOrderHook"; +export type { GetInventoryQueryKey } from "./store/useGetInventoryHook"; +export type { GetInventorySuspenseQueryKey } from "./store/useGetInventorySuspenseHook"; +export type { GetOrderByIdQueryKey } from "./store/useGetOrderByIdHook"; +export type { GetOrderByIdSuspenseQueryKey } from "./store/useGetOrderByIdSuspenseHook"; +export type { PlaceOrderMutationKey } from "./store/usePlaceOrderHook"; +export type { PlaceOrderPatchMutationKey } from "./store/usePlaceOrderPatchHook"; +export type { CreateUserMutationKey } from "./user/useCreateUserHook"; +export type { CreateUsersWithListInputMutationKey } from "./user/useCreateUsersWithListInputHook"; +export type { DeleteUserMutationKey } from "./user/useDeleteUserHook"; +export type { GetUserByNameQueryKey } from "./user/useGetUserByNameHook"; +export type { GetUserByNameSuspenseQueryKey } from "./user/useGetUserByNameSuspenseHook"; +export type { LoginUserQueryKey } from "./user/useLoginUserHook"; +export type { LoginUserSuspenseQueryKey } from "./user/useLoginUserSuspenseHook"; +export type { LogoutUserQueryKey } from "./user/useLogoutUserHook"; +export type { LogoutUserSuspenseQueryKey } from "./user/useLogoutUserSuspenseHook"; +export type { UpdateUserMutationKey } from "./user/useUpdateUserHook"; +export { addPetMutationKey, useAddPetHook } from "./pet/useAddPetHook"; +export { deletePetMutationKey, useDeletePetHook } from "./pet/useDeletePetHook"; +export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from "./pet/useFindPetsByStatusHook"; +export { findPetsByStatusSuspenseQueryKey, findPetsByStatusSuspenseQueryOptionsHook, useFindPetsByStatusSuspenseHook } from "./pet/useFindPetsByStatusSuspenseHook"; +export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from "./pet/useFindPetsByTagsHook"; +export { findPetsByTagsInfiniteQueryKey, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook } from "./pet/useFindPetsByTagsInfiniteHook"; +export { findPetsByTagsSuspenseQueryKey, findPetsByTagsSuspenseQueryOptionsHook, useFindPetsByTagsSuspenseHook } from "./pet/useFindPetsByTagsSuspenseHook"; +export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from "./pet/useGetPetByIdHook"; +export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from "./pet/useGetPetByIdSuspenseHook"; +export { updatePetMutationKey, useUpdatePetHook } from "./pet/useUpdatePetHook"; +export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from "./pet/useUpdatePetWithFormHook"; +export { updatePetWithFormSuspenseQueryKey, updatePetWithFormSuspenseQueryOptionsHook, useUpdatePetWithFormSuspenseHook } from "./pet/useUpdatePetWithFormSuspenseHook"; +export { uploadFileMutationKey, useUploadFileHook } from "./pet/useUploadFileHook"; +export { deleteOrderMutationKey, useDeleteOrderHook } from "./store/useDeleteOrderHook"; +export { getInventoryQueryKey, getInventoryQueryOptionsHook } from "./store/useGetInventoryHook"; +export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from "./store/useGetInventorySuspenseHook"; +export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from "./store/useGetOrderByIdHook"; +export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from "./store/useGetOrderByIdSuspenseHook"; +export { placeOrderMutationKey, usePlaceOrderHook } from "./store/usePlaceOrderHook"; +export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from "./store/usePlaceOrderPatchHook"; +export { createUserMutationKey, useCreateUserHook } from "./user/useCreateUserHook"; +export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from "./user/useCreateUsersWithListInputHook"; +export { deleteUserMutationKey, useDeleteUserHook } from "./user/useDeleteUserHook"; +export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from "./user/useGetUserByNameHook"; +export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from "./user/useGetUserByNameSuspenseHook"; +export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from "./user/useLoginUserHook"; +export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from "./user/useLoginUserSuspenseHook"; +export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from "./user/useLogoutUserHook"; +export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from "./user/useLogoutUserSuspenseHook"; +export { updateUserMutationKey, useUpdateUserHook } from "./user/useUpdateUserHook"; \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/index.ts b/examples/react-query/src/gen/hooks/pet/index.ts index 216f4d5e3..3e84e50e2 100644 --- a/examples/react-query/src/gen/hooks/pet/index.ts +++ b/examples/react-query/src/gen/hooks/pet/index.ts @@ -1,34 +1,26 @@ -export type { AddPetMutationKey } from './useAddPetHook.ts' -export type { DeletePetMutationKey } from './useDeletePetHook.ts' -export type { FindPetsByStatusQueryKey } from './useFindPetsByStatusHook.ts' -export type { FindPetsByStatusSuspenseQueryKey } from './useFindPetsByStatusSuspenseHook.ts' -export type { FindPetsByTagsQueryKey } from './useFindPetsByTagsHook.ts' -export type { FindPetsByTagsInfiniteQueryKey } from './useFindPetsByTagsInfiniteHook.ts' -export type { FindPetsByTagsSuspenseQueryKey } from './useFindPetsByTagsSuspenseHook.ts' -export type { GetPetByIdQueryKey } from './useGetPetByIdHook.ts' -export type { GetPetByIdSuspenseQueryKey } from './useGetPetByIdSuspenseHook.ts' -export type { UpdatePetMutationKey } from './useUpdatePetHook.ts' -export type { UpdatePetWithFormQueryKey } from './useUpdatePetWithFormHook.ts' -export type { UpdatePetWithFormSuspenseQueryKey } from './useUpdatePetWithFormSuspenseHook.ts' -export type { UploadFileMutationKey } from './useUploadFileHook.ts' -export { addPetMutationKey, useAddPetHook } from './useAddPetHook.ts' -export { deletePetMutationKey, useDeletePetHook } from './useDeletePetHook.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './useFindPetsByStatusHook.ts' -export { - findPetsByStatusSuspenseQueryKey, - findPetsByStatusSuspenseQueryOptionsHook, - useFindPetsByStatusSuspenseHook, -} from './useFindPetsByStatusSuspenseHook.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './useFindPetsByTagsHook.ts' -export { findPetsByTagsInfiniteQueryKey, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook } from './useFindPetsByTagsInfiniteHook.ts' -export { findPetsByTagsSuspenseQueryKey, findPetsByTagsSuspenseQueryOptionsHook, useFindPetsByTagsSuspenseHook } from './useFindPetsByTagsSuspenseHook.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './useGetPetByIdHook.ts' -export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from './useGetPetByIdSuspenseHook.ts' -export { updatePetMutationKey, useUpdatePetHook } from './useUpdatePetHook.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './useUpdatePetWithFormHook.ts' -export { - updatePetWithFormSuspenseQueryKey, - updatePetWithFormSuspenseQueryOptionsHook, - useUpdatePetWithFormSuspenseHook, -} from './useUpdatePetWithFormSuspenseHook.ts' -export { uploadFileMutationKey, useUploadFileHook } from './useUploadFileHook.ts' +export type { AddPetMutationKey } from "./useAddPetHook"; +export type { DeletePetMutationKey } from "./useDeletePetHook"; +export type { FindPetsByStatusQueryKey } from "./useFindPetsByStatusHook"; +export type { FindPetsByStatusSuspenseQueryKey } from "./useFindPetsByStatusSuspenseHook"; +export type { FindPetsByTagsQueryKey } from "./useFindPetsByTagsHook"; +export type { FindPetsByTagsInfiniteQueryKey } from "./useFindPetsByTagsInfiniteHook"; +export type { FindPetsByTagsSuspenseQueryKey } from "./useFindPetsByTagsSuspenseHook"; +export type { GetPetByIdQueryKey } from "./useGetPetByIdHook"; +export type { GetPetByIdSuspenseQueryKey } from "./useGetPetByIdSuspenseHook"; +export type { UpdatePetMutationKey } from "./useUpdatePetHook"; +export type { UpdatePetWithFormQueryKey } from "./useUpdatePetWithFormHook"; +export type { UpdatePetWithFormSuspenseQueryKey } from "./useUpdatePetWithFormSuspenseHook"; +export type { UploadFileMutationKey } from "./useUploadFileHook"; +export { addPetMutationKey, useAddPetHook } from "./useAddPetHook"; +export { deletePetMutationKey, useDeletePetHook } from "./useDeletePetHook"; +export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from "./useFindPetsByStatusHook"; +export { findPetsByStatusSuspenseQueryKey, findPetsByStatusSuspenseQueryOptionsHook, useFindPetsByStatusSuspenseHook } from "./useFindPetsByStatusSuspenseHook"; +export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from "./useFindPetsByTagsHook"; +export { findPetsByTagsInfiniteQueryKey, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook } from "./useFindPetsByTagsInfiniteHook"; +export { findPetsByTagsSuspenseQueryKey, findPetsByTagsSuspenseQueryOptionsHook, useFindPetsByTagsSuspenseHook } from "./useFindPetsByTagsSuspenseHook"; +export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from "./useGetPetByIdHook"; +export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from "./useGetPetByIdSuspenseHook"; +export { updatePetMutationKey, useUpdatePetHook } from "./useUpdatePetHook"; +export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from "./useUpdatePetWithFormHook"; +export { updatePetWithFormSuspenseQueryKey, updatePetWithFormSuspenseQueryOptionsHook, useUpdatePetWithFormSuspenseHook } from "./useUpdatePetWithFormSuspenseHook"; +export { uploadFileMutationKey, useUploadFileHook } from "./useUploadFileHook"; \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts index 29407c1ba..23922bf0e 100644 --- a/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts @@ -1,53 +1,43 @@ -import client from '@kubb/plugin-client/client' -import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../models/AddPet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from "../../models/AddPet"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const addPetMutationKey = () => [{ url: '/pet' }] as const + export const addPetMutationKey = () => [{ "url": "/pet" }] as const; -export type AddPetMutationKey = ReturnType + export type AddPetMutationKey = ReturnType; -/** + /** * @description Add a new pet to the store * @summary Add a new pet to the store * {@link /pet} */ async function addPetHook(data: AddPetMutationRequest, config: Partial> = {}) { - const res = await client({ method: 'POST', url: '/pet', data, ...config }) - return res.data + const res = await client({ method: "POST", url: `/pet`, data, ...config }); + return res.data; } -/** + /** * @description Add a new pet to the store * @summary Add a new pet to the store * {@link /pet} */ -export function useAddPetHook( - options: { - mutation?: UseMutationOptions< - AddPetMutationResponse, - AddPet405, - { - data: AddPetMutationRequest - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? addPetMutationKey() - return useMutation< - AddPetMutationResponse, - AddPet405, - { - data: AddPetMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return addPetHook(data, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useAddPetHook(options: { + mutation?: UseMutationOptions; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? addPetMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return addPetHook(data, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts b/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts index 9eb7cfd30..5b52c2f28 100644 --- a/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts @@ -1,68 +1,47 @@ -import client from '@kubb/plugin-client/client' -import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../models/DeletePet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from "../../models/DeletePet"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const deletePetMutationKey = () => [{ url: '/pet/{pet_id}' }] as const + export const deletePetMutationKey = () => [{ "url": "/pet/{pet_id}" }] as const; -export type DeletePetMutationKey = ReturnType + export type DeletePetMutationKey = ReturnType; -/** + /** * @description delete a pet * @summary Deletes a pet * {@link /pet/:pet_id} */ -async function deletePetHook( - { - pet_id, - }: { - pet_id: DeletePetPathParams['pet_id'] - }, - headers?: DeletePetHeaderParams, - config: Partial = {}, -) { - const res = await client({ - method: 'DELETE', - url: `/pet/${pet_id}`, - headers: { ...headers, ...config.headers }, - ...config, - }) - return res.data +async function deletePetHook({ pet_id }: { + pet_id: DeletePetPathParams["pet_id"]; +}, headers?: DeletePetHeaderParams, config: Partial = {}) { + const res = await client({ method: "DELETE", url: `/pet/${pet_id}`, headers: { ...headers, ...config.headers }, ...config }); + return res.data; } -/** + /** * @description delete a pet * @summary Deletes a pet * {@link /pet/:pet_id} */ -export function useDeletePetHook( - options: { - mutation?: UseMutationOptions< - DeletePetMutationResponse, - DeletePet400, - { - pet_id: DeletePetPathParams['pet_id'] - headers?: DeletePetHeaderParams - } - > - client?: Partial - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? deletePetMutationKey() - return useMutation< - DeletePetMutationResponse, - DeletePet400, - { - pet_id: DeletePetPathParams['pet_id'] - headers?: DeletePetHeaderParams - } - >({ - mutationFn: async ({ pet_id, headers }) => { - return deletePetHook({ pet_id }, headers, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useDeletePetHook(options: { + mutation?: UseMutationOptions; + client?: Partial; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? deletePetMutationKey(); + return useMutation({ + mutationFn: async ({ pet_id, headers }) => { + return deletePetHook({ pet_id }, headers, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts index 732f7ffd8..a92a6da6a 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts @@ -1,59 +1,52 @@ -import client from '@kubb/plugin-client/client' -import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../models/FindPetsByStatus.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' -import { queryOptions, useQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from "../../models/FindPetsByStatus"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; -export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => ['v5', { url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const + export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => ["v5", { url: "/pet/findByStatus" }, ...(params ? [params] : [])] as const; -export type FindPetsByStatusQueryKey = ReturnType + export type FindPetsByStatusQueryKey = ReturnType; -/** + /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * {@link /pet/findByStatus} */ async function findPetsByStatusHook(params?: FindPetsByStatusQueryParams, config: Partial = {}) { - const res = await client({ method: 'GET', url: '/pet/findByStatus', params, ...config }) - return res.data + const res = await client({ method: "GET", url: `/pet/findByStatus`, params, ...config }); + return res.data; } -export function findPetsByStatusQueryOptionsHook(params?: FindPetsByStatusQueryParams, config: Partial = {}) { - const queryKey = findPetsByStatusQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return findPetsByStatusHook(params, config) - }, - }) + export function findPetsByStatusQueryOptionsHook(params?: FindPetsByStatusQueryParams, config: Partial = {}) { + const queryKey = findPetsByStatusQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByStatusHook(params, config); + }, + }); } -/** + /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * {@link /pet/findByStatus} */ -export function useFindPetsByStatusHook< - TData = FindPetsByStatusQueryResponse, - TQueryData = FindPetsByStatusQueryResponse, - TQueryKey extends QueryKey = FindPetsByStatusQueryKey, ->( - params?: FindPetsByStatusQueryParams, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params) - const query = useQuery({ - ...(findPetsByStatusQueryOptionsHook(params, config) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useFindPetsByStatusHook(params?: FindPetsByStatusQueryParams, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params); + const query = useQuery({ + ...findPetsByStatusQueryOptionsHook(params, config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts index 1f02ca60d..08f47267d 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts @@ -1,60 +1,52 @@ -import client from '@kubb/plugin-client/client' -import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../models/FindPetsByStatus.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from "../../models/FindPetsByStatus"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const findPetsByStatusSuspenseQueryKey = (params?: FindPetsByStatusQueryParams) => - ['v5', { url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const + export const findPetsByStatusSuspenseQueryKey = (params?: FindPetsByStatusQueryParams) => ["v5", { url: "/pet/findByStatus" }, ...(params ? [params] : [])] as const; -export type FindPetsByStatusSuspenseQueryKey = ReturnType + export type FindPetsByStatusSuspenseQueryKey = ReturnType; -/** + /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * {@link /pet/findByStatus} */ async function findPetsByStatusHook(params?: FindPetsByStatusQueryParams, config: Partial = {}) { - const res = await client({ method: 'GET', url: '/pet/findByStatus', params, ...config }) - return res.data + const res = await client({ method: "GET", url: `/pet/findByStatus`, params, ...config }); + return res.data; } -export function findPetsByStatusSuspenseQueryOptionsHook(params?: FindPetsByStatusQueryParams, config: Partial = {}) { - const queryKey = findPetsByStatusSuspenseQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return findPetsByStatusHook(params, config) - }, - }) + export function findPetsByStatusSuspenseQueryOptionsHook(params?: FindPetsByStatusQueryParams, config: Partial = {}) { + const queryKey = findPetsByStatusSuspenseQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByStatusHook(params, config); + }, + }); } -/** + /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * {@link /pet/findByStatus} */ -export function useFindPetsByStatusSuspenseHook< - TData = FindPetsByStatusQueryResponse, - TQueryData = FindPetsByStatusQueryResponse, - TQueryKey extends QueryKey = FindPetsByStatusSuspenseQueryKey, ->( - params?: FindPetsByStatusQueryParams, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByStatusSuspenseQueryKey(params) - const query = useSuspenseQuery({ - ...(findPetsByStatusSuspenseQueryOptionsHook(params, config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useFindPetsByStatusSuspenseHook(params?: FindPetsByStatusQueryParams, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByStatusSuspenseQueryKey(params); + const query = useSuspenseQuery({ + ...findPetsByStatusSuspenseQueryOptionsHook(params, config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts index 71f50c2d5..fc2722529 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts @@ -1,59 +1,52 @@ -import client from '@kubb/plugin-client/client' -import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' -import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' -import { queryOptions, useQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from "../../models/FindPetsByTags"; +import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; -export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => ['v5', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const + export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => ["v5", { url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; -export type FindPetsByTagsQueryKey = ReturnType + export type FindPetsByTagsQueryKey = ReturnType; -/** + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * {@link /pet/findByTags} */ async function findPetsByTagsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client({ method: 'GET', url: '/pet/findByTags', params, ...config }) - return res + const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); + return res; } -export function findPetsByTagsQueryOptionsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const queryKey = findPetsByTagsQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return findPetsByTagsHook(params, config) - }, - }) + export function findPetsByTagsQueryOptionsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const queryKey = findPetsByTagsQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByTagsHook(params, config); + }, + }); } -/** + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * {@link /pet/findByTags} */ -export function useFindPetsByTagsHook< - TData = ResponseConfig, - TQueryData = ResponseConfig, - TQueryKey extends QueryKey = FindPetsByTagsQueryKey, ->( - params?: FindPetsByTagsQueryParams, - options: { - query?: Partial, FindPetsByTags400, TData, TQueryData, TQueryKey>> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params) - const query = useQuery({ - ...(findPetsByTagsQueryOptionsHook(params, config) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useFindPetsByTagsHook, TQueryData = ResponseConfig, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(params?: FindPetsByTagsQueryParams, options: { + query?: Partial, FindPetsByTags400, TData, TQueryData, TQueryKey>>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params); + const query = useQuery({ + ...findPetsByTagsQueryOptionsHook(params, config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts index 67d63c5fd..f48854a95 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts @@ -1,65 +1,58 @@ -import client from '@kubb/plugin-client/client' -import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' -import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/client' -import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query' -import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from "../../models/FindPetsByTags"; +import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; +import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from "@tanstack/react-query"; +import { infiniteQueryOptions, useInfiniteQuery } from "@tanstack/react-query"; -export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => ['v5', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const + export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => ["v5", { url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; -export type FindPetsByTagsInfiniteQueryKey = ReturnType + export type FindPetsByTagsInfiniteQueryKey = ReturnType; -/** + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * {@link /pet/findByTags} */ async function findPetsByTagsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client({ method: 'GET', url: '/pet/findByTags', params, ...config }) - return res + const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); + return res; } -export function findPetsByTagsInfiniteQueryOptionsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const queryKey = findPetsByTagsInfiniteQueryKey(params) - return infiniteQueryOptions({ - queryKey, - queryFn: async ({ signal, pageParam }) => { - config.signal = signal - if (params) { - params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize'] - } - return findPetsByTagsHook(params, config) - }, - initialPageParam: 0, - getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1), - getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1), - }) + export function findPetsByTagsInfiniteQueryOptionsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const queryKey = findPetsByTagsInfiniteQueryKey(params); + return infiniteQueryOptions({ + queryKey, + queryFn: async ({ signal, pageParam }) => { + config.signal = signal; + if (params) { + params["pageSize"] = pageParam as unknown as FindPetsByTagsQueryParams["pageSize"]; + } + return findPetsByTagsHook(params, config); + }, + initialPageParam: 0, + getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1, + getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1 + }); } -/** + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * {@link /pet/findByTags} */ -export function useFindPetsByTagsInfiniteHook< - TData = InfiniteData>, - TQueryData = ResponseConfig, - TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey, ->( - params?: FindPetsByTagsQueryParams, - options: { - query?: Partial, FindPetsByTags400, TData, TQueryData, TQueryKey>> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params) - const query = useInfiniteQuery({ - ...(findPetsByTagsInfiniteQueryOptionsHook(params, config) as unknown as InfiniteQueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseInfiniteQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useFindPetsByTagsInfiniteHook>, TQueryData = ResponseConfig, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(params?: FindPetsByTagsQueryParams, options: { + query?: Partial, FindPetsByTags400, TData, TQueryData, TQueryKey>>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params); + const query = useInfiniteQuery({ + ...findPetsByTagsInfiniteQueryOptionsHook(params, config) as unknown as InfiniteQueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseInfiniteQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts index 917abc9fa..b20ee51de 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts @@ -1,59 +1,52 @@ -import client from '@kubb/plugin-client/client' -import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' -import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from "../../models/FindPetsByTags"; +import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const findPetsByTagsSuspenseQueryKey = (params?: FindPetsByTagsQueryParams) => ['v5', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const + export const findPetsByTagsSuspenseQueryKey = (params?: FindPetsByTagsQueryParams) => ["v5", { url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; -export type FindPetsByTagsSuspenseQueryKey = ReturnType + export type FindPetsByTagsSuspenseQueryKey = ReturnType; -/** + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * {@link /pet/findByTags} */ async function findPetsByTagsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client({ method: 'GET', url: '/pet/findByTags', params, ...config }) - return res + const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); + return res; } -export function findPetsByTagsSuspenseQueryOptionsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const queryKey = findPetsByTagsSuspenseQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return findPetsByTagsHook(params, config) - }, - }) + export function findPetsByTagsSuspenseQueryOptionsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const queryKey = findPetsByTagsSuspenseQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByTagsHook(params, config); + }, + }); } -/** + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * {@link /pet/findByTags} */ -export function useFindPetsByTagsSuspenseHook< - TData = ResponseConfig, - TQueryData = ResponseConfig, - TQueryKey extends QueryKey = FindPetsByTagsSuspenseQueryKey, ->( - params?: FindPetsByTagsQueryParams, - options: { - query?: Partial, FindPetsByTags400, TData, TQueryKey>> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseQueryKey(params) - const query = useSuspenseQuery({ - ...(findPetsByTagsSuspenseQueryOptionsHook(params, config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useFindPetsByTagsSuspenseHook, TQueryData = ResponseConfig, TQueryKey extends QueryKey = FindPetsByTagsSuspenseQueryKey>(params?: FindPetsByTagsQueryParams, options: { + query?: Partial, FindPetsByTags400, TData, TQueryKey>>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseQueryKey(params); + const query = useSuspenseQuery({ + ...findPetsByTagsSuspenseQueryOptionsHook(params, config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts index d485796b3..f619dbe92 100644 --- a/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts @@ -1,78 +1,61 @@ -import client from '@kubb/plugin-client/client' -import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../models/GetPetById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' -import { queryOptions, useQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from "../../models/GetPetById"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getPetByIdQueryKey = ({ - pet_id, -}: { - pet_id: GetPetByIdPathParams['pet_id'] -}) => ['v5', { url: '/pet/:pet_id', params: { pet_id: pet_id } }] as const + export const getPetByIdQueryKey = ({ pet_id }: { + pet_id: GetPetByIdPathParams["pet_id"]; +}) => ["v5", { url: "/pet/:pet_id", params: { pet_id: pet_id } }] as const; -export type GetPetByIdQueryKey = ReturnType + export type GetPetByIdQueryKey = ReturnType; -/** + /** * @description Returns a single pet * @summary Find pet by ID * {@link /pet/:pet_id} */ -async function getPetByIdHook( - { - pet_id, - }: { - pet_id: GetPetByIdPathParams['pet_id'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/pet/${pet_id}`, ...config }) - return res.data +async function getPetByIdHook({ pet_id }: { + pet_id: GetPetByIdPathParams["pet_id"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/${pet_id}`, ...config }); + return res.data; } -export function getPetByIdQueryOptionsHook( - { - pet_id, - }: { - pet_id: GetPetByIdPathParams['pet_id'] - }, - config: Partial = {}, -) { - const queryKey = getPetByIdQueryKey({ pet_id }) - return queryOptions({ - enabled: !!pet_id, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getPetByIdHook({ pet_id }, config) - }, - }) + export function getPetByIdQueryOptionsHook({ pet_id }: { + pet_id: GetPetByIdPathParams["pet_id"]; +}, config: Partial = {}) { + const queryKey = getPetByIdQueryKey({ pet_id }); + return queryOptions({ + enabled: !!(pet_id), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getPetByIdHook({ pet_id }, config); + }, + }); } -/** + /** * @description Returns a single pet * @summary Find pet by ID * {@link /pet/:pet_id} */ -export function useGetPetByIdHook( - { - pet_id, - }: { - pet_id: GetPetByIdPathParams['pet_id'] - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey({ pet_id }) - const query = useQuery({ - ...(getPetByIdQueryOptionsHook({ pet_id }, config) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetPetByIdHook({ pet_id }: { + pet_id: GetPetByIdPathParams["pet_id"]; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey({ pet_id }); + const query = useQuery({ + ...getPetByIdQueryOptionsHook({ pet_id }, config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts index 2459f6183..8109cec33 100644 --- a/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts @@ -1,82 +1,61 @@ -import client from '@kubb/plugin-client/client' -import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../models/GetPetById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from "../../models/GetPetById"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getPetByIdSuspenseQueryKey = ({ - pet_id, -}: { - pet_id: GetPetByIdPathParams['pet_id'] -}) => ['v5', { url: '/pet/:pet_id', params: { pet_id: pet_id } }] as const + export const getPetByIdSuspenseQueryKey = ({ pet_id }: { + pet_id: GetPetByIdPathParams["pet_id"]; +}) => ["v5", { url: "/pet/:pet_id", params: { pet_id: pet_id } }] as const; -export type GetPetByIdSuspenseQueryKey = ReturnType + export type GetPetByIdSuspenseQueryKey = ReturnType; -/** + /** * @description Returns a single pet * @summary Find pet by ID * {@link /pet/:pet_id} */ -async function getPetByIdHook( - { - pet_id, - }: { - pet_id: GetPetByIdPathParams['pet_id'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/pet/${pet_id}`, ...config }) - return res.data +async function getPetByIdHook({ pet_id }: { + pet_id: GetPetByIdPathParams["pet_id"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/${pet_id}`, ...config }); + return res.data; } -export function getPetByIdSuspenseQueryOptionsHook( - { - pet_id, - }: { - pet_id: GetPetByIdPathParams['pet_id'] - }, - config: Partial = {}, -) { - const queryKey = getPetByIdSuspenseQueryKey({ pet_id }) - return queryOptions({ - enabled: !!pet_id, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getPetByIdHook({ pet_id }, config) - }, - }) + export function getPetByIdSuspenseQueryOptionsHook({ pet_id }: { + pet_id: GetPetByIdPathParams["pet_id"]; +}, config: Partial = {}) { + const queryKey = getPetByIdSuspenseQueryKey({ pet_id }); + return queryOptions({ + enabled: !!(pet_id), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getPetByIdHook({ pet_id }, config); + }, + }); } -/** + /** * @description Returns a single pet * @summary Find pet by ID * {@link /pet/:pet_id} */ -export function useGetPetByIdSuspenseHook< - TData = GetPetByIdQueryResponse, - TQueryData = GetPetByIdQueryResponse, - TQueryKey extends QueryKey = GetPetByIdSuspenseQueryKey, ->( - { - pet_id, - }: { - pet_id: GetPetByIdPathParams['pet_id'] - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getPetByIdSuspenseQueryKey({ pet_id }) - const query = useSuspenseQuery({ - ...(getPetByIdSuspenseQueryOptionsHook({ pet_id }, config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetPetByIdSuspenseHook({ pet_id }: { + pet_id: GetPetByIdPathParams["pet_id"]; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getPetByIdSuspenseQueryKey({ pet_id }); + const query = useSuspenseQuery({ + ...getPetByIdSuspenseQueryOptionsHook({ pet_id }, config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts index 949dff978..37d87c0da 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts @@ -1,58 +1,43 @@ -import client from '@kubb/plugin-client/client' -import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../../models/UpdatePet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from "../../models/UpdatePet"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const updatePetMutationKey = () => [{ url: '/pet' }] as const + export const updatePetMutationKey = () => [{ "url": "/pet" }] as const; -export type UpdatePetMutationKey = ReturnType + export type UpdatePetMutationKey = ReturnType; -/** + /** * @description Update an existing pet by Id * @summary Update an existing pet * {@link /pet} */ async function updatePetHook(data: UpdatePetMutationRequest, config: Partial> = {}) { - const res = await client({ - method: 'PUT', - url: '/pet', - data, - ...config, - }) - return res.data + const res = await client({ method: "PUT", url: `/pet`, data, ...config }); + return res.data; } -/** + /** * @description Update an existing pet by Id * @summary Update an existing pet * {@link /pet} */ -export function useUpdatePetHook( - options: { - mutation?: UseMutationOptions< - UpdatePetMutationResponse, - UpdatePet400 | UpdatePet404 | UpdatePet405, - { - data: UpdatePetMutationRequest - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? updatePetMutationKey() - return useMutation< - UpdatePetMutationResponse, - UpdatePet400 | UpdatePet404 | UpdatePet405, - { - data: UpdatePetMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return updatePetHook(data, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useUpdatePetHook(options: { + mutation?: UseMutationOptions; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? updatePetMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return updatePetHook(data, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts index bd1ff8067..dfb9a643a 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts @@ -1,73 +1,51 @@ -import client from '@kubb/plugin-client/client' -import type { - UpdatePetWithFormMutationResponse, - UpdatePetWithFormPathParams, - UpdatePetWithFormQueryParams, - UpdatePetWithForm405, -} from '../../models/UpdatePetWithForm.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' -import { queryOptions, useQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405 } from "../../models/UpdatePetWithForm"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; -export const updatePetWithFormQueryKey = (pet_id: UpdatePetWithFormPathParams['pet_id'], params?: UpdatePetWithFormQueryParams) => - ['v5', { url: '/pet/:pet_id', params: { pet_id: pet_id } }, ...(params ? [params] : [])] as const + export const updatePetWithFormQueryKey = (pet_id: UpdatePetWithFormPathParams["pet_id"], params?: UpdatePetWithFormQueryParams) => ["v5", { url: "/pet/:pet_id", params: { pet_id: pet_id } }, ...(params ? [params] : [])] as const; -export type UpdatePetWithFormQueryKey = ReturnType + export type UpdatePetWithFormQueryKey = ReturnType; -/** + /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} */ -async function updatePetWithFormHook( - pet_id: UpdatePetWithFormPathParams['pet_id'], - params?: UpdatePetWithFormQueryParams, - config: Partial = {}, -) { - const res = await client({ method: 'POST', url: `/pet/${pet_id}`, params, ...config }) - return res.data +async function updatePetWithFormHook(pet_id: UpdatePetWithFormPathParams["pet_id"], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { + const res = await client({ method: "POST", url: `/pet/${pet_id}`, params, ...config }); + return res.data; } -export function updatePetWithFormQueryOptionsHook( - pet_id: UpdatePetWithFormPathParams['pet_id'], - params?: UpdatePetWithFormQueryParams, - config: Partial = {}, -) { - const queryKey = updatePetWithFormQueryKey(pet_id, params) - return queryOptions({ - enabled: !!pet_id, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return updatePetWithFormHook(pet_id, params, config) - }, - }) + export function updatePetWithFormQueryOptionsHook(pet_id: UpdatePetWithFormPathParams["pet_id"], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { + const queryKey = updatePetWithFormQueryKey(pet_id, params); + return queryOptions({ + enabled: !!(pet_id), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return updatePetWithFormHook(pet_id, params, config); + }, + }); } -/** + /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} */ -export function useUpdatePetWithFormHook< - TData = UpdatePetWithFormMutationResponse, - TQueryData = UpdatePetWithFormMutationResponse, - TQueryKey extends QueryKey = UpdatePetWithFormQueryKey, ->( - pet_id: UpdatePetWithFormPathParams['pet_id'], - params?: UpdatePetWithFormQueryParams, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(pet_id, params) - const query = useQuery({ - ...(updatePetWithFormQueryOptionsHook(pet_id, params, config) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useUpdatePetWithFormHook(pet_id: UpdatePetWithFormPathParams["pet_id"], params?: UpdatePetWithFormQueryParams, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(pet_id, params); + const query = useQuery({ + ...updatePetWithFormQueryOptionsHook(pet_id, params, config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts index 160e7c781..c238660bc 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts @@ -1,73 +1,51 @@ -import client from '@kubb/plugin-client/client' -import type { - UpdatePetWithFormMutationResponse, - UpdatePetWithFormPathParams, - UpdatePetWithFormQueryParams, - UpdatePetWithForm405, -} from '../../models/UpdatePetWithForm.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405 } from "../../models/UpdatePetWithForm"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const updatePetWithFormSuspenseQueryKey = (pet_id: UpdatePetWithFormPathParams['pet_id'], params?: UpdatePetWithFormQueryParams) => - ['v5', { url: '/pet/:pet_id', params: { pet_id: pet_id } }, ...(params ? [params] : [])] as const + export const updatePetWithFormSuspenseQueryKey = (pet_id: UpdatePetWithFormPathParams["pet_id"], params?: UpdatePetWithFormQueryParams) => ["v5", { url: "/pet/:pet_id", params: { pet_id: pet_id } }, ...(params ? [params] : [])] as const; -export type UpdatePetWithFormSuspenseQueryKey = ReturnType + export type UpdatePetWithFormSuspenseQueryKey = ReturnType; -/** + /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} */ -async function updatePetWithFormHook( - pet_id: UpdatePetWithFormPathParams['pet_id'], - params?: UpdatePetWithFormQueryParams, - config: Partial = {}, -) { - const res = await client({ method: 'POST', url: `/pet/${pet_id}`, params, ...config }) - return res.data +async function updatePetWithFormHook(pet_id: UpdatePetWithFormPathParams["pet_id"], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { + const res = await client({ method: "POST", url: `/pet/${pet_id}`, params, ...config }); + return res.data; } -export function updatePetWithFormSuspenseQueryOptionsHook( - pet_id: UpdatePetWithFormPathParams['pet_id'], - params?: UpdatePetWithFormQueryParams, - config: Partial = {}, -) { - const queryKey = updatePetWithFormSuspenseQueryKey(pet_id, params) - return queryOptions({ - enabled: !!pet_id, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return updatePetWithFormHook(pet_id, params, config) - }, - }) + export function updatePetWithFormSuspenseQueryOptionsHook(pet_id: UpdatePetWithFormPathParams["pet_id"], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { + const queryKey = updatePetWithFormSuspenseQueryKey(pet_id, params); + return queryOptions({ + enabled: !!(pet_id), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return updatePetWithFormHook(pet_id, params, config); + }, + }); } -/** + /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} */ -export function useUpdatePetWithFormSuspenseHook< - TData = UpdatePetWithFormMutationResponse, - TQueryData = UpdatePetWithFormMutationResponse, - TQueryKey extends QueryKey = UpdatePetWithFormSuspenseQueryKey, ->( - pet_id: UpdatePetWithFormPathParams['pet_id'], - params?: UpdatePetWithFormQueryParams, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? updatePetWithFormSuspenseQueryKey(pet_id, params) - const query = useSuspenseQuery({ - ...(updatePetWithFormSuspenseQueryOptionsHook(pet_id, params, config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useUpdatePetWithFormSuspenseHook(pet_id: UpdatePetWithFormPathParams["pet_id"], params?: UpdatePetWithFormQueryParams, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? updatePetWithFormSuspenseQueryKey(pet_id, params); + const query = useSuspenseQuery({ + ...updatePetWithFormSuspenseQueryOptionsHook(pet_id, params, config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts index 8fbb5dce7..2762d6fbb 100644 --- a/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts @@ -1,71 +1,47 @@ -import client from '@kubb/plugin-client/client' -import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../../models/UploadFile.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from "../../models/UploadFile"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const uploadFileMutationKey = () => [{ url: '/pet/{petId}/uploadImage' }] as const + export const uploadFileMutationKey = () => [{ "url": "/pet/{petId}/uploadImage" }] as const; -export type UploadFileMutationKey = ReturnType + export type UploadFileMutationKey = ReturnType; -/** + /** * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -async function uploadFileHook( - { - petId, - }: { - petId: UploadFilePathParams['petId'] - }, - data?: UploadFileMutationRequest, - params?: UploadFileQueryParams, - config: Partial> = {}, -) { - const res = await client({ - method: 'POST', - url: `/pet/${petId}/uploadImage`, - params, - data, - headers: { 'Content-Type': 'application/octet-stream', ...config.headers }, - ...config, - }) - return res.data +async function uploadFileHook({ petId }: { + petId: UploadFilePathParams["petId"]; +}, data?: UploadFileMutationRequest, params?: UploadFileQueryParams, config: Partial> = {}) { + const res = await client({ method: "POST", url: `/pet/${petId}/uploadImage`, params, data, headers: { "Content-Type": "application/octet-stream", ...config.headers }, ...config }); + return res.data; } -/** + /** * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -export function useUploadFileHook( - options: { - mutation?: UseMutationOptions< - UploadFileMutationResponse, - Error, - { - petId: UploadFilePathParams['petId'] - data?: UploadFileMutationRequest - params?: UploadFileQueryParams - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? uploadFileMutationKey() - return useMutation< - UploadFileMutationResponse, - Error, - { - petId: UploadFilePathParams['petId'] - data?: UploadFileMutationRequest - params?: UploadFileQueryParams - } - >({ - mutationFn: async ({ petId, data, params }) => { - return uploadFileHook({ petId }, data, params, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useUploadFileHook(options: { + mutation?: UseMutationOptions; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? uploadFileMutationKey(); + return useMutation({ + mutationFn: async ({ petId, data, params }) => { + return uploadFileHook({ petId }, data, params, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/store/index.ts b/examples/react-query/src/gen/hooks/store/index.ts index 2856659e6..1b16c158a 100644 --- a/examples/react-query/src/gen/hooks/store/index.ts +++ b/examples/react-query/src/gen/hooks/store/index.ts @@ -1,14 +1,14 @@ -export type { DeleteOrderMutationKey } from './useDeleteOrderHook.ts' -export type { GetInventoryQueryKey } from './useGetInventoryHook.ts' -export type { GetInventorySuspenseQueryKey } from './useGetInventorySuspenseHook.ts' -export type { GetOrderByIdQueryKey } from './useGetOrderByIdHook.ts' -export type { GetOrderByIdSuspenseQueryKey } from './useGetOrderByIdSuspenseHook.ts' -export type { PlaceOrderMutationKey } from './usePlaceOrderHook.ts' -export type { PlaceOrderPatchMutationKey } from './usePlaceOrderPatchHook.ts' -export { deleteOrderMutationKey, useDeleteOrderHook } from './useDeleteOrderHook.ts' -export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './useGetInventoryHook.ts' -export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './useGetInventorySuspenseHook.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './useGetOrderByIdHook.ts' -export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './useGetOrderByIdSuspenseHook.ts' -export { placeOrderMutationKey, usePlaceOrderHook } from './usePlaceOrderHook.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './usePlaceOrderPatchHook.ts' +export type { DeleteOrderMutationKey } from "./useDeleteOrderHook"; +export type { GetInventoryQueryKey } from "./useGetInventoryHook"; +export type { GetInventorySuspenseQueryKey } from "./useGetInventorySuspenseHook"; +export type { GetOrderByIdQueryKey } from "./useGetOrderByIdHook"; +export type { GetOrderByIdSuspenseQueryKey } from "./useGetOrderByIdSuspenseHook"; +export type { PlaceOrderMutationKey } from "./usePlaceOrderHook"; +export type { PlaceOrderPatchMutationKey } from "./usePlaceOrderPatchHook"; +export { deleteOrderMutationKey, useDeleteOrderHook } from "./useDeleteOrderHook"; +export { getInventoryQueryKey, getInventoryQueryOptionsHook } from "./useGetInventoryHook"; +export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from "./useGetInventorySuspenseHook"; +export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from "./useGetOrderByIdHook"; +export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from "./useGetOrderByIdSuspenseHook"; +export { placeOrderMutationKey, usePlaceOrderHook } from "./usePlaceOrderHook"; +export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from "./usePlaceOrderPatchHook"; \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts index 0469eb661..03bec6913 100644 --- a/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts @@ -1,64 +1,45 @@ -import client from '@kubb/plugin-client/client' -import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../../models/DeleteOrder.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from "../../models/DeleteOrder"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const deleteOrderMutationKey = () => [{ url: '/store/order/{orderId}' }] as const + export const deleteOrderMutationKey = () => [{ "url": "/store/order/{orderId}" }] as const; -export type DeleteOrderMutationKey = ReturnType + export type DeleteOrderMutationKey = ReturnType; -/** + /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -async function deleteOrderHook( - { - orderId, - }: { - orderId: DeleteOrderPathParams['orderId'] - }, - config: Partial = {}, -) { - const res = await client({ - method: 'DELETE', - url: `/store/order/${orderId}`, - ...config, - }) - return res.data +async function deleteOrderHook({ orderId }: { + orderId: DeleteOrderPathParams["orderId"]; +}, config: Partial = {}) { + const res = await client({ method: "DELETE", url: `/store/order/${orderId}`, ...config }); + return res.data; } -/** + /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -export function useDeleteOrderHook( - options: { - mutation?: UseMutationOptions< - DeleteOrderMutationResponse, - DeleteOrder400 | DeleteOrder404, - { - orderId: DeleteOrderPathParams['orderId'] - } - > - client?: Partial - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? deleteOrderMutationKey() - return useMutation< - DeleteOrderMutationResponse, - DeleteOrder400 | DeleteOrder404, - { - orderId: DeleteOrderPathParams['orderId'] - } - >({ - mutationFn: async ({ orderId }) => { - return deleteOrderHook({ orderId }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useDeleteOrderHook(options: { + mutation?: UseMutationOptions; + client?: Partial; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? deleteOrderMutationKey(); + return useMutation({ + mutationFn: async ({ orderId }) => { + return deleteOrderHook({ orderId }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts b/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts index be32156ca..64d3bab58 100644 --- a/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts @@ -1,29 +1,29 @@ -import client from '@kubb/plugin-client/client' -import type { GetInventoryQueryResponse } from '../../models/GetInventory.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import { queryOptions } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { GetInventoryQueryResponse } from "../../models/GetInventory"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import { queryOptions } from "@tanstack/react-query"; -export const getInventoryQueryKey = () => ['v5', { url: '/store/inventory' }] as const + export const getInventoryQueryKey = () => ["v5", { url: "/store/inventory" }] as const; -export type GetInventoryQueryKey = ReturnType + export type GetInventoryQueryKey = ReturnType; -/** + /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * {@link /store/inventory} */ async function getInventoryHook(config: Partial = {}) { - const res = await client({ method: 'GET', url: '/store/inventory', ...config }) - return res.data + const res = await client({ method: "GET", url: `/store/inventory`, ...config }); + return res.data; } -export function getInventoryQueryOptionsHook(config: Partial = {}) { - const queryKey = getInventoryQueryKey() - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getInventoryHook(config) - }, - }) -} + export function getInventoryQueryOptionsHook(config: Partial = {}) { + const queryKey = getInventoryQueryKey(); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getInventoryHook(config); + }, + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts index 275ccb979..99f55d0c2 100644 --- a/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts @@ -1,58 +1,52 @@ -import client from '@kubb/plugin-client/client' -import type { GetInventoryQueryResponse } from '../../models/GetInventory.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { GetInventoryQueryResponse } from "../../models/GetInventory"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getInventorySuspenseQueryKey = () => ['v5', { url: '/store/inventory' }] as const + export const getInventorySuspenseQueryKey = () => ["v5", { url: "/store/inventory" }] as const; -export type GetInventorySuspenseQueryKey = ReturnType + export type GetInventorySuspenseQueryKey = ReturnType; -/** + /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * {@link /store/inventory} */ async function getInventoryHook(config: Partial = {}) { - const res = await client({ method: 'GET', url: '/store/inventory', ...config }) - return res.data + const res = await client({ method: "GET", url: `/store/inventory`, ...config }); + return res.data; } -export function getInventorySuspenseQueryOptionsHook(config: Partial = {}) { - const queryKey = getInventorySuspenseQueryKey() - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getInventoryHook(config) - }, - }) + export function getInventorySuspenseQueryOptionsHook(config: Partial = {}) { + const queryKey = getInventorySuspenseQueryKey(); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getInventoryHook(config); + }, + }); } -/** + /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * {@link /store/inventory} */ -export function useGetInventorySuspenseHook< - TData = GetInventoryQueryResponse, - TQueryData = GetInventoryQueryResponse, - TQueryKey extends QueryKey = GetInventorySuspenseQueryKey, ->( - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getInventorySuspenseQueryKey() - const query = useSuspenseQuery({ - ...(getInventorySuspenseQueryOptionsHook(config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetInventorySuspenseHook(options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getInventorySuspenseQueryKey(); + const query = useSuspenseQuery({ + ...getInventorySuspenseQueryOptionsHook(config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts index c7080ac75..efc27486a 100644 --- a/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts @@ -1,82 +1,61 @@ -import client from '@kubb/plugin-client/client' -import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../../models/GetOrderById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' -import { queryOptions, useQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from "../../models/GetOrderById"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getOrderByIdQueryKey = ({ - orderId, -}: { - orderId: GetOrderByIdPathParams['orderId'] -}) => ['v5', { url: '/store/order/:orderId', params: { orderId: orderId } }] as const + export const getOrderByIdQueryKey = ({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}) => ["v5", { url: "/store/order/:orderId", params: { orderId: orderId } }] as const; -export type GetOrderByIdQueryKey = ReturnType + export type GetOrderByIdQueryKey = ReturnType; -/** + /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderByIdHook( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/store/order/${orderId}`, ...config }) - return res.data +async function getOrderByIdHook({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/store/order/${orderId}`, ...config }); + return res.data; } -export function getOrderByIdQueryOptionsHook( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { - const queryKey = getOrderByIdQueryKey({ orderId }) - return queryOptions({ - enabled: !!orderId, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getOrderByIdHook({ orderId }, config) - }, - }) + export function getOrderByIdQueryOptionsHook({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}, config: Partial = {}) { + const queryKey = getOrderByIdQueryKey({ orderId }); + return queryOptions({ + enabled: !!(orderId), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getOrderByIdHook({ orderId }, config); + }, + }); } -/** + /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -export function useGetOrderByIdHook< - TData = GetOrderByIdQueryResponse, - TQueryData = GetOrderByIdQueryResponse, - TQueryKey extends QueryKey = GetOrderByIdQueryKey, ->( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey({ orderId }) - const query = useQuery({ - ...(getOrderByIdQueryOptionsHook({ orderId }, config) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetOrderByIdHook({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey({ orderId }); + const query = useQuery({ + ...getOrderByIdQueryOptionsHook({ orderId }, config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts index 243465957..c5ffeb59b 100644 --- a/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts @@ -1,82 +1,61 @@ -import client from '@kubb/plugin-client/client' -import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../../models/GetOrderById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from "../../models/GetOrderById"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getOrderByIdSuspenseQueryKey = ({ - orderId, -}: { - orderId: GetOrderByIdPathParams['orderId'] -}) => ['v5', { url: '/store/order/:orderId', params: { orderId: orderId } }] as const + export const getOrderByIdSuspenseQueryKey = ({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}) => ["v5", { url: "/store/order/:orderId", params: { orderId: orderId } }] as const; -export type GetOrderByIdSuspenseQueryKey = ReturnType + export type GetOrderByIdSuspenseQueryKey = ReturnType; -/** + /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderByIdHook( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/store/order/${orderId}`, ...config }) - return res.data +async function getOrderByIdHook({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/store/order/${orderId}`, ...config }); + return res.data; } -export function getOrderByIdSuspenseQueryOptionsHook( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { - const queryKey = getOrderByIdSuspenseQueryKey({ orderId }) - return queryOptions({ - enabled: !!orderId, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getOrderByIdHook({ orderId }, config) - }, - }) + export function getOrderByIdSuspenseQueryOptionsHook({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}, config: Partial = {}) { + const queryKey = getOrderByIdSuspenseQueryKey({ orderId }); + return queryOptions({ + enabled: !!(orderId), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getOrderByIdHook({ orderId }, config); + }, + }); } -/** + /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -export function useGetOrderByIdSuspenseHook< - TData = GetOrderByIdQueryResponse, - TQueryData = GetOrderByIdQueryResponse, - TQueryKey extends QueryKey = GetOrderByIdSuspenseQueryKey, ->( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getOrderByIdSuspenseQueryKey({ orderId }) - const query = useSuspenseQuery({ - ...(getOrderByIdSuspenseQueryOptionsHook({ orderId }, config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetOrderByIdSuspenseHook({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getOrderByIdSuspenseQueryKey({ orderId }); + const query = useSuspenseQuery({ + ...getOrderByIdSuspenseQueryOptionsHook({ orderId }, config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts index cd58a2434..ef0ee936a 100644 --- a/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts @@ -1,53 +1,43 @@ -import client from '@kubb/plugin-client/client' -import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../../models/PlaceOrder.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from "../../models/PlaceOrder"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const placeOrderMutationKey = () => [{ url: '/store/order' }] as const + export const placeOrderMutationKey = () => [{ "url": "/store/order" }] as const; -export type PlaceOrderMutationKey = ReturnType + export type PlaceOrderMutationKey = ReturnType; -/** + /** * @description Place a new order in the store * @summary Place an order for a pet * {@link /store/order} */ async function placeOrderHook(data?: PlaceOrderMutationRequest, config: Partial> = {}) { - const res = await client({ method: 'POST', url: '/store/order', data, ...config }) - return res.data + const res = await client({ method: "POST", url: `/store/order`, data, ...config }); + return res.data; } -/** + /** * @description Place a new order in the store * @summary Place an order for a pet * {@link /store/order} */ -export function usePlaceOrderHook( - options: { - mutation?: UseMutationOptions< - PlaceOrderMutationResponse, - PlaceOrder405, - { - data?: PlaceOrderMutationRequest - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? placeOrderMutationKey() - return useMutation< - PlaceOrderMutationResponse, - PlaceOrder405, - { - data?: PlaceOrderMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return placeOrderHook(data, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function usePlaceOrderHook(options: { + mutation?: UseMutationOptions; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? placeOrderMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return placeOrderHook(data, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts b/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts index b28f96123..5ffb0574b 100644 --- a/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts @@ -1,58 +1,43 @@ -import client from '@kubb/plugin-client/client' -import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from '../../models/PlaceOrderPatch.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from "../../models/PlaceOrderPatch"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const placeOrderPatchMutationKey = () => [{ url: '/store/order' }] as const + export const placeOrderPatchMutationKey = () => [{ "url": "/store/order" }] as const; -export type PlaceOrderPatchMutationKey = ReturnType + export type PlaceOrderPatchMutationKey = ReturnType; -/** + /** * @description Place a new order in the store with patch * @summary Place an order for a pet with patch * {@link /store/order} */ async function placeOrderPatchHook(data?: PlaceOrderPatchMutationRequest, config: Partial> = {}) { - const res = await client({ - method: 'PATCH', - url: '/store/order', - data, - ...config, - }) - return res.data + const res = await client({ method: "PATCH", url: `/store/order`, data, ...config }); + return res.data; } -/** + /** * @description Place a new order in the store with patch * @summary Place an order for a pet with patch * {@link /store/order} */ -export function usePlaceOrderPatchHook( - options: { - mutation?: UseMutationOptions< - PlaceOrderPatchMutationResponse, - PlaceOrderPatch405, - { - data?: PlaceOrderPatchMutationRequest - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? placeOrderPatchMutationKey() - return useMutation< - PlaceOrderPatchMutationResponse, - PlaceOrderPatch405, - { - data?: PlaceOrderPatchMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return placeOrderPatchHook(data, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function usePlaceOrderPatchHook(options: { + mutation?: UseMutationOptions; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? placeOrderPatchMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return placeOrderPatchHook(data, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/index.ts b/examples/react-query/src/gen/hooks/user/index.ts index 6988fc7a3..dd928e603 100644 --- a/examples/react-query/src/gen/hooks/user/index.ts +++ b/examples/react-query/src/gen/hooks/user/index.ts @@ -1,20 +1,20 @@ -export type { CreateUserMutationKey } from './useCreateUserHook.ts' -export type { CreateUsersWithListInputMutationKey } from './useCreateUsersWithListInputHook.ts' -export type { DeleteUserMutationKey } from './useDeleteUserHook.ts' -export type { GetUserByNameQueryKey } from './useGetUserByNameHook.ts' -export type { GetUserByNameSuspenseQueryKey } from './useGetUserByNameSuspenseHook.ts' -export type { LoginUserQueryKey } from './useLoginUserHook.ts' -export type { LoginUserSuspenseQueryKey } from './useLoginUserSuspenseHook.ts' -export type { LogoutUserQueryKey } from './useLogoutUserHook.ts' -export type { LogoutUserSuspenseQueryKey } from './useLogoutUserSuspenseHook.ts' -export type { UpdateUserMutationKey } from './useUpdateUserHook.ts' -export { createUserMutationKey, useCreateUserHook } from './useCreateUserHook.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './useCreateUsersWithListInputHook.ts' -export { deleteUserMutationKey, useDeleteUserHook } from './useDeleteUserHook.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './useGetUserByNameHook.ts' -export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from './useGetUserByNameSuspenseHook.ts' -export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './useLoginUserHook.ts' -export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './useLoginUserSuspenseHook.ts' -export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './useLogoutUserHook.ts' -export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './useLogoutUserSuspenseHook.ts' -export { updateUserMutationKey, useUpdateUserHook } from './useUpdateUserHook.ts' +export type { CreateUserMutationKey } from "./useCreateUserHook"; +export type { CreateUsersWithListInputMutationKey } from "./useCreateUsersWithListInputHook"; +export type { DeleteUserMutationKey } from "./useDeleteUserHook"; +export type { GetUserByNameQueryKey } from "./useGetUserByNameHook"; +export type { GetUserByNameSuspenseQueryKey } from "./useGetUserByNameSuspenseHook"; +export type { LoginUserQueryKey } from "./useLoginUserHook"; +export type { LoginUserSuspenseQueryKey } from "./useLoginUserSuspenseHook"; +export type { LogoutUserQueryKey } from "./useLogoutUserHook"; +export type { LogoutUserSuspenseQueryKey } from "./useLogoutUserSuspenseHook"; +export type { UpdateUserMutationKey } from "./useUpdateUserHook"; +export { createUserMutationKey, useCreateUserHook } from "./useCreateUserHook"; +export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from "./useCreateUsersWithListInputHook"; +export { deleteUserMutationKey, useDeleteUserHook } from "./useDeleteUserHook"; +export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from "./useGetUserByNameHook"; +export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from "./useGetUserByNameSuspenseHook"; +export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from "./useLoginUserHook"; +export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from "./useLoginUserSuspenseHook"; +export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from "./useLogoutUserHook"; +export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from "./useLogoutUserSuspenseHook"; +export { updateUserMutationKey, useUpdateUserHook } from "./useUpdateUserHook"; \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts index 5bb722338..b0d4af240 100644 --- a/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts @@ -1,53 +1,43 @@ -import client from '@kubb/plugin-client/client' -import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/CreateUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { CreateUserMutationRequest, CreateUserMutationResponse } from "../../models/CreateUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const createUserMutationKey = () => [{ url: '/user' }] as const + export const createUserMutationKey = () => [{ "url": "/user" }] as const; -export type CreateUserMutationKey = ReturnType + export type CreateUserMutationKey = ReturnType; -/** + /** * @description This can only be done by the logged in user. * @summary Create user * {@link /user} */ async function createUserHook(data?: CreateUserMutationRequest, config: Partial> = {}) { - const res = await client({ method: 'POST', url: '/user', data, ...config }) - return res.data + const res = await client({ method: "POST", url: `/user`, data, ...config }); + return res.data; } -/** + /** * @description This can only be done by the logged in user. * @summary Create user * {@link /user} */ -export function useCreateUserHook( - options: { - mutation?: UseMutationOptions< - CreateUserMutationResponse, - Error, - { - data?: CreateUserMutationRequest - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? createUserMutationKey() - return useMutation< - CreateUserMutationResponse, - Error, - { - data?: CreateUserMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return createUserHook(data, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useCreateUserHook(options: { + mutation?: UseMutationOptions; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? createUserMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return createUserHook(data, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts b/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts index 8fb9abfc3..d72e980ef 100644 --- a/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts @@ -1,61 +1,43 @@ -import client from '@kubb/plugin-client/client' -import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../../models/CreateUsersWithListInput.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from "../../models/CreateUsersWithListInput"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const createUsersWithListInputMutationKey = () => [{ url: '/user/createWithList' }] as const + export const createUsersWithListInputMutationKey = () => [{ "url": "/user/createWithList" }] as const; -export type CreateUsersWithListInputMutationKey = ReturnType + export type CreateUsersWithListInputMutationKey = ReturnType; -/** + /** * @description Creates list of users with given input array * @summary Creates list of users with given input array * {@link /user/createWithList} */ -async function createUsersWithListInputHook( - data?: CreateUsersWithListInputMutationRequest, - config: Partial> = {}, -) { - const res = await client({ - method: 'POST', - url: '/user/createWithList', - data, - ...config, - }) - return res.data +async function createUsersWithListInputHook(data?: CreateUsersWithListInputMutationRequest, config: Partial> = {}) { + const res = await client({ method: "POST", url: `/user/createWithList`, data, ...config }); + return res.data; } -/** + /** * @description Creates list of users with given input array * @summary Creates list of users with given input array * {@link /user/createWithList} */ -export function useCreateUsersWithListInputHook( - options: { - mutation?: UseMutationOptions< - CreateUsersWithListInputMutationResponse, - Error, - { - data?: CreateUsersWithListInputMutationRequest - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? createUsersWithListInputMutationKey() - return useMutation< - CreateUsersWithListInputMutationResponse, - Error, - { - data?: CreateUsersWithListInputMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return createUsersWithListInputHook(data, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useCreateUsersWithListInputHook(options: { + mutation?: UseMutationOptions; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? createUsersWithListInputMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return createUsersWithListInputHook(data, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts b/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts index 8ed31002d..c05832098 100644 --- a/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts @@ -1,60 +1,45 @@ -import client from '@kubb/plugin-client/client' -import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../../models/DeleteUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from "../../models/DeleteUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const deleteUserMutationKey = () => [{ url: '/user/{username}' }] as const + export const deleteUserMutationKey = () => [{ "url": "/user/{username}" }] as const; -export type DeleteUserMutationKey = ReturnType + export type DeleteUserMutationKey = ReturnType; -/** + /** * @description This can only be done by the logged in user. * @summary Delete user * {@link /user/:username} */ -async function deleteUserHook( - { - username, - }: { - username: DeleteUserPathParams['username'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'DELETE', url: `/user/${username}`, ...config }) - return res.data +async function deleteUserHook({ username }: { + username: DeleteUserPathParams["username"]; +}, config: Partial = {}) { + const res = await client({ method: "DELETE", url: `/user/${username}`, ...config }); + return res.data; } -/** + /** * @description This can only be done by the logged in user. * @summary Delete user * {@link /user/:username} */ -export function useDeleteUserHook( - options: { - mutation?: UseMutationOptions< - DeleteUserMutationResponse, - DeleteUser400 | DeleteUser404, - { - username: DeleteUserPathParams['username'] - } - > - client?: Partial - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? deleteUserMutationKey() - return useMutation< - DeleteUserMutationResponse, - DeleteUser400 | DeleteUser404, - { - username: DeleteUserPathParams['username'] - } - >({ - mutationFn: async ({ username }) => { - return deleteUserHook({ username }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useDeleteUserHook(options: { + mutation?: UseMutationOptions; + client?: Partial; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? deleteUserMutationKey(); + return useMutation({ + mutationFn: async ({ username }) => { + return deleteUserHook({ username }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts b/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts index c44afdff5..53c81d3be 100644 --- a/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts @@ -1,80 +1,59 @@ -import client from '@kubb/plugin-client/client' -import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../../models/GetUserByName.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' -import { queryOptions, useQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from "../../models/GetUserByName"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; -export const getUserByNameQueryKey = ({ - username, -}: { - username: GetUserByNamePathParams['username'] -}) => ['v5', { url: '/user/:username', params: { username: username } }] as const + export const getUserByNameQueryKey = ({ username }: { + username: GetUserByNamePathParams["username"]; +}) => ["v5", { url: "/user/:username", params: { username: username } }] as const; -export type GetUserByNameQueryKey = ReturnType + export type GetUserByNameQueryKey = ReturnType; -/** + /** * @summary Get user by user name * {@link /user/:username} */ -async function getUserByNameHook( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/user/${username}`, ...config }) - return res.data +async function getUserByNameHook({ username }: { + username: GetUserByNamePathParams["username"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/user/${username}`, ...config }); + return res.data; } -export function getUserByNameQueryOptionsHook( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { - const queryKey = getUserByNameQueryKey({ username }) - return queryOptions({ - enabled: !!username, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getUserByNameHook({ username }, config) - }, - }) + export function getUserByNameQueryOptionsHook({ username }: { + username: GetUserByNamePathParams["username"]; +}, config: Partial = {}) { + const queryKey = getUserByNameQueryKey({ username }); + return queryOptions({ + enabled: !!(username), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getUserByNameHook({ username }, config); + }, + }); } -/** + /** * @summary Get user by user name * {@link /user/:username} */ -export function useGetUserByNameHook< - TData = GetUserByNameQueryResponse, - TQueryData = GetUserByNameQueryResponse, - TQueryKey extends QueryKey = GetUserByNameQueryKey, ->( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey({ username }) - const query = useQuery({ - ...(getUserByNameQueryOptionsHook({ username }, config) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetUserByNameHook({ username }: { + username: GetUserByNamePathParams["username"]; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey({ username }); + const query = useQuery({ + ...getUserByNameQueryOptionsHook({ username }, config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts index 9fb561079..7f9701658 100644 --- a/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts @@ -1,80 +1,59 @@ -import client from '@kubb/plugin-client/client' -import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../../models/GetUserByName.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from "../../models/GetUserByName"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const getUserByNameSuspenseQueryKey = ({ - username, -}: { - username: GetUserByNamePathParams['username'] -}) => ['v5', { url: '/user/:username', params: { username: username } }] as const + export const getUserByNameSuspenseQueryKey = ({ username }: { + username: GetUserByNamePathParams["username"]; +}) => ["v5", { url: "/user/:username", params: { username: username } }] as const; -export type GetUserByNameSuspenseQueryKey = ReturnType + export type GetUserByNameSuspenseQueryKey = ReturnType; -/** + /** * @summary Get user by user name * {@link /user/:username} */ -async function getUserByNameHook( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/user/${username}`, ...config }) - return res.data +async function getUserByNameHook({ username }: { + username: GetUserByNamePathParams["username"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/user/${username}`, ...config }); + return res.data; } -export function getUserByNameSuspenseQueryOptionsHook( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { - const queryKey = getUserByNameSuspenseQueryKey({ username }) - return queryOptions({ - enabled: !!username, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getUserByNameHook({ username }, config) - }, - }) + export function getUserByNameSuspenseQueryOptionsHook({ username }: { + username: GetUserByNamePathParams["username"]; +}, config: Partial = {}) { + const queryKey = getUserByNameSuspenseQueryKey({ username }); + return queryOptions({ + enabled: !!(username), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getUserByNameHook({ username }, config); + }, + }); } -/** + /** * @summary Get user by user name * {@link /user/:username} */ -export function useGetUserByNameSuspenseHook< - TData = GetUserByNameQueryResponse, - TQueryData = GetUserByNameQueryResponse, - TQueryKey extends QueryKey = GetUserByNameSuspenseQueryKey, ->( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getUserByNameSuspenseQueryKey({ username }) - const query = useSuspenseQuery({ - ...(getUserByNameSuspenseQueryOptionsHook({ username }, config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetUserByNameSuspenseHook({ username }: { + username: GetUserByNamePathParams["username"]; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getUserByNameSuspenseQueryKey({ username }); + const query = useSuspenseQuery({ + ...getUserByNameSuspenseQueryOptionsHook({ username }, config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts index 392424142..376c45b9c 100644 --- a/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts @@ -1,53 +1,50 @@ -import client from '@kubb/plugin-client/client' -import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../models/LoginUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' -import { queryOptions, useQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from "../../models/LoginUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; -export const loginUserQueryKey = (params?: LoginUserQueryParams) => ['v5', { url: '/user/login' }, ...(params ? [params] : [])] as const + export const loginUserQueryKey = (params?: LoginUserQueryParams) => ["v5", { url: "/user/login" }, ...(params ? [params] : [])] as const; -export type LoginUserQueryKey = ReturnType + export type LoginUserQueryKey = ReturnType; -/** + /** * @summary Logs user into the system * {@link /user/login} */ async function loginUserHook(params?: LoginUserQueryParams, config: Partial = {}) { - const res = await client({ method: 'GET', url: '/user/login', params, ...config }) - return res.data + const res = await client({ method: "GET", url: `/user/login`, params, ...config }); + return res.data; } -export function loginUserQueryOptionsHook(params?: LoginUserQueryParams, config: Partial = {}) { - const queryKey = loginUserQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return loginUserHook(params, config) - }, - }) + export function loginUserQueryOptionsHook(params?: LoginUserQueryParams, config: Partial = {}) { + const queryKey = loginUserQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return loginUserHook(params, config); + }, + }); } -/** + /** * @summary Logs user into the system * {@link /user/login} */ -export function useLoginUserHook( - params?: LoginUserQueryParams, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params) - const query = useQuery({ - ...(loginUserQueryOptionsHook(params, config) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useLoginUserHook(params?: LoginUserQueryParams, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params); + const query = useQuery({ + ...loginUserQueryOptionsHook(params, config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts index ce9a46528..76e773cf4 100644 --- a/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts @@ -1,57 +1,50 @@ -import client from '@kubb/plugin-client/client' -import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../models/LoginUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from "../../models/LoginUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const loginUserSuspenseQueryKey = (params?: LoginUserQueryParams) => ['v5', { url: '/user/login' }, ...(params ? [params] : [])] as const + export const loginUserSuspenseQueryKey = (params?: LoginUserQueryParams) => ["v5", { url: "/user/login" }, ...(params ? [params] : [])] as const; -export type LoginUserSuspenseQueryKey = ReturnType + export type LoginUserSuspenseQueryKey = ReturnType; -/** + /** * @summary Logs user into the system * {@link /user/login} */ async function loginUserHook(params?: LoginUserQueryParams, config: Partial = {}) { - const res = await client({ method: 'GET', url: '/user/login', params, ...config }) - return res.data + const res = await client({ method: "GET", url: `/user/login`, params, ...config }); + return res.data; } -export function loginUserSuspenseQueryOptionsHook(params?: LoginUserQueryParams, config: Partial = {}) { - const queryKey = loginUserSuspenseQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return loginUserHook(params, config) - }, - }) + export function loginUserSuspenseQueryOptionsHook(params?: LoginUserQueryParams, config: Partial = {}) { + const queryKey = loginUserSuspenseQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return loginUserHook(params, config); + }, + }); } -/** + /** * @summary Logs user into the system * {@link /user/login} */ -export function useLoginUserSuspenseHook< - TData = LoginUserQueryResponse, - TQueryData = LoginUserQueryResponse, - TQueryKey extends QueryKey = LoginUserSuspenseQueryKey, ->( - params?: LoginUserQueryParams, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? loginUserSuspenseQueryKey(params) - const query = useSuspenseQuery({ - ...(loginUserSuspenseQueryOptionsHook(params, config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useLoginUserSuspenseHook(params?: LoginUserQueryParams, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? loginUserSuspenseQueryKey(params); + const query = useSuspenseQuery({ + ...loginUserSuspenseQueryOptionsHook(params, config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts index 879101dc3..6d7f6a2cc 100644 --- a/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts @@ -1,52 +1,50 @@ -import client from '@kubb/plugin-client/client' -import type { LogoutUserQueryResponse } from '../../models/LogoutUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' -import { queryOptions, useQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { LogoutUserQueryResponse } from "../../models/LogoutUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useQuery } from "@tanstack/react-query"; -export const logoutUserQueryKey = () => ['v5', { url: '/user/logout' }] as const + export const logoutUserQueryKey = () => ["v5", { url: "/user/logout" }] as const; -export type LogoutUserQueryKey = ReturnType + export type LogoutUserQueryKey = ReturnType; -/** + /** * @summary Logs out current logged in user session * {@link /user/logout} */ async function logoutUserHook(config: Partial = {}) { - const res = await client({ method: 'GET', url: '/user/logout', ...config }) - return res.data + const res = await client({ method: "GET", url: `/user/logout`, ...config }); + return res.data; } -export function logoutUserQueryOptionsHook(config: Partial = {}) { - const queryKey = logoutUserQueryKey() - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return logoutUserHook(config) - }, - }) + export function logoutUserQueryOptionsHook(config: Partial = {}) { + const queryKey = logoutUserQueryKey(); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return logoutUserHook(config); + }, + }); } -/** + /** * @summary Logs out current logged in user session * {@link /user/logout} */ -export function useLogoutUserHook( - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey() - const query = useQuery({ - ...(logoutUserQueryOptionsHook(config) as unknown as QueryObserverOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useLogoutUserHook(options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey(); + const query = useQuery({ + ...logoutUserQueryOptionsHook(config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts index 13baebdc5..fe6dde7b7 100644 --- a/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts @@ -1,56 +1,50 @@ -import client from '@kubb/plugin-client/client' -import type { LogoutUserQueryResponse } from '../../models/LogoutUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' -import { queryOptions, useSuspenseQuery } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { LogoutUserQueryResponse } from "../../models/LogoutUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; -export const logoutUserSuspenseQueryKey = () => ['v5', { url: '/user/logout' }] as const + export const logoutUserSuspenseQueryKey = () => ["v5", { url: "/user/logout" }] as const; -export type LogoutUserSuspenseQueryKey = ReturnType + export type LogoutUserSuspenseQueryKey = ReturnType; -/** + /** * @summary Logs out current logged in user session * {@link /user/logout} */ async function logoutUserHook(config: Partial = {}) { - const res = await client({ method: 'GET', url: '/user/logout', ...config }) - return res.data + const res = await client({ method: "GET", url: `/user/logout`, ...config }); + return res.data; } -export function logoutUserSuspenseQueryOptionsHook(config: Partial = {}) { - const queryKey = logoutUserSuspenseQueryKey() - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return logoutUserHook(config) - }, - }) + export function logoutUserSuspenseQueryOptionsHook(config: Partial = {}) { + const queryKey = logoutUserSuspenseQueryKey(); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return logoutUserHook(config); + }, + }); } -/** + /** * @summary Logs out current logged in user session * {@link /user/logout} */ -export function useLogoutUserSuspenseHook< - TData = LogoutUserQueryResponse, - TQueryData = LogoutUserQueryResponse, - TQueryKey extends QueryKey = LogoutUserSuspenseQueryKey, ->( - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? logoutUserSuspenseQueryKey() - const query = useSuspenseQuery({ - ...(logoutUserSuspenseQueryOptionsHook(config) as unknown as UseSuspenseQueryOptions), - queryKey, - ...(queryOptions as unknown as Omit), - }) as UseSuspenseQueryResult & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useLogoutUserSuspenseHook(options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? logoutUserSuspenseQueryKey(); + const query = useSuspenseQuery({ + ...logoutUserSuspenseQueryOptionsHook(config) as unknown as UseSuspenseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseSuspenseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts index 32b20b0d5..6a9d4256a 100644 --- a/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts @@ -1,63 +1,47 @@ -import client from '@kubb/plugin-client/client' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/UpdateUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { UseMutationOptions } from '@tanstack/react-query' -import { useMutation } from '@tanstack/react-query' +import client from "@kubb/plugin-client/client"; +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from "../../models/UpdateUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { UseMutationOptions } from "@tanstack/react-query"; +import { useMutation } from "@tanstack/react-query"; -export const updateUserMutationKey = () => [{ url: '/user/{username}' }] as const + export const updateUserMutationKey = () => [{ "url": "/user/{username}" }] as const; -export type UpdateUserMutationKey = ReturnType + export type UpdateUserMutationKey = ReturnType; -/** + /** * @description This can only be done by the logged in user. * @summary Update user * {@link /user/:username} */ -async function updateUserHook( - { - username, - }: { - username: UpdateUserPathParams['username'] - }, - data?: UpdateUserMutationRequest, - config: Partial> = {}, -) { - const res = await client({ method: 'PUT', url: `/user/${username}`, data, ...config }) - return res.data +async function updateUserHook({ username }: { + username: UpdateUserPathParams["username"]; +}, data?: UpdateUserMutationRequest, config: Partial> = {}) { + const res = await client({ method: "PUT", url: `/user/${username}`, data, ...config }); + return res.data; } -/** + /** * @description This can only be done by the logged in user. * @summary Update user * {@link /user/:username} */ -export function useUpdateUserHook( - options: { - mutation?: UseMutationOptions< - UpdateUserMutationResponse, - Error, - { - username: UpdateUserPathParams['username'] - data?: UpdateUserMutationRequest - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? updateUserMutationKey() - return useMutation< - UpdateUserMutationResponse, - Error, - { - username: UpdateUserPathParams['username'] - data?: UpdateUserMutationRequest - } - >({ - mutationFn: async ({ username, data }) => { - return updateUserHook({ username }, data, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useUpdateUserHook(options: { + mutation?: UseMutationOptions; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? updateUserMutationKey(); + return useMutation({ + mutationFn: async ({ username, data }) => { + return updateUserHook({ username }, data, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/react-query/src/gen/index.ts b/examples/react-query/src/gen/index.ts deleted file mode 100644 index 17f6a3417..000000000 --- a/examples/react-query/src/gen/index.ts +++ /dev/null @@ -1,175 +0,0 @@ -export type { AddPetMutationKey } from './hooks/pet/useAddPetHook.ts' -export type { DeletePetMutationKey } from './hooks/pet/useDeletePetHook.ts' -export type { FindPetsByStatusQueryKey } from './hooks/pet/useFindPetsByStatusHook.ts' -export type { FindPetsByStatusSuspenseQueryKey } from './hooks/pet/useFindPetsByStatusSuspenseHook.ts' -export type { FindPetsByTagsQueryKey } from './hooks/pet/useFindPetsByTagsHook.ts' -export type { FindPetsByTagsInfiniteQueryKey } from './hooks/pet/useFindPetsByTagsInfiniteHook.ts' -export type { FindPetsByTagsSuspenseQueryKey } from './hooks/pet/useFindPetsByTagsSuspenseHook.ts' -export type { GetPetByIdQueryKey } from './hooks/pet/useGetPetByIdHook.ts' -export type { GetPetByIdSuspenseQueryKey } from './hooks/pet/useGetPetByIdSuspenseHook.ts' -export type { UpdatePetMutationKey } from './hooks/pet/useUpdatePetHook.ts' -export type { UpdatePetWithFormQueryKey } from './hooks/pet/useUpdatePetWithFormHook.ts' -export type { UpdatePetWithFormSuspenseQueryKey } from './hooks/pet/useUpdatePetWithFormSuspenseHook.ts' -export type { UploadFileMutationKey } from './hooks/pet/useUploadFileHook.ts' -export type { DeleteOrderMutationKey } from './hooks/store/useDeleteOrderHook.ts' -export type { GetInventoryQueryKey } from './hooks/store/useGetInventoryHook.ts' -export type { GetInventorySuspenseQueryKey } from './hooks/store/useGetInventorySuspenseHook.ts' -export type { GetOrderByIdQueryKey } from './hooks/store/useGetOrderByIdHook.ts' -export type { GetOrderByIdSuspenseQueryKey } from './hooks/store/useGetOrderByIdSuspenseHook.ts' -export type { PlaceOrderMutationKey } from './hooks/store/usePlaceOrderHook.ts' -export type { PlaceOrderPatchMutationKey } from './hooks/store/usePlaceOrderPatchHook.ts' -export type { CreateUserMutationKey } from './hooks/user/useCreateUserHook.ts' -export type { CreateUsersWithListInputMutationKey } from './hooks/user/useCreateUsersWithListInputHook.ts' -export type { DeleteUserMutationKey } from './hooks/user/useDeleteUserHook.ts' -export type { GetUserByNameQueryKey } from './hooks/user/useGetUserByNameHook.ts' -export type { GetUserByNameSuspenseQueryKey } from './hooks/user/useGetUserByNameSuspenseHook.ts' -export type { LoginUserQueryKey } from './hooks/user/useLoginUserHook.ts' -export type { LoginUserSuspenseQueryKey } from './hooks/user/useLoginUserSuspenseHook.ts' -export type { LogoutUserQueryKey } from './hooks/user/useLogoutUserHook.ts' -export type { LogoutUserSuspenseQueryKey } from './hooks/user/useLogoutUserSuspenseHook.ts' -export type { UpdateUserMutationKey } from './hooks/user/useUpdateUserHook.ts' -export type { AddPet200, AddPet405, AddPetMutationRequest, AddPetMutationResponse, AddPetMutation } from './models/AddPet.ts' -export type { AddPetRequestStatusEnum, AddPetRequest } from './models/AddPetRequest.ts' -export type { Address } from './models/Address.ts' -export type { ApiResponse } from './models/ApiResponse.ts' -export type { Category } from './models/Category.ts' -export type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse, CreateUserMutation } from './models/CreateUser.ts' -export type { - CreateUsersWithListInput200, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputMutation, -} from './models/CreateUsersWithListInput.ts' -export type { Customer } from './models/Customer.ts' -export type { DeleteOrderPathParams, DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, DeleteOrderMutation } from './models/DeleteOrder.ts' -export type { DeletePetPathParams, DeletePetHeaderParams, DeletePet400, DeletePetMutationResponse, DeletePetMutation } from './models/DeletePet.ts' -export type { DeleteUserPathParams, DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUserMutation } from './models/DeleteUser.ts' -export type { - FindPetsByStatusQueryParamsStatusEnum, - FindPetsByStatusQueryParams, - FindPetsByStatus200, - FindPetsByStatus400, - FindPetsByStatusQueryResponse, - FindPetsByStatusQuery, -} from './models/FindPetsByStatus.ts' -export type { - FindPetsByTagsQueryParams, - FindPetsByTags200, - FindPetsByTags400, - FindPetsByTagsQueryResponse, - FindPetsByTagsQuery, -} from './models/FindPetsByTags.ts' -export type { GetInventory200, GetInventoryQueryResponse, GetInventoryQuery } from './models/GetInventory.ts' -export type { - GetOrderByIdPathParams, - GetOrderById200, - GetOrderById400, - GetOrderById404, - GetOrderByIdQueryResponse, - GetOrderByIdQuery, -} from './models/GetOrderById.ts' -export type { GetPetByIdPathParams, GetPetById200, GetPetById400, GetPetById404, GetPetByIdQueryResponse, GetPetByIdQuery } from './models/GetPetById.ts' -export type { - GetUserByNamePathParams, - GetUserByName200, - GetUserByName400, - GetUserByName404, - GetUserByNameQueryResponse, - GetUserByNameQuery, -} from './models/GetUserByName.ts' -export type { LoginUserQueryParams, LoginUser200, LoginUser400, LoginUserQueryResponse, LoginUserQuery } from './models/LoginUser.ts' -export type { LogoutUserError, LogoutUserQueryResponse, LogoutUserQuery } from './models/LogoutUser.ts' -export type { OrderStatusEnum, OrderHttpStatusEnum, Order } from './models/Order.ts' -export type { PetStatusEnum, Pet } from './models/Pet.ts' -export type { PetNotFound } from './models/PetNotFound.ts' -export type { PlaceOrder200, PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrderMutation } from './models/PlaceOrder.ts' -export type { - PlaceOrderPatch200, - PlaceOrderPatch405, - PlaceOrderPatchMutationRequest, - PlaceOrderPatchMutationResponse, - PlaceOrderPatchMutation, -} from './models/PlaceOrderPatch.ts' -export type { Tag } from './models/Tag.ts' -export type { - UpdatePet200, - UpdatePet400, - UpdatePet404, - UpdatePet405, - UpdatePetMutationRequest, - UpdatePetMutationResponse, - UpdatePetMutation, -} from './models/UpdatePet.ts' -export type { - UpdatePetWithFormPathParams, - UpdatePetWithFormQueryParams, - UpdatePetWithForm405, - UpdatePetWithFormMutationResponse, - UpdatePetWithFormMutation, -} from './models/UpdatePetWithForm.ts' -export type { UpdateUserPathParams, UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserMutation } from './models/UpdateUser.ts' -export type { - UploadFilePathParams, - UploadFileQueryParams, - UploadFile200, - UploadFileMutationRequest, - UploadFileMutationResponse, - UploadFileMutation, -} from './models/UploadFile.ts' -export type { User } from './models/User.ts' -export type { UserArray } from './models/UserArray.ts' -export { addPetMutationKey, useAddPetHook } from './hooks/pet/useAddPetHook.ts' -export { deletePetMutationKey, useDeletePetHook } from './hooks/pet/useDeletePetHook.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './hooks/pet/useFindPetsByStatusHook.ts' -export { - findPetsByStatusSuspenseQueryKey, - findPetsByStatusSuspenseQueryOptionsHook, - useFindPetsByStatusSuspenseHook, -} from './hooks/pet/useFindPetsByStatusSuspenseHook.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './hooks/pet/useFindPetsByTagsHook.ts' -export { - findPetsByTagsInfiniteQueryKey, - findPetsByTagsInfiniteQueryOptionsHook, - useFindPetsByTagsInfiniteHook, -} from './hooks/pet/useFindPetsByTagsInfiniteHook.ts' -export { - findPetsByTagsSuspenseQueryKey, - findPetsByTagsSuspenseQueryOptionsHook, - useFindPetsByTagsSuspenseHook, -} from './hooks/pet/useFindPetsByTagsSuspenseHook.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './hooks/pet/useGetPetByIdHook.ts' -export { getPetByIdSuspenseQueryKey, getPetByIdSuspenseQueryOptionsHook, useGetPetByIdSuspenseHook } from './hooks/pet/useGetPetByIdSuspenseHook.ts' -export { updatePetMutationKey, useUpdatePetHook } from './hooks/pet/useUpdatePetHook.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './hooks/pet/useUpdatePetWithFormHook.ts' -export { - updatePetWithFormSuspenseQueryKey, - updatePetWithFormSuspenseQueryOptionsHook, - useUpdatePetWithFormSuspenseHook, -} from './hooks/pet/useUpdatePetWithFormSuspenseHook.ts' -export { uploadFileMutationKey, useUploadFileHook } from './hooks/pet/useUploadFileHook.ts' -export { deleteOrderMutationKey, useDeleteOrderHook } from './hooks/store/useDeleteOrderHook.ts' -export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './hooks/store/useGetInventoryHook.ts' -export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './hooks/store/useGetInventorySuspenseHook.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './hooks/store/useGetOrderByIdHook.ts' -export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './hooks/store/useGetOrderByIdSuspenseHook.ts' -export { placeOrderMutationKey, usePlaceOrderHook } from './hooks/store/usePlaceOrderHook.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './hooks/store/usePlaceOrderPatchHook.ts' -export { createUserMutationKey, useCreateUserHook } from './hooks/user/useCreateUserHook.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './hooks/user/useCreateUsersWithListInputHook.ts' -export { deleteUserMutationKey, useDeleteUserHook } from './hooks/user/useDeleteUserHook.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './hooks/user/useGetUserByNameHook.ts' -export { - getUserByNameSuspenseQueryKey, - getUserByNameSuspenseQueryOptionsHook, - useGetUserByNameSuspenseHook, -} from './hooks/user/useGetUserByNameSuspenseHook.ts' -export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './hooks/user/useLoginUserHook.ts' -export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './hooks/user/useLoginUserSuspenseHook.ts' -export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './hooks/user/useLogoutUserHook.ts' -export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './hooks/user/useLogoutUserSuspenseHook.ts' -export { updateUserMutationKey, useUpdateUserHook } from './hooks/user/useUpdateUserHook.ts' -export { addPetRequestStatusEnum } from './models/AddPetRequest.ts' -export { findPetsByStatusQueryParamsStatusEnum } from './models/FindPetsByStatus.ts' -export { orderStatusEnum, orderHttpStatusEnum } from './models/Order.ts' -export { petStatusEnum } from './models/Pet.ts' diff --git a/examples/react-query/src/gen/models/AddPet.ts b/examples/react-query/src/gen/models/AddPet.ts index 6b8238423..568f0bac6 100644 --- a/examples/react-query/src/gen/models/AddPet.ts +++ b/examples/react-query/src/gen/models/AddPet.ts @@ -1,34 +1,34 @@ -import type { AddPetRequest } from './AddPetRequest.ts' -import type { Pet } from './Pet.ts' +import type { AddPetRequest } from "./AddPetRequest"; +import type { Pet } from "./Pet"; -/** + /** * @description Successful operation - */ -export type AddPet200 = Pet +*/ +export type AddPet200 = Pet; -/** + /** * @description Pet not found - */ +*/ export type AddPet405 = { - /** - * @type integer | undefined, int32 - */ - code?: number - /** - * @type string | undefined - */ - message?: string -} + /** + * @type integer | undefined, int32 + */ + code?: number; + /** + * @type string | undefined + */ + message?: string; +}; -/** + /** * @description Create a new pet in the store - */ -export type AddPetMutationRequest = AddPetRequest +*/ +export type AddPetMutationRequest = AddPetRequest; -export type AddPetMutationResponse = AddPet200 + export type AddPetMutationResponse = AddPet200; -export type AddPetMutation = { - Response: AddPet200 - Request: AddPetMutationRequest - Errors: AddPet405 -} + export type AddPetMutation = { + Response: AddPet200; + Request: AddPetMutationRequest; + Errors: AddPet405; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/AddPetRequest.ts b/examples/react-query/src/gen/models/AddPetRequest.ts index 729119574..b3a76503c 100644 --- a/examples/react-query/src/gen/models/AddPetRequest.ts +++ b/examples/react-query/src/gen/models/AddPetRequest.ts @@ -1,38 +1,38 @@ -import type { Category } from './Category.ts' -import type { Tag } from './Tag.ts' +import type { Category } from "./Category"; +import type { Tag } from "./Tag"; -export const addPetRequestStatusEnum = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const + export const addPetRequestStatusEnum = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; -export type AddPetRequestStatusEnum = (typeof addPetRequestStatusEnum)[keyof typeof addPetRequestStatusEnum] + export type AddPetRequestStatusEnum = (typeof addPetRequestStatusEnum)[keyof typeof addPetRequestStatusEnum]; -export type AddPetRequest = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string - */ - name: string - /** - * @type object | undefined - */ - category?: Category - /** - * @type array - */ - photoUrls: string[] - /** - * @type array | undefined - */ - tags?: Tag[] - /** - * @description pet status in the store - * @type string | undefined - */ - status?: AddPetRequestStatusEnum -} + export type AddPetRequest = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string + */ + name: string; + /** + * @type object | undefined + */ + category?: Category; + /** + * @type array + */ + photoUrls: string[]; + /** + * @type array | undefined + */ + tags?: Tag[]; + /** + * @description pet status in the store + * @type string | undefined + */ + status?: AddPetRequestStatusEnum; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/Address.ts b/examples/react-query/src/gen/models/Address.ts index eb578826d..4b61854c4 100644 --- a/examples/react-query/src/gen/models/Address.ts +++ b/examples/react-query/src/gen/models/Address.ts @@ -1,18 +1,18 @@ export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string -} + /** + * @type string | undefined + */ + street?: string; + /** + * @type string | undefined + */ + city?: string; + /** + * @type string | undefined + */ + state?: string; + /** + * @type string | undefined + */ + zip?: string; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/ApiResponse.ts b/examples/react-query/src/gen/models/ApiResponse.ts index 3a6dae779..2a8e81e25 100644 --- a/examples/react-query/src/gen/models/ApiResponse.ts +++ b/examples/react-query/src/gen/models/ApiResponse.ts @@ -1,14 +1,14 @@ export type ApiResponse = { - /** - * @type integer | undefined, int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} + /** + * @type integer | undefined, int32 + */ + code?: number; + /** + * @type string | undefined + */ + type?: string; + /** + * @type string | undefined + */ + message?: string; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/Category.ts b/examples/react-query/src/gen/models/Category.ts index 3b48c48f3..49380ed19 100644 --- a/examples/react-query/src/gen/models/Category.ts +++ b/examples/react-query/src/gen/models/Category.ts @@ -1,10 +1,10 @@ export type Category = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + name?: string; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/CreateUser.ts b/examples/react-query/src/gen/models/CreateUser.ts index 0dbdb0c8d..06124c4e9 100644 --- a/examples/react-query/src/gen/models/CreateUser.ts +++ b/examples/react-query/src/gen/models/CreateUser.ts @@ -1,19 +1,19 @@ -import type { User } from './User.ts' +import type { User } from "./User"; -/** + /** * @description successful operation - */ -export type CreateUserError = User +*/ +export type CreateUserError = User; -/** + /** * @description Created user object - */ -export type CreateUserMutationRequest = User +*/ +export type CreateUserMutationRequest = User; -export type CreateUserMutationResponse = any + export type CreateUserMutationResponse = any; -export type CreateUserMutation = { - Response: any - Request: CreateUserMutationRequest - Errors: any -} + export type CreateUserMutation = { + Response: any; + Request: CreateUserMutationRequest; + Errors: any; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/CreateUsersWithListInput.ts b/examples/react-query/src/gen/models/CreateUsersWithListInput.ts index b58f6dc2e..cf8a947e6 100644 --- a/examples/react-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/react-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,21 +1,21 @@ -import type { User } from './User.ts' +import type { User } from "./User"; -/** + /** * @description Successful operation - */ -export type CreateUsersWithListInput200 = User +*/ +export type CreateUsersWithListInput200 = User; -/** + /** * @description successful operation - */ -export type CreateUsersWithListInputError = any +*/ +export type CreateUsersWithListInputError = any; -export type CreateUsersWithListInputMutationRequest = User[] + export type CreateUsersWithListInputMutationRequest = User[]; -export type CreateUsersWithListInputMutationResponse = CreateUsersWithListInput200 + export type CreateUsersWithListInputMutationResponse = CreateUsersWithListInput200; -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInput200 - Request: CreateUsersWithListInputMutationRequest - Errors: any -} + export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInput200; + Request: CreateUsersWithListInputMutationRequest; + Errors: any; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/Customer.ts b/examples/react-query/src/gen/models/Customer.ts index dea157e6e..8479512ff 100644 --- a/examples/react-query/src/gen/models/Customer.ts +++ b/examples/react-query/src/gen/models/Customer.ts @@ -1,16 +1,16 @@ -import type { Address } from './Address.ts' +import type { Address } from "./Address"; -export type Customer = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string | undefined - */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] -} + export type Customer = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + username?: string; + /** + * @type array | undefined + */ + address?: Address[]; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/DeleteOrder.ts b/examples/react-query/src/gen/models/DeleteOrder.ts index 3b22473aa..2280bda3b 100644 --- a/examples/react-query/src/gen/models/DeleteOrder.ts +++ b/examples/react-query/src/gen/models/DeleteOrder.ts @@ -1,25 +1,25 @@ export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer, int64 - */ - orderId: number -} + /** + * @description ID of the order that needs to be deleted + * @type integer, int64 + */ + orderId: number; +}; -/** + /** * @description Invalid ID supplied - */ -export type DeleteOrder400 = any +*/ +export type DeleteOrder400 = any; -/** + /** * @description Order not found - */ -export type DeleteOrder404 = any +*/ +export type DeleteOrder404 = any; -export type DeleteOrderMutationResponse = any + export type DeleteOrderMutationResponse = any; -export type DeleteOrderMutation = { - Response: any - PathParams: DeleteOrderPathParams - Errors: DeleteOrder400 | DeleteOrder404 -} + export type DeleteOrderMutation = { + Response: any; + PathParams: DeleteOrderPathParams; + Errors: DeleteOrder400 | DeleteOrder404; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/DeletePet.ts b/examples/react-query/src/gen/models/DeletePet.ts index fa4bbf6c9..da6da26c9 100644 --- a/examples/react-query/src/gen/models/DeletePet.ts +++ b/examples/react-query/src/gen/models/DeletePet.ts @@ -1,28 +1,28 @@ export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer, int64 - */ - pet_id: number -} + /** + * @description Pet id to delete + * @type integer, int64 + */ + pet_id: number; +}; -export type DeletePetHeaderParams = { - /** - * @type string | undefined - */ - api_key?: string -} + export type DeletePetHeaderParams = { + /** + * @type string | undefined + */ + api_key?: string; +}; -/** + /** * @description Invalid pet value - */ -export type DeletePet400 = any +*/ +export type DeletePet400 = any; -export type DeletePetMutationResponse = any + export type DeletePetMutationResponse = any; -export type DeletePetMutation = { - Response: any - PathParams: DeletePetPathParams - HeaderParams: DeletePetHeaderParams - Errors: DeletePet400 -} + export type DeletePetMutation = { + Response: any; + PathParams: DeletePetPathParams; + HeaderParams: DeletePetHeaderParams; + Errors: DeletePet400; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/DeleteUser.ts b/examples/react-query/src/gen/models/DeleteUser.ts index 8cb71e167..31ecf784f 100644 --- a/examples/react-query/src/gen/models/DeleteUser.ts +++ b/examples/react-query/src/gen/models/DeleteUser.ts @@ -1,25 +1,25 @@ export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} + /** + * @description The name that needs to be deleted + * @type string + */ + username: string; +}; -/** + /** * @description Invalid username supplied - */ -export type DeleteUser400 = any +*/ +export type DeleteUser400 = any; -/** + /** * @description User not found - */ -export type DeleteUser404 = any +*/ +export type DeleteUser404 = any; -export type DeleteUserMutationResponse = any + export type DeleteUserMutationResponse = any; -export type DeleteUserMutation = { - Response: any - PathParams: DeleteUserPathParams - Errors: DeleteUser400 | DeleteUser404 -} + export type DeleteUserMutation = { + Response: any; + PathParams: DeleteUserPathParams; + Errors: DeleteUser400 | DeleteUser404; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/FindPetsByStatus.ts b/examples/react-query/src/gen/models/FindPetsByStatus.ts index cbc794f0f..34ced6a62 100644 --- a/examples/react-query/src/gen/models/FindPetsByStatus.ts +++ b/examples/react-query/src/gen/models/FindPetsByStatus.ts @@ -1,36 +1,36 @@ -import type { Pet } from './Pet.ts' +import type { Pet } from "./Pet"; -export const findPetsByStatusQueryParamsStatusEnum = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const + export const findPetsByStatusQueryParamsStatusEnum = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; -export type FindPetsByStatusQueryParamsStatusEnum = (typeof findPetsByStatusQueryParamsStatusEnum)[keyof typeof findPetsByStatusQueryParamsStatusEnum] + export type FindPetsByStatusQueryParamsStatusEnum = (typeof findPetsByStatusQueryParamsStatusEnum)[keyof typeof findPetsByStatusQueryParamsStatusEnum]; -export type FindPetsByStatusQueryParams = { - /** - * @description Status values that need to be considered for filter - * @default "available" - * @type string | undefined - */ - status?: FindPetsByStatusQueryParamsStatusEnum -} + export type FindPetsByStatusQueryParams = { + /** + * @description Status values that need to be considered for filter + * @default "available" + * @type string | undefined + */ + status?: FindPetsByStatusQueryParamsStatusEnum; +}; -/** + /** * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] +*/ +export type FindPetsByStatus200 = Pet[]; -/** + /** * @description Invalid status value - */ -export type FindPetsByStatus400 = any +*/ +export type FindPetsByStatus400 = any; -export type FindPetsByStatusQueryResponse = FindPetsByStatus200 + export type FindPetsByStatusQueryResponse = FindPetsByStatus200; -export type FindPetsByStatusQuery = { - Response: FindPetsByStatus200 - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} + export type FindPetsByStatusQuery = { + Response: FindPetsByStatus200; + QueryParams: FindPetsByStatusQueryParams; + Errors: FindPetsByStatus400; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/FindPetsByTags.ts b/examples/react-query/src/gen/models/FindPetsByTags.ts index 8c7b0462f..338efbbb2 100644 --- a/examples/react-query/src/gen/models/FindPetsByTags.ts +++ b/examples/react-query/src/gen/models/FindPetsByTags.ts @@ -1,37 +1,37 @@ -import type { Pet } from './Pet.ts' +import type { Pet } from "./Pet"; -export type FindPetsByTagsQueryParams = { - /** - * @description Tags to filter by - * @type array | undefined - */ - tags?: string[] - /** - * @description to request with required page number or pagination - * @type string | undefined - */ - page?: string - /** - * @description to request with required page size - * @type string | undefined - */ - pageSize?: string -} + export type FindPetsByTagsQueryParams = { + /** + * @description Tags to filter by + * @type array | undefined + */ + tags?: string[]; + /** + * @description to request with required page number or pagination + * @type string | undefined + */ + page?: string; + /** + * @description to request with required page size + * @type string | undefined + */ + pageSize?: string; +}; -/** + /** * @description successful operation - */ -export type FindPetsByTags200 = Pet[] +*/ +export type FindPetsByTags200 = Pet[]; -/** + /** * @description Invalid tag value - */ -export type FindPetsByTags400 = any +*/ +export type FindPetsByTags400 = any; -export type FindPetsByTagsQueryResponse = FindPetsByTags200 + export type FindPetsByTagsQueryResponse = FindPetsByTags200; -export type FindPetsByTagsQuery = { - Response: FindPetsByTags200 - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} + export type FindPetsByTagsQuery = { + Response: FindPetsByTags200; + QueryParams: FindPetsByTagsQueryParams; + Errors: FindPetsByTags400; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/GetInventory.ts b/examples/react-query/src/gen/models/GetInventory.ts index 411828e36..0a2beab9f 100644 --- a/examples/react-query/src/gen/models/GetInventory.ts +++ b/examples/react-query/src/gen/models/GetInventory.ts @@ -1,13 +1,13 @@ /** * @description successful operation - */ +*/ export type GetInventory200 = { - [key: string]: number -} + [key: string]: number; +}; -export type GetInventoryQueryResponse = GetInventory200 + export type GetInventoryQueryResponse = GetInventory200; -export type GetInventoryQuery = { - Response: GetInventory200 - Errors: any -} + export type GetInventoryQuery = { + Response: GetInventory200; + Errors: any; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/GetOrderById.ts b/examples/react-query/src/gen/models/GetOrderById.ts index f9d5e88d5..9944ceaf5 100644 --- a/examples/react-query/src/gen/models/GetOrderById.ts +++ b/examples/react-query/src/gen/models/GetOrderById.ts @@ -1,32 +1,32 @@ -import type { Order } from './Order.ts' +import type { Order } from "./Order"; -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer, int64 - */ - orderId: number -} + export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer, int64 + */ + orderId: number; +}; -/** + /** * @description successful operation - */ -export type GetOrderById200 = Order +*/ +export type GetOrderById200 = Order; -/** + /** * @description Invalid ID supplied - */ -export type GetOrderById400 = any +*/ +export type GetOrderById400 = any; -/** + /** * @description Order not found - */ -export type GetOrderById404 = any +*/ +export type GetOrderById404 = any; -export type GetOrderByIdQueryResponse = GetOrderById200 + export type GetOrderByIdQueryResponse = GetOrderById200; -export type GetOrderByIdQuery = { - Response: GetOrderById200 - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} + export type GetOrderByIdQuery = { + Response: GetOrderById200; + PathParams: GetOrderByIdPathParams; + Errors: GetOrderById400 | GetOrderById404; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/GetPetById.ts b/examples/react-query/src/gen/models/GetPetById.ts index 56d7ec725..77d0378bb 100644 --- a/examples/react-query/src/gen/models/GetPetById.ts +++ b/examples/react-query/src/gen/models/GetPetById.ts @@ -1,32 +1,32 @@ -import type { Pet } from './Pet.ts' +import type { Pet } from "./Pet"; -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer, int64 - */ - pet_id: number -} + export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer, int64 + */ + pet_id: number; +}; -/** + /** * @description successful operation - */ -export type GetPetById200 = Pet +*/ +export type GetPetById200 = Pet; -/** + /** * @description Invalid ID supplied - */ -export type GetPetById400 = any +*/ +export type GetPetById400 = any; -/** + /** * @description Pet not found - */ -export type GetPetById404 = any +*/ +export type GetPetById404 = any; -export type GetPetByIdQueryResponse = GetPetById200 + export type GetPetByIdQueryResponse = GetPetById200; -export type GetPetByIdQuery = { - Response: GetPetById200 - PathParams: GetPetByIdPathParams - Errors: GetPetById400 | GetPetById404 -} + export type GetPetByIdQuery = { + Response: GetPetById200; + PathParams: GetPetByIdPathParams; + Errors: GetPetById400 | GetPetById404; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/GetUserByName.ts b/examples/react-query/src/gen/models/GetUserByName.ts index bcaf06405..4421fa742 100644 --- a/examples/react-query/src/gen/models/GetUserByName.ts +++ b/examples/react-query/src/gen/models/GetUserByName.ts @@ -1,32 +1,32 @@ -import type { User } from './User.ts' +import type { User } from "./User"; -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} + export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string; +}; -/** + /** * @description successful operation - */ -export type GetUserByName200 = User +*/ +export type GetUserByName200 = User; -/** + /** * @description Invalid username supplied - */ -export type GetUserByName400 = any +*/ +export type GetUserByName400 = any; -/** + /** * @description User not found - */ -export type GetUserByName404 = any +*/ +export type GetUserByName404 = any; -export type GetUserByNameQueryResponse = GetUserByName200 + export type GetUserByNameQueryResponse = GetUserByName200; -export type GetUserByNameQuery = { - Response: GetUserByName200 - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} + export type GetUserByNameQuery = { + Response: GetUserByName200; + PathParams: GetUserByNamePathParams; + Errors: GetUserByName400 | GetUserByName404; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/LoginUser.ts b/examples/react-query/src/gen/models/LoginUser.ts index f8869afdb..82a6e8674 100644 --- a/examples/react-query/src/gen/models/LoginUser.ts +++ b/examples/react-query/src/gen/models/LoginUser.ts @@ -1,30 +1,30 @@ export type LoginUserQueryParams = { - /** - * @description The user name for login - * @type string | undefined - */ - username?: string - /** - * @description The password for login in clear text - * @type string | undefined - */ - password?: string -} + /** + * @description The user name for login + * @type string | undefined + */ + username?: string; + /** + * @description The password for login in clear text + * @type string | undefined + */ + password?: string; +}; -/** + /** * @description successful operation - */ -export type LoginUser200 = string +*/ +export type LoginUser200 = string; -/** + /** * @description Invalid username/password supplied - */ -export type LoginUser400 = any +*/ +export type LoginUser400 = any; -export type LoginUserQueryResponse = LoginUser200 + export type LoginUserQueryResponse = LoginUser200; -export type LoginUserQuery = { - Response: LoginUser200 - QueryParams: LoginUserQueryParams - Errors: LoginUser400 -} + export type LoginUserQuery = { + Response: LoginUser200; + QueryParams: LoginUserQueryParams; + Errors: LoginUser400; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/LogoutUser.ts b/examples/react-query/src/gen/models/LogoutUser.ts index c969417e5..6615bff43 100644 --- a/examples/react-query/src/gen/models/LogoutUser.ts +++ b/examples/react-query/src/gen/models/LogoutUser.ts @@ -1,11 +1,11 @@ /** * @description successful operation - */ -export type LogoutUserError = any +*/ +export type LogoutUserError = any; -export type LogoutUserQueryResponse = any + export type LogoutUserQueryResponse = any; -export type LogoutUserQuery = { - Response: any - Errors: any -} + export type LogoutUserQuery = { + Response: any; + Errors: any; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/Order.ts b/examples/react-query/src/gen/models/Order.ts index 74e22b4de..ff4212419 100644 --- a/examples/react-query/src/gen/models/Order.ts +++ b/examples/react-query/src/gen/models/Order.ts @@ -1,48 +1,48 @@ export const orderStatusEnum = { - placed: 'placed', - approved: 'approved', - delivered: 'delivered', -} as const + "placed": "placed", + "approved": "approved", + "delivered": "delivered" +} as const; -export type OrderStatusEnum = (typeof orderStatusEnum)[keyof typeof orderStatusEnum] + export type OrderStatusEnum = (typeof orderStatusEnum)[keyof typeof orderStatusEnum]; -export const orderHttpStatusEnum = { - '200': 200, - '400': 400, - '500': 500, -} as const + export const orderHttpStatusEnum = { + "200": 200, + "400": 400, + "500": 500 +} as const; -export type OrderHttpStatusEnum = (typeof orderHttpStatusEnum)[keyof typeof orderHttpStatusEnum] + export type OrderHttpStatusEnum = (typeof orderHttpStatusEnum)[keyof typeof orderHttpStatusEnum]; -export type Order = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type integer | undefined, int64 - */ - petId?: number - /** - * @type integer | undefined, int32 - */ - quantity?: number - /** - * @type string | undefined, date-time - */ - shipDate?: string - /** - * @description Order Status - * @type string | undefined - */ - status?: OrderStatusEnum - /** - * @description HTTP Status - * @type number | undefined - */ - http_status?: OrderHttpStatusEnum - /** - * @type boolean | undefined - */ - complete?: boolean -} + export type Order = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type integer | undefined, int64 + */ + petId?: number; + /** + * @type integer | undefined, int32 + */ + quantity?: number; + /** + * @type string | undefined, date-time + */ + shipDate?: string; + /** + * @description Order Status + * @type string | undefined + */ + status?: OrderStatusEnum; + /** + * @description HTTP Status + * @type number | undefined + */ + http_status?: OrderHttpStatusEnum; + /** + * @type boolean | undefined + */ + complete?: boolean; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/Pet.ts b/examples/react-query/src/gen/models/Pet.ts index cb876282d..a1da85530 100644 --- a/examples/react-query/src/gen/models/Pet.ts +++ b/examples/react-query/src/gen/models/Pet.ts @@ -1,38 +1,38 @@ -import type { Category } from './Category.ts' -import type { Tag } from './Tag.ts' +import type { Category } from "./Category"; +import type { Tag } from "./Tag"; -export const petStatusEnum = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const + export const petStatusEnum = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; -export type PetStatusEnum = (typeof petStatusEnum)[keyof typeof petStatusEnum] + export type PetStatusEnum = (typeof petStatusEnum)[keyof typeof petStatusEnum]; -export type Pet = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string - */ - name: string - /** - * @type object | undefined - */ - category?: Category - /** - * @type array - */ - photoUrls: string[] - /** - * @type array | undefined - */ - tags?: Tag[] - /** - * @description pet status in the store - * @type string | undefined - */ - status?: PetStatusEnum -} + export type Pet = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string + */ + name: string; + /** + * @type object | undefined + */ + category?: Category; + /** + * @type array + */ + photoUrls: string[]; + /** + * @type array | undefined + */ + tags?: Tag[]; + /** + * @description pet status in the store + * @type string | undefined + */ + status?: PetStatusEnum; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/PetNotFound.ts b/examples/react-query/src/gen/models/PetNotFound.ts index adad1616d..ba3c67312 100644 --- a/examples/react-query/src/gen/models/PetNotFound.ts +++ b/examples/react-query/src/gen/models/PetNotFound.ts @@ -1,10 +1,10 @@ export type PetNotFound = { - /** - * @type integer | undefined, int32 - */ - code?: number - /** - * @type string | undefined - */ - message?: string -} + /** + * @type integer | undefined, int32 + */ + code?: number; + /** + * @type string | undefined + */ + message?: string; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/PlaceOrder.ts b/examples/react-query/src/gen/models/PlaceOrder.ts index 01b05dd83..64894c78b 100644 --- a/examples/react-query/src/gen/models/PlaceOrder.ts +++ b/examples/react-query/src/gen/models/PlaceOrder.ts @@ -1,21 +1,21 @@ -import type { Order } from './Order.ts' +import type { Order } from "./Order"; -/** + /** * @description successful operation - */ -export type PlaceOrder200 = Order +*/ +export type PlaceOrder200 = Order; -/** + /** * @description Invalid input - */ -export type PlaceOrder405 = any +*/ +export type PlaceOrder405 = any; -export type PlaceOrderMutationRequest = Order + export type PlaceOrderMutationRequest = Order; -export type PlaceOrderMutationResponse = PlaceOrder200 + export type PlaceOrderMutationResponse = PlaceOrder200; -export type PlaceOrderMutation = { - Response: PlaceOrder200 - Request: PlaceOrderMutationRequest - Errors: PlaceOrder405 -} + export type PlaceOrderMutation = { + Response: PlaceOrder200; + Request: PlaceOrderMutationRequest; + Errors: PlaceOrder405; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/PlaceOrderPatch.ts b/examples/react-query/src/gen/models/PlaceOrderPatch.ts index e02a53261..549a9b121 100644 --- a/examples/react-query/src/gen/models/PlaceOrderPatch.ts +++ b/examples/react-query/src/gen/models/PlaceOrderPatch.ts @@ -1,21 +1,21 @@ -import type { Order } from './Order.ts' +import type { Order } from "./Order"; -/** + /** * @description successful operation - */ -export type PlaceOrderPatch200 = Order +*/ +export type PlaceOrderPatch200 = Order; -/** + /** * @description Invalid input - */ -export type PlaceOrderPatch405 = any +*/ +export type PlaceOrderPatch405 = any; -export type PlaceOrderPatchMutationRequest = Order + export type PlaceOrderPatchMutationRequest = Order; -export type PlaceOrderPatchMutationResponse = PlaceOrderPatch200 + export type PlaceOrderPatchMutationResponse = PlaceOrderPatch200; -export type PlaceOrderPatchMutation = { - Response: PlaceOrderPatch200 - Request: PlaceOrderPatchMutationRequest - Errors: PlaceOrderPatch405 -} + export type PlaceOrderPatchMutation = { + Response: PlaceOrderPatch200; + Request: PlaceOrderPatchMutationRequest; + Errors: PlaceOrderPatch405; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/Tag.ts b/examples/react-query/src/gen/models/Tag.ts index d76160eae..3ae285108 100644 --- a/examples/react-query/src/gen/models/Tag.ts +++ b/examples/react-query/src/gen/models/Tag.ts @@ -1,10 +1,10 @@ export type Tag = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + name?: string; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/UpdatePet.ts b/examples/react-query/src/gen/models/UpdatePet.ts index 8b31bc1ff..e35d868a8 100644 --- a/examples/react-query/src/gen/models/UpdatePet.ts +++ b/examples/react-query/src/gen/models/UpdatePet.ts @@ -1,34 +1,34 @@ -import type { Pet } from './Pet.ts' +import type { Pet } from "./Pet"; -/** + /** * @description Successful operation - */ -export type UpdatePet200 = Pet +*/ +export type UpdatePet200 = Pet; -/** + /** * @description Invalid ID supplied - */ -export type UpdatePet400 = any +*/ +export type UpdatePet400 = any; -/** + /** * @description Pet not found - */ -export type UpdatePet404 = any +*/ +export type UpdatePet404 = any; -/** + /** * @description Validation exception - */ -export type UpdatePet405 = any +*/ +export type UpdatePet405 = any; -/** + /** * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet +*/ +export type UpdatePetMutationRequest = Pet; -export type UpdatePetMutationResponse = UpdatePet200 + export type UpdatePetMutationResponse = UpdatePet200; -export type UpdatePetMutation = { - Response: UpdatePet200 - Request: UpdatePetMutationRequest - Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 -} + export type UpdatePetMutation = { + Response: UpdatePet200; + Request: UpdatePetMutationRequest; + Errors: UpdatePet400 | UpdatePet404 | UpdatePet405; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/UpdatePetWithForm.ts b/examples/react-query/src/gen/models/UpdatePetWithForm.ts index 63f31c82d..23db139e3 100644 --- a/examples/react-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/react-query/src/gen/models/UpdatePetWithForm.ts @@ -1,34 +1,34 @@ export type UpdatePetWithFormPathParams = { - /** - * @description ID of pet that needs to be updated - * @type integer, int64 - */ - pet_id: number -} + /** + * @description ID of pet that needs to be updated + * @type integer, int64 + */ + pet_id: number; +}; -export type UpdatePetWithFormQueryParams = { - /** - * @description Name of pet that needs to be updated - * @type string | undefined - */ - name?: string - /** - * @description Status of pet that needs to be updated - * @type string | undefined - */ - status?: string -} + export type UpdatePetWithFormQueryParams = { + /** + * @description Name of pet that needs to be updated + * @type string | undefined + */ + name?: string; + /** + * @description Status of pet that needs to be updated + * @type string | undefined + */ + status?: string; +}; -/** + /** * @description Invalid input - */ -export type UpdatePetWithForm405 = any +*/ +export type UpdatePetWithForm405 = any; -export type UpdatePetWithFormMutationResponse = any + export type UpdatePetWithFormMutationResponse = any; -export type UpdatePetWithFormMutation = { - Response: any - PathParams: UpdatePetWithFormPathParams - QueryParams: UpdatePetWithFormQueryParams - Errors: UpdatePetWithForm405 -} + export type UpdatePetWithFormMutation = { + Response: any; + PathParams: UpdatePetWithFormPathParams; + QueryParams: UpdatePetWithFormQueryParams; + Errors: UpdatePetWithForm405; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/UpdateUser.ts b/examples/react-query/src/gen/models/UpdateUser.ts index 12450a76f..49db639a1 100644 --- a/examples/react-query/src/gen/models/UpdateUser.ts +++ b/examples/react-query/src/gen/models/UpdateUser.ts @@ -1,28 +1,28 @@ -import type { User } from './User.ts' +import type { User } from "./User"; -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} + export type UpdateUserPathParams = { + /** + * @description name that need to be deleted + * @type string + */ + username: string; +}; -/** + /** * @description successful operation - */ -export type UpdateUserError = any +*/ +export type UpdateUserError = any; -/** + /** * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User +*/ +export type UpdateUserMutationRequest = User; -export type UpdateUserMutationResponse = any + export type UpdateUserMutationResponse = any; -export type UpdateUserMutation = { - Response: any - Request: UpdateUserMutationRequest - PathParams: UpdateUserPathParams - Errors: any -} + export type UpdateUserMutation = { + Response: any; + Request: UpdateUserMutationRequest; + PathParams: UpdateUserPathParams; + Errors: any; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/UploadFile.ts b/examples/react-query/src/gen/models/UploadFile.ts index 09f741b3e..4181ef503 100644 --- a/examples/react-query/src/gen/models/UploadFile.ts +++ b/examples/react-query/src/gen/models/UploadFile.ts @@ -1,34 +1,34 @@ -import type { ApiResponse } from './ApiResponse.ts' +import type { ApiResponse } from "./ApiResponse"; -export type UploadFilePathParams = { - /** - * @description ID of pet to update - * @type integer, int64 - */ - petId: number -} + export type UploadFilePathParams = { + /** + * @description ID of pet to update + * @type integer, int64 + */ + petId: number; +}; -export type UploadFileQueryParams = { - /** - * @description Additional Metadata - * @type string | undefined - */ - additionalMetadata?: string -} + export type UploadFileQueryParams = { + /** + * @description Additional Metadata + * @type string | undefined + */ + additionalMetadata?: string; +}; -/** + /** * @description successful operation - */ -export type UploadFile200 = ApiResponse +*/ +export type UploadFile200 = ApiResponse; -export type UploadFileMutationRequest = Blob + export type UploadFileMutationRequest = Blob; -export type UploadFileMutationResponse = UploadFile200 + export type UploadFileMutationResponse = UploadFile200; -export type UploadFileMutation = { - Response: UploadFile200 - Request: UploadFileMutationRequest - PathParams: UploadFilePathParams - QueryParams: UploadFileQueryParams - Errors: any -} + export type UploadFileMutation = { + Response: UploadFile200; + Request: UploadFileMutationRequest; + PathParams: UploadFilePathParams; + QueryParams: UploadFileQueryParams; + Errors: any; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/User.ts b/examples/react-query/src/gen/models/User.ts index 5fbab3d29..9e8b913d4 100644 --- a/examples/react-query/src/gen/models/User.ts +++ b/examples/react-query/src/gen/models/User.ts @@ -1,35 +1,35 @@ export type User = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string | undefined - */ - username?: string - /** - * @type string | undefined - */ - firstName?: string - /** - * @type string | undefined - */ - lastName?: string - /** - * @type string | undefined - */ - email?: string - /** - * @type string | undefined - */ - password?: string - /** - * @type string | undefined - */ - phone?: string - /** - * @description User Status - * @type integer | undefined, int32 - */ - userStatus?: number -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + username?: string; + /** + * @type string | undefined + */ + firstName?: string; + /** + * @type string | undefined + */ + lastName?: string; + /** + * @type string | undefined + */ + email?: string; + /** + * @type string | undefined + */ + password?: string; + /** + * @type string | undefined + */ + phone?: string; + /** + * @description User Status + * @type integer | undefined, int32 + */ + userStatus?: number; +}; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/UserArray.ts b/examples/react-query/src/gen/models/UserArray.ts index 3b7eef0e8..d17573215 100644 --- a/examples/react-query/src/gen/models/UserArray.ts +++ b/examples/react-query/src/gen/models/UserArray.ts @@ -1,3 +1,3 @@ -import type { User } from './User.ts' +import type { User } from "./User"; -export type UserArray = User[] + export type UserArray = User[]; \ No newline at end of file diff --git a/examples/react-query/src/gen/models/index.ts b/examples/react-query/src/gen/models/index.ts index 9adde6fe5..c8da9b272 100644 --- a/examples/react-query/src/gen/models/index.ts +++ b/examples/react-query/src/gen/models/index.ts @@ -1,82 +1,35 @@ -export type { AddPet200, AddPet405, AddPetMutationRequest, AddPetMutationResponse, AddPetMutation } from './AddPet.ts' -export type { AddPetRequestStatusEnum, AddPetRequest } from './AddPetRequest.ts' -export type { Address } from './Address.ts' -export type { ApiResponse } from './ApiResponse.ts' -export type { Category } from './Category.ts' -export type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse, CreateUserMutation } from './CreateUser.ts' -export type { - CreateUsersWithListInput200, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputMutation, -} from './CreateUsersWithListInput.ts' -export type { Customer } from './Customer.ts' -export type { DeleteOrderPathParams, DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, DeleteOrderMutation } from './DeleteOrder.ts' -export type { DeletePetPathParams, DeletePetHeaderParams, DeletePet400, DeletePetMutationResponse, DeletePetMutation } from './DeletePet.ts' -export type { DeleteUserPathParams, DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUserMutation } from './DeleteUser.ts' -export type { - FindPetsByStatusQueryParamsStatusEnum, - FindPetsByStatusQueryParams, - FindPetsByStatus200, - FindPetsByStatus400, - FindPetsByStatusQueryResponse, - FindPetsByStatusQuery, -} from './FindPetsByStatus.ts' -export type { FindPetsByTagsQueryParams, FindPetsByTags200, FindPetsByTags400, FindPetsByTagsQueryResponse, FindPetsByTagsQuery } from './FindPetsByTags.ts' -export type { GetInventory200, GetInventoryQueryResponse, GetInventoryQuery } from './GetInventory.ts' -export type { GetOrderByIdPathParams, GetOrderById200, GetOrderById400, GetOrderById404, GetOrderByIdQueryResponse, GetOrderByIdQuery } from './GetOrderById.ts' -export type { GetPetByIdPathParams, GetPetById200, GetPetById400, GetPetById404, GetPetByIdQueryResponse, GetPetByIdQuery } from './GetPetById.ts' -export type { - GetUserByNamePathParams, - GetUserByName200, - GetUserByName400, - GetUserByName404, - GetUserByNameQueryResponse, - GetUserByNameQuery, -} from './GetUserByName.ts' -export type { LoginUserQueryParams, LoginUser200, LoginUser400, LoginUserQueryResponse, LoginUserQuery } from './LoginUser.ts' -export type { LogoutUserError, LogoutUserQueryResponse, LogoutUserQuery } from './LogoutUser.ts' -export type { OrderStatusEnum, OrderHttpStatusEnum, Order } from './Order.ts' -export type { PetStatusEnum, Pet } from './Pet.ts' -export type { PetNotFound } from './PetNotFound.ts' -export type { PlaceOrder200, PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrderMutation } from './PlaceOrder.ts' -export type { - PlaceOrderPatch200, - PlaceOrderPatch405, - PlaceOrderPatchMutationRequest, - PlaceOrderPatchMutationResponse, - PlaceOrderPatchMutation, -} from './PlaceOrderPatch.ts' -export type { Tag } from './Tag.ts' -export type { - UpdatePet200, - UpdatePet400, - UpdatePet404, - UpdatePet405, - UpdatePetMutationRequest, - UpdatePetMutationResponse, - UpdatePetMutation, -} from './UpdatePet.ts' -export type { - UpdatePetWithFormPathParams, - UpdatePetWithFormQueryParams, - UpdatePetWithForm405, - UpdatePetWithFormMutationResponse, - UpdatePetWithFormMutation, -} from './UpdatePetWithForm.ts' -export type { UpdateUserPathParams, UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserMutation } from './UpdateUser.ts' -export type { - UploadFilePathParams, - UploadFileQueryParams, - UploadFile200, - UploadFileMutationRequest, - UploadFileMutationResponse, - UploadFileMutation, -} from './UploadFile.ts' -export type { User } from './User.ts' -export type { UserArray } from './UserArray.ts' -export { addPetRequestStatusEnum } from './AddPetRequest.ts' -export { findPetsByStatusQueryParamsStatusEnum } from './FindPetsByStatus.ts' -export { orderStatusEnum, orderHttpStatusEnum } from './Order.ts' -export { petStatusEnum } from './Pet.ts' +export type { AddPet200, AddPet405, AddPetMutationRequest, AddPetMutationResponse, AddPetMutation } from "./AddPet"; +export type { AddPetRequestStatusEnum, AddPetRequest } from "./AddPetRequest"; +export type { Address } from "./Address"; +export type { ApiResponse } from "./ApiResponse"; +export type { Category } from "./Category"; +export type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse, CreateUserMutation } from "./CreateUser"; +export type { CreateUsersWithListInput200, CreateUsersWithListInputError, CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, CreateUsersWithListInputMutation } from "./CreateUsersWithListInput"; +export type { Customer } from "./Customer"; +export type { DeleteOrderPathParams, DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, DeleteOrderMutation } from "./DeleteOrder"; +export type { DeletePetPathParams, DeletePetHeaderParams, DeletePet400, DeletePetMutationResponse, DeletePetMutation } from "./DeletePet"; +export type { DeleteUserPathParams, DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUserMutation } from "./DeleteUser"; +export type { FindPetsByStatusQueryParamsStatusEnum, FindPetsByStatusQueryParams, FindPetsByStatus200, FindPetsByStatus400, FindPetsByStatusQueryResponse, FindPetsByStatusQuery } from "./FindPetsByStatus"; +export type { FindPetsByTagsQueryParams, FindPetsByTags200, FindPetsByTags400, FindPetsByTagsQueryResponse, FindPetsByTagsQuery } from "./FindPetsByTags"; +export type { GetInventory200, GetInventoryQueryResponse, GetInventoryQuery } from "./GetInventory"; +export type { GetOrderByIdPathParams, GetOrderById200, GetOrderById400, GetOrderById404, GetOrderByIdQueryResponse, GetOrderByIdQuery } from "./GetOrderById"; +export type { GetPetByIdPathParams, GetPetById200, GetPetById400, GetPetById404, GetPetByIdQueryResponse, GetPetByIdQuery } from "./GetPetById"; +export type { GetUserByNamePathParams, GetUserByName200, GetUserByName400, GetUserByName404, GetUserByNameQueryResponse, GetUserByNameQuery } from "./GetUserByName"; +export type { LoginUserQueryParams, LoginUser200, LoginUser400, LoginUserQueryResponse, LoginUserQuery } from "./LoginUser"; +export type { LogoutUserError, LogoutUserQueryResponse, LogoutUserQuery } from "./LogoutUser"; +export type { OrderStatusEnum, OrderHttpStatusEnum, Order } from "./Order"; +export type { PetStatusEnum, Pet } from "./Pet"; +export type { PetNotFound } from "./PetNotFound"; +export type { PlaceOrder200, PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrderMutation } from "./PlaceOrder"; +export type { PlaceOrderPatch200, PlaceOrderPatch405, PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatchMutation } from "./PlaceOrderPatch"; +export type { Tag } from "./Tag"; +export type { UpdatePet200, UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePetMutation } from "./UpdatePet"; +export type { UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405, UpdatePetWithFormMutationResponse, UpdatePetWithFormMutation } from "./UpdatePetWithForm"; +export type { UpdateUserPathParams, UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserMutation } from "./UpdateUser"; +export type { UploadFilePathParams, UploadFileQueryParams, UploadFile200, UploadFileMutationRequest, UploadFileMutationResponse, UploadFileMutation } from "./UploadFile"; +export type { User } from "./User"; +export type { UserArray } from "./UserArray"; +export { addPetRequestStatusEnum } from "./AddPetRequest"; +export { findPetsByStatusQueryParamsStatusEnum } from "./FindPetsByStatus"; +export { orderStatusEnum, orderHttpStatusEnum } from "./Order"; +export { petStatusEnum } from "./Pet"; \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/index.ts b/examples/vue-query/src/gen/hooks/index.ts index 430d65216..3e5e52d62 100644 --- a/examples/vue-query/src/gen/hooks/index.ts +++ b/examples/vue-query/src/gen/hooks/index.ts @@ -1,38 +1,38 @@ -export type { AddPetMutationKey } from './useAddPet' -export type { CreateUserMutationKey } from './useCreateUser' -export type { CreateUsersWithListInputMutationKey } from './useCreateUsersWithListInput' -export type { DeleteOrderMutationKey } from './useDeleteOrder' -export type { DeletePetMutationKey } from './useDeletePet' -export type { DeleteUserMutationKey } from './useDeleteUser' -export type { FindPetsByStatusQueryKey } from './useFindPetsByStatus' -export type { FindPetsByTagsQueryKey } from './useFindPetsByTags' -export type { GetInventoryQueryKey } from './useGetInventory' -export type { GetOrderByIdQueryKey } from './useGetOrderById' -export type { GetPetByIdQueryKey } from './useGetPetById' -export type { GetUserByNameQueryKey } from './useGetUserByName' -export type { LoginUserQueryKey } from './useLoginUser' -export type { LogoutUserQueryKey } from './useLogoutUser' -export type { PlaceOrderMutationKey } from './usePlaceOrder' -export type { UpdatePetMutationKey } from './useUpdatePet' -export type { UpdatePetWithFormMutationKey } from './useUpdatePetWithForm' -export type { UpdateUserMutationKey } from './useUpdateUser' -export type { UploadFileMutationKey } from './useUploadFile' -export { addPetMutationKey, useAddPet } from './useAddPet' -export { createUserMutationKey, useCreateUser } from './useCreateUser' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './useCreateUsersWithListInput' -export { deleteOrderMutationKey, useDeleteOrder } from './useDeleteOrder' -export { deletePetMutationKey, useDeletePet } from './useDeletePet' -export { deleteUserMutationKey, useDeleteUser } from './useDeleteUser' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags' -export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './useGetInventory' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById' -export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './useGetPetById' -export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName' -export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './useLoginUser' -export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './useLogoutUser' -export { placeOrderMutationKey, usePlaceOrder } from './usePlaceOrder' -export { updatePetMutationKey, useUpdatePet } from './useUpdatePet' -export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './useUpdatePetWithForm' -export { updateUserMutationKey, useUpdateUser } from './useUpdateUser' -export { uploadFileMutationKey, useUploadFile } from './useUploadFile' +export type { AddPetMutationKey } from "./useAddPet"; +export type { CreateUserMutationKey } from "./useCreateUser"; +export type { CreateUsersWithListInputMutationKey } from "./useCreateUsersWithListInput"; +export type { DeleteOrderMutationKey } from "./useDeleteOrder"; +export type { DeletePetMutationKey } from "./useDeletePet"; +export type { DeleteUserMutationKey } from "./useDeleteUser"; +export type { FindPetsByStatusQueryKey } from "./useFindPetsByStatus"; +export type { FindPetsByTagsQueryKey } from "./useFindPetsByTags"; +export type { GetInventoryQueryKey } from "./useGetInventory"; +export type { GetOrderByIdQueryKey } from "./useGetOrderById"; +export type { GetPetByIdQueryKey } from "./useGetPetById"; +export type { GetUserByNameQueryKey } from "./useGetUserByName"; +export type { LoginUserQueryKey } from "./useLoginUser"; +export type { LogoutUserQueryKey } from "./useLogoutUser"; +export type { PlaceOrderMutationKey } from "./usePlaceOrder"; +export type { UpdatePetMutationKey } from "./useUpdatePet"; +export type { UpdatePetWithFormMutationKey } from "./useUpdatePetWithForm"; +export type { UpdateUserMutationKey } from "./useUpdateUser"; +export type { UploadFileMutationKey } from "./useUploadFile"; +export { addPetMutationKey, useAddPet } from "./useAddPet"; +export { createUserMutationKey, useCreateUser } from "./useCreateUser"; +export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from "./useCreateUsersWithListInput"; +export { deleteOrderMutationKey, useDeleteOrder } from "./useDeleteOrder"; +export { deletePetMutationKey, useDeletePet } from "./useDeletePet"; +export { deleteUserMutationKey, useDeleteUser } from "./useDeleteUser"; +export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from "./useFindPetsByStatus"; +export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from "./useFindPetsByTags"; +export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from "./useGetInventory"; +export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from "./useGetOrderById"; +export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from "./useGetPetById"; +export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from "./useGetUserByName"; +export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from "./useLoginUser"; +export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from "./useLogoutUser"; +export { placeOrderMutationKey, usePlaceOrder } from "./usePlaceOrder"; +export { updatePetMutationKey, useUpdatePet } from "./useUpdatePet"; +export { updatePetWithFormMutationKey, useUpdatePetWithForm } from "./useUpdatePetWithForm"; +export { updateUserMutationKey, useUpdateUser } from "./useUpdateUser"; +export { uploadFileMutationKey, useUploadFile } from "./useUploadFile"; \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useAddPet.ts b/examples/vue-query/src/gen/hooks/useAddPet.ts index 9431ad4aa..dc8bd6f73 100644 --- a/examples/vue-query/src/gen/hooks/useAddPet.ts +++ b/examples/vue-query/src/gen/hooks/useAddPet.ts @@ -1,61 +1,46 @@ -import client from '@kubb/plugin-client/client' -import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from "../models/AddPet"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const addPetMutationKey = () => [{ url: '/pet' }] as const + export const addPetMutationKey = () => [{ "url": "/pet" }] as const; -export type AddPetMutationKey = ReturnType + export type AddPetMutationKey = ReturnType; -/** + /** * @description Add a new pet to the store * @summary Add a new pet to the store * {@link /pet} */ -async function addPet( - { - data, - }: { - data: AddPetMutationRequest - }, - config: Partial> = {}, -) { - const res = await client({ method: 'POST', url: '/pet', data, ...config }) - return res.data +async function addPet({ data }: { + data: AddPetMutationRequest; +}, config: Partial> = {}) { + const res = await client({ method: "POST", url: `/pet`, data, ...config }); + return res.data; } -/** + /** * @description Add a new pet to the store * @summary Add a new pet to the store * {@link /pet} */ -export function useAddPet( - options: { - mutation?: MutationObserverOptions< - AddPetMutationResponse, - AddPet405, - { - data: MaybeRef - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? addPetMutationKey() - return useMutation< - AddPetMutationResponse, - AddPet405, - { - data: AddPetMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return addPet({ data }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useAddPet(options: { + mutation?: MutationObserverOptions; + }>; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? addPetMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return addPet({ data }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useCreateUser.ts b/examples/vue-query/src/gen/hooks/useCreateUser.ts index 20d308196..81fb7e1bb 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUser.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUser.ts @@ -1,61 +1,46 @@ -import client from '@kubb/plugin-client/client' -import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { CreateUserMutationRequest, CreateUserMutationResponse } from "../models/CreateUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const createUserMutationKey = () => [{ url: '/user' }] as const + export const createUserMutationKey = () => [{ "url": "/user" }] as const; -export type CreateUserMutationKey = ReturnType + export type CreateUserMutationKey = ReturnType; -/** + /** * @description This can only be done by the logged in user. * @summary Create user * {@link /user} */ -async function createUser( - { - data, - }: { - data?: CreateUserMutationRequest - }, - config: Partial> = {}, -) { - const res = await client({ method: 'POST', url: '/user', data, ...config }) - return res.data +async function createUser({ data }: { + data?: CreateUserMutationRequest; +}, config: Partial> = {}) { + const res = await client({ method: "POST", url: `/user`, data, ...config }); + return res.data; } -/** + /** * @description This can only be done by the logged in user. * @summary Create user * {@link /user} */ -export function useCreateUser( - options: { - mutation?: MutationObserverOptions< - CreateUserMutationResponse, - Error, - { - data?: MaybeRef - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? createUserMutationKey() - return useMutation< - CreateUserMutationResponse, - Error, - { - data?: CreateUserMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return createUser({ data }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useCreateUser(options: { + mutation?: MutationObserverOptions; + }>; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? createUserMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return createUser({ data }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts index 0d58c354f..78a0e4072 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts @@ -1,66 +1,46 @@ -import client from '@kubb/plugin-client/client' -import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from "../models/CreateUsersWithListInput"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const createUsersWithListInputMutationKey = () => [{ url: '/user/createWithList' }] as const + export const createUsersWithListInputMutationKey = () => [{ "url": "/user/createWithList" }] as const; -export type CreateUsersWithListInputMutationKey = ReturnType + export type CreateUsersWithListInputMutationKey = ReturnType; -/** + /** * @description Creates list of users with given input array * @summary Creates list of users with given input array * {@link /user/createWithList} */ -async function createUsersWithListInput( - { - data, - }: { - data?: CreateUsersWithListInputMutationRequest - }, - config: Partial> = {}, -) { - const res = await client({ - method: 'POST', - url: '/user/createWithList', - data, - ...config, - }) - return res.data +async function createUsersWithListInput({ data }: { + data?: CreateUsersWithListInputMutationRequest; +}, config: Partial> = {}) { + const res = await client({ method: "POST", url: `/user/createWithList`, data, ...config }); + return res.data; } -/** + /** * @description Creates list of users with given input array * @summary Creates list of users with given input array * {@link /user/createWithList} */ -export function useCreateUsersWithListInput( - options: { - mutation?: MutationObserverOptions< - CreateUsersWithListInputMutationResponse, - Error, - { - data?: MaybeRef - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? createUsersWithListInputMutationKey() - return useMutation< - CreateUsersWithListInputMutationResponse, - Error, - { - data?: CreateUsersWithListInputMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return createUsersWithListInput({ data }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useCreateUsersWithListInput(options: { + mutation?: MutationObserverOptions; + }>; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? createUsersWithListInputMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return createUsersWithListInput({ data }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts index 3960a1840..6633d6ebd 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts @@ -1,65 +1,46 @@ -import client from '@kubb/plugin-client/client' -import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from "../models/DeleteOrder"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const deleteOrderMutationKey = () => [{ url: '/store/order/{orderId}' }] as const + export const deleteOrderMutationKey = () => [{ "url": "/store/order/{orderId}" }] as const; -export type DeleteOrderMutationKey = ReturnType + export type DeleteOrderMutationKey = ReturnType; -/** + /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -async function deleteOrder( - { - orderId, - }: { - orderId: DeleteOrderPathParams['orderId'] - }, - config: Partial = {}, -) { - const res = await client({ - method: 'DELETE', - url: `/store/order/${orderId}`, - ...config, - }) - return res.data +async function deleteOrder({ orderId }: { + orderId: DeleteOrderPathParams["orderId"]; +}, config: Partial = {}) { + const res = await client({ method: "DELETE", url: `/store/order/${orderId}`, ...config }); + return res.data; } -/** + /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -export function useDeleteOrder( - options: { - mutation?: MutationObserverOptions< - DeleteOrderMutationResponse, - DeleteOrder400 | DeleteOrder404, - { - orderId: MaybeRef - } - > - client?: Partial - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? deleteOrderMutationKey() - return useMutation< - DeleteOrderMutationResponse, - DeleteOrder400 | DeleteOrder404, - { - orderId: DeleteOrderPathParams['orderId'] - } - >({ - mutationFn: async ({ orderId }) => { - return deleteOrder({ orderId }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useDeleteOrder(options: { + mutation?: MutationObserverOptions; + }>; + client?: Partial; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? deleteOrderMutationKey(); + return useMutation({ + mutationFn: async ({ orderId }) => { + return deleteOrder({ orderId }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useDeletePet.ts b/examples/vue-query/src/gen/hooks/useDeletePet.ts index 5c406c288..714222410 100644 --- a/examples/vue-query/src/gen/hooks/useDeletePet.ts +++ b/examples/vue-query/src/gen/hooks/useDeletePet.ts @@ -1,70 +1,49 @@ -import client from '@kubb/plugin-client/client' -import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from "../models/DeletePet"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const deletePetMutationKey = () => [{ url: '/pet/{petId}' }] as const + export const deletePetMutationKey = () => [{ "url": "/pet/{petId}" }] as const; -export type DeletePetMutationKey = ReturnType + export type DeletePetMutationKey = ReturnType; -/** + /** * @description delete a pet * @summary Deletes a pet * {@link /pet/:petId} */ -async function deletePet( - { - petId, - headers, - }: { - petId: DeletePetPathParams['petId'] - headers?: DeletePetHeaderParams - }, - config: Partial = {}, -) { - const res = await client({ - method: 'DELETE', - url: `/pet/${petId}`, - headers: { ...headers, ...config.headers }, - ...config, - }) - return res.data +async function deletePet({ petId, headers }: { + petId: DeletePetPathParams["petId"]; + headers?: DeletePetHeaderParams; +}, config: Partial = {}) { + const res = await client({ method: "DELETE", url: `/pet/${petId}`, headers: { ...headers, ...config.headers }, ...config }); + return res.data; } -/** + /** * @description delete a pet * @summary Deletes a pet * {@link /pet/:petId} */ -export function useDeletePet( - options: { - mutation?: MutationObserverOptions< - DeletePetMutationResponse, - DeletePet400, - { - petId: MaybeRef - headers?: MaybeRef - } - > - client?: Partial - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? deletePetMutationKey() - return useMutation< - DeletePetMutationResponse, - DeletePet400, - { - petId: DeletePetPathParams['petId'] - headers?: DeletePetHeaderParams - } - >({ - mutationFn: async ({ petId, headers }) => { - return deletePet({ petId, headers }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useDeletePet(options: { + mutation?: MutationObserverOptions; + headers?: MaybeRef; + }>; + client?: Partial; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? deletePetMutationKey(); + return useMutation({ + mutationFn: async ({ petId, headers }) => { + return deletePet({ petId, headers }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useDeleteUser.ts b/examples/vue-query/src/gen/hooks/useDeleteUser.ts index 76feaf0fb..2ee798c6b 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteUser.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteUser.ts @@ -1,61 +1,46 @@ -import client from '@kubb/plugin-client/client' -import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../models/DeleteUser' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from "../models/DeleteUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const deleteUserMutationKey = () => [{ url: '/user/{username}' }] as const + export const deleteUserMutationKey = () => [{ "url": "/user/{username}" }] as const; -export type DeleteUserMutationKey = ReturnType + export type DeleteUserMutationKey = ReturnType; -/** + /** * @description This can only be done by the logged in user. * @summary Delete user * {@link /user/:username} */ -async function deleteUser( - { - username, - }: { - username: DeleteUserPathParams['username'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'DELETE', url: `/user/${username}`, ...config }) - return res.data +async function deleteUser({ username }: { + username: DeleteUserPathParams["username"]; +}, config: Partial = {}) { + const res = await client({ method: "DELETE", url: `/user/${username}`, ...config }); + return res.data; } -/** + /** * @description This can only be done by the logged in user. * @summary Delete user * {@link /user/:username} */ -export function useDeleteUser( - options: { - mutation?: MutationObserverOptions< - DeleteUserMutationResponse, - DeleteUser400 | DeleteUser404, - { - username: MaybeRef - } - > - client?: Partial - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? deleteUserMutationKey() - return useMutation< - DeleteUserMutationResponse, - DeleteUser400 | DeleteUser404, - { - username: DeleteUserPathParams['username'] - } - >({ - mutationFn: async ({ username }) => { - return deleteUser({ username }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useDeleteUser(options: { + mutation?: MutationObserverOptions; + }>; + client?: Partial; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? deleteUserMutationKey(); + return useMutation({ + mutationFn: async ({ username }) => { + return deleteUser({ username }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts index dc71df713..c820f24d4 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts @@ -1,79 +1,60 @@ -import client from '@kubb/plugin-client/client' -import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import { unref } from 'vue' +import client from "@kubb/plugin-client/client"; +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from "../models/FindPetsByStatus"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { queryOptions, useQuery } from "@tanstack/vue-query"; +import { unref } from "vue"; -export const findPetsByStatusQueryKey = (params?: MaybeRef) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const + export const findPetsByStatusQueryKey = (params?: MaybeRef) => [{ url: "/pet/findByStatus" }, ...(params ? [params] : [])] as const; -export type FindPetsByStatusQueryKey = ReturnType + export type FindPetsByStatusQueryKey = ReturnType; -/** + /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * {@link /pet/findByStatus} */ -async function findPetsByStatus( - { - params, - }: { - params?: FindPetsByStatusQueryParams - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: '/pet/findByStatus', params, ...config }) - return res.data +async function findPetsByStatus({ params }: { + params?: FindPetsByStatusQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/findByStatus`, params, ...config }); + return res.data; } -export function findPetsByStatusQueryOptions( - { - params, - }: { - params?: MaybeRef - }, - config: Partial = {}, -) { - const queryKey = findPetsByStatusQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return findPetsByStatus(unref({ params: unref(params) }), unref(config)) - }, - }) + export function findPetsByStatusQueryOptions({ params }: { + params?: MaybeRef; +}, config: Partial = {}) { + const queryKey = findPetsByStatusQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByStatus(unref({ params: unref(params) }), unref(config)); + }, + }); } -/** + /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * {@link /pet/findByStatus} */ -export function useFindPetsByStatus< - TData = FindPetsByStatusQueryResponse, - TQueryData = FindPetsByStatusQueryResponse, - TQueryKey extends QueryKey = FindPetsByStatusQueryKey, ->( - { - params, - }: { - params?: MaybeRef - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params) - const query = useQuery({ - ...(findPetsByStatusQueryOptions({ params }, config) as unknown as QueryObserverOptions), - queryKey: queryKey as QueryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useFindPetsByStatus({ params }: { + params?: MaybeRef; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params); + const query = useQuery({ + ...findPetsByStatusQueryOptions({ params }, config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts index ee05561dd..5223814e1 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts @@ -1,79 +1,60 @@ -import client from '@kubb/plugin-client/client' -import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import { unref } from 'vue' +import client from "@kubb/plugin-client/client"; +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from "../models/FindPetsByTags"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { queryOptions, useQuery } from "@tanstack/vue-query"; +import { unref } from "vue"; -export const findPetsByTagsQueryKey = (params?: MaybeRef) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const + export const findPetsByTagsQueryKey = (params?: MaybeRef) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; -export type FindPetsByTagsQueryKey = ReturnType + export type FindPetsByTagsQueryKey = ReturnType; -/** + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * {@link /pet/findByTags} */ -async function findPetsByTags( - { - params, - }: { - params?: FindPetsByTagsQueryParams - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: '/pet/findByTags', params, ...config }) - return res.data +async function findPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); + return res.data; } -export function findPetsByTagsQueryOptions( - { - params, - }: { - params?: MaybeRef - }, - config: Partial = {}, -) { - const queryKey = findPetsByTagsQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return findPetsByTags(unref({ params: unref(params) }), unref(config)) - }, - }) + export function findPetsByTagsQueryOptions({ params }: { + params?: MaybeRef; +}, config: Partial = {}) { + const queryKey = findPetsByTagsQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByTags(unref({ params: unref(params) }), unref(config)); + }, + }); } -/** + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * {@link /pet/findByTags} */ -export function useFindPetsByTags< - TData = FindPetsByTagsQueryResponse, - TQueryData = FindPetsByTagsQueryResponse, - TQueryKey extends QueryKey = FindPetsByTagsQueryKey, ->( - { - params, - }: { - params?: MaybeRef - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params) - const query = useQuery({ - ...(findPetsByTagsQueryOptions({ params }, config) as unknown as QueryObserverOptions), - queryKey: queryKey as QueryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useFindPetsByTags({ params }: { + params?: MaybeRef; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params); + const query = useQuery({ + ...findPetsByTagsQueryOptions({ params }, config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useGetInventory.ts b/examples/vue-query/src/gen/hooks/useGetInventory.ts index 1f97f4346..563623755 100644 --- a/examples/vue-query/src/gen/hooks/useGetInventory.ts +++ b/examples/vue-query/src/gen/hooks/useGetInventory.ts @@ -1,55 +1,53 @@ -import client from '@kubb/plugin-client/client' -import type { GetInventoryQueryResponse } from '../models/GetInventory' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import { unref } from 'vue' +import client from "@kubb/plugin-client/client"; +import type { GetInventoryQueryResponse } from "../models/GetInventory"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/vue-query"; +import { queryOptions, useQuery } from "@tanstack/vue-query"; +import { unref } from "vue"; -export const getInventoryQueryKey = () => [{ url: '/store/inventory' }] as const + export const getInventoryQueryKey = () => [{ url: "/store/inventory" }] as const; -export type GetInventoryQueryKey = ReturnType + export type GetInventoryQueryKey = ReturnType; -/** + /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * {@link /store/inventory} */ async function getInventory(config: Partial = {}) { - const res = await client({ method: 'GET', url: '/store/inventory', ...config }) - return res.data + const res = await client({ method: "GET", url: `/store/inventory`, ...config }); + return res.data; } -export function getInventoryQueryOptions(config: Partial = {}) { - const queryKey = getInventoryQueryKey() - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getInventory(unref(config)) - }, - }) + export function getInventoryQueryOptions(config: Partial = {}) { + const queryKey = getInventoryQueryKey(); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getInventory(unref(config)); + }, + }); } -/** + /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * {@link /store/inventory} */ -export function useGetInventory( - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getInventoryQueryKey() - const query = useQuery({ - ...(getInventoryQueryOptions(config) as unknown as QueryObserverOptions), - queryKey: queryKey as QueryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetInventory(options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getInventoryQueryKey(); + const query = useQuery({ + ...getInventoryQueryOptions(config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useGetOrderById.ts b/examples/vue-query/src/gen/hooks/useGetOrderById.ts index a749ded91..563662c35 100644 --- a/examples/vue-query/src/gen/hooks/useGetOrderById.ts +++ b/examples/vue-query/src/gen/hooks/useGetOrderById.ts @@ -1,80 +1,63 @@ -import client from '@kubb/plugin-client/client' -import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import { unref } from 'vue' +import client from "@kubb/plugin-client/client"; +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from "../models/GetOrderById"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { queryOptions, useQuery } from "@tanstack/vue-query"; +import { unref } from "vue"; -export const getOrderByIdQueryKey = ({ - orderId, -}: { - orderId: MaybeRef -}) => [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const + export const getOrderByIdQueryKey = ({ orderId }: { + orderId: MaybeRef; +}) => [{ url: "/store/order/:orderId", params: { orderId: orderId } }] as const; -export type GetOrderByIdQueryKey = ReturnType + export type GetOrderByIdQueryKey = ReturnType; -/** + /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderById( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/store/order/${orderId}`, ...config }) - return res.data +async function getOrderById({ orderId }: { + orderId: GetOrderByIdPathParams["orderId"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/store/order/${orderId}`, ...config }); + return res.data; } -export function getOrderByIdQueryOptions( - { - orderId, - }: { - orderId: MaybeRef - }, - config: Partial = {}, -) { - const queryKey = getOrderByIdQueryKey({ orderId }) - return queryOptions({ - enabled: !!orderId, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getOrderById(unref({ orderId: unref(orderId) }), unref(config)) - }, - }) + export function getOrderByIdQueryOptions({ orderId }: { + orderId: MaybeRef; +}, config: Partial = {}) { + const queryKey = getOrderByIdQueryKey({ orderId }); + return queryOptions({ + enabled: !!(orderId), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getOrderById(unref({ orderId: unref(orderId) }), unref(config)); + }, + }); } -/** + /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -export function useGetOrderById( - { - orderId, - }: { - orderId: MaybeRef - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey({ orderId }) - const query = useQuery({ - ...(getOrderByIdQueryOptions({ orderId }, config) as unknown as QueryObserverOptions), - queryKey: queryKey as QueryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetOrderById({ orderId }: { + orderId: MaybeRef; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey({ orderId }); + const query = useQuery({ + ...getOrderByIdQueryOptions({ orderId }, config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useGetPetById.ts b/examples/vue-query/src/gen/hooks/useGetPetById.ts index 49c5dff03..dc6d9ee8f 100644 --- a/examples/vue-query/src/gen/hooks/useGetPetById.ts +++ b/examples/vue-query/src/gen/hooks/useGetPetById.ts @@ -1,80 +1,63 @@ -import client from '@kubb/plugin-client/client' -import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import { unref } from 'vue' +import client from "@kubb/plugin-client/client"; +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from "../models/GetPetById"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { queryOptions, useQuery } from "@tanstack/vue-query"; +import { unref } from "vue"; -export const getPetByIdQueryKey = ({ - petId, -}: { - petId: MaybeRef -}) => [{ url: '/pet/:petId', params: { petId: petId } }] as const + export const getPetByIdQueryKey = ({ petId }: { + petId: MaybeRef; +}) => [{ url: "/pet/:petId", params: { petId: petId } }] as const; -export type GetPetByIdQueryKey = ReturnType + export type GetPetByIdQueryKey = ReturnType; -/** + /** * @description Returns a single pet * @summary Find pet by ID * {@link /pet/:petId} */ -async function getPetById( - { - petId, - }: { - petId: GetPetByIdPathParams['petId'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/pet/${petId}`, ...config }) - return res.data +async function getPetById({ petId }: { + petId: GetPetByIdPathParams["petId"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/${petId}`, ...config }); + return res.data; } -export function getPetByIdQueryOptions( - { - petId, - }: { - petId: MaybeRef - }, - config: Partial = {}, -) { - const queryKey = getPetByIdQueryKey({ petId }) - return queryOptions({ - enabled: !!petId, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getPetById(unref({ petId: unref(petId) }), unref(config)) - }, - }) + export function getPetByIdQueryOptions({ petId }: { + petId: MaybeRef; +}, config: Partial = {}) { + const queryKey = getPetByIdQueryKey({ petId }); + return queryOptions({ + enabled: !!(petId), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getPetById(unref({ petId: unref(petId) }), unref(config)); + }, + }); } -/** + /** * @description Returns a single pet * @summary Find pet by ID * {@link /pet/:petId} */ -export function useGetPetById( - { - petId, - }: { - petId: MaybeRef - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey({ petId }) - const query = useQuery({ - ...(getPetByIdQueryOptions({ petId }, config) as unknown as QueryObserverOptions), - queryKey: queryKey as QueryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetPetById({ petId }: { + petId: MaybeRef; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey({ petId }); + const query = useQuery({ + ...getPetByIdQueryOptions({ petId }, config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useGetUserByName.ts b/examples/vue-query/src/gen/hooks/useGetUserByName.ts index cf61bb432..23e1b1c31 100644 --- a/examples/vue-query/src/gen/hooks/useGetUserByName.ts +++ b/examples/vue-query/src/gen/hooks/useGetUserByName.ts @@ -1,82 +1,61 @@ -import client from '@kubb/plugin-client/client' -import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import { unref } from 'vue' +import client from "@kubb/plugin-client/client"; +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from "../models/GetUserByName"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { queryOptions, useQuery } from "@tanstack/vue-query"; +import { unref } from "vue"; -export const getUserByNameQueryKey = ({ - username, -}: { - username: MaybeRef -}) => [{ url: '/user/:username', params: { username: username } }] as const + export const getUserByNameQueryKey = ({ username }: { + username: MaybeRef; +}) => [{ url: "/user/:username", params: { username: username } }] as const; -export type GetUserByNameQueryKey = ReturnType + export type GetUserByNameQueryKey = ReturnType; -/** + /** * @summary Get user by user name * {@link /user/:username} */ -async function getUserByName( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: `/user/${username}`, ...config }) - return res.data +async function getUserByName({ username }: { + username: GetUserByNamePathParams["username"]; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/user/${username}`, ...config }); + return res.data; } -export function getUserByNameQueryOptions( - { - username, - }: { - username: MaybeRef - }, - config: Partial = {}, -) { - const queryKey = getUserByNameQueryKey({ username }) - return queryOptions({ - enabled: !!username, - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return getUserByName(unref({ username: unref(username) }), unref(config)) - }, - }) + export function getUserByNameQueryOptions({ username }: { + username: MaybeRef; +}, config: Partial = {}) { + const queryKey = getUserByNameQueryKey({ username }); + return queryOptions({ + enabled: !!(username), + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return getUserByName(unref({ username: unref(username) }), unref(config)); + }, + }); } -/** + /** * @summary Get user by user name * {@link /user/:username} */ -export function useGetUserByName< - TData = GetUserByNameQueryResponse, - TQueryData = GetUserByNameQueryResponse, - TQueryKey extends QueryKey = GetUserByNameQueryKey, ->( - { - username, - }: { - username: MaybeRef - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey({ username }) - const query = useQuery({ - ...(getUserByNameQueryOptions({ username }, config) as unknown as QueryObserverOptions), - queryKey: queryKey as QueryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useGetUserByName({ username }: { + username: MaybeRef; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey({ username }); + const query = useQuery({ + ...getUserByNameQueryOptions({ username }, config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useLoginUser.ts b/examples/vue-query/src/gen/hooks/useLoginUser.ts index e6c71e009..027c7523a 100644 --- a/examples/vue-query/src/gen/hooks/useLoginUser.ts +++ b/examples/vue-query/src/gen/hooks/useLoginUser.ts @@ -1,73 +1,58 @@ -import client from '@kubb/plugin-client/client' -import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import { unref } from 'vue' +import client from "@kubb/plugin-client/client"; +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from "../models/LoginUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { queryOptions, useQuery } from "@tanstack/vue-query"; +import { unref } from "vue"; -export const loginUserQueryKey = (params?: MaybeRef) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const + export const loginUserQueryKey = (params?: MaybeRef) => [{ url: "/user/login" }, ...(params ? [params] : [])] as const; -export type LoginUserQueryKey = ReturnType + export type LoginUserQueryKey = ReturnType; -/** + /** * @summary Logs user into the system * {@link /user/login} */ -async function loginUser( - { - params, - }: { - params?: LoginUserQueryParams - }, - config: Partial = {}, -) { - const res = await client({ method: 'GET', url: '/user/login', params, ...config }) - return res.data +async function loginUser({ params }: { + params?: LoginUserQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/user/login`, params, ...config }); + return res.data; } -export function loginUserQueryOptions( - { - params, - }: { - params?: MaybeRef - }, - config: Partial = {}, -) { - const queryKey = loginUserQueryKey(params) - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return loginUser(unref({ params: unref(params) }), unref(config)) - }, - }) + export function loginUserQueryOptions({ params }: { + params?: MaybeRef; +}, config: Partial = {}) { + const queryKey = loginUserQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return loginUser(unref({ params: unref(params) }), unref(config)); + }, + }); } -/** + /** * @summary Logs user into the system * {@link /user/login} */ -export function useLoginUser( - { - params, - }: { - params?: MaybeRef - }, - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params) - const query = useQuery({ - ...(loginUserQueryOptions({ params }, config) as unknown as QueryObserverOptions), - queryKey: queryKey as QueryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useLoginUser({ params }: { + params?: MaybeRef; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params); + const query = useQuery({ + ...loginUserQueryOptions({ params }, config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useLogoutUser.ts b/examples/vue-query/src/gen/hooks/useLogoutUser.ts index 5451398e3..9be1c713f 100644 --- a/examples/vue-query/src/gen/hooks/useLogoutUser.ts +++ b/examples/vue-query/src/gen/hooks/useLogoutUser.ts @@ -1,53 +1,51 @@ -import client from '@kubb/plugin-client/client' -import type { LogoutUserQueryResponse } from '../models/LogoutUser' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/vue-query' -import { queryOptions, useQuery } from '@tanstack/vue-query' -import { unref } from 'vue' +import client from "@kubb/plugin-client/client"; +import type { LogoutUserQueryResponse } from "../models/LogoutUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/vue-query"; +import { queryOptions, useQuery } from "@tanstack/vue-query"; +import { unref } from "vue"; -export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const + export const logoutUserQueryKey = () => [{ url: "/user/logout" }] as const; -export type LogoutUserQueryKey = ReturnType + export type LogoutUserQueryKey = ReturnType; -/** + /** * @summary Logs out current logged in user session * {@link /user/logout} */ async function logoutUser(config: Partial = {}) { - const res = await client({ method: 'GET', url: '/user/logout', ...config }) - return res.data + const res = await client({ method: "GET", url: `/user/logout`, ...config }); + return res.data; } -export function logoutUserQueryOptions(config: Partial = {}) { - const queryKey = logoutUserQueryKey() - return queryOptions({ - queryKey, - queryFn: async ({ signal }) => { - config.signal = signal - return logoutUser(unref(config)) - }, - }) + export function logoutUserQueryOptions(config: Partial = {}) { + const queryKey = logoutUserQueryKey(); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return logoutUser(unref(config)); + }, + }); } -/** + /** * @summary Logs out current logged in user session * {@link /user/logout} */ -export function useLogoutUser( - options: { - query?: Partial> - client?: Partial - } = {}, -) { - const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey() - const query = useQuery({ - ...(logoutUserQueryOptions(config) as unknown as QueryObserverOptions), - queryKey: queryKey as QueryKey, - ...(queryOptions as unknown as Omit), - }) as UseQueryReturnType & { - queryKey: TQueryKey - } - query.queryKey = queryKey as TQueryKey - return query -} +export function useLogoutUser(options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey(); + const query = useQuery({ + ...logoutUserQueryOptions(config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts index 9c577c7f0..c26a9b4cf 100644 --- a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts +++ b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts @@ -1,61 +1,46 @@ -import client from '@kubb/plugin-client/client' -import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../models/PlaceOrder' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from "../models/PlaceOrder"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const placeOrderMutationKey = () => [{ url: '/store/order' }] as const + export const placeOrderMutationKey = () => [{ "url": "/store/order" }] as const; -export type PlaceOrderMutationKey = ReturnType + export type PlaceOrderMutationKey = ReturnType; -/** + /** * @description Place a new order in the store * @summary Place an order for a pet * {@link /store/order} */ -async function placeOrder( - { - data, - }: { - data?: PlaceOrderMutationRequest - }, - config: Partial> = {}, -) { - const res = await client({ method: 'POST', url: '/store/order', data, ...config }) - return res.data +async function placeOrder({ data }: { + data?: PlaceOrderMutationRequest; +}, config: Partial> = {}) { + const res = await client({ method: "POST", url: `/store/order`, data, ...config }); + return res.data; } -/** + /** * @description Place a new order in the store * @summary Place an order for a pet * {@link /store/order} */ -export function usePlaceOrder( - options: { - mutation?: MutationObserverOptions< - PlaceOrderMutationResponse, - PlaceOrder405, - { - data?: MaybeRef - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? placeOrderMutationKey() - return useMutation< - PlaceOrderMutationResponse, - PlaceOrder405, - { - data?: PlaceOrderMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return placeOrder({ data }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function usePlaceOrder(options: { + mutation?: MutationObserverOptions; + }>; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? placeOrderMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return placeOrder({ data }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useUpdatePet.ts b/examples/vue-query/src/gen/hooks/useUpdatePet.ts index 23a1efe56..d70df2ade 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePet.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePet.ts @@ -1,66 +1,46 @@ -import client from '@kubb/plugin-client/client' -import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../models/UpdatePet' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from "../models/UpdatePet"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const updatePetMutationKey = () => [{ url: '/pet' }] as const + export const updatePetMutationKey = () => [{ "url": "/pet" }] as const; -export type UpdatePetMutationKey = ReturnType + export type UpdatePetMutationKey = ReturnType; -/** + /** * @description Update an existing pet by Id * @summary Update an existing pet * {@link /pet} */ -async function updatePet( - { - data, - }: { - data: UpdatePetMutationRequest - }, - config: Partial> = {}, -) { - const res = await client({ - method: 'PUT', - url: '/pet', - data, - ...config, - }) - return res.data +async function updatePet({ data }: { + data: UpdatePetMutationRequest; +}, config: Partial> = {}) { + const res = await client({ method: "PUT", url: `/pet`, data, ...config }); + return res.data; } -/** + /** * @description Update an existing pet by Id * @summary Update an existing pet * {@link /pet} */ -export function useUpdatePet( - options: { - mutation?: MutationObserverOptions< - UpdatePetMutationResponse, - UpdatePet400 | UpdatePet404 | UpdatePet405, - { - data: MaybeRef - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? updatePetMutationKey() - return useMutation< - UpdatePetMutationResponse, - UpdatePet400 | UpdatePet404 | UpdatePet405, - { - data: UpdatePetMutationRequest - } - >({ - mutationFn: async ({ data }) => { - return updatePet({ data }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useUpdatePet(options: { + mutation?: MutationObserverOptions; + }>; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? updatePetMutationKey(); + return useMutation({ + mutationFn: async ({ data }) => { + return updatePet({ data }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts index 842be5350..9682f9165 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts @@ -1,68 +1,47 @@ -import client from '@kubb/plugin-client/client' -import type { - UpdatePetWithFormMutationResponse, - UpdatePetWithFormPathParams, - UpdatePetWithFormQueryParams, - UpdatePetWithForm405, -} from '../models/UpdatePetWithForm' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405 } from "../models/UpdatePetWithForm"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const + export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const; -export type UpdatePetWithFormMutationKey = ReturnType + export type UpdatePetWithFormMutationKey = ReturnType; -/** + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} */ -async function updatePetWithForm( - { - petId, - params, - }: { - petId: UpdatePetWithFormPathParams['petId'] - params?: UpdatePetWithFormQueryParams - }, - config: Partial = {}, -) { - const res = await client({ method: 'POST', url: `/pet/${petId}`, params, ...config }) - return res.data +async function updatePetWithForm({ petId, params }: { + petId: UpdatePetWithFormPathParams["petId"]; + params?: UpdatePetWithFormQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "POST", url: `/pet/${petId}`, params, ...config }); + return res.data; } -/** + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} */ -export function useUpdatePetWithForm( - options: { - mutation?: MutationObserverOptions< - UpdatePetWithFormMutationResponse, - UpdatePetWithForm405, - { - petId: MaybeRef - params?: MaybeRef - } - > - client?: Partial - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey() - return useMutation< - UpdatePetWithFormMutationResponse, - UpdatePetWithForm405, - { - petId: UpdatePetWithFormPathParams['petId'] - params?: UpdatePetWithFormQueryParams - } - >({ - mutationFn: async ({ petId, params }) => { - return updatePetWithForm({ petId, params }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useUpdatePetWithForm(options: { + mutation?: MutationObserverOptions; + params?: MaybeRef; + }>; + client?: Partial; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey(); + return useMutation({ + mutationFn: async ({ petId, params }) => { + return updatePetWithForm({ petId, params }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useUpdateUser.ts b/examples/vue-query/src/gen/hooks/useUpdateUser.ts index befbc325c..d429a5748 100644 --- a/examples/vue-query/src/gen/hooks/useUpdateUser.ts +++ b/examples/vue-query/src/gen/hooks/useUpdateUser.ts @@ -1,65 +1,49 @@ -import client from '@kubb/plugin-client/client' -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from "../models/UpdateUser"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const updateUserMutationKey = () => [{ url: '/user/{username}' }] as const + export const updateUserMutationKey = () => [{ "url": "/user/{username}" }] as const; -export type UpdateUserMutationKey = ReturnType + export type UpdateUserMutationKey = ReturnType; -/** + /** * @description This can only be done by the logged in user. * @summary Update user * {@link /user/:username} */ -async function updateUser( - { - username, - data, - }: { - username: UpdateUserPathParams['username'] - data?: UpdateUserMutationRequest - }, - config: Partial> = {}, -) { - const res = await client({ method: 'PUT', url: `/user/${username}`, data, ...config }) - return res.data +async function updateUser({ username, data }: { + username: UpdateUserPathParams["username"]; + data?: UpdateUserMutationRequest; +}, config: Partial> = {}) { + const res = await client({ method: "PUT", url: `/user/${username}`, data, ...config }); + return res.data; } -/** + /** * @description This can only be done by the logged in user. * @summary Update user * {@link /user/:username} */ -export function useUpdateUser( - options: { - mutation?: MutationObserverOptions< - UpdateUserMutationResponse, - Error, - { - username: MaybeRef - data?: MaybeRef - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? updateUserMutationKey() - return useMutation< - UpdateUserMutationResponse, - Error, - { - username: UpdateUserPathParams['username'] - data?: UpdateUserMutationRequest - } - >({ - mutationFn: async ({ username, data }) => { - return updateUser({ username, data }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useUpdateUser(options: { + mutation?: MutationObserverOptions; + data?: MaybeRef; + }>; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? updateUserMutationKey(); + return useMutation({ + mutationFn: async ({ username, data }) => { + return updateUser({ username, data }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/hooks/useUploadFile.ts b/examples/vue-query/src/gen/hooks/useUploadFile.ts index 375f94043..d44428cce 100644 --- a/examples/vue-query/src/gen/hooks/useUploadFile.ts +++ b/examples/vue-query/src/gen/hooks/useUploadFile.ts @@ -1,74 +1,50 @@ -import client from '@kubb/plugin-client/client' -import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile' -import type { RequestConfig } from '@kubb/plugin-client/client' -import type { MutationObserverOptions } from '@tanstack/vue-query' -import type { MaybeRef } from 'vue' -import { useMutation } from '@tanstack/vue-query' +import client from "@kubb/plugin-client/client"; +import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from "../models/UploadFile"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { MutationObserverOptions } from "@tanstack/vue-query"; +import type { MaybeRef } from "vue"; +import { useMutation } from "@tanstack/vue-query"; -export const uploadFileMutationKey = () => [{ url: '/pet/{petId}/uploadImage' }] as const + export const uploadFileMutationKey = () => [{ "url": "/pet/{petId}/uploadImage" }] as const; -export type UploadFileMutationKey = ReturnType + export type UploadFileMutationKey = ReturnType; -/** + /** * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -async function uploadFile( - { - petId, - data, - params, - }: { - petId: UploadFilePathParams['petId'] - data?: UploadFileMutationRequest - params?: UploadFileQueryParams - }, - config: Partial> = {}, -) { - const res = await client({ - method: 'POST', - url: `/pet/${petId}/uploadImage`, - params, - data, - headers: { 'Content-Type': 'application/octet-stream', ...config.headers }, - ...config, - }) - return res.data +async function uploadFile({ petId, data, params }: { + petId: UploadFilePathParams["petId"]; + data?: UploadFileMutationRequest; + params?: UploadFileQueryParams; +}, config: Partial> = {}) { + const res = await client({ method: "POST", url: `/pet/${petId}/uploadImage`, params, data, headers: { "Content-Type": "application/octet-stream", ...config.headers }, ...config }); + return res.data; } -/** + /** * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -export function useUploadFile( - options: { - mutation?: MutationObserverOptions< - UploadFileMutationResponse, - Error, - { - petId: MaybeRef - data?: MaybeRef - params?: MaybeRef - } - > - client?: Partial> - } = {}, -) { - const { mutation: mutationOptions, client: config = {} } = options ?? {} - const mutationKey = mutationOptions?.mutationKey ?? uploadFileMutationKey() - return useMutation< - UploadFileMutationResponse, - Error, - { - petId: UploadFilePathParams['petId'] - data?: UploadFileMutationRequest - params?: UploadFileQueryParams - } - >({ - mutationFn: async ({ petId, data, params }) => { - return uploadFile({ petId, data, params }, config) - }, - mutationKey, - ...mutationOptions, - }) -} +export function useUploadFile(options: { + mutation?: MutationObserverOptions; + data?: MaybeRef; + params?: MaybeRef; + }>; + client?: Partial>; +} = {}) { + const { mutation: mutationOptions, client: config = {} } = options ?? {}; + const mutationKey = mutationOptions?.mutationKey ?? uploadFileMutationKey(); + return useMutation({ + mutationFn: async ({ petId, data, params }) => { + return uploadFile({ petId, data, params }, config); + }, + mutationKey, + ...mutationOptions + }); +} \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/AddPet.ts b/examples/vue-query/src/gen/models/AddPet.ts index 7c43b22b1..2d4e85901 100644 --- a/examples/vue-query/src/gen/models/AddPet.ts +++ b/examples/vue-query/src/gen/models/AddPet.ts @@ -1,24 +1,24 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -/** + /** * @description Successful operation - */ -export type AddPet200 = Pet +*/ +export type AddPet200 = Pet; -/** + /** * @description Invalid input - */ -export type AddPet405 = any +*/ +export type AddPet405 = any; -/** + /** * @description Create a new pet in the store - */ -export type AddPetMutationRequest = Pet +*/ +export type AddPetMutationRequest = Pet; -export type AddPetMutationResponse = AddPet200 + export type AddPetMutationResponse = AddPet200; -export type AddPetMutation = { - Response: AddPet200 - Request: AddPetMutationRequest - Errors: AddPet405 -} + export type AddPetMutation = { + Response: AddPet200; + Request: AddPetMutationRequest; + Errors: AddPet405; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/Address.ts b/examples/vue-query/src/gen/models/Address.ts index c8e706e14..d7ffd22c3 100644 --- a/examples/vue-query/src/gen/models/Address.ts +++ b/examples/vue-query/src/gen/models/Address.ts @@ -1,31 +1,35 @@ export const addressIdentifierEnum = { - NW: 'NW', - NE: 'NE', - SW: 'SW', - SE: 'SE', -} as const + "NW": "NW", + "NE": "NE", + "SW": "SW", + "SE": "SE" +} as const; -export type AddressIdentifierEnum = (typeof addressIdentifierEnum)[keyof typeof addressIdentifierEnum] + export type AddressIdentifierEnum = (typeof addressIdentifierEnum)[keyof typeof addressIdentifierEnum]; -export type Address = { - /** - * @type string | undefined - */ - street?: string - /** - * @type string | undefined - */ - city?: string - /** - * @type string | undefined - */ - state?: string - /** - * @type string | undefined - */ - zip?: string - /** - * @type array | undefined - */ - identifier?: [number, string, AddressIdentifierEnum] -} + export type Address = { + /** + * @type string | undefined + */ + street?: string; + /** + * @type string | undefined + */ + city?: string; + /** + * @type string | undefined + */ + state?: string; + /** + * @type string | undefined + */ + zip?: string; + /** + * @type array | undefined + */ + identifier?: [ + number, + string, + AddressIdentifierEnum + ]; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/ApiResponse.ts b/examples/vue-query/src/gen/models/ApiResponse.ts index 3a6dae779..2a8e81e25 100644 --- a/examples/vue-query/src/gen/models/ApiResponse.ts +++ b/examples/vue-query/src/gen/models/ApiResponse.ts @@ -1,14 +1,14 @@ export type ApiResponse = { - /** - * @type integer | undefined, int32 - */ - code?: number - /** - * @type string | undefined - */ - type?: string - /** - * @type string | undefined - */ - message?: string -} + /** + * @type integer | undefined, int32 + */ + code?: number; + /** + * @type string | undefined + */ + type?: string; + /** + * @type string | undefined + */ + message?: string; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/Category.ts b/examples/vue-query/src/gen/models/Category.ts index 3b48c48f3..49380ed19 100644 --- a/examples/vue-query/src/gen/models/Category.ts +++ b/examples/vue-query/src/gen/models/Category.ts @@ -1,10 +1,10 @@ export type Category = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + name?: string; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/CreateUser.ts b/examples/vue-query/src/gen/models/CreateUser.ts index 775e3946b..06124c4e9 100644 --- a/examples/vue-query/src/gen/models/CreateUser.ts +++ b/examples/vue-query/src/gen/models/CreateUser.ts @@ -1,19 +1,19 @@ -import type { User } from './User' +import type { User } from "./User"; -/** + /** * @description successful operation - */ -export type CreateUserError = User +*/ +export type CreateUserError = User; -/** + /** * @description Created user object - */ -export type CreateUserMutationRequest = User +*/ +export type CreateUserMutationRequest = User; -export type CreateUserMutationResponse = any + export type CreateUserMutationResponse = any; -export type CreateUserMutation = { - Response: any - Request: CreateUserMutationRequest - Errors: any -} + export type CreateUserMutation = { + Response: any; + Request: CreateUserMutationRequest; + Errors: any; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts index 2e76255f9..cf8a947e6 100644 --- a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,21 +1,21 @@ -import type { User } from './User' +import type { User } from "./User"; -/** + /** * @description Successful operation - */ -export type CreateUsersWithListInput200 = User +*/ +export type CreateUsersWithListInput200 = User; -/** + /** * @description successful operation - */ -export type CreateUsersWithListInputError = any +*/ +export type CreateUsersWithListInputError = any; -export type CreateUsersWithListInputMutationRequest = User[] + export type CreateUsersWithListInputMutationRequest = User[]; -export type CreateUsersWithListInputMutationResponse = CreateUsersWithListInput200 + export type CreateUsersWithListInputMutationResponse = CreateUsersWithListInput200; -export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInput200 - Request: CreateUsersWithListInputMutationRequest - Errors: any -} + export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInput200; + Request: CreateUsersWithListInputMutationRequest; + Errors: any; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/Customer.ts b/examples/vue-query/src/gen/models/Customer.ts index cfd611151..8479512ff 100644 --- a/examples/vue-query/src/gen/models/Customer.ts +++ b/examples/vue-query/src/gen/models/Customer.ts @@ -1,16 +1,16 @@ -import type { Address } from './Address' +import type { Address } from "./Address"; -export type Customer = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string | undefined - */ - username?: string - /** - * @type array | undefined - */ - address?: Address[] -} + export type Customer = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + username?: string; + /** + * @type array | undefined + */ + address?: Address[]; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/DeleteOrder.ts b/examples/vue-query/src/gen/models/DeleteOrder.ts index 3b22473aa..2280bda3b 100644 --- a/examples/vue-query/src/gen/models/DeleteOrder.ts +++ b/examples/vue-query/src/gen/models/DeleteOrder.ts @@ -1,25 +1,25 @@ export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer, int64 - */ - orderId: number -} + /** + * @description ID of the order that needs to be deleted + * @type integer, int64 + */ + orderId: number; +}; -/** + /** * @description Invalid ID supplied - */ -export type DeleteOrder400 = any +*/ +export type DeleteOrder400 = any; -/** + /** * @description Order not found - */ -export type DeleteOrder404 = any +*/ +export type DeleteOrder404 = any; -export type DeleteOrderMutationResponse = any + export type DeleteOrderMutationResponse = any; -export type DeleteOrderMutation = { - Response: any - PathParams: DeleteOrderPathParams - Errors: DeleteOrder400 | DeleteOrder404 -} + export type DeleteOrderMutation = { + Response: any; + PathParams: DeleteOrderPathParams; + Errors: DeleteOrder400 | DeleteOrder404; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/DeletePet.ts b/examples/vue-query/src/gen/models/DeletePet.ts index ec4506cf7..407109083 100644 --- a/examples/vue-query/src/gen/models/DeletePet.ts +++ b/examples/vue-query/src/gen/models/DeletePet.ts @@ -1,28 +1,28 @@ export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer, int64 - */ - petId: number -} + /** + * @description Pet id to delete + * @type integer, int64 + */ + petId: number; +}; -export type DeletePetHeaderParams = { - /** - * @type string | undefined - */ - api_key?: string -} + export type DeletePetHeaderParams = { + /** + * @type string | undefined + */ + api_key?: string; +}; -/** + /** * @description Invalid pet value - */ -export type DeletePet400 = any +*/ +export type DeletePet400 = any; -export type DeletePetMutationResponse = any + export type DeletePetMutationResponse = any; -export type DeletePetMutation = { - Response: any - PathParams: DeletePetPathParams - HeaderParams: DeletePetHeaderParams - Errors: DeletePet400 -} + export type DeletePetMutation = { + Response: any; + PathParams: DeletePetPathParams; + HeaderParams: DeletePetHeaderParams; + Errors: DeletePet400; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/DeleteUser.ts b/examples/vue-query/src/gen/models/DeleteUser.ts index 8cb71e167..31ecf784f 100644 --- a/examples/vue-query/src/gen/models/DeleteUser.ts +++ b/examples/vue-query/src/gen/models/DeleteUser.ts @@ -1,25 +1,25 @@ export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string -} + /** + * @description The name that needs to be deleted + * @type string + */ + username: string; +}; -/** + /** * @description Invalid username supplied - */ -export type DeleteUser400 = any +*/ +export type DeleteUser400 = any; -/** + /** * @description User not found - */ -export type DeleteUser404 = any +*/ +export type DeleteUser404 = any; -export type DeleteUserMutationResponse = any + export type DeleteUserMutationResponse = any; -export type DeleteUserMutation = { - Response: any - PathParams: DeleteUserPathParams - Errors: DeleteUser400 | DeleteUser404 -} + export type DeleteUserMutation = { + Response: any; + PathParams: DeleteUserPathParams; + Errors: DeleteUser400 | DeleteUser404; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/FindPetsByStatus.ts b/examples/vue-query/src/gen/models/FindPetsByStatus.ts index d8fd7f1c5..34ced6a62 100644 --- a/examples/vue-query/src/gen/models/FindPetsByStatus.ts +++ b/examples/vue-query/src/gen/models/FindPetsByStatus.ts @@ -1,36 +1,36 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export const findPetsByStatusQueryParamsStatusEnum = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const + export const findPetsByStatusQueryParamsStatusEnum = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; -export type FindPetsByStatusQueryParamsStatusEnum = (typeof findPetsByStatusQueryParamsStatusEnum)[keyof typeof findPetsByStatusQueryParamsStatusEnum] + export type FindPetsByStatusQueryParamsStatusEnum = (typeof findPetsByStatusQueryParamsStatusEnum)[keyof typeof findPetsByStatusQueryParamsStatusEnum]; -export type FindPetsByStatusQueryParams = { - /** - * @description Status values that need to be considered for filter - * @default "available" - * @type string | undefined - */ - status?: FindPetsByStatusQueryParamsStatusEnum -} + export type FindPetsByStatusQueryParams = { + /** + * @description Status values that need to be considered for filter + * @default "available" + * @type string | undefined + */ + status?: FindPetsByStatusQueryParamsStatusEnum; +}; -/** + /** * @description successful operation - */ -export type FindPetsByStatus200 = Pet[] +*/ +export type FindPetsByStatus200 = Pet[]; -/** + /** * @description Invalid status value - */ -export type FindPetsByStatus400 = any +*/ +export type FindPetsByStatus400 = any; -export type FindPetsByStatusQueryResponse = FindPetsByStatus200 + export type FindPetsByStatusQueryResponse = FindPetsByStatus200; -export type FindPetsByStatusQuery = { - Response: FindPetsByStatus200 - QueryParams: FindPetsByStatusQueryParams - Errors: FindPetsByStatus400 -} + export type FindPetsByStatusQuery = { + Response: FindPetsByStatus200; + QueryParams: FindPetsByStatusQueryParams; + Errors: FindPetsByStatus400; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/FindPetsByTags.ts b/examples/vue-query/src/gen/models/FindPetsByTags.ts index 66c3744a4..10c589fbd 100644 --- a/examples/vue-query/src/gen/models/FindPetsByTags.ts +++ b/examples/vue-query/src/gen/models/FindPetsByTags.ts @@ -1,27 +1,27 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export type FindPetsByTagsQueryParams = { - /** - * @description Tags to filter by - * @type array | undefined - */ - tags?: string[] -} + export type FindPetsByTagsQueryParams = { + /** + * @description Tags to filter by + * @type array | undefined + */ + tags?: string[]; +}; -/** + /** * @description successful operation - */ -export type FindPetsByTags200 = Pet[] +*/ +export type FindPetsByTags200 = Pet[]; -/** + /** * @description Invalid tag value - */ -export type FindPetsByTags400 = any +*/ +export type FindPetsByTags400 = any; -export type FindPetsByTagsQueryResponse = FindPetsByTags200 + export type FindPetsByTagsQueryResponse = FindPetsByTags200; -export type FindPetsByTagsQuery = { - Response: FindPetsByTags200 - QueryParams: FindPetsByTagsQueryParams - Errors: FindPetsByTags400 -} + export type FindPetsByTagsQuery = { + Response: FindPetsByTags200; + QueryParams: FindPetsByTagsQueryParams; + Errors: FindPetsByTags400; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/GetInventory.ts b/examples/vue-query/src/gen/models/GetInventory.ts index 411828e36..0a2beab9f 100644 --- a/examples/vue-query/src/gen/models/GetInventory.ts +++ b/examples/vue-query/src/gen/models/GetInventory.ts @@ -1,13 +1,13 @@ /** * @description successful operation - */ +*/ export type GetInventory200 = { - [key: string]: number -} + [key: string]: number; +}; -export type GetInventoryQueryResponse = GetInventory200 + export type GetInventoryQueryResponse = GetInventory200; -export type GetInventoryQuery = { - Response: GetInventory200 - Errors: any -} + export type GetInventoryQuery = { + Response: GetInventory200; + Errors: any; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/GetOrderById.ts b/examples/vue-query/src/gen/models/GetOrderById.ts index 5bcb06186..9944ceaf5 100644 --- a/examples/vue-query/src/gen/models/GetOrderById.ts +++ b/examples/vue-query/src/gen/models/GetOrderById.ts @@ -1,32 +1,32 @@ -import type { Order } from './Order' +import type { Order } from "./Order"; -export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer, int64 - */ - orderId: number -} + export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer, int64 + */ + orderId: number; +}; -/** + /** * @description successful operation - */ -export type GetOrderById200 = Order +*/ +export type GetOrderById200 = Order; -/** + /** * @description Invalid ID supplied - */ -export type GetOrderById400 = any +*/ +export type GetOrderById400 = any; -/** + /** * @description Order not found - */ -export type GetOrderById404 = any +*/ +export type GetOrderById404 = any; -export type GetOrderByIdQueryResponse = GetOrderById200 + export type GetOrderByIdQueryResponse = GetOrderById200; -export type GetOrderByIdQuery = { - Response: GetOrderById200 - PathParams: GetOrderByIdPathParams - Errors: GetOrderById400 | GetOrderById404 -} + export type GetOrderByIdQuery = { + Response: GetOrderById200; + PathParams: GetOrderByIdPathParams; + Errors: GetOrderById400 | GetOrderById404; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/GetPetById.ts b/examples/vue-query/src/gen/models/GetPetById.ts index 6150714f9..ead878803 100644 --- a/examples/vue-query/src/gen/models/GetPetById.ts +++ b/examples/vue-query/src/gen/models/GetPetById.ts @@ -1,32 +1,32 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer, int64 - */ - petId: number -} + export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer, int64 + */ + petId: number; +}; -/** + /** * @description successful operation - */ -export type GetPetById200 = Pet +*/ +export type GetPetById200 = Pet; -/** + /** * @description Invalid ID supplied - */ -export type GetPetById400 = any +*/ +export type GetPetById400 = any; -/** + /** * @description Pet not found - */ -export type GetPetById404 = any +*/ +export type GetPetById404 = any; -export type GetPetByIdQueryResponse = GetPetById200 + export type GetPetByIdQueryResponse = GetPetById200; -export type GetPetByIdQuery = { - Response: GetPetById200 - PathParams: GetPetByIdPathParams - Errors: GetPetById400 | GetPetById404 -} + export type GetPetByIdQuery = { + Response: GetPetById200; + PathParams: GetPetByIdPathParams; + Errors: GetPetById400 | GetPetById404; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/GetUserByName.ts b/examples/vue-query/src/gen/models/GetUserByName.ts index dd2f1be4e..4421fa742 100644 --- a/examples/vue-query/src/gen/models/GetUserByName.ts +++ b/examples/vue-query/src/gen/models/GetUserByName.ts @@ -1,32 +1,32 @@ -import type { User } from './User' +import type { User } from "./User"; -export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string -} + export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string; +}; -/** + /** * @description successful operation - */ -export type GetUserByName200 = User +*/ +export type GetUserByName200 = User; -/** + /** * @description Invalid username supplied - */ -export type GetUserByName400 = any +*/ +export type GetUserByName400 = any; -/** + /** * @description User not found - */ -export type GetUserByName404 = any +*/ +export type GetUserByName404 = any; -export type GetUserByNameQueryResponse = GetUserByName200 + export type GetUserByNameQueryResponse = GetUserByName200; -export type GetUserByNameQuery = { - Response: GetUserByName200 - PathParams: GetUserByNamePathParams - Errors: GetUserByName400 | GetUserByName404 -} + export type GetUserByNameQuery = { + Response: GetUserByName200; + PathParams: GetUserByNamePathParams; + Errors: GetUserByName400 | GetUserByName404; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/LoginUser.ts b/examples/vue-query/src/gen/models/LoginUser.ts index f8869afdb..82a6e8674 100644 --- a/examples/vue-query/src/gen/models/LoginUser.ts +++ b/examples/vue-query/src/gen/models/LoginUser.ts @@ -1,30 +1,30 @@ export type LoginUserQueryParams = { - /** - * @description The user name for login - * @type string | undefined - */ - username?: string - /** - * @description The password for login in clear text - * @type string | undefined - */ - password?: string -} + /** + * @description The user name for login + * @type string | undefined + */ + username?: string; + /** + * @description The password for login in clear text + * @type string | undefined + */ + password?: string; +}; -/** + /** * @description successful operation - */ -export type LoginUser200 = string +*/ +export type LoginUser200 = string; -/** + /** * @description Invalid username/password supplied - */ -export type LoginUser400 = any +*/ +export type LoginUser400 = any; -export type LoginUserQueryResponse = LoginUser200 + export type LoginUserQueryResponse = LoginUser200; -export type LoginUserQuery = { - Response: LoginUser200 - QueryParams: LoginUserQueryParams - Errors: LoginUser400 -} + export type LoginUserQuery = { + Response: LoginUser200; + QueryParams: LoginUserQueryParams; + Errors: LoginUser400; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/LogoutUser.ts b/examples/vue-query/src/gen/models/LogoutUser.ts index c969417e5..6615bff43 100644 --- a/examples/vue-query/src/gen/models/LogoutUser.ts +++ b/examples/vue-query/src/gen/models/LogoutUser.ts @@ -1,11 +1,11 @@ /** * @description successful operation - */ -export type LogoutUserError = any +*/ +export type LogoutUserError = any; -export type LogoutUserQueryResponse = any + export type LogoutUserQueryResponse = any; -export type LogoutUserQuery = { - Response: any - Errors: any -} + export type LogoutUserQuery = { + Response: any; + Errors: any; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/Order.ts b/examples/vue-query/src/gen/models/Order.ts index 5e694abb6..5337bffc2 100644 --- a/examples/vue-query/src/gen/models/Order.ts +++ b/examples/vue-query/src/gen/models/Order.ts @@ -1,35 +1,35 @@ export const orderStatusEnum = { - placed: 'placed', - approved: 'approved', - delivered: 'delivered', -} as const + "placed": "placed", + "approved": "approved", + "delivered": "delivered" +} as const; -export type OrderStatusEnum = (typeof orderStatusEnum)[keyof typeof orderStatusEnum] + export type OrderStatusEnum = (typeof orderStatusEnum)[keyof typeof orderStatusEnum]; -export type Order = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type integer | undefined, int64 - */ - petId?: number - /** - * @type integer | undefined, int32 - */ - quantity?: number - /** - * @type string | undefined, date-time - */ - shipDate?: string - /** - * @description Order Status - * @type string | undefined - */ - status?: OrderStatusEnum - /** - * @type boolean | undefined - */ - complete?: boolean -} + export type Order = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type integer | undefined, int64 + */ + petId?: number; + /** + * @type integer | undefined, int32 + */ + quantity?: number; + /** + * @type string | undefined, date-time + */ + shipDate?: string; + /** + * @description Order Status + * @type string | undefined + */ + status?: OrderStatusEnum; + /** + * @type boolean | undefined + */ + complete?: boolean; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/Pet.ts b/examples/vue-query/src/gen/models/Pet.ts index 15dc1a464..a1da85530 100644 --- a/examples/vue-query/src/gen/models/Pet.ts +++ b/examples/vue-query/src/gen/models/Pet.ts @@ -1,38 +1,38 @@ -import type { Category } from './Category' -import type { Tag } from './Tag' +import type { Category } from "./Category"; +import type { Tag } from "./Tag"; -export const petStatusEnum = { - available: 'available', - pending: 'pending', - sold: 'sold', -} as const + export const petStatusEnum = { + "available": "available", + "pending": "pending", + "sold": "sold" +} as const; -export type PetStatusEnum = (typeof petStatusEnum)[keyof typeof petStatusEnum] + export type PetStatusEnum = (typeof petStatusEnum)[keyof typeof petStatusEnum]; -export type Pet = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string - */ - name: string - /** - * @type object | undefined - */ - category?: Category - /** - * @type array - */ - photoUrls: string[] - /** - * @type array | undefined - */ - tags?: Tag[] - /** - * @description pet status in the store - * @type string | undefined - */ - status?: PetStatusEnum -} + export type Pet = { + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string + */ + name: string; + /** + * @type object | undefined + */ + category?: Category; + /** + * @type array + */ + photoUrls: string[]; + /** + * @type array | undefined + */ + tags?: Tag[]; + /** + * @description pet status in the store + * @type string | undefined + */ + status?: PetStatusEnum; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/PlaceOrder.ts b/examples/vue-query/src/gen/models/PlaceOrder.ts index 3aa55065a..64894c78b 100644 --- a/examples/vue-query/src/gen/models/PlaceOrder.ts +++ b/examples/vue-query/src/gen/models/PlaceOrder.ts @@ -1,21 +1,21 @@ -import type { Order } from './Order' +import type { Order } from "./Order"; -/** + /** * @description successful operation - */ -export type PlaceOrder200 = Order +*/ +export type PlaceOrder200 = Order; -/** + /** * @description Invalid input - */ -export type PlaceOrder405 = any +*/ +export type PlaceOrder405 = any; -export type PlaceOrderMutationRequest = Order + export type PlaceOrderMutationRequest = Order; -export type PlaceOrderMutationResponse = PlaceOrder200 + export type PlaceOrderMutationResponse = PlaceOrder200; -export type PlaceOrderMutation = { - Response: PlaceOrder200 - Request: PlaceOrderMutationRequest - Errors: PlaceOrder405 -} + export type PlaceOrderMutation = { + Response: PlaceOrder200; + Request: PlaceOrderMutationRequest; + Errors: PlaceOrder405; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/Tag.ts b/examples/vue-query/src/gen/models/Tag.ts index d76160eae..3ae285108 100644 --- a/examples/vue-query/src/gen/models/Tag.ts +++ b/examples/vue-query/src/gen/models/Tag.ts @@ -1,10 +1,10 @@ export type Tag = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string | undefined - */ - name?: string -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + name?: string; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/UpdatePet.ts b/examples/vue-query/src/gen/models/UpdatePet.ts index 9574eed65..e35d868a8 100644 --- a/examples/vue-query/src/gen/models/UpdatePet.ts +++ b/examples/vue-query/src/gen/models/UpdatePet.ts @@ -1,34 +1,34 @@ -import type { Pet } from './Pet' +import type { Pet } from "./Pet"; -/** + /** * @description Successful operation - */ -export type UpdatePet200 = Pet +*/ +export type UpdatePet200 = Pet; -/** + /** * @description Invalid ID supplied - */ -export type UpdatePet400 = any +*/ +export type UpdatePet400 = any; -/** + /** * @description Pet not found - */ -export type UpdatePet404 = any +*/ +export type UpdatePet404 = any; -/** + /** * @description Validation exception - */ -export type UpdatePet405 = any +*/ +export type UpdatePet405 = any; -/** + /** * @description Update an existent pet in the store - */ -export type UpdatePetMutationRequest = Pet +*/ +export type UpdatePetMutationRequest = Pet; -export type UpdatePetMutationResponse = UpdatePet200 + export type UpdatePetMutationResponse = UpdatePet200; -export type UpdatePetMutation = { - Response: UpdatePet200 - Request: UpdatePetMutationRequest - Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 -} + export type UpdatePetMutation = { + Response: UpdatePet200; + Request: UpdatePetMutationRequest; + Errors: UpdatePet400 | UpdatePet404 | UpdatePet405; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts index ca645f500..8665c84c9 100644 --- a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts @@ -1,34 +1,34 @@ export type UpdatePetWithFormPathParams = { - /** - * @description ID of pet that needs to be updated - * @type integer, int64 - */ - petId: number -} + /** + * @description ID of pet that needs to be updated + * @type integer, int64 + */ + petId: number; +}; -export type UpdatePetWithFormQueryParams = { - /** - * @description Name of pet that needs to be updated - * @type string | undefined - */ - name?: string - /** - * @description Status of pet that needs to be updated - * @type string | undefined - */ - status?: string -} + export type UpdatePetWithFormQueryParams = { + /** + * @description Name of pet that needs to be updated + * @type string | undefined + */ + name?: string; + /** + * @description Status of pet that needs to be updated + * @type string | undefined + */ + status?: string; +}; -/** + /** * @description Invalid input - */ -export type UpdatePetWithForm405 = any +*/ +export type UpdatePetWithForm405 = any; -export type UpdatePetWithFormMutationResponse = any + export type UpdatePetWithFormMutationResponse = any; -export type UpdatePetWithFormMutation = { - Response: any - PathParams: UpdatePetWithFormPathParams - QueryParams: UpdatePetWithFormQueryParams - Errors: UpdatePetWithForm405 -} + export type UpdatePetWithFormMutation = { + Response: any; + PathParams: UpdatePetWithFormPathParams; + QueryParams: UpdatePetWithFormQueryParams; + Errors: UpdatePetWithForm405; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/UpdateUser.ts b/examples/vue-query/src/gen/models/UpdateUser.ts index 6a89b12cc..49db639a1 100644 --- a/examples/vue-query/src/gen/models/UpdateUser.ts +++ b/examples/vue-query/src/gen/models/UpdateUser.ts @@ -1,28 +1,28 @@ -import type { User } from './User' +import type { User } from "./User"; -export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string -} + export type UpdateUserPathParams = { + /** + * @description name that need to be deleted + * @type string + */ + username: string; +}; -/** + /** * @description successful operation - */ -export type UpdateUserError = any +*/ +export type UpdateUserError = any; -/** + /** * @description Update an existent user in the store - */ -export type UpdateUserMutationRequest = User +*/ +export type UpdateUserMutationRequest = User; -export type UpdateUserMutationResponse = any + export type UpdateUserMutationResponse = any; -export type UpdateUserMutation = { - Response: any - Request: UpdateUserMutationRequest - PathParams: UpdateUserPathParams - Errors: any -} + export type UpdateUserMutation = { + Response: any; + Request: UpdateUserMutationRequest; + PathParams: UpdateUserPathParams; + Errors: any; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/UploadFile.ts b/examples/vue-query/src/gen/models/UploadFile.ts index cbb4a1c80..4181ef503 100644 --- a/examples/vue-query/src/gen/models/UploadFile.ts +++ b/examples/vue-query/src/gen/models/UploadFile.ts @@ -1,34 +1,34 @@ -import type { ApiResponse } from './ApiResponse' +import type { ApiResponse } from "./ApiResponse"; -export type UploadFilePathParams = { - /** - * @description ID of pet to update - * @type integer, int64 - */ - petId: number -} + export type UploadFilePathParams = { + /** + * @description ID of pet to update + * @type integer, int64 + */ + petId: number; +}; -export type UploadFileQueryParams = { - /** - * @description Additional Metadata - * @type string | undefined - */ - additionalMetadata?: string -} + export type UploadFileQueryParams = { + /** + * @description Additional Metadata + * @type string | undefined + */ + additionalMetadata?: string; +}; -/** + /** * @description successful operation - */ -export type UploadFile200 = ApiResponse +*/ +export type UploadFile200 = ApiResponse; -export type UploadFileMutationRequest = Blob + export type UploadFileMutationRequest = Blob; -export type UploadFileMutationResponse = UploadFile200 + export type UploadFileMutationResponse = UploadFile200; -export type UploadFileMutation = { - Response: UploadFile200 - Request: UploadFileMutationRequest - PathParams: UploadFilePathParams - QueryParams: UploadFileQueryParams - Errors: any -} + export type UploadFileMutation = { + Response: UploadFile200; + Request: UploadFileMutationRequest; + PathParams: UploadFilePathParams; + QueryParams: UploadFileQueryParams; + Errors: any; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/User.ts b/examples/vue-query/src/gen/models/User.ts index 5fbab3d29..9e8b913d4 100644 --- a/examples/vue-query/src/gen/models/User.ts +++ b/examples/vue-query/src/gen/models/User.ts @@ -1,35 +1,35 @@ export type User = { - /** - * @type integer | undefined, int64 - */ - id?: number - /** - * @type string | undefined - */ - username?: string - /** - * @type string | undefined - */ - firstName?: string - /** - * @type string | undefined - */ - lastName?: string - /** - * @type string | undefined - */ - email?: string - /** - * @type string | undefined - */ - password?: string - /** - * @type string | undefined - */ - phone?: string - /** - * @description User Status - * @type integer | undefined, int32 - */ - userStatus?: number -} + /** + * @type integer | undefined, int64 + */ + id?: number; + /** + * @type string | undefined + */ + username?: string; + /** + * @type string | undefined + */ + firstName?: string; + /** + * @type string | undefined + */ + lastName?: string; + /** + * @type string | undefined + */ + email?: string; + /** + * @type string | undefined + */ + password?: string; + /** + * @type string | undefined + */ + phone?: string; + /** + * @description User Status + * @type integer | undefined, int32 + */ + userStatus?: number; +}; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/UserArray.ts b/examples/vue-query/src/gen/models/UserArray.ts index effb23af2..d17573215 100644 --- a/examples/vue-query/src/gen/models/UserArray.ts +++ b/examples/vue-query/src/gen/models/UserArray.ts @@ -1,3 +1,3 @@ -import type { User } from './User' +import type { User } from "./User"; -export type UserArray = User[] + export type UserArray = User[]; \ No newline at end of file diff --git a/examples/vue-query/src/gen/models/index.ts b/examples/vue-query/src/gen/models/index.ts index 1d52b46aa..8b968b76d 100644 --- a/examples/vue-query/src/gen/models/index.ts +++ b/examples/vue-query/src/gen/models/index.ts @@ -1,73 +1,32 @@ -export type { AddPet200, AddPet405, AddPetMutationRequest, AddPetMutationResponse, AddPetMutation } from './AddPet' -export type { AddressIdentifierEnum, Address } from './Address' -export type { ApiResponse } from './ApiResponse' -export type { Category } from './Category' -export type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse, CreateUserMutation } from './CreateUser' -export type { - CreateUsersWithListInput200, - CreateUsersWithListInputError, - CreateUsersWithListInputMutationRequest, - CreateUsersWithListInputMutationResponse, - CreateUsersWithListInputMutation, -} from './CreateUsersWithListInput' -export type { Customer } from './Customer' -export type { DeleteOrderPathParams, DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, DeleteOrderMutation } from './DeleteOrder' -export type { DeletePetPathParams, DeletePetHeaderParams, DeletePet400, DeletePetMutationResponse, DeletePetMutation } from './DeletePet' -export type { DeleteUserPathParams, DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUserMutation } from './DeleteUser' -export type { - FindPetsByStatusQueryParamsStatusEnum, - FindPetsByStatusQueryParams, - FindPetsByStatus200, - FindPetsByStatus400, - FindPetsByStatusQueryResponse, - FindPetsByStatusQuery, -} from './FindPetsByStatus' -export type { FindPetsByTagsQueryParams, FindPetsByTags200, FindPetsByTags400, FindPetsByTagsQueryResponse, FindPetsByTagsQuery } from './FindPetsByTags' -export type { GetInventory200, GetInventoryQueryResponse, GetInventoryQuery } from './GetInventory' -export type { GetOrderByIdPathParams, GetOrderById200, GetOrderById400, GetOrderById404, GetOrderByIdQueryResponse, GetOrderByIdQuery } from './GetOrderById' -export type { GetPetByIdPathParams, GetPetById200, GetPetById400, GetPetById404, GetPetByIdQueryResponse, GetPetByIdQuery } from './GetPetById' -export type { - GetUserByNamePathParams, - GetUserByName200, - GetUserByName400, - GetUserByName404, - GetUserByNameQueryResponse, - GetUserByNameQuery, -} from './GetUserByName' -export type { LoginUserQueryParams, LoginUser200, LoginUser400, LoginUserQueryResponse, LoginUserQuery } from './LoginUser' -export type { LogoutUserError, LogoutUserQueryResponse, LogoutUserQuery } from './LogoutUser' -export type { OrderStatusEnum, Order } from './Order' -export type { PetStatusEnum, Pet } from './Pet' -export type { PlaceOrder200, PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrderMutation } from './PlaceOrder' -export type { Tag } from './Tag' -export type { - UpdatePet200, - UpdatePet400, - UpdatePet404, - UpdatePet405, - UpdatePetMutationRequest, - UpdatePetMutationResponse, - UpdatePetMutation, -} from './UpdatePet' -export type { - UpdatePetWithFormPathParams, - UpdatePetWithFormQueryParams, - UpdatePetWithForm405, - UpdatePetWithFormMutationResponse, - UpdatePetWithFormMutation, -} from './UpdatePetWithForm' -export type { UpdateUserPathParams, UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserMutation } from './UpdateUser' -export type { - UploadFilePathParams, - UploadFileQueryParams, - UploadFile200, - UploadFileMutationRequest, - UploadFileMutationResponse, - UploadFileMutation, -} from './UploadFile' -export type { User } from './User' -export type { UserArray } from './UserArray' -export { addressIdentifierEnum } from './Address' -export { findPetsByStatusQueryParamsStatusEnum } from './FindPetsByStatus' -export { orderStatusEnum } from './Order' -export { petStatusEnum } from './Pet' +export type { AddPet200, AddPet405, AddPetMutationRequest, AddPetMutationResponse, AddPetMutation } from "./AddPet"; +export type { AddressIdentifierEnum, Address } from "./Address"; +export type { ApiResponse } from "./ApiResponse"; +export type { Category } from "./Category"; +export type { CreateUserError, CreateUserMutationRequest, CreateUserMutationResponse, CreateUserMutation } from "./CreateUser"; +export type { CreateUsersWithListInput200, CreateUsersWithListInputError, CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, CreateUsersWithListInputMutation } from "./CreateUsersWithListInput"; +export type { Customer } from "./Customer"; +export type { DeleteOrderPathParams, DeleteOrder400, DeleteOrder404, DeleteOrderMutationResponse, DeleteOrderMutation } from "./DeleteOrder"; +export type { DeletePetPathParams, DeletePetHeaderParams, DeletePet400, DeletePetMutationResponse, DeletePetMutation } from "./DeletePet"; +export type { DeleteUserPathParams, DeleteUser400, DeleteUser404, DeleteUserMutationResponse, DeleteUserMutation } from "./DeleteUser"; +export type { FindPetsByStatusQueryParamsStatusEnum, FindPetsByStatusQueryParams, FindPetsByStatus200, FindPetsByStatus400, FindPetsByStatusQueryResponse, FindPetsByStatusQuery } from "./FindPetsByStatus"; +export type { FindPetsByTagsQueryParams, FindPetsByTags200, FindPetsByTags400, FindPetsByTagsQueryResponse, FindPetsByTagsQuery } from "./FindPetsByTags"; +export type { GetInventory200, GetInventoryQueryResponse, GetInventoryQuery } from "./GetInventory"; +export type { GetOrderByIdPathParams, GetOrderById200, GetOrderById400, GetOrderById404, GetOrderByIdQueryResponse, GetOrderByIdQuery } from "./GetOrderById"; +export type { GetPetByIdPathParams, GetPetById200, GetPetById400, GetPetById404, GetPetByIdQueryResponse, GetPetByIdQuery } from "./GetPetById"; +export type { GetUserByNamePathParams, GetUserByName200, GetUserByName400, GetUserByName404, GetUserByNameQueryResponse, GetUserByNameQuery } from "./GetUserByName"; +export type { LoginUserQueryParams, LoginUser200, LoginUser400, LoginUserQueryResponse, LoginUserQuery } from "./LoginUser"; +export type { LogoutUserError, LogoutUserQueryResponse, LogoutUserQuery } from "./LogoutUser"; +export type { OrderStatusEnum, Order } from "./Order"; +export type { PetStatusEnum, Pet } from "./Pet"; +export type { PlaceOrder200, PlaceOrder405, PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrderMutation } from "./PlaceOrder"; +export type { Tag } from "./Tag"; +export type { UpdatePet200, UpdatePet400, UpdatePet404, UpdatePet405, UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePetMutation } from "./UpdatePet"; +export type { UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405, UpdatePetWithFormMutationResponse, UpdatePetWithFormMutation } from "./UpdatePetWithForm"; +export type { UpdateUserPathParams, UpdateUserError, UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserMutation } from "./UpdateUser"; +export type { UploadFilePathParams, UploadFileQueryParams, UploadFile200, UploadFileMutationRequest, UploadFileMutationResponse, UploadFileMutation } from "./UploadFile"; +export type { User } from "./User"; +export type { UserArray } from "./UserArray"; +export { addressIdentifierEnum } from "./Address"; +export { findPetsByStatusQueryParamsStatusEnum } from "./FindPetsByStatus"; +export { orderStatusEnum } from "./Order"; +export { petStatusEnum } from "./Pet"; \ No newline at end of file diff --git a/packages/plugin-client/src/generators/clientGenerator.test.tsx b/packages/plugin-client/src/generators/clientGenerator.test.tsx index 53caea9a3..09ba6231b 100644 --- a/packages/plugin-client/src/generators/clientGenerator.test.tsx +++ b/packages/plugin-client/src/generators/clientGenerator.test.tsx @@ -109,6 +109,7 @@ describe('clientGenerator operation', async () => { path: '.', banner: '/* eslint-disable no-alert, no-console */', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx b/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx index 8608ffbb9..b22b22791 100644 --- a/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx +++ b/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx @@ -38,6 +38,7 @@ describe('groupedClientsGenerators operations', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-client/src/generators/operationsGenerator.test.tsx b/packages/plugin-client/src/generators/operationsGenerator.test.tsx index a85253e56..77172db90 100644 --- a/packages/plugin-client/src/generators/operationsGenerator.test.tsx +++ b/packages/plugin-client/src/generators/operationsGenerator.test.tsx @@ -38,6 +38,7 @@ describe('operationsGenerator operations', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-faker/src/generators/fakerGenerator.test.tsx b/packages/plugin-faker/src/generators/fakerGenerator.test.tsx index 359abf753..ba6266f83 100644 --- a/packages/plugin-faker/src/generators/fakerGenerator.test.tsx +++ b/packages/plugin-faker/src/generators/fakerGenerator.test.tsx @@ -94,6 +94,7 @@ describe('fakerGenerator schema', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin @@ -199,6 +200,7 @@ describe('fakerGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-msw/src/generators/handlersGenerator.test.tsx b/packages/plugin-msw/src/generators/handlersGenerator.test.tsx index cd3040dc2..0fc1e8132 100644 --- a/packages/plugin-msw/src/generators/handlersGenerator.test.tsx +++ b/packages/plugin-msw/src/generators/handlersGenerator.test.tsx @@ -33,6 +33,7 @@ describe('handlersGenerator operations', async () => { path: '.', }, parser: 'data', + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-msw/src/generators/mswGenerator.test.tsx b/packages/plugin-msw/src/generators/mswGenerator.test.tsx index cd86e0849..5d976a0e9 100644 --- a/packages/plugin-msw/src/generators/mswGenerator.test.tsx +++ b/packages/plugin-msw/src/generators/mswGenerator.test.tsx @@ -63,6 +63,7 @@ describe('mswGenerator operation', async () => { path: '.', }, parser: 'data', + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx index 989c5ee3a..a559f1086 100644 --- a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx @@ -70,6 +70,7 @@ describe('infiniteQueryGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx index c84e377a9..87764c394 100644 --- a/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx @@ -102,6 +102,7 @@ describe('mutationGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-react-query/src/generators/queryGenerator.test.tsx b/packages/plugin-react-query/src/generators/queryGenerator.test.tsx index f89dbe682..4f5a2eb5d 100644 --- a/packages/plugin-react-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/queryGenerator.test.tsx @@ -132,6 +132,7 @@ describe('queryGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-react-query/src/generators/suspenseQueryGenerator.test.tsx b/packages/plugin-react-query/src/generators/suspenseQueryGenerator.test.tsx index 3a826c6c2..5d4c30756 100644 --- a/packages/plugin-react-query/src/generators/suspenseQueryGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/suspenseQueryGenerator.test.tsx @@ -53,6 +53,7 @@ describe('suspenseQueryGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx b/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx index 82e12f818..fe615564e 100644 --- a/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx @@ -125,6 +125,7 @@ describe('queryGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx index bbe53c0f8..696837fb5 100644 --- a/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx @@ -100,6 +100,7 @@ describe('mutationGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx b/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx index 7ea2a3455..a0bf79e37 100644 --- a/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx @@ -130,6 +130,7 @@ describe('queryGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-swr/src/generators/mutationGenerator.test.tsx b/packages/plugin-swr/src/generators/mutationGenerator.test.tsx index 90f53ad69..4e864c7b3 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.test.tsx @@ -100,6 +100,7 @@ describe('mutationGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-swr/src/generators/queryGenerator.test.tsx b/packages/plugin-swr/src/generators/queryGenerator.test.tsx index 80c9569b5..f72da3504 100644 --- a/packages/plugin-swr/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-swr/src/generators/queryGenerator.test.tsx @@ -114,6 +114,7 @@ describe('queryGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-ts/src/generators/typeGenerator.test.tsx b/packages/plugin-ts/src/generators/typeGenerator.test.tsx index f75b47b26..38d4a475c 100644 --- a/packages/plugin-ts/src/generators/typeGenerator.test.tsx +++ b/packages/plugin-ts/src/generators/typeGenerator.test.tsx @@ -351,6 +351,7 @@ describe('typeGenerator schema', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin @@ -449,6 +450,7 @@ describe('typeGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx index 925f1f7df..d921b1872 100644 --- a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx @@ -69,6 +69,7 @@ describe('infiniteQueryGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx index 6b26a09b6..ad9f0634b 100644 --- a/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx @@ -101,6 +101,7 @@ describe('mutationGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx b/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx index c9ee85d43..d5f43529e 100644 --- a/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx @@ -131,6 +131,7 @@ describe('queryGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-zod/src/generators/operationsGenerator.test.tsx b/packages/plugin-zod/src/generators/operationsGenerator.test.tsx index 8cafc1adb..72259091e 100644 --- a/packages/plugin-zod/src/generators/operationsGenerator.test.tsx +++ b/packages/plugin-zod/src/generators/operationsGenerator.test.tsx @@ -42,6 +42,7 @@ describe('operationsGenerator operations', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin diff --git a/packages/plugin-zod/src/generators/zodGenerator.test.tsx b/packages/plugin-zod/src/generators/zodGenerator.test.tsx index 8e6d992a2..88bed4abd 100644 --- a/packages/plugin-zod/src/generators/zodGenerator.test.tsx +++ b/packages/plugin-zod/src/generators/zodGenerator.test.tsx @@ -257,6 +257,7 @@ describe('zodGenerator schema', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin @@ -355,6 +356,7 @@ describe('zodGenerator operation', async () => { output: { path: '.', }, + group: undefined, ...props.options, } const plugin = { options } as Plugin