From 95c8f011d2b0c36f23074e94bc51c5d43b073a51 Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Fri, 13 Dec 2024 21:01:01 +0100 Subject: [PATCH] feat: support of fetch client as part of ``@kubb/plugin-client` --- .changeset/honest-years-jam.md | 5 + docs/changelog.md | 3 + docs/knowledge-base/fetch.md | 4 +- docs/plugins/plugin-client/client.md | 11 ++ docs/plugins/plugin-client/importPath.md | 2 +- docs/plugins/plugin-client/index.md | 4 + e2e/tsconfig.json | 2 +- .../gen/clients/axios/petService/addPet.ts | 4 +- .../gen/clients/axios/petService/deletePet.ts | 4 +- .../axios/petService/findPetsByStatus.ts | 4 +- .../axios/petService/findPetsByTags.ts | 4 +- .../clients/axios/petService/getPetById.ts | 4 +- .../gen/clients/axios/petService/updatePet.ts | 4 +- .../axios/petService/updatePetWithForm.ts | 4 +- .../clients/axios/petService/uploadFile.ts | 4 +- .../clients/axios/userService/createUser.ts | 4 +- .../userService/createUsersWithListInput.ts | 4 +- .../clients/axios/userService/deleteUser.ts | 4 +- .../axios/userService/getUserByName.ts | 4 +- .../clients/axios/userService/loginUser.ts | 4 +- .../clients/axios/userService/logoutUser.ts | 4 +- .../clients/axios/userService/updateUser.ts | 4 +- examples/client/src/gen/tag.ts | 4 +- examples/client/src/gen/tagObject.ts | 4 +- examples/fetch/kubb.config.ts | 2 +- examples/fetch/src/gen/addPet.ts | 4 +- examples/fetch/src/gen/createUser.ts | 4 +- .../fetch/src/gen/createUsersWithListInput.ts | 4 +- examples/fetch/src/gen/deleteOrder.ts | 4 +- examples/fetch/src/gen/deletePet.ts | 4 +- examples/fetch/src/gen/deleteUser.ts | 4 +- examples/fetch/src/gen/findPetsByStatus.ts | 4 +- examples/fetch/src/gen/findPetsByTags.ts | 4 +- examples/fetch/src/gen/getInventory.ts | 4 +- examples/fetch/src/gen/getOrderById.ts | 4 +- examples/fetch/src/gen/getPetById.ts | 4 +- examples/fetch/src/gen/getUserByName.ts | 4 +- examples/fetch/src/gen/loginUser.ts | 4 +- examples/fetch/src/gen/logoutUser.ts | 4 +- examples/fetch/src/gen/placeOrder.ts | 4 +- examples/fetch/src/gen/placeOrderPatch.ts | 4 +- examples/fetch/src/gen/updatePet.ts | 4 +- examples/fetch/src/gen/updatePetWithForm.ts | 4 +- examples/fetch/src/gen/updateUser.ts | 4 +- examples/fetch/src/gen/uploadFile.ts | 4 +- examples/react-query/kubb.config.ts | 2 +- 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/simple-single/src/gen/hooks.ts | 4 +- examples/solid-query/kubb.config.js | 2 +- .../src/gen/hooks/createFindPetsByStatus.ts | 4 +- .../src/gen/hooks/createFindPetsByTags.ts | 4 +- .../src/gen/hooks/createGetInventory.ts | 4 +- .../src/gen/hooks/createGetOrderById.ts | 4 +- .../src/gen/hooks/createGetPetById.ts | 4 +- .../src/gen/hooks/createGetUserByName.ts | 4 +- .../src/gen/hooks/createLoginUser.ts | 4 +- .../src/gen/hooks/createLogoutUser.ts | 4 +- .../src/gen/hooks/createUpdatePetWithForm.ts | 4 +- examples/svelte-query/kubb.config.js | 2 +- .../src/gen/hooks/createAddPet.ts | 4 +- .../src/gen/hooks/createCreateUser.ts | 4 +- .../hooks/createCreateUsersWithListInput.ts | 4 +- .../src/gen/hooks/createDeleteOrder.ts | 4 +- .../src/gen/hooks/createDeletePet.ts | 4 +- .../src/gen/hooks/createDeleteUser.ts | 4 +- .../src/gen/hooks/createFindPetsByStatus.ts | 4 +- .../src/gen/hooks/createFindPetsByTags.ts | 4 +- .../src/gen/hooks/createGetInventory.ts | 4 +- .../src/gen/hooks/createGetOrderById.ts | 4 +- .../src/gen/hooks/createGetPetById.ts | 4 +- .../src/gen/hooks/createGetUserByName.ts | 4 +- .../src/gen/hooks/createLoginUser.ts | 4 +- .../src/gen/hooks/createLogoutUser.ts | 4 +- .../src/gen/hooks/createPlaceOrder.ts | 4 +- .../src/gen/hooks/createPlaceOrderPatch.ts | 4 +- .../src/gen/hooks/createUpdatePet.ts | 4 +- .../src/gen/hooks/createUpdatePetWithForm.ts | 4 +- .../src/gen/hooks/createUpdateUser.ts | 4 +- .../src/gen/hooks/createUploadFile.ts | 4 +- examples/swr/src/gen/hooks/useAddPet.ts | 4 +- examples/swr/src/gen/hooks/useCreateUser.ts | 4 +- .../gen/hooks/useCreateUsersWithListInput.ts | 4 +- examples/swr/src/gen/hooks/useDeleteOrder.ts | 4 +- examples/swr/src/gen/hooks/useDeletePet.ts | 4 +- examples/swr/src/gen/hooks/useDeleteUser.ts | 4 +- .../swr/src/gen/hooks/useFindPetsByStatus.ts | 4 +- .../swr/src/gen/hooks/useFindPetsByTags.ts | 4 +- examples/swr/src/gen/hooks/useGetInventory.ts | 4 +- examples/swr/src/gen/hooks/useGetOrderById.ts | 4 +- examples/swr/src/gen/hooks/useGetPetById.ts | 4 +- .../swr/src/gen/hooks/useGetUserByName.ts | 4 +- examples/swr/src/gen/hooks/useLoginUser.ts | 4 +- examples/swr/src/gen/hooks/useLogoutUser.ts | 4 +- examples/swr/src/gen/hooks/usePlaceOrder.ts | 4 +- .../swr/src/gen/hooks/usePlaceOrderPatch.ts | 4 +- examples/swr/src/gen/hooks/useUpdatePet.ts | 4 +- .../swr/src/gen/hooks/useUpdatePetWithForm.ts | 4 +- examples/swr/src/gen/hooks/useUpdateUser.ts | 4 +- examples/swr/src/gen/hooks/useUploadFile.ts | 4 +- examples/typescript/petStore.yaml | 1 + examples/typescript/src/gen/models.ts | 6 +- examples/typescript/src/gen/modelsConst.ts | 6 +- .../typescript/src/gen/modelsConstEnum.ts | 6 +- examples/typescript/src/gen/modelsLiteral.ts | 6 +- .../typescript/src/gen/modelsPascalConst.ts | 6 +- examples/typescript/src/gen/schemas/Pet.json | 1 + examples/typescript/src/gen/ts/models/Pet.ts | 4 +- .../typescript/src/gen/ts/models/UpdatePet.ts | 2 +- examples/typescript/src/gen/ts/models/oas.ts | 1 + 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 +++++++---- examples/zod/src/gen/zodClients.ts | 4 +- packages/plugin-client/package.json | 22 ++- .../{client.ts => src/clients/axios.ts} | 0 .../plugin-client/src/clients/fetch.ts | 25 ++- .../src/generators/__snapshots__/deletePet.ts | 4 +- .../__snapshots__/deletePetObject.ts | 4 +- .../generators/__snapshots__/findByTags.ts | 4 +- .../__snapshots__/findByTagsFull.ts | 4 +- .../__snapshots__/findByTagsObject.ts | 4 +- .../__snapshots__/findByTagsWithZod.ts | 4 +- .../__snapshots__/findByTagsWithZodFull.ts | 4 +- .../generators/__snapshots__/updatePetById.ts | 4 +- .../src/generators/clientGenerator.test.tsx | 2 +- .../groupedClientGenerator.test.tsx | 2 +- .../generators/operationsGenerator.test.tsx | 2 +- packages/plugin-client/src/plugin.ts | 3 +- packages/plugin-client/src/types.ts | 11 +- packages/plugin-client/tsup.config.ts | 6 +- packages/plugin-oas/mocks/petStore.yaml | 1 + .../SchemaGenerator.test.ts.snap | 3 + .../__snapshots__/clientDataReturnTypeFull.ts | 4 +- .../generators/__snapshots__/findByTags.ts | 4 +- .../__snapshots__/findByTagsObject.ts | 4 +- .../findByTagsPathParamsObject.ts | 4 +- .../findByTagsWithCustomQueryKey.ts | 4 +- .../__snapshots__/findByTagsWithZod.ts | 4 +- .../__snapshots__/findInfiniteByTags.ts | 4 +- .../__snapshots__/findInfiniteByTagsCursor.ts | 4 +- .../generators/__snapshots__/getAsMutation.ts | 4 +- .../__snapshots__/getPetIdCamelCase.ts | 4 +- .../generators/__snapshots__/postAsQuery.ts | 4 +- .../generators/__snapshots__/updatePetById.ts | 4 +- .../updatePetByIdPathParamsObject.ts | 4 +- .../infiniteQueryGenerator.test.tsx | 2 +- .../src/generators/mutationGenerator.test.tsx | 2 +- .../src/generators/queryGenerator.test.tsx | 4 +- .../suspenseQueryGenerator.test.tsx | 2 +- packages/plugin-react-query/src/plugin.ts | 2 +- .../__snapshots__/clientDataReturnTypeFull.ts | 4 +- .../generators/__snapshots__/findByTags.ts | 4 +- .../__snapshots__/findByTagsObject.ts | 4 +- .../findByTagsPathParamsObject.ts | 4 +- .../findByTagsWithCustomQueryKey.ts | 4 +- .../__snapshots__/findByTagsWithZod.ts | 4 +- .../generators/__snapshots__/postAsQuery.ts | 4 +- .../src/generators/queryGenerator.test.tsx | 4 +- packages/plugin-solid-query/src/plugin.ts | 2 +- .../__snapshots__/clientDataReturnTypeFull.ts | 4 +- .../generators/__snapshots__/findByTags.ts | 4 +- .../__snapshots__/findByTagsObject.ts | 4 +- .../findByTagsPathParamsObject.ts | 4 +- .../findByTagsWithCustomQueryKey.ts | 4 +- .../__snapshots__/findByTagsWithZod.ts | 4 +- .../generators/__snapshots__/postAsQuery.ts | 4 +- .../generators/__snapshots__/updatePetById.ts | 4 +- .../updatePetByIdPathParamsObject.ts | 4 +- .../src/generators/mutationGenerator.test.tsx | 2 +- .../src/generators/queryGenerator.test.tsx | 4 +- packages/plugin-svelte-query/src/plugin.ts | 2 +- .../__snapshots__/clientDataReturnTypeFull.ts | 4 +- .../generators/__snapshots__/findByTags.ts | 4 +- .../__snapshots__/findByTagsObject.ts | 4 +- .../findByTagsPathParamsObject.ts | 4 +- .../__snapshots__/findByTagsWithZod.ts | 4 +- .../generators/__snapshots__/getAsMutation.ts | 4 +- .../generators/__snapshots__/postAsQuery.ts | 4 +- .../generators/__snapshots__/updatePetById.ts | 4 +- .../updatePetByIdPathParamsObject.ts | 4 +- .../src/generators/mutationGenerator.test.tsx | 2 +- .../src/generators/queryGenerator.test.tsx | 4 +- packages/plugin-swr/src/plugin.ts | 2 +- .../__snapshots__/clientDataReturnTypeFull.ts | 4 +- .../generators/__snapshots__/findByTags.ts | 4 +- .../__snapshots__/findByTagsObject.ts | 4 +- .../findByTagsPathParamsObject.ts | 4 +- .../findByTagsWithCustomQueryKey.ts | 4 +- .../__snapshots__/findByTagsWithZod.ts | 4 +- .../__snapshots__/findInfiniteByTags.ts | 4 +- .../__snapshots__/findInfiniteByTagsCursor.ts | 4 +- .../generators/__snapshots__/postAsQuery.ts | 4 +- .../generators/__snapshots__/updatePetById.ts | 4 +- .../updatePetByIdPathParamsObject.ts | 4 +- .../infiniteQueryGenerator.test.tsx | 2 +- .../src/generators/mutationGenerator.test.tsx | 2 +- .../src/generators/queryGenerator.test.tsx | 4 +- packages/plugin-vue-query/src/plugin.ts | 2 +- tsconfig.json | 2 +- 311 files changed, 4612 insertions(+), 3566 deletions(-) create mode 100644 .changeset/honest-years-jam.md create mode 100644 docs/plugins/plugin-client/client.md create mode 100644 examples/react-query/src/gen/index.ts rename packages/plugin-client/{client.ts => src/clients/axios.ts} (100%) rename examples/fetch/src/client.ts => packages/plugin-client/src/clients/fetch.ts (58%) diff --git a/.changeset/honest-years-jam.md b/.changeset/honest-years-jam.md new file mode 100644 index 000000000..a1c041363 --- /dev/null +++ b/.changeset/honest-years-jam.md @@ -0,0 +1,5 @@ +--- +"@kubb/plugin-client": minor +--- + +support of fetch client as part of ``@kubb/plugin-client` diff --git a/docs/changelog.md b/docs/changelog.md index 5fc3cca2b..50cba0f05 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,9 @@ title: Changelog # Changelog +## 3.3.0 +- [`plugin-client`](/plugins/plugin-client): `client` to use `fetch` or `axios` as HTTP client + ## 3.2.0 - [`plugin-msw`](/plugins/plugin-msw): `paramsCasing` to define casing for params - [`plugin-react-query`](/plugins/plugin-react-query/): `paramsCasing` to define casing for params diff --git a/docs/knowledge-base/fetch.md b/docs/knowledge-base/fetch.md index 266d84592..63dd8d771 100644 --- a/docs/knowledge-base/fetch.md +++ b/docs/knowledge-base/fetch.md @@ -6,12 +6,12 @@ outline: deep --- # Use of Fetch -By default, `@kubb/plugin-client` uses the import client from `@kubb/plugin-client/client` as its client, which is based on the Axios instance interface for making API calls. +By default, `@kubb/plugin-client` uses the import client from `@kubb/plugin-client/clients/axios` as its client, which is based on the Axios instance interface for making API calls. However, there are cases where you might want to customize the client. For example, you might prefer to use [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch) or [Ky](https://github.com/sindresorhus/ky). ## Create a `kubb.config.ts` with the following config -`importPath` can be a relative, import alias, or an import to another library(default `@kubb/plugin-client/client` will be used). +`importPath` can be a relative, import alias, or an import to another library(default `@kubb/plugin-client/clients/axios` will be used). See [plugins/plugin-client](/plugins/plugin-client/#client). ```typescript twoslash diff --git a/docs/plugins/plugin-client/client.md b/docs/plugins/plugin-client/client.md new file mode 100644 index 000000000..6e765a3c7 --- /dev/null +++ b/docs/plugins/plugin-client/client.md @@ -0,0 +1,11 @@ +Which client should be used to do the HTTP calls + +| | | +|----------:|:---------------------| +| Type: | `'axios' \| 'fetch'` | +| Required: | `false` | +| Default: | `'axios'` | + + +- `'axios'` will use `@kubb/plugin-client/clients/axios` to fetch data. +- `'fetch'` will use `@kubb/plugin-client/clients/fetch` to fetch data. diff --git a/docs/plugins/plugin-client/importPath.md b/docs/plugins/plugin-client/importPath.md index 5da50acfe..d1576d0e2 100644 --- a/docs/plugins/plugin-client/importPath.md +++ b/docs/plugins/plugin-client/importPath.md @@ -9,4 +9,4 @@ It allows both relative and absolute path but be aware that we will not change t |----------:|:-------------------------------| | Type: | `string` | | Required: | `false` | -| Default: | `'@kubb/plugin-client/client'` | +| Default: | `'@kubb/plugin-client/clients/axios'` | diff --git a/docs/plugins/plugin-client/index.md b/docs/plugins/plugin-client/index.md index e00efd5b4..a9da2ad2a 100644 --- a/docs/plugins/plugin-client/index.md +++ b/docs/plugins/plugin-client/index.md @@ -130,6 +130,9 @@ Create `operations.ts` file with all operations grouped by methods. ### parser +### client + + ### baseURL @@ -210,6 +213,7 @@ export default defineConfig({ ], pathParamsType: "object", dataReturnType: 'full', + client: 'axios' }), ], }) diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json index d6a5a5fa6..634323646 100644 --- a/e2e/tsconfig.json +++ b/e2e/tsconfig.json @@ -25,7 +25,7 @@ "@kubb/core": ["../packages/core/src/index.ts"], "@kubb/plugin-oas": ["../packages/plugin-oas/src/index.ts"], "@kubb/plugin-client": ["../packages/plugin-client/src/index.ts"], - "@kubb/plugin-client/client": ["../packages/plugin-client/client.ts"], + "@kubb/plugin-client/clients/axios": ["../packages/plugin-client/client.ts"], "@kubb/plugin-faker": ["../packages/plugin-faker/src/index.ts"], "@kubb/plugin-msw": ["../packages/plugin-msw/src/index.ts"], "@kubb/plugin-react-query": ["../packages/plugin-react-query/src/index.ts"], diff --git a/examples/client/src/gen/clients/axios/petService/addPet.ts b/examples/client/src/gen/clients/axios/petService/addPet.ts index 625b48c6a..aca6f694c 100644 --- a/examples/client/src/gen/clients/axios/petService/addPet.ts +++ b/examples/client/src/gen/clients/axios/petService/addPet.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../../models/ts/petController/AddPet.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description Add a new pet to the store diff --git a/examples/client/src/gen/clients/axios/petService/deletePet.ts b/examples/client/src/gen/clients/axios/petService/deletePet.ts index 218a11df0..af4d713ac 100644 --- a/examples/client/src/gen/clients/axios/petService/deletePet.ts +++ b/examples/client/src/gen/clients/axios/petService/deletePet.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../../models/ts/petController/DeletePet.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description delete a pet diff --git a/examples/client/src/gen/clients/axios/petService/findPetsByStatus.ts b/examples/client/src/gen/clients/axios/petService/findPetsByStatus.ts index 6a0dd49bd..21e257006 100644 --- a/examples/client/src/gen/clients/axios/petService/findPetsByStatus.ts +++ b/examples/client/src/gen/clients/axios/petService/findPetsByStatus.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../../models/ts/petController/FindPetsByStatus.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description Multiple status values can be provided with comma separated strings diff --git a/examples/client/src/gen/clients/axios/petService/findPetsByTags.ts b/examples/client/src/gen/clients/axios/petService/findPetsByTags.ts index 479349633..873767eed 100644 --- a/examples/client/src/gen/clients/axios/petService/findPetsByTags.ts +++ b/examples/client/src/gen/clients/axios/petService/findPetsByTags.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../../models/ts/petController/FindPetsByTags.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. diff --git a/examples/client/src/gen/clients/axios/petService/getPetById.ts b/examples/client/src/gen/clients/axios/petService/getPetById.ts index b4008ad76..cb511d980 100644 --- a/examples/client/src/gen/clients/axios/petService/getPetById.ts +++ b/examples/client/src/gen/clients/axios/petService/getPetById.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../../models/ts/petController/GetPetById.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description Returns a single pet diff --git a/examples/client/src/gen/clients/axios/petService/updatePet.ts b/examples/client/src/gen/clients/axios/petService/updatePet.ts index c0e844d42..ea7c1d543 100644 --- a/examples/client/src/gen/clients/axios/petService/updatePet.ts +++ b/examples/client/src/gen/clients/axios/petService/updatePet.ts @@ -1,5 +1,5 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UpdatePetMutationRequest, UpdatePetMutationResponse, @@ -7,7 +7,7 @@ import type { UpdatePet404, UpdatePet405, } from '../../../models/ts/petController/UpdatePet.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description Update an existing pet by Id diff --git a/examples/client/src/gen/clients/axios/petService/updatePetWithForm.ts b/examples/client/src/gen/clients/axios/petService/updatePetWithForm.ts index d02c52cf0..a42616746 100644 --- a/examples/client/src/gen/clients/axios/petService/updatePetWithForm.ts +++ b/examples/client/src/gen/clients/axios/petService/updatePetWithForm.ts @@ -1,12 +1,12 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405, } from '../../../models/ts/petController/UpdatePetWithForm.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @summary Updates a pet in the store with form data diff --git a/examples/client/src/gen/clients/axios/petService/uploadFile.ts b/examples/client/src/gen/clients/axios/petService/uploadFile.ts index 071a73b06..ce9dbcd6e 100644 --- a/examples/client/src/gen/clients/axios/petService/uploadFile.ts +++ b/examples/client/src/gen/clients/axios/petService/uploadFile.ts @@ -1,12 +1,12 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams, } from '../../../models/ts/petController/UploadFile.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @summary uploads an image diff --git a/examples/client/src/gen/clients/axios/userService/createUser.ts b/examples/client/src/gen/clients/axios/userService/createUser.ts index e0a332275..23149d5bb 100644 --- a/examples/client/src/gen/clients/axios/userService/createUser.ts +++ b/examples/client/src/gen/clients/axios/userService/createUser.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description This can only be done by the logged in user. diff --git a/examples/client/src/gen/clients/axios/userService/createUsersWithListInput.ts b/examples/client/src/gen/clients/axios/userService/createUsersWithListInput.ts index c17ed8251..9670fc213 100644 --- a/examples/client/src/gen/clients/axios/userService/createUsersWithListInput.ts +++ b/examples/client/src/gen/clients/axios/userService/createUsersWithListInput.ts @@ -1,10 +1,10 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, } from '../../../models/ts/userController/CreateUsersWithListInput.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description Creates list of users with given input array diff --git a/examples/client/src/gen/clients/axios/userService/deleteUser.ts b/examples/client/src/gen/clients/axios/userService/deleteUser.ts index 7bf7559d6..2c9ac24d7 100644 --- a/examples/client/src/gen/clients/axios/userService/deleteUser.ts +++ b/examples/client/src/gen/clients/axios/userService/deleteUser.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../../../models/ts/userController/DeleteUser.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description This can only be done by the logged in user. diff --git a/examples/client/src/gen/clients/axios/userService/getUserByName.ts b/examples/client/src/gen/clients/axios/userService/getUserByName.ts index 9bfbe5846..2adbd48a9 100644 --- a/examples/client/src/gen/clients/axios/userService/getUserByName.ts +++ b/examples/client/src/gen/clients/axios/userService/getUserByName.ts @@ -1,12 +1,12 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404, } from '../../../models/ts/userController/GetUserByName.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @summary Get user by user name diff --git a/examples/client/src/gen/clients/axios/userService/loginUser.ts b/examples/client/src/gen/clients/axios/userService/loginUser.ts index 934d00be3..50d4f2485 100644 --- a/examples/client/src/gen/clients/axios/userService/loginUser.ts +++ b/examples/client/src/gen/clients/axios/userService/loginUser.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../../models/ts/userController/LoginUser.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @summary Logs user into the system diff --git a/examples/client/src/gen/clients/axios/userService/logoutUser.ts b/examples/client/src/gen/clients/axios/userService/logoutUser.ts index e7d1e0f0e..01996be60 100644 --- a/examples/client/src/gen/clients/axios/userService/logoutUser.ts +++ b/examples/client/src/gen/clients/axios/userService/logoutUser.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @summary Logs out current logged in user session diff --git a/examples/client/src/gen/clients/axios/userService/updateUser.ts b/examples/client/src/gen/clients/axios/userService/updateUser.ts index 044006c61..dc368f07f 100644 --- a/examples/client/src/gen/clients/axios/userService/updateUser.ts +++ b/examples/client/src/gen/clients/axios/userService/updateUser.ts @@ -1,7 +1,7 @@ /* eslint-disable no-alert, no-console */ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../../models/ts/userController/UpdateUser.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description This can only be done by the logged in user. diff --git a/examples/client/src/gen/tag.ts b/examples/client/src/gen/tag.ts index 70fa83994..965430bfa 100644 --- a/examples/client/src/gen/tag.ts +++ b/examples/client/src/gen/tag.ts @@ -1,10 +1,10 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from './models/ts/storeController/DeleteOrder.js' import type { GetInventoryQueryResponse } from './models/ts/storeController/GetInventory.js' import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from './models/ts/storeController/GetOrderById.js' import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from './models/ts/storeController/PlaceOrder.js' import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from './models/ts/storeController/PlaceOrderPatch.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description Returns a map of status codes to quantities diff --git a/examples/client/src/gen/tagObject.ts b/examples/client/src/gen/tagObject.ts index bf0dac726..b1b298aca 100644 --- a/examples/client/src/gen/tagObject.ts +++ b/examples/client/src/gen/tagObject.ts @@ -1,10 +1,10 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from './models/ts/storeController/DeleteOrder.js' import type { GetInventoryQueryResponse } from './models/ts/storeController/GetInventory.js' import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from './models/ts/storeController/GetOrderById.js' import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from './models/ts/storeController/PlaceOrder.js' import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from './models/ts/storeController/PlaceOrderPatch.js' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' /** * @description Returns a map of status codes to quantities diff --git a/examples/fetch/kubb.config.ts b/examples/fetch/kubb.config.ts index 7132e1850..d7aec2ce2 100644 --- a/examples/fetch/kubb.config.ts +++ b/examples/fetch/kubb.config.ts @@ -31,7 +31,7 @@ export default defineConfig(() => { output: { path: '.', }, - importPath: '../client.ts', + client: 'fetch', }), ], } diff --git a/examples/fetch/src/gen/addPet.ts b/examples/fetch/src/gen/addPet.ts index 970723889..9fe8e459c 100644 --- a/examples/fetch/src/gen/addPet.ts +++ b/examples/fetch/src/gen/addPet.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Add a new pet to the store diff --git a/examples/fetch/src/gen/createUser.ts b/examples/fetch/src/gen/createUser.ts index 8418cc50d..e7de931e6 100644 --- a/examples/fetch/src/gen/createUser.ts +++ b/examples/fetch/src/gen/createUser.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { CreateUserMutationRequest, CreateUserMutationResponse } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description This can only be done by the logged in user. diff --git a/examples/fetch/src/gen/createUsersWithListInput.ts b/examples/fetch/src/gen/createUsersWithListInput.ts index 33b98935a..53cbafe07 100644 --- a/examples/fetch/src/gen/createUsersWithListInput.ts +++ b/examples/fetch/src/gen/createUsersWithListInput.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Creates list of users with given input array diff --git a/examples/fetch/src/gen/deleteOrder.ts b/examples/fetch/src/gen/deleteOrder.ts index deef08883..f7d67e049 100644 --- a/examples/fetch/src/gen/deleteOrder.ts +++ b/examples/fetch/src/gen/deleteOrder.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors diff --git a/examples/fetch/src/gen/deletePet.ts b/examples/fetch/src/gen/deletePet.ts index 5add3f6e3..747916c4b 100644 --- a/examples/fetch/src/gen/deletePet.ts +++ b/examples/fetch/src/gen/deletePet.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description delete a pet diff --git a/examples/fetch/src/gen/deleteUser.ts b/examples/fetch/src/gen/deleteUser.ts index 45e827dd8..a1eb99298 100644 --- a/examples/fetch/src/gen/deleteUser.ts +++ b/examples/fetch/src/gen/deleteUser.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description This can only be done by the logged in user. diff --git a/examples/fetch/src/gen/findPetsByStatus.ts b/examples/fetch/src/gen/findPetsByStatus.ts index 5a644d09d..c70dbb621 100644 --- a/examples/fetch/src/gen/findPetsByStatus.ts +++ b/examples/fetch/src/gen/findPetsByStatus.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Multiple status values can be provided with comma separated strings diff --git a/examples/fetch/src/gen/findPetsByTags.ts b/examples/fetch/src/gen/findPetsByTags.ts index 500cb15f0..0cff04586 100644 --- a/examples/fetch/src/gen/findPetsByTags.ts +++ b/examples/fetch/src/gen/findPetsByTags.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. diff --git a/examples/fetch/src/gen/getInventory.ts b/examples/fetch/src/gen/getInventory.ts index 826f2fe50..171ff07bd 100644 --- a/examples/fetch/src/gen/getInventory.ts +++ b/examples/fetch/src/gen/getInventory.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { GetInventoryQueryResponse } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Returns a map of status codes to quantities diff --git a/examples/fetch/src/gen/getOrderById.ts b/examples/fetch/src/gen/getOrderById.ts index cec04f757..23e5d0752 100644 --- a/examples/fetch/src/gen/getOrderById.ts +++ b/examples/fetch/src/gen/getOrderById.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. diff --git a/examples/fetch/src/gen/getPetById.ts b/examples/fetch/src/gen/getPetById.ts index d1705c972..d1f85bf52 100644 --- a/examples/fetch/src/gen/getPetById.ts +++ b/examples/fetch/src/gen/getPetById.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Returns a single pet diff --git a/examples/fetch/src/gen/getUserByName.ts b/examples/fetch/src/gen/getUserByName.ts index 9df4c23b0..f6f9f8abd 100644 --- a/examples/fetch/src/gen/getUserByName.ts +++ b/examples/fetch/src/gen/getUserByName.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @summary Get user by user name diff --git a/examples/fetch/src/gen/loginUser.ts b/examples/fetch/src/gen/loginUser.ts index 36a3aafa3..d867adbfe 100644 --- a/examples/fetch/src/gen/loginUser.ts +++ b/examples/fetch/src/gen/loginUser.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @summary Logs user into the system diff --git a/examples/fetch/src/gen/logoutUser.ts b/examples/fetch/src/gen/logoutUser.ts index 274ab5c1f..e0e661b21 100644 --- a/examples/fetch/src/gen/logoutUser.ts +++ b/examples/fetch/src/gen/logoutUser.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { LogoutUserQueryResponse } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @summary Logs out current logged in user session diff --git a/examples/fetch/src/gen/placeOrder.ts b/examples/fetch/src/gen/placeOrder.ts index f20e2826a..1c7c1edd1 100644 --- a/examples/fetch/src/gen/placeOrder.ts +++ b/examples/fetch/src/gen/placeOrder.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Place a new order in the store diff --git a/examples/fetch/src/gen/placeOrderPatch.ts b/examples/fetch/src/gen/placeOrderPatch.ts index 78a3b57e3..3ef4e3064 100644 --- a/examples/fetch/src/gen/placeOrderPatch.ts +++ b/examples/fetch/src/gen/placeOrderPatch.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Place a new order in the store with patch diff --git a/examples/fetch/src/gen/updatePet.ts b/examples/fetch/src/gen/updatePet.ts index 3ceaead3f..44b894ef8 100644 --- a/examples/fetch/src/gen/updatePet.ts +++ b/examples/fetch/src/gen/updatePet.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description Update an existing pet by Id diff --git a/examples/fetch/src/gen/updatePetWithForm.ts b/examples/fetch/src/gen/updatePetWithForm.ts index a20770e5f..8c7fe9cba 100644 --- a/examples/fetch/src/gen/updatePetWithForm.ts +++ b/examples/fetch/src/gen/updatePetWithForm.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405 } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @summary Updates a pet in the store with form data diff --git a/examples/fetch/src/gen/updateUser.ts b/examples/fetch/src/gen/updateUser.ts index 8d0f15f7f..f23be4659 100644 --- a/examples/fetch/src/gen/updateUser.ts +++ b/examples/fetch/src/gen/updateUser.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @description This can only be done by the logged in user. diff --git a/examples/fetch/src/gen/uploadFile.ts b/examples/fetch/src/gen/uploadFile.ts index 7b14db421..6ea8fb247 100644 --- a/examples/fetch/src/gen/uploadFile.ts +++ b/examples/fetch/src/gen/uploadFile.ts @@ -1,6 +1,6 @@ -import client from '../client.ts' -import type { RequestConfig } from '../client.ts' +import client from '@kubb/plugin-client/clients/fetch' import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from './models.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/fetch' /** * @summary uploads an image diff --git a/examples/react-query/kubb.config.ts b/examples/react-query/kubb.config.ts index 5ea87a81d..3e993910b 100644 --- a/examples/react-query/kubb.config.ts +++ b/examples/react-query/kubb.config.ts @@ -53,7 +53,7 @@ export const config = { options: { client: { dataReturnType: 'full', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, infinite: { queryParam: 'pageSize', diff --git a/examples/react-query/src/gen/hooks/index.ts b/examples/react-query/src/gen/hooks/index.ts index c1eb158a5..8d9537715 100644 --- a/examples/react-query/src/gen/hooks/index.ts +++ b/examples/react-query/src/gen/hooks/index.ts @@ -1,60 +1,68 @@ -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 +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' diff --git a/examples/react-query/src/gen/hooks/pet/index.ts b/examples/react-query/src/gen/hooks/pet/index.ts index 3e84e50e2..216f4d5e3 100644 --- a/examples/react-query/src/gen/hooks/pet/index.ts +++ b/examples/react-query/src/gen/hooks/pet/index.ts @@ -1,26 +1,34 @@ -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 +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/pet/useAddPetHook.ts b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts index 23922bf0e..4c2775d92 100644 --- a/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts @@ -1,43 +1,53 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../models/AddPet.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts b/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts index 5b52c2f28..536f2cfd0 100644 --- a/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts @@ -1,47 +1,68 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../models/DeletePet.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts index a92a6da6a..7ce9db41f 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts @@ -1,52 +1,59 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../models/FindPetsByStatus.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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(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 +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts index 08f47267d..93c97ed19 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts @@ -1,52 +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, UseSuspenseQueryOptions, UseSuspenseQueryResult } from "@tanstack/react-query"; -import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; +import client from '@kubb/plugin-client/clients/axios' +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../../models/FindPetsByStatus.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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(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 +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts index fc2722529..18f37196b 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts @@ -1,52 +1,59 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' +import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios' +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, 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 +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts index f48854a95..ccb0ef22b 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts @@ -1,58 +1,65 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' +import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios' +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>, 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 +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts index b20ee51de..56bdfbe9c 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts @@ -1,52 +1,59 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../../models/FindPetsByTags.ts' +import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios' +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, 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 +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts index f619dbe92..fca044970 100644 --- a/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts @@ -1,61 +1,78 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../models/GetPetById.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; -} \ No newline at end of file +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts index 8109cec33..cb804e45e 100644 --- a/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts @@ -1,61 +1,82 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../models/GetPetById.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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({ 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 +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts index 37d87c0da..7b30740ed 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts @@ -1,43 +1,58 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../../models/UpdatePet.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts index dfb9a643a..a033e9163 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts @@ -1,51 +1,73 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { + UpdatePetWithFormMutationResponse, + UpdatePetWithFormPathParams, + UpdatePetWithFormQueryParams, + UpdatePetWithForm405, +} from '../../models/UpdatePetWithForm.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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(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 +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts index c238660bc..a4ac2244a 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts @@ -1,51 +1,73 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { + UpdatePetWithFormMutationResponse, + UpdatePetWithFormPathParams, + UpdatePetWithFormQueryParams, + UpdatePetWithForm405, +} from '../../models/UpdatePetWithForm.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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(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 +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 +} diff --git a/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts index 2762d6fbb..51d4e990a 100644 --- a/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts @@ -1,47 +1,71 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../../models/UploadFile.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/store/index.ts b/examples/react-query/src/gen/hooks/store/index.ts index 1b16c158a..2856659e6 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"; -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 +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/store/useDeleteOrderHook.ts b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts index 03bec6913..ed2fc510a 100644 --- a/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts @@ -1,45 +1,64 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../../models/DeleteOrder.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts b/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts index 64d3bab58..d57f9f834 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"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import { queryOptions } from "@tanstack/react-query"; +import client from '@kubb/plugin-client/clients/axios' +import type { GetInventoryQueryResponse } from '../../models/GetInventory.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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); - }, - }); -} \ No newline at end of file +export function getInventoryQueryOptionsHook(config: Partial = {}) { + const queryKey = getInventoryQueryKey() + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal + return getInventoryHook(config) + }, + }) +} diff --git a/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts index 99f55d0c2..6aca8675f 100644 --- a/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts @@ -1,52 +1,58 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { GetInventoryQueryResponse } from '../../models/GetInventory.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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(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 +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 +} diff --git a/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts index efc27486a..42abfd476 100644 --- a/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts @@ -1,61 +1,82 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../../models/GetOrderById.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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({ 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 +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 +} diff --git a/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts index c5ffeb59b..ebf612e0c 100644 --- a/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts @@ -1,61 +1,82 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../../models/GetOrderById.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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({ 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 +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 +} diff --git a/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts index ef0ee936a..4e8fbbd3c 100644 --- a/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts @@ -1,43 +1,53 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../../models/PlaceOrder.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts b/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts index 5ffb0574b..310968091 100644 --- a/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts @@ -1,43 +1,58 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from '../../models/PlaceOrderPatch.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/user/index.ts b/examples/react-query/src/gen/hooks/user/index.ts index dd928e603..6988fc7a3 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"; -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 +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/user/useCreateUserHook.ts b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts index b0d4af240..37696025e 100644 --- a/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts @@ -1,43 +1,53 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../models/CreateUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts b/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts index d72e980ef..5b74e299b 100644 --- a/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts @@ -1,43 +1,61 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../../models/CreateUsersWithListInput.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts b/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts index c05832098..41d99d1f1 100644 --- a/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts @@ -1,45 +1,60 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../../models/DeleteUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts b/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts index 53c81d3be..a8f136e90 100644 --- a/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts @@ -1,59 +1,80 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../../models/GetUserByName.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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({ 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 +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 +} diff --git a/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts index 7f9701658..c9c6a8860 100644 --- a/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts @@ -1,59 +1,80 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../../models/GetUserByName.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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({ 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 +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 +} diff --git a/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts index 376c45b9c..ee8d2cdb4 100644 --- a/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts @@ -1,50 +1,53 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../models/LoginUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; -} \ No newline at end of file +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 +} diff --git a/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts index 76e773cf4..17a23703e 100644 --- a/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts @@ -1,50 +1,57 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../models/LoginUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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(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 +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 +} diff --git a/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts index 6d7f6a2cc..d0b1e5ea6 100644 --- a/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts @@ -1,50 +1,52 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { LogoutUserQueryResponse } from '../../models/LogoutUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; -} \ No newline at end of file +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 +} diff --git a/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts index fe6dde7b7..fde3f84cb 100644 --- a/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts @@ -1,50 +1,56 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { LogoutUserQueryResponse } from '../../models/LogoutUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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(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 +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 +} diff --git a/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts index 6a9d4256a..2f93b2f97 100644 --- a/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts @@ -1,47 +1,63 @@ -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"; +import client from '@kubb/plugin-client/clients/axios' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../models/UpdateUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/react-query/src/gen/index.ts b/examples/react-query/src/gen/index.ts new file mode 100644 index 000000000..17f6a3417 --- /dev/null +++ b/examples/react-query/src/gen/index.ts @@ -0,0 +1,175 @@ +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 568f0bac6..6b8238423 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"; -import type { Pet } from "./Pet"; +import type { AddPetRequest } from './AddPetRequest.ts' +import type { Pet } from './Pet.ts' - /** +/** * @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; -}; \ No newline at end of file +export type AddPetMutation = { + Response: AddPet200 + Request: AddPetMutationRequest + Errors: AddPet405 +} diff --git a/examples/react-query/src/gen/models/AddPetRequest.ts b/examples/react-query/src/gen/models/AddPetRequest.ts index b3a76503c..729119574 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"; -import type { Tag } from "./Tag"; +import type { Category } from './Category.ts' +import type { Tag } from './Tag.ts' - 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; -}; \ No newline at end of file +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 +} diff --git a/examples/react-query/src/gen/models/Address.ts b/examples/react-query/src/gen/models/Address.ts index 4b61854c4..eb578826d 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; -}; \ No newline at end of file + /** + * @type string | undefined + */ + street?: string + /** + * @type string | undefined + */ + city?: string + /** + * @type string | undefined + */ + state?: string + /** + * @type string | undefined + */ + zip?: string +} diff --git a/examples/react-query/src/gen/models/ApiResponse.ts b/examples/react-query/src/gen/models/ApiResponse.ts index 2a8e81e25..3a6dae779 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; -}; \ No newline at end of file + /** + * @type integer | undefined, int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string +} diff --git a/examples/react-query/src/gen/models/Category.ts b/examples/react-query/src/gen/models/Category.ts index 49380ed19..3b48c48f3 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; -}; \ No newline at end of file + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + name?: string +} diff --git a/examples/react-query/src/gen/models/CreateUser.ts b/examples/react-query/src/gen/models/CreateUser.ts index 06124c4e9..0dbdb0c8d 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"; +import type { User } from './User.ts' - /** +/** * @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; -}; \ No newline at end of file +export type CreateUserMutation = { + Response: any + Request: CreateUserMutationRequest + Errors: any +} diff --git a/examples/react-query/src/gen/models/CreateUsersWithListInput.ts b/examples/react-query/src/gen/models/CreateUsersWithListInput.ts index cf8a947e6..b58f6dc2e 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"; +import type { User } from './User.ts' - /** +/** * @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; -}; \ No newline at end of file +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInput200 + Request: CreateUsersWithListInputMutationRequest + Errors: any +} diff --git a/examples/react-query/src/gen/models/Customer.ts b/examples/react-query/src/gen/models/Customer.ts index 8479512ff..dea157e6e 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"; +import type { Address } from './Address.ts' - 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 +export type Customer = { + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + username?: string + /** + * @type array | undefined + */ + address?: Address[] +} diff --git a/examples/react-query/src/gen/models/DeleteOrder.ts b/examples/react-query/src/gen/models/DeleteOrder.ts index 2280bda3b..3b22473aa 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; -}; \ No newline at end of file +export type DeleteOrderMutation = { + Response: any + PathParams: DeleteOrderPathParams + Errors: DeleteOrder400 | DeleteOrder404 +} diff --git a/examples/react-query/src/gen/models/DeletePet.ts b/examples/react-query/src/gen/models/DeletePet.ts index da6da26c9..fa4bbf6c9 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; -}; \ No newline at end of file +export type DeletePetMutation = { + Response: any + PathParams: DeletePetPathParams + HeaderParams: DeletePetHeaderParams + Errors: DeletePet400 +} diff --git a/examples/react-query/src/gen/models/DeleteUser.ts b/examples/react-query/src/gen/models/DeleteUser.ts index 31ecf784f..8cb71e167 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; -}; \ No newline at end of file +export type DeleteUserMutation = { + Response: any + PathParams: DeleteUserPathParams + Errors: DeleteUser400 | DeleteUser404 +} diff --git a/examples/react-query/src/gen/models/FindPetsByStatus.ts b/examples/react-query/src/gen/models/FindPetsByStatus.ts index 34ced6a62..cbc794f0f 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"; +import type { Pet } from './Pet.ts' - 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; -}; \ No newline at end of file +export type FindPetsByStatusQuery = { + Response: FindPetsByStatus200 + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} diff --git a/examples/react-query/src/gen/models/FindPetsByTags.ts b/examples/react-query/src/gen/models/FindPetsByTags.ts index 338efbbb2..8c7b0462f 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"; +import type { Pet } from './Pet.ts' - 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; -}; \ No newline at end of file +export type FindPetsByTagsQuery = { + Response: FindPetsByTags200 + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} diff --git a/examples/react-query/src/gen/models/GetInventory.ts b/examples/react-query/src/gen/models/GetInventory.ts index 0a2beab9f..411828e36 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; -}; \ No newline at end of file +export type GetInventoryQuery = { + Response: GetInventory200 + Errors: any +} diff --git a/examples/react-query/src/gen/models/GetOrderById.ts b/examples/react-query/src/gen/models/GetOrderById.ts index 9944ceaf5..f9d5e88d5 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"; +import type { Order } from './Order.ts' - 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; -}; \ No newline at end of file +export type GetOrderByIdQuery = { + Response: GetOrderById200 + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} diff --git a/examples/react-query/src/gen/models/GetPetById.ts b/examples/react-query/src/gen/models/GetPetById.ts index 77d0378bb..56d7ec725 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"; +import type { Pet } from './Pet.ts' - 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; -}; \ No newline at end of file +export type GetPetByIdQuery = { + Response: GetPetById200 + PathParams: GetPetByIdPathParams + Errors: GetPetById400 | GetPetById404 +} diff --git a/examples/react-query/src/gen/models/GetUserByName.ts b/examples/react-query/src/gen/models/GetUserByName.ts index 4421fa742..bcaf06405 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"; +import type { User } from './User.ts' - 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; -}; \ No newline at end of file +export type GetUserByNameQuery = { + Response: GetUserByName200 + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} diff --git a/examples/react-query/src/gen/models/LoginUser.ts b/examples/react-query/src/gen/models/LoginUser.ts index 82a6e8674..f8869afdb 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; -}; \ No newline at end of file +export type LoginUserQuery = { + Response: LoginUser200 + QueryParams: LoginUserQueryParams + Errors: LoginUser400 +} diff --git a/examples/react-query/src/gen/models/LogoutUser.ts b/examples/react-query/src/gen/models/LogoutUser.ts index 6615bff43..c969417e5 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; -}; \ No newline at end of file +export type LogoutUserQuery = { + Response: any + Errors: any +} diff --git a/examples/react-query/src/gen/models/Order.ts b/examples/react-query/src/gen/models/Order.ts index ff4212419..74e22b4de 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; -}; \ No newline at end of file +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 +} diff --git a/examples/react-query/src/gen/models/Pet.ts b/examples/react-query/src/gen/models/Pet.ts index a1da85530..cb876282d 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"; -import type { Tag } from "./Tag"; +import type { Category } from './Category.ts' +import type { Tag } from './Tag.ts' - 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; -}; \ No newline at end of file +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 +} diff --git a/examples/react-query/src/gen/models/PetNotFound.ts b/examples/react-query/src/gen/models/PetNotFound.ts index ba3c67312..adad1616d 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; -}; \ No newline at end of file + /** + * @type integer | undefined, int32 + */ + code?: number + /** + * @type string | undefined + */ + message?: string +} diff --git a/examples/react-query/src/gen/models/PlaceOrder.ts b/examples/react-query/src/gen/models/PlaceOrder.ts index 64894c78b..01b05dd83 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"; +import type { Order } from './Order.ts' - /** +/** * @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; -}; \ No newline at end of file +export type PlaceOrderMutation = { + Response: PlaceOrder200 + Request: PlaceOrderMutationRequest + Errors: PlaceOrder405 +} diff --git a/examples/react-query/src/gen/models/PlaceOrderPatch.ts b/examples/react-query/src/gen/models/PlaceOrderPatch.ts index 549a9b121..e02a53261 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"; +import type { Order } from './Order.ts' - /** +/** * @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; -}; \ No newline at end of file +export type PlaceOrderPatchMutation = { + Response: PlaceOrderPatch200 + Request: PlaceOrderPatchMutationRequest + Errors: PlaceOrderPatch405 +} diff --git a/examples/react-query/src/gen/models/Tag.ts b/examples/react-query/src/gen/models/Tag.ts index 3ae285108..d76160eae 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; -}; \ No newline at end of file + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + name?: string +} diff --git a/examples/react-query/src/gen/models/UpdatePet.ts b/examples/react-query/src/gen/models/UpdatePet.ts index e35d868a8..8b31bc1ff 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"; +import type { Pet } from './Pet.ts' - /** +/** * @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; -}; \ No newline at end of file +export type UpdatePetMutation = { + Response: UpdatePet200 + Request: UpdatePetMutationRequest + Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 +} diff --git a/examples/react-query/src/gen/models/UpdatePetWithForm.ts b/examples/react-query/src/gen/models/UpdatePetWithForm.ts index 23db139e3..63f31c82d 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; -}; \ No newline at end of file +export type UpdatePetWithFormMutation = { + Response: any + PathParams: UpdatePetWithFormPathParams + QueryParams: UpdatePetWithFormQueryParams + Errors: UpdatePetWithForm405 +} diff --git a/examples/react-query/src/gen/models/UpdateUser.ts b/examples/react-query/src/gen/models/UpdateUser.ts index 49db639a1..12450a76f 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"; +import type { User } from './User.ts' - 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; -}; \ No newline at end of file +export type UpdateUserMutation = { + Response: any + Request: UpdateUserMutationRequest + PathParams: UpdateUserPathParams + Errors: any +} diff --git a/examples/react-query/src/gen/models/UploadFile.ts b/examples/react-query/src/gen/models/UploadFile.ts index 4181ef503..09f741b3e 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"; +import type { ApiResponse } from './ApiResponse.ts' - 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; -}; \ No newline at end of file +export type UploadFileMutation = { + Response: UploadFile200 + Request: UploadFileMutationRequest + PathParams: UploadFilePathParams + QueryParams: UploadFileQueryParams + Errors: any +} diff --git a/examples/react-query/src/gen/models/User.ts b/examples/react-query/src/gen/models/User.ts index 9e8b913d4..5fbab3d29 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; -}; \ No newline at end of file + /** + * @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 +} diff --git a/examples/react-query/src/gen/models/UserArray.ts b/examples/react-query/src/gen/models/UserArray.ts index d17573215..3b7eef0e8 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"; +import type { User } from './User.ts' - export type UserArray = User[]; \ No newline at end of file +export type UserArray = User[] diff --git a/examples/react-query/src/gen/models/index.ts b/examples/react-query/src/gen/models/index.ts index c8da9b272..9adde6fe5 100644 --- a/examples/react-query/src/gen/models/index.ts +++ b/examples/react-query/src/gen/models/index.ts @@ -1,35 +1,82 @@ -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 +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' diff --git a/examples/simple-single/src/gen/hooks.ts b/examples/simple-single/src/gen/hooks.ts index 9035c98b9..e90e12609 100644 --- a/examples/simple-single/src/gen/hooks.ts +++ b/examples/simple-single/src/gen/hooks.ts @@ -1,4 +1,4 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UpdatePetMutationRequest, UpdatePetMutationResponse, @@ -65,7 +65,7 @@ import type { DeleteUser400, DeleteUser404, } from './models' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { UseMutationOptions, QueryKey, QueryObserverOptions, UseQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query' import { useMutation, queryOptions, useQuery, useSuspenseQuery } from '@tanstack/react-query' diff --git a/examples/solid-query/kubb.config.js b/examples/solid-query/kubb.config.js index 85eff7c43..0f51006be 100644 --- a/examples/solid-query/kubb.config.js +++ b/examples/solid-query/kubb.config.js @@ -34,7 +34,7 @@ export default defineConfig({ options: { client: { dataReturnType: 'full', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, infinite: { queryParam: 'pageSize', diff --git a/examples/solid-query/src/gen/hooks/createFindPetsByStatus.ts b/examples/solid-query/src/gen/hooks/createFindPetsByStatus.ts index f484232ed..49cfa442b 100644 --- a/examples/solid-query/src/gen/hooks/createFindPetsByStatus.ts +++ b/examples/solid-query/src/gen/hooks/createFindPetsByStatus.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { queryOptions } from '@tanstack/solid-query' export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const diff --git a/examples/solid-query/src/gen/hooks/createFindPetsByTags.ts b/examples/solid-query/src/gen/hooks/createFindPetsByTags.ts index 8ba07a8bb..77c0c388f 100644 --- a/examples/solid-query/src/gen/hooks/createFindPetsByTags.ts +++ b/examples/solid-query/src/gen/hooks/createFindPetsByTags.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { queryOptions } from '@tanstack/solid-query' export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const diff --git a/examples/solid-query/src/gen/hooks/createGetInventory.ts b/examples/solid-query/src/gen/hooks/createGetInventory.ts index ea8a82a29..4aa8230cf 100644 --- a/examples/solid-query/src/gen/hooks/createGetInventory.ts +++ b/examples/solid-query/src/gen/hooks/createGetInventory.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetInventoryQueryResponse } from '../models/GetInventory.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { queryOptions } from '@tanstack/solid-query' export const getInventoryQueryKey = () => [{ url: '/store/inventory' }] as const diff --git a/examples/solid-query/src/gen/hooks/createGetOrderById.ts b/examples/solid-query/src/gen/hooks/createGetOrderById.ts index acd21db23..e3b6f8a57 100644 --- a/examples/solid-query/src/gen/hooks/createGetOrderById.ts +++ b/examples/solid-query/src/gen/hooks/createGetOrderById.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { queryOptions } from '@tanstack/solid-query' export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const diff --git a/examples/solid-query/src/gen/hooks/createGetPetById.ts b/examples/solid-query/src/gen/hooks/createGetPetById.ts index dec5eda34..5b358b409 100644 --- a/examples/solid-query/src/gen/hooks/createGetPetById.ts +++ b/examples/solid-query/src/gen/hooks/createGetPetById.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { queryOptions } from '@tanstack/solid-query' export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const diff --git a/examples/solid-query/src/gen/hooks/createGetUserByName.ts b/examples/solid-query/src/gen/hooks/createGetUserByName.ts index 6694510c7..2fe2190bf 100644 --- a/examples/solid-query/src/gen/hooks/createGetUserByName.ts +++ b/examples/solid-query/src/gen/hooks/createGetUserByName.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { queryOptions } from '@tanstack/solid-query' export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: '/user/:username', params: { username: username } }] as const diff --git a/examples/solid-query/src/gen/hooks/createLoginUser.ts b/examples/solid-query/src/gen/hooks/createLoginUser.ts index 4272613e1..c7b46372a 100644 --- a/examples/solid-query/src/gen/hooks/createLoginUser.ts +++ b/examples/solid-query/src/gen/hooks/createLoginUser.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { queryOptions } from '@tanstack/solid-query' export const loginUserQueryKey = (params?: LoginUserQueryParams) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const diff --git a/examples/solid-query/src/gen/hooks/createLogoutUser.ts b/examples/solid-query/src/gen/hooks/createLogoutUser.ts index e862261ef..4a03c3e04 100644 --- a/examples/solid-query/src/gen/hooks/createLogoutUser.ts +++ b/examples/solid-query/src/gen/hooks/createLogoutUser.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { LogoutUserQueryResponse } from '../models/LogoutUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { queryOptions } from '@tanstack/solid-query' export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const diff --git a/examples/solid-query/src/gen/hooks/createUpdatePetWithForm.ts b/examples/solid-query/src/gen/hooks/createUpdatePetWithForm.ts index 955996afc..0762d28f9 100644 --- a/examples/solid-query/src/gen/hooks/createUpdatePetWithForm.ts +++ b/examples/solid-query/src/gen/hooks/createUpdatePetWithForm.ts @@ -1,11 +1,11 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405, } from '../models/UpdatePetWithForm.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/solid-query' import { queryOptions, createQuery } from '@tanstack/solid-query' diff --git a/examples/svelte-query/kubb.config.js b/examples/svelte-query/kubb.config.js index e90049c78..f9058c4ae 100644 --- a/examples/svelte-query/kubb.config.js +++ b/examples/svelte-query/kubb.config.js @@ -33,7 +33,7 @@ export default defineConfig({ options: { client: { dataReturnType: 'full', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, infinite: { queryParam: 'pageSize', diff --git a/examples/svelte-query/src/gen/hooks/createAddPet.ts b/examples/svelte-query/src/gen/hooks/createAddPet.ts index d64e719b4..54efd3735 100644 --- a/examples/svelte-query/src/gen/hooks/createAddPet.ts +++ b/examples/svelte-query/src/gen/hooks/createAddPet.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createCreateUser.ts b/examples/svelte-query/src/gen/hooks/createCreateUser.ts index f923b8ef3..0756a621f 100644 --- a/examples/svelte-query/src/gen/hooks/createCreateUser.ts +++ b/examples/svelte-query/src/gen/hooks/createCreateUser.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createCreateUsersWithListInput.ts b/examples/svelte-query/src/gen/hooks/createCreateUsersWithListInput.ts index 51778e2d6..72eae43c3 100644 --- a/examples/svelte-query/src/gen/hooks/createCreateUsersWithListInput.ts +++ b/examples/svelte-query/src/gen/hooks/createCreateUsersWithListInput.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createDeleteOrder.ts b/examples/svelte-query/src/gen/hooks/createDeleteOrder.ts index 1498aec89..bb8cf7264 100644 --- a/examples/svelte-query/src/gen/hooks/createDeleteOrder.ts +++ b/examples/svelte-query/src/gen/hooks/createDeleteOrder.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createDeletePet.ts b/examples/svelte-query/src/gen/hooks/createDeletePet.ts index ee8b7a1d4..8761918ca 100644 --- a/examples/svelte-query/src/gen/hooks/createDeletePet.ts +++ b/examples/svelte-query/src/gen/hooks/createDeletePet.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createDeleteUser.ts b/examples/svelte-query/src/gen/hooks/createDeleteUser.ts index 6f4eefa88..b57f6703d 100644 --- a/examples/svelte-query/src/gen/hooks/createDeleteUser.ts +++ b/examples/svelte-query/src/gen/hooks/createDeleteUser.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../models/DeleteUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createFindPetsByStatus.ts b/examples/svelte-query/src/gen/hooks/createFindPetsByStatus.ts index b1664e6f0..cab5e796c 100644 --- a/examples/svelte-query/src/gen/hooks/createFindPetsByStatus.ts +++ b/examples/svelte-query/src/gen/hooks/createFindPetsByStatus.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createFindPetsByTags.ts b/examples/svelte-query/src/gen/hooks/createFindPetsByTags.ts index a4719d864..3325865c2 100644 --- a/examples/svelte-query/src/gen/hooks/createFindPetsByTags.ts +++ b/examples/svelte-query/src/gen/hooks/createFindPetsByTags.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags.ts' -import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/client' +import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createGetInventory.ts b/examples/svelte-query/src/gen/hooks/createGetInventory.ts index 83fe9d1e9..bedb2a421 100644 --- a/examples/svelte-query/src/gen/hooks/createGetInventory.ts +++ b/examples/svelte-query/src/gen/hooks/createGetInventory.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetInventoryQueryResponse } from '../models/GetInventory.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createGetOrderById.ts b/examples/svelte-query/src/gen/hooks/createGetOrderById.ts index f38efdb31..ebd19d049 100644 --- a/examples/svelte-query/src/gen/hooks/createGetOrderById.ts +++ b/examples/svelte-query/src/gen/hooks/createGetOrderById.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createGetPetById.ts b/examples/svelte-query/src/gen/hooks/createGetPetById.ts index bd5973a41..a447d70ab 100644 --- a/examples/svelte-query/src/gen/hooks/createGetPetById.ts +++ b/examples/svelte-query/src/gen/hooks/createGetPetById.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createGetUserByName.ts b/examples/svelte-query/src/gen/hooks/createGetUserByName.ts index 2fdf51a9c..1c32fc463 100644 --- a/examples/svelte-query/src/gen/hooks/createGetUserByName.ts +++ b/examples/svelte-query/src/gen/hooks/createGetUserByName.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createLoginUser.ts b/examples/svelte-query/src/gen/hooks/createLoginUser.ts index c2fffaa9d..8d3d474be 100644 --- a/examples/svelte-query/src/gen/hooks/createLoginUser.ts +++ b/examples/svelte-query/src/gen/hooks/createLoginUser.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createLogoutUser.ts b/examples/svelte-query/src/gen/hooks/createLogoutUser.ts index 2c7937d71..a30facf35 100644 --- a/examples/svelte-query/src/gen/hooks/createLogoutUser.ts +++ b/examples/svelte-query/src/gen/hooks/createLogoutUser.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { LogoutUserQueryResponse } from '../models/LogoutUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createPlaceOrder.ts b/examples/svelte-query/src/gen/hooks/createPlaceOrder.ts index 10394b3f6..cad9722b5 100644 --- a/examples/svelte-query/src/gen/hooks/createPlaceOrder.ts +++ b/examples/svelte-query/src/gen/hooks/createPlaceOrder.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../models/PlaceOrder.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createPlaceOrderPatch.ts b/examples/svelte-query/src/gen/hooks/createPlaceOrderPatch.ts index 77c68cae4..f71afd122 100644 --- a/examples/svelte-query/src/gen/hooks/createPlaceOrderPatch.ts +++ b/examples/svelte-query/src/gen/hooks/createPlaceOrderPatch.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from '../models/PlaceOrderPatch.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createUpdatePet.ts b/examples/svelte-query/src/gen/hooks/createUpdatePet.ts index d69429088..c0f4ed722 100644 --- a/examples/svelte-query/src/gen/hooks/createUpdatePet.ts +++ b/examples/svelte-query/src/gen/hooks/createUpdatePet.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../models/UpdatePet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createUpdatePetWithForm.ts b/examples/svelte-query/src/gen/hooks/createUpdatePetWithForm.ts index 24e6c20e9..ee1ab353d 100644 --- a/examples/svelte-query/src/gen/hooks/createUpdatePetWithForm.ts +++ b/examples/svelte-query/src/gen/hooks/createUpdatePetWithForm.ts @@ -1,11 +1,11 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405, } from '../models/UpdatePetWithForm.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createUpdateUser.ts b/examples/svelte-query/src/gen/hooks/createUpdateUser.ts index 797b08eb7..0c2b829a9 100644 --- a/examples/svelte-query/src/gen/hooks/createUpdateUser.ts +++ b/examples/svelte-query/src/gen/hooks/createUpdateUser.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/svelte-query/src/gen/hooks/createUploadFile.ts b/examples/svelte-query/src/gen/hooks/createUploadFile.ts index 426c42318..a735745b9 100644 --- a/examples/svelte-query/src/gen/hooks/createUploadFile.ts +++ b/examples/svelte-query/src/gen/hooks/createUploadFile.ts @@ -1,6 +1,6 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' diff --git a/examples/swr/src/gen/hooks/useAddPet.ts b/examples/swr/src/gen/hooks/useAddPet.ts index 633ea42a8..8871fe4df 100644 --- a/examples/swr/src/gen/hooks/useAddPet.ts +++ b/examples/swr/src/gen/hooks/useAddPet.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const addPetMutationKey = () => [{ url: '/pet' }] as const diff --git a/examples/swr/src/gen/hooks/useCreateUser.ts b/examples/swr/src/gen/hooks/useCreateUser.ts index b148e08b8..2875af86f 100644 --- a/examples/swr/src/gen/hooks/useCreateUser.ts +++ b/examples/swr/src/gen/hooks/useCreateUser.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const createUserMutationKey = () => [{ url: '/user' }] as const diff --git a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts index 360662cd1..388864041 100644 --- a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const createUsersWithListInputMutationKey = () => [{ url: '/user/createWithList' }] as const diff --git a/examples/swr/src/gen/hooks/useDeleteOrder.ts b/examples/swr/src/gen/hooks/useDeleteOrder.ts index 759c6fa01..7b79f8afc 100644 --- a/examples/swr/src/gen/hooks/useDeleteOrder.ts +++ b/examples/swr/src/gen/hooks/useDeleteOrder.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const deleteOrderMutationKey = () => [{ url: '/store/order/{orderId}' }] as const diff --git a/examples/swr/src/gen/hooks/useDeletePet.ts b/examples/swr/src/gen/hooks/useDeletePet.ts index 66a518282..e66121641 100644 --- a/examples/swr/src/gen/hooks/useDeletePet.ts +++ b/examples/swr/src/gen/hooks/useDeletePet.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const deletePetMutationKey = () => [{ url: '/pet/{petId}' }] as const diff --git a/examples/swr/src/gen/hooks/useDeleteUser.ts b/examples/swr/src/gen/hooks/useDeleteUser.ts index d7703387b..47ac8529f 100644 --- a/examples/swr/src/gen/hooks/useDeleteUser.ts +++ b/examples/swr/src/gen/hooks/useDeleteUser.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../models/DeleteUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const deleteUserMutationKey = () => [{ url: '/user/{username}' }] as const diff --git a/examples/swr/src/gen/hooks/useFindPetsByStatus.ts b/examples/swr/src/gen/hooks/useFindPetsByStatus.ts index bce0b2522..edfa7ec08 100644 --- a/examples/swr/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/swr/src/gen/hooks/useFindPetsByStatus.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const diff --git a/examples/swr/src/gen/hooks/useFindPetsByTags.ts b/examples/swr/src/gen/hooks/useFindPetsByTags.ts index fbe42df66..2ce75306e 100644 --- a/examples/swr/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/swr/src/gen/hooks/useFindPetsByTags.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const diff --git a/examples/swr/src/gen/hooks/useGetInventory.ts b/examples/swr/src/gen/hooks/useGetInventory.ts index a30cf7863..61c3c13c2 100644 --- a/examples/swr/src/gen/hooks/useGetInventory.ts +++ b/examples/swr/src/gen/hooks/useGetInventory.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { GetInventoryQueryResponse } from '../models/GetInventory.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const getInventoryQueryKey = () => [{ url: '/store/inventory' }] as const diff --git a/examples/swr/src/gen/hooks/useGetOrderById.ts b/examples/swr/src/gen/hooks/useGetOrderById.ts index d0e8e83c3..19b85400e 100644 --- a/examples/swr/src/gen/hooks/useGetOrderById.ts +++ b/examples/swr/src/gen/hooks/useGetOrderById.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const diff --git a/examples/swr/src/gen/hooks/useGetPetById.ts b/examples/swr/src/gen/hooks/useGetPetById.ts index 56f5f112d..dfd0ffa2e 100644 --- a/examples/swr/src/gen/hooks/useGetPetById.ts +++ b/examples/swr/src/gen/hooks/useGetPetById.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const diff --git a/examples/swr/src/gen/hooks/useGetUserByName.ts b/examples/swr/src/gen/hooks/useGetUserByName.ts index 15f128780..8431df1a3 100644 --- a/examples/swr/src/gen/hooks/useGetUserByName.ts +++ b/examples/swr/src/gen/hooks/useGetUserByName.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: '/user/:username', params: { username: username } }] as const diff --git a/examples/swr/src/gen/hooks/useLoginUser.ts b/examples/swr/src/gen/hooks/useLoginUser.ts index 66353585a..047f0f1f6 100644 --- a/examples/swr/src/gen/hooks/useLoginUser.ts +++ b/examples/swr/src/gen/hooks/useLoginUser.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const loginUserQueryKey = (params?: LoginUserQueryParams) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const diff --git a/examples/swr/src/gen/hooks/useLogoutUser.ts b/examples/swr/src/gen/hooks/useLogoutUser.ts index e2890f446..7daf6d31f 100644 --- a/examples/swr/src/gen/hooks/useLogoutUser.ts +++ b/examples/swr/src/gen/hooks/useLogoutUser.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { LogoutUserQueryResponse } from '../models/LogoutUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const diff --git a/examples/swr/src/gen/hooks/usePlaceOrder.ts b/examples/swr/src/gen/hooks/usePlaceOrder.ts index 80054ba2d..2e579c5e6 100644 --- a/examples/swr/src/gen/hooks/usePlaceOrder.ts +++ b/examples/swr/src/gen/hooks/usePlaceOrder.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../models/PlaceOrder.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const placeOrderMutationKey = () => [{ url: '/store/order' }] as const diff --git a/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts b/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts index 6397f4b0c..0a5a3d44b 100644 --- a/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts +++ b/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { PlaceOrderPatchMutationRequest, PlaceOrderPatchMutationResponse, PlaceOrderPatch405 } from '../models/PlaceOrderPatch.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const placeOrderPatchMutationKey = () => [{ url: '/store/order' }] as const diff --git a/examples/swr/src/gen/hooks/useUpdatePet.ts b/examples/swr/src/gen/hooks/useUpdatePet.ts index d6d8b5315..b71bc9ac1 100644 --- a/examples/swr/src/gen/hooks/useUpdatePet.ts +++ b/examples/swr/src/gen/hooks/useUpdatePet.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../models/UpdatePet.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const updatePetMutationKey = () => [{ url: '/pet' }] as const diff --git a/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts b/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts index 4d79019d7..c2799710a 100644 --- a/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts @@ -1,4 +1,4 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { UpdatePetWithFormMutationResponse, @@ -6,7 +6,7 @@ import type { UpdatePetWithFormQueryParams, UpdatePetWithForm405, } from '../models/UpdatePetWithForm.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const diff --git a/examples/swr/src/gen/hooks/useUpdateUser.ts b/examples/swr/src/gen/hooks/useUpdateUser.ts index 43f5598be..d0e538650 100644 --- a/examples/swr/src/gen/hooks/useUpdateUser.ts +++ b/examples/swr/src/gen/hooks/useUpdateUser.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const updateUserMutationKey = () => [{ url: '/user/{username}' }] as const diff --git a/examples/swr/src/gen/hooks/useUploadFile.ts b/examples/swr/src/gen/hooks/useUploadFile.ts index 28b52aa67..b8923e6fe 100644 --- a/examples/swr/src/gen/hooks/useUploadFile.ts +++ b/examples/swr/src/gen/hooks/useUploadFile.ts @@ -1,7 +1,7 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' export const uploadFileMutationKey = () => [{ url: '/pet/{petId}/uploadImage' }] as const diff --git a/examples/typescript/petStore.yaml b/examples/typescript/petStore.yaml index 4dc2aeb58..fab92fa99 100644 --- a/examples/typescript/petStore.yaml +++ b/examples/typescript/petStore.yaml @@ -800,6 +800,7 @@ components: type: array xml: wrapped: true + readOnly: true items: $ref: '#/components/schemas/Tag' status: diff --git a/examples/typescript/src/gen/models.ts b/examples/typescript/src/gen/models.ts index 35a47c697..94b3c4ada 100644 --- a/examples/typescript/src/gen/models.ts +++ b/examples/typescript/src/gen/models.ts @@ -171,7 +171,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -202,7 +202,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -325,7 +325,7 @@ export type UpdatePet405 = any /** * @description Update an existent pet in the store */ -export type UpdatePetMutationRequest = Omit, 'type'> +export type UpdatePetMutationRequest = Omit, 'type' | 'tags'> export type UpdatePetMutationResponse = UpdatePet200 diff --git a/examples/typescript/src/gen/modelsConst.ts b/examples/typescript/src/gen/modelsConst.ts index 02d107588..64785306c 100644 --- a/examples/typescript/src/gen/modelsConst.ts +++ b/examples/typescript/src/gen/modelsConst.ts @@ -179,7 +179,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -210,7 +210,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -339,7 +339,7 @@ export type UpdatePet405 = any /** * @description Update an existent pet in the store */ -export type UpdatePetMutationRequest = Omit, 'type'> +export type UpdatePetMutationRequest = Omit, 'type' | 'tags'> export type UpdatePetMutationResponse = UpdatePet200 diff --git a/examples/typescript/src/gen/modelsConstEnum.ts b/examples/typescript/src/gen/modelsConstEnum.ts index 35a47c697..94b3c4ada 100644 --- a/examples/typescript/src/gen/modelsConstEnum.ts +++ b/examples/typescript/src/gen/modelsConstEnum.ts @@ -171,7 +171,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -202,7 +202,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -325,7 +325,7 @@ export type UpdatePet405 = any /** * @description Update an existent pet in the store */ -export type UpdatePetMutationRequest = Omit, 'type'> +export type UpdatePetMutationRequest = Omit, 'type' | 'tags'> export type UpdatePetMutationResponse = UpdatePet200 diff --git a/examples/typescript/src/gen/modelsLiteral.ts b/examples/typescript/src/gen/modelsLiteral.ts index 440e6be52..4b2ab5ed7 100644 --- a/examples/typescript/src/gen/modelsLiteral.ts +++ b/examples/typescript/src/gen/modelsLiteral.ts @@ -156,7 +156,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -187,7 +187,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -302,7 +302,7 @@ export type UpdatePet405 = any /** * @description Update an existent pet in the store */ -export type UpdatePetMutationRequest = Omit, 'type'> +export type UpdatePetMutationRequest = Omit, 'type' | 'tags'> export type UpdatePetMutationResponse = UpdatePet200 diff --git a/examples/typescript/src/gen/modelsPascalConst.ts b/examples/typescript/src/gen/modelsPascalConst.ts index 02d107588..64785306c 100644 --- a/examples/typescript/src/gen/modelsPascalConst.ts +++ b/examples/typescript/src/gen/modelsPascalConst.ts @@ -179,7 +179,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -210,7 +210,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -339,7 +339,7 @@ export type UpdatePet405 = any /** * @description Update an existent pet in the store */ -export type UpdatePetMutationRequest = Omit, 'type'> +export type UpdatePetMutationRequest = Omit, 'type' | 'tags'> export type UpdatePetMutationResponse = UpdatePet200 diff --git a/examples/typescript/src/gen/schemas/Pet.json b/examples/typescript/src/gen/schemas/Pet.json index 61aaa0f92..3f5a4e988 100644 --- a/examples/typescript/src/gen/schemas/Pet.json +++ b/examples/typescript/src/gen/schemas/Pet.json @@ -30,6 +30,7 @@ "tags": { "type": "array", "xml": { "wrapped": true }, + "readOnly": true, "items": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } }, diff --git a/examples/typescript/src/gen/ts/models/Pet.ts b/examples/typescript/src/gen/ts/models/Pet.ts index 0dc84bdd5..d240b4f4a 100644 --- a/examples/typescript/src/gen/ts/models/Pet.ts +++ b/examples/typescript/src/gen/ts/models/Pet.ts @@ -39,7 +39,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined @@ -67,7 +67,7 @@ export type Pet = /** * @type array | undefined */ - tags?: Tag[] + readonly tags?: Tag[] /** * @description pet status in the store * @type string | undefined diff --git a/examples/typescript/src/gen/ts/models/UpdatePet.ts b/examples/typescript/src/gen/ts/models/UpdatePet.ts index fb4b01d07..3d99e5e12 100644 --- a/examples/typescript/src/gen/ts/models/UpdatePet.ts +++ b/examples/typescript/src/gen/ts/models/UpdatePet.ts @@ -23,7 +23,7 @@ export type UpdatePet405 = any /** * @description Update an existent pet in the store */ -export type UpdatePetMutationRequest = Omit, 'type'> +export type UpdatePetMutationRequest = Omit, 'type' | 'tags'> export type UpdatePetMutationResponse = UpdatePet200 diff --git a/examples/typescript/src/gen/ts/models/oas.ts b/examples/typescript/src/gen/ts/models/oas.ts index 52c74254d..2597ac83a 100644 --- a/examples/typescript/src/gen/ts/models/oas.ts +++ b/examples/typescript/src/gen/ts/models/oas.ts @@ -1154,6 +1154,7 @@ export const oas = { xml: { wrapped: true, }, + readOnly: true, items: { $ref: '#/components/schemas/Tag', }, diff --git a/examples/vue-query/src/gen/hooks/index.ts b/examples/vue-query/src/gen/hooks/index.ts index 3e5e52d62..430d65216 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"; \ No newline at end of file +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' diff --git a/examples/vue-query/src/gen/hooks/useAddPet.ts b/examples/vue-query/src/gen/hooks/useAddPet.ts index dc8bd6f73..b2ea4b36e 100644 --- a/examples/vue-query/src/gen/hooks/useAddPet.ts +++ b/examples/vue-query/src/gen/hooks/useAddPet.ts @@ -1,46 +1,61 @@ -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/clients/axios' +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - }>; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useCreateUser.ts b/examples/vue-query/src/gen/hooks/useCreateUser.ts index 81fb7e1bb..23251e630 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUser.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUser.ts @@ -1,46 +1,61 @@ -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/clients/axios' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - }>; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts index 78a0e4072..7eb59cd2a 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts @@ -1,46 +1,66 @@ -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/clients/axios' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - }>; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts index 6633d6ebd..9f0782fc4 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts @@ -1,46 +1,65 @@ -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/clients/axios' +import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - }>; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useDeletePet.ts b/examples/vue-query/src/gen/hooks/useDeletePet.ts index 714222410..4c5b6ea33 100644 --- a/examples/vue-query/src/gen/hooks/useDeletePet.ts +++ b/examples/vue-query/src/gen/hooks/useDeletePet.ts @@ -1,49 +1,70 @@ -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/clients/axios' +import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useDeleteUser.ts b/examples/vue-query/src/gen/hooks/useDeleteUser.ts index 2ee798c6b..3e580cac0 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteUser.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteUser.ts @@ -1,46 +1,61 @@ -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/clients/axios' +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../models/DeleteUser' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - }>; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts index c820f24d4..a24bafed4 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts @@ -1,60 +1,79 @@ -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/clients/axios' +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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({ 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 +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 +} diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts index 5223814e1..659542a2e 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts @@ -1,60 +1,79 @@ -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/clients/axios' +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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({ 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 +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 +} diff --git a/examples/vue-query/src/gen/hooks/useGetInventory.ts b/examples/vue-query/src/gen/hooks/useGetInventory.ts index 563623755..878e26a31 100644 --- a/examples/vue-query/src/gen/hooks/useGetInventory.ts +++ b/examples/vue-query/src/gen/hooks/useGetInventory.ts @@ -1,53 +1,55 @@ -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/clients/axios' +import type { GetInventoryQueryResponse } from '../models/GetInventory' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; -} \ No newline at end of file +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 +} diff --git a/examples/vue-query/src/gen/hooks/useGetOrderById.ts b/examples/vue-query/src/gen/hooks/useGetOrderById.ts index 563662c35..5b67a7c6d 100644 --- a/examples/vue-query/src/gen/hooks/useGetOrderById.ts +++ b/examples/vue-query/src/gen/hooks/useGetOrderById.ts @@ -1,63 +1,80 @@ -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/clients/axios' +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; -} \ No newline at end of file +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 +} diff --git a/examples/vue-query/src/gen/hooks/useGetPetById.ts b/examples/vue-query/src/gen/hooks/useGetPetById.ts index dc6d9ee8f..fda46d622 100644 --- a/examples/vue-query/src/gen/hooks/useGetPetById.ts +++ b/examples/vue-query/src/gen/hooks/useGetPetById.ts @@ -1,63 +1,80 @@ -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/clients/axios' +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; -} \ No newline at end of file +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 +} diff --git a/examples/vue-query/src/gen/hooks/useGetUserByName.ts b/examples/vue-query/src/gen/hooks/useGetUserByName.ts index 23e1b1c31..2b274a568 100644 --- a/examples/vue-query/src/gen/hooks/useGetUserByName.ts +++ b/examples/vue-query/src/gen/hooks/useGetUserByName.ts @@ -1,61 +1,82 @@ -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/clients/axios' +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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({ 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 +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 +} diff --git a/examples/vue-query/src/gen/hooks/useLoginUser.ts b/examples/vue-query/src/gen/hooks/useLoginUser.ts index 027c7523a..150c4f357 100644 --- a/examples/vue-query/src/gen/hooks/useLoginUser.ts +++ b/examples/vue-query/src/gen/hooks/useLoginUser.ts @@ -1,58 +1,73 @@ -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/clients/axios' +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; -} \ No newline at end of file +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 +} diff --git a/examples/vue-query/src/gen/hooks/useLogoutUser.ts b/examples/vue-query/src/gen/hooks/useLogoutUser.ts index 9be1c713f..df214bbf1 100644 --- a/examples/vue-query/src/gen/hooks/useLogoutUser.ts +++ b/examples/vue-query/src/gen/hooks/useLogoutUser.ts @@ -1,51 +1,53 @@ -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/clients/axios' +import type { LogoutUserQueryResponse } from '../models/LogoutUser' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; -} \ No newline at end of file +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 +} diff --git a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts index c26a9b4cf..88d6133cc 100644 --- a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts +++ b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts @@ -1,46 +1,61 @@ -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/clients/axios' +import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../models/PlaceOrder' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - }>; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useUpdatePet.ts b/examples/vue-query/src/gen/hooks/useUpdatePet.ts index d70df2ade..c8fa8c2e3 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePet.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePet.ts @@ -1,46 +1,66 @@ -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/clients/axios' +import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../models/UpdatePet' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - }>; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts index 9682f9165..5bf4b0ac5 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts @@ -1,47 +1,68 @@ -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/clients/axios' +import type { + UpdatePetWithFormMutationResponse, + UpdatePetWithFormPathParams, + UpdatePetWithFormQueryParams, + UpdatePetWithForm405, +} from '../models/UpdatePetWithForm' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useUpdateUser.ts b/examples/vue-query/src/gen/hooks/useUpdateUser.ts index d429a5748..e767743ec 100644 --- a/examples/vue-query/src/gen/hooks/useUpdateUser.ts +++ b/examples/vue-query/src/gen/hooks/useUpdateUser.ts @@ -1,49 +1,65 @@ -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/clients/axios' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/hooks/useUploadFile.ts b/examples/vue-query/src/gen/hooks/useUploadFile.ts index d44428cce..a662edb4b 100644 --- a/examples/vue-query/src/gen/hooks/useUploadFile.ts +++ b/examples/vue-query/src/gen/hooks/useUploadFile.ts @@ -1,50 +1,74 @@ -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/clients/axios' +import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' +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; - 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 +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, + }) +} diff --git a/examples/vue-query/src/gen/models/AddPet.ts b/examples/vue-query/src/gen/models/AddPet.ts index 2d4e85901..7c43b22b1 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; -}; \ No newline at end of file +export type AddPetMutation = { + Response: AddPet200 + Request: AddPetMutationRequest + Errors: AddPet405 +} diff --git a/examples/vue-query/src/gen/models/Address.ts b/examples/vue-query/src/gen/models/Address.ts index d7ffd22c3..c8e706e14 100644 --- a/examples/vue-query/src/gen/models/Address.ts +++ b/examples/vue-query/src/gen/models/Address.ts @@ -1,35 +1,31 @@ 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 - ]; -}; \ No newline at end of file +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] +} diff --git a/examples/vue-query/src/gen/models/ApiResponse.ts b/examples/vue-query/src/gen/models/ApiResponse.ts index 2a8e81e25..3a6dae779 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; -}; \ No newline at end of file + /** + * @type integer | undefined, int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string +} diff --git a/examples/vue-query/src/gen/models/Category.ts b/examples/vue-query/src/gen/models/Category.ts index 49380ed19..3b48c48f3 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; -}; \ No newline at end of file + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + name?: string +} diff --git a/examples/vue-query/src/gen/models/CreateUser.ts b/examples/vue-query/src/gen/models/CreateUser.ts index 06124c4e9..775e3946b 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; -}; \ No newline at end of file +export type CreateUserMutation = { + Response: any + Request: CreateUserMutationRequest + Errors: any +} diff --git a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts index cf8a947e6..2e76255f9 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; -}; \ No newline at end of file +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInput200 + Request: CreateUsersWithListInputMutationRequest + Errors: any +} diff --git a/examples/vue-query/src/gen/models/Customer.ts b/examples/vue-query/src/gen/models/Customer.ts index 8479512ff..cfd611151 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[]; -}; \ No newline at end of file +export type Customer = { + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + username?: string + /** + * @type array | undefined + */ + address?: Address[] +} diff --git a/examples/vue-query/src/gen/models/DeleteOrder.ts b/examples/vue-query/src/gen/models/DeleteOrder.ts index 2280bda3b..3b22473aa 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; -}; \ No newline at end of file +export type DeleteOrderMutation = { + Response: any + PathParams: DeleteOrderPathParams + Errors: DeleteOrder400 | DeleteOrder404 +} diff --git a/examples/vue-query/src/gen/models/DeletePet.ts b/examples/vue-query/src/gen/models/DeletePet.ts index 407109083..ec4506cf7 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; -}; \ No newline at end of file +export type DeletePetMutation = { + Response: any + PathParams: DeletePetPathParams + HeaderParams: DeletePetHeaderParams + Errors: DeletePet400 +} diff --git a/examples/vue-query/src/gen/models/DeleteUser.ts b/examples/vue-query/src/gen/models/DeleteUser.ts index 31ecf784f..8cb71e167 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; -}; \ No newline at end of file +export type DeleteUserMutation = { + Response: any + PathParams: DeleteUserPathParams + Errors: DeleteUser400 | DeleteUser404 +} diff --git a/examples/vue-query/src/gen/models/FindPetsByStatus.ts b/examples/vue-query/src/gen/models/FindPetsByStatus.ts index 34ced6a62..d8fd7f1c5 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; -}; \ No newline at end of file +export type FindPetsByStatusQuery = { + Response: FindPetsByStatus200 + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} diff --git a/examples/vue-query/src/gen/models/FindPetsByTags.ts b/examples/vue-query/src/gen/models/FindPetsByTags.ts index 10c589fbd..66c3744a4 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; -}; \ No newline at end of file +export type FindPetsByTagsQuery = { + Response: FindPetsByTags200 + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} diff --git a/examples/vue-query/src/gen/models/GetInventory.ts b/examples/vue-query/src/gen/models/GetInventory.ts index 0a2beab9f..411828e36 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; -}; \ No newline at end of file +export type GetInventoryQuery = { + Response: GetInventory200 + Errors: any +} diff --git a/examples/vue-query/src/gen/models/GetOrderById.ts b/examples/vue-query/src/gen/models/GetOrderById.ts index 9944ceaf5..5bcb06186 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; -}; \ No newline at end of file +export type GetOrderByIdQuery = { + Response: GetOrderById200 + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} diff --git a/examples/vue-query/src/gen/models/GetPetById.ts b/examples/vue-query/src/gen/models/GetPetById.ts index ead878803..6150714f9 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; -}; \ No newline at end of file +export type GetPetByIdQuery = { + Response: GetPetById200 + PathParams: GetPetByIdPathParams + Errors: GetPetById400 | GetPetById404 +} diff --git a/examples/vue-query/src/gen/models/GetUserByName.ts b/examples/vue-query/src/gen/models/GetUserByName.ts index 4421fa742..dd2f1be4e 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; -}; \ No newline at end of file +export type GetUserByNameQuery = { + Response: GetUserByName200 + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} diff --git a/examples/vue-query/src/gen/models/LoginUser.ts b/examples/vue-query/src/gen/models/LoginUser.ts index 82a6e8674..f8869afdb 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; -}; \ No newline at end of file +export type LoginUserQuery = { + Response: LoginUser200 + QueryParams: LoginUserQueryParams + Errors: LoginUser400 +} diff --git a/examples/vue-query/src/gen/models/LogoutUser.ts b/examples/vue-query/src/gen/models/LogoutUser.ts index 6615bff43..c969417e5 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; -}; \ No newline at end of file +export type LogoutUserQuery = { + Response: any + Errors: any +} diff --git a/examples/vue-query/src/gen/models/Order.ts b/examples/vue-query/src/gen/models/Order.ts index 5337bffc2..5e694abb6 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; -}; \ No newline at end of file +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 +} diff --git a/examples/vue-query/src/gen/models/Pet.ts b/examples/vue-query/src/gen/models/Pet.ts index a1da85530..15dc1a464 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; -}; \ No newline at end of file +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 +} diff --git a/examples/vue-query/src/gen/models/PlaceOrder.ts b/examples/vue-query/src/gen/models/PlaceOrder.ts index 64894c78b..3aa55065a 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; -}; \ No newline at end of file +export type PlaceOrderMutation = { + Response: PlaceOrder200 + Request: PlaceOrderMutationRequest + Errors: PlaceOrder405 +} diff --git a/examples/vue-query/src/gen/models/Tag.ts b/examples/vue-query/src/gen/models/Tag.ts index 3ae285108..d76160eae 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; -}; \ No newline at end of file + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + name?: string +} diff --git a/examples/vue-query/src/gen/models/UpdatePet.ts b/examples/vue-query/src/gen/models/UpdatePet.ts index e35d868a8..9574eed65 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; -}; \ No newline at end of file +export type UpdatePetMutation = { + Response: UpdatePet200 + Request: UpdatePetMutationRequest + Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 +} diff --git a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts index 8665c84c9..ca645f500 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; -}; \ No newline at end of file +export type UpdatePetWithFormMutation = { + Response: any + PathParams: UpdatePetWithFormPathParams + QueryParams: UpdatePetWithFormQueryParams + Errors: UpdatePetWithForm405 +} diff --git a/examples/vue-query/src/gen/models/UpdateUser.ts b/examples/vue-query/src/gen/models/UpdateUser.ts index 49db639a1..6a89b12cc 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; -}; \ No newline at end of file +export type UpdateUserMutation = { + Response: any + Request: UpdateUserMutationRequest + PathParams: UpdateUserPathParams + Errors: any +} diff --git a/examples/vue-query/src/gen/models/UploadFile.ts b/examples/vue-query/src/gen/models/UploadFile.ts index 4181ef503..cbb4a1c80 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; -}; \ No newline at end of file +export type UploadFileMutation = { + Response: UploadFile200 + Request: UploadFileMutationRequest + PathParams: UploadFilePathParams + QueryParams: UploadFileQueryParams + Errors: any +} diff --git a/examples/vue-query/src/gen/models/User.ts b/examples/vue-query/src/gen/models/User.ts index 9e8b913d4..5fbab3d29 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; -}; \ No newline at end of file + /** + * @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 +} diff --git a/examples/vue-query/src/gen/models/UserArray.ts b/examples/vue-query/src/gen/models/UserArray.ts index d17573215..effb23af2 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[]; \ No newline at end of file +export type UserArray = User[] diff --git a/examples/vue-query/src/gen/models/index.ts b/examples/vue-query/src/gen/models/index.ts index 8b968b76d..1d52b46aa 100644 --- a/examples/vue-query/src/gen/models/index.ts +++ b/examples/vue-query/src/gen/models/index.ts @@ -1,32 +1,73 @@ -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 +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' diff --git a/examples/zod/src/gen/zodClients.ts b/examples/zod/src/gen/zodClients.ts index c1c2deb9f..a999ad8b7 100644 --- a/examples/zod/src/gen/zodClients.ts +++ b/examples/zod/src/gen/zodClients.ts @@ -1,10 +1,10 @@ -import client from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' import type { DeleteOrderMutationResponseType, DeleteOrderPathParamsType, DeleteOrder400Type, DeleteOrder404Type } from './ts/DeleteOrderType.ts' import type { GetInventoryQueryResponseType } from './ts/GetInventoryType.ts' import type { GetOrderByIdQueryResponseType, GetOrderByIdPathParamsType, GetOrderById400Type, GetOrderById404Type } from './ts/GetOrderByIdType.ts' import type { PlaceOrderPatchMutationRequestType, PlaceOrderPatchMutationResponseType, PlaceOrderPatch405Type } from './ts/PlaceOrderPatchType.ts' import type { PlaceOrderMutationRequestType, PlaceOrderMutationResponseType, PlaceOrder405Type } from './ts/PlaceOrderType.ts' -import type { RequestConfig } from '@kubb/plugin-client/client' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import { deleteOrderMutationResponseSchema } from './zod/deleteOrderSchema.gen.ts' import { getInventoryQueryResponseSchema } from './zod/getInventorySchema.gen.ts' import { getOrderByIdQueryResponseSchema } from './zod/getOrderByIdSchema.gen.ts' diff --git a/packages/plugin-client/package.json b/packages/plugin-client/package.json index fbf34d42a..4f0302415 100644 --- a/packages/plugin-client/package.json +++ b/packages/plugin-client/package.json @@ -36,15 +36,15 @@ "require": "./dist/components.cjs", "default": "./dist/components.cjs" }, - "./client": { - "import": "./dist/client.js", - "require": "./dist/client.cjs", - "default": "./dist/client.cjs" + "./clients/axios": { + "import": "./dist/clients/axios.js", + "require": "./dist/clients/axios.cjs", + "default": "./dist/clients/axios.cjs" }, - "./ts-client": { - "import": "./client.ts", - "require": "./client.ts", - "default": "./client.ts" + "./clients/fetch": { + "import": "./dist/clients/fetch.js", + "require": "./dist/clients/fetch.cjs", + "default": "./dist/clients/fetch.cjs" }, "./package.json": "./package.json", "./*": "./*" @@ -59,6 +59,12 @@ ], "generators": [ "./dist/generators.d.ts" + ], + "clients/axios": [ + "./dist/clients/axios.d.ts" + ], + "clients/fetch": [ + "./dist/clients/fetch.d.ts" ] } }, diff --git a/packages/plugin-client/client.ts b/packages/plugin-client/src/clients/axios.ts similarity index 100% rename from packages/plugin-client/client.ts rename to packages/plugin-client/src/clients/axios.ts diff --git a/examples/fetch/src/client.ts b/packages/plugin-client/src/clients/fetch.ts similarity index 58% rename from examples/fetch/src/client.ts rename to packages/plugin-client/src/clients/fetch.ts index 644d3f64d..5da0b91a1 100644 --- a/examples/fetch/src/client.ts +++ b/packages/plugin-client/src/clients/fetch.ts @@ -1,29 +1,35 @@ +/** + * Subset of AxiosRequestConfig + */ export type RequestConfig = { baseURL?: string url?: string - method: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' - params?: object + method: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' + params?: unknown data?: TData | FormData responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream' signal?: AbortSignal - headers?: HeadersInit + headers?: [string, string][] | Record } - +/** + * Subset of AxiosResponse + */ export type ResponseConfig = { data: TData status: number statusText: string + headers?: [string, string][] | Record } export const fetchClient = async (config: RequestConfig): Promise> => { - const response = await fetch(`${config.baseURL}${config.url}`, { + const response = await fetch('https://example.org/post', { method: config.method.toUpperCase(), body: JSON.stringify(config.data), signal: config.signal, headers: config.headers, }) - const data = await response.json() + const data = (await response.json()) as TData return { data, @@ -32,4 +38,11 @@ export const fetchClient = async } } +fetchClient.getConfig = () => { + throw new Error('Not supported') +} +fetchClient.setConfig = () => { + throw new Error('Not supported') +} + export default fetchClient diff --git a/packages/plugin-client/src/generators/__snapshots__/deletePet.ts b/packages/plugin-client/src/generators/__snapshots__/deletePet.ts index d19937df8..314dfcc69 100644 --- a/packages/plugin-client/src/generators/__snapshots__/deletePet.ts +++ b/packages/plugin-client/src/generators/__snapshots__/deletePet.ts @@ -1,6 +1,6 @@ /* eslint-disable no-alert, no-console */ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; /** * @description delete a pet diff --git a/packages/plugin-client/src/generators/__snapshots__/deletePetObject.ts b/packages/plugin-client/src/generators/__snapshots__/deletePetObject.ts index 7ce179610..d83ad73f0 100644 --- a/packages/plugin-client/src/generators/__snapshots__/deletePetObject.ts +++ b/packages/plugin-client/src/generators/__snapshots__/deletePetObject.ts @@ -1,6 +1,6 @@ /* eslint-disable no-alert, no-console */ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; /** * @description delete a pet diff --git a/packages/plugin-client/src/generators/__snapshots__/findByTags.ts b/packages/plugin-client/src/generators/__snapshots__/findByTags.ts index c7e025c82..3bcfb1b2b 100644 --- a/packages/plugin-client/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-client/src/generators/__snapshots__/findByTags.ts @@ -1,6 +1,6 @@ /* eslint-disable no-alert, no-console */ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. diff --git a/packages/plugin-client/src/generators/__snapshots__/findByTagsFull.ts b/packages/plugin-client/src/generators/__snapshots__/findByTagsFull.ts index 10d1400c7..5f446ddd3 100644 --- a/packages/plugin-client/src/generators/__snapshots__/findByTagsFull.ts +++ b/packages/plugin-client/src/generators/__snapshots__/findByTagsFull.ts @@ -1,6 +1,6 @@ /* eslint-disable no-alert, no-console */ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. diff --git a/packages/plugin-client/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-client/src/generators/__snapshots__/findByTagsObject.ts index a6416d9f7..0b05d0692 100644 --- a/packages/plugin-client/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-client/src/generators/__snapshots__/findByTagsObject.ts @@ -1,6 +1,6 @@ /* eslint-disable no-alert, no-console */ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. diff --git a/packages/plugin-client/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-client/src/generators/__snapshots__/findByTagsWithZod.ts index ce969aa6a..846830b16 100644 --- a/packages/plugin-client/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-client/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,6 +1,6 @@ /* eslint-disable no-alert, no-console */ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. diff --git a/packages/plugin-client/src/generators/__snapshots__/findByTagsWithZodFull.ts b/packages/plugin-client/src/generators/__snapshots__/findByTagsWithZodFull.ts index 3735f31e8..23d7961c5 100644 --- a/packages/plugin-client/src/generators/__snapshots__/findByTagsWithZodFull.ts +++ b/packages/plugin-client/src/generators/__snapshots__/findByTagsWithZodFull.ts @@ -1,6 +1,6 @@ /* eslint-disable no-alert, no-console */ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. diff --git a/packages/plugin-client/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-client/src/generators/__snapshots__/updatePetById.ts index d2588e327..9d4da137b 100644 --- a/packages/plugin-client/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-client/src/generators/__snapshots__/updatePetById.ts @@ -1,6 +1,6 @@ /* eslint-disable no-alert, no-console */ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; /** * @summary Updates a pet in the store with form data diff --git a/packages/plugin-client/src/generators/clientGenerator.test.tsx b/packages/plugin-client/src/generators/clientGenerator.test.tsx index 328c816fd..d4365912d 100644 --- a/packages/plugin-client/src/generators/clientGenerator.test.tsx +++ b/packages/plugin-client/src/generators/clientGenerator.test.tsx @@ -103,7 +103,7 @@ describe('clientGenerator operation', async () => { paramsCasing: undefined, paramsType: 'inline', pathParamsType: 'inline', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', baseURL: '', parser: 'client', output: { diff --git a/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx b/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx index 41dbe31a3..ce700ac44 100644 --- a/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx +++ b/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx @@ -33,7 +33,7 @@ describe('groupedClientsGenerators operations', async () => { paramsType: 'inline', paramsCasing: undefined, pathParamsType: 'inline', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', baseURL: '', parser: 'client', output: { diff --git a/packages/plugin-client/src/generators/operationsGenerator.test.tsx b/packages/plugin-client/src/generators/operationsGenerator.test.tsx index 934169b48..a34f16832 100644 --- a/packages/plugin-client/src/generators/operationsGenerator.test.tsx +++ b/packages/plugin-client/src/generators/operationsGenerator.test.tsx @@ -33,7 +33,7 @@ describe('operationsGenerator operations', async () => { paramsType: 'inline', paramsCasing: undefined, pathParamsType: 'inline', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', baseURL: '', parser: 'client', output: { diff --git a/packages/plugin-client/src/plugin.ts b/packages/plugin-client/src/plugin.ts index c8e06af75..2feaf567d 100644 --- a/packages/plugin-client/src/plugin.ts +++ b/packages/plugin-client/src/plugin.ts @@ -29,8 +29,9 @@ export const pluginClient = createPlugin((options) => { baseURL, paramsCasing, generators = [clientGenerator, group ? groupedClientGenerator : undefined, operations ? operationsGenerator : undefined].filter(Boolean), - importPath = '@kubb/plugin-client/client', parser = 'client', + client = 'axios', + importPath = client === 'fetch' ? '@kubb/plugin-client/clients/fetch' : '@kubb/plugin-client/clients/axios', } = options return { diff --git a/packages/plugin-client/src/types.ts b/packages/plugin-client/src/types.ts index a77ebdc98..0f3469ee0 100644 --- a/packages/plugin-client/src/types.ts +++ b/packages/plugin-client/src/types.ts @@ -33,7 +33,7 @@ export type Options = { * Path to the client import path that will be used to do the API calls. * It will be used as `import client from '${client.importPath}'`. * It allows both relative and absolute path but be aware that we will not change the path. - * @default '@kubb/plugin-client/client' + * @default '@kubb/plugin-client/clients/axios' */ importPath?: string /** @@ -68,10 +68,17 @@ export type Options = { pathParamsType?: 'object' | 'inline' /** * Which parser can be used before returning the data - * - 'zod' will use `@kubb/plugin-zod` to parse the data. + * - 'zod' will use `@kubb/plugin-zod` to parse the data. * @default 'client' */ parser?: 'client' | 'zod' + /** + * Which client should be used to do the HTTP calls + * - 'axios' will use `@kubb/plugin-client/clients/axios` to fetch data. + * - 'fetch' will use `@kubb/plugin-client/clients/fetch` to fetch data. + * @default 'axios' + */ + client?: 'axios' | 'fetch' transformers?: { /** * Customize the names based on the type that is provided by the plugin. diff --git a/packages/plugin-client/tsup.config.ts b/packages/plugin-client/tsup.config.ts index df138e14b..ab0276e36 100644 --- a/packages/plugin-client/tsup.config.ts +++ b/packages/plugin-client/tsup.config.ts @@ -7,7 +7,8 @@ export default defineConfig([ ...optionsCJS, entry: { index: 'src/index.ts', - client: 'client.ts', + 'clients/axios': 'src/clients/axios.ts', + 'clients/fetch': 'src/clients/fetch.ts', components: 'src/components/index.ts', generators: 'src/generators/index.ts', }, @@ -16,7 +17,8 @@ export default defineConfig([ ...optionsESM, entry: { index: 'src/index.ts', - client: 'client.ts', + 'clients/axios': 'src/clients/axios.ts', + 'clients/fetch': 'src/clients/fetch.ts', components: 'src/components/index.ts', generators: 'src/generators/index.ts', }, diff --git a/packages/plugin-oas/mocks/petStore.yaml b/packages/plugin-oas/mocks/petStore.yaml index 42237f2c8..1e8b97363 100644 --- a/packages/plugin-oas/mocks/petStore.yaml +++ b/packages/plugin-oas/mocks/petStore.yaml @@ -157,6 +157,7 @@ components: - streetNumber Pets: type: array + readOnly: true items: $ref: '#/components/schemas/Pet' Toy: diff --git a/packages/plugin-oas/src/__snapshots__/SchemaGenerator.test.ts.snap b/packages/plugin-oas/src/__snapshots__/SchemaGenerator.test.ts.snap index 687738207..66d4bc9f7 100644 --- a/packages/plugin-oas/src/__snapshots__/SchemaGenerator.test.ts.snap +++ b/packages/plugin-oas/src/__snapshots__/SchemaGenerator.test.ts.snap @@ -349,6 +349,9 @@ exports[`SchemaGenerator core > 'Pets' 1`] = ` }, "keyword": "schema", }, + { + "keyword": "readOnly", + }, ] `; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-react-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts index a16336c22..d130763c7 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts index d2efd0542..d7f37409c 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts index b2a320424..4a17eb906 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index d2efd0542..d7f37409c 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index 89ef76734..55869a2b1 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts index d2efd0542..d7f37409c 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts index a32357755..6b8d0abb3 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from "@tanstack/react-query"; import { infiniteQueryOptions, useInfiniteQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts index 8cf16fe1a..45a1d0d51 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from "@tanstack/react-query"; import { infiniteQueryOptions, useInfiniteQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/getAsMutation.ts b/packages/plugin-react-query/src/generators/__snapshots__/getAsMutation.ts index 5ba17a12b..0dbc7c2e3 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/getAsMutation.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/getAsMutation.ts @@ -1,5 +1,5 @@ -import client from '@kubb/plugin-client/client' -import type { RequestConfig } from '@kubb/plugin-client/client' +import client from '@kubb/plugin-client/clients/axios' +import type { RequestConfig } from '@kubb/plugin-client/clients/axios' import type { UseMutationOptions } from 'custom-swr/mutation' import { useMutation } from 'custom-swr/mutation' diff --git a/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts b/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts index 717bf5492..ce9b60d7a 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts index a5ddef819..e751fdeda 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryResult } from "custom-query"; import { queryOptions, useQuery } from "custom-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts index 004c00ef1..b351f9708 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { UseMutationOptions } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index fb0852437..3d9547eec 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { UseMutationOptions } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query"; diff --git a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx index 61a7a0b1a..7e0e11ed8 100644 --- a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx @@ -51,7 +51,7 @@ describe('infiniteQueryGenerator operation', async () => { const options: PluginReactQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsCasing: undefined, diff --git a/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx index 223d1f0f8..aa6191890 100644 --- a/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx @@ -82,7 +82,7 @@ describe('mutationGenerator operation', async () => { const options: PluginReactQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsType: 'inline', diff --git a/packages/plugin-react-query/src/generators/queryGenerator.test.tsx b/packages/plugin-react-query/src/generators/queryGenerator.test.tsx index 9694c2a19..39e4f641b 100644 --- a/packages/plugin-react-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/queryGenerator.test.tsx @@ -72,7 +72,7 @@ describe('queryGenerator operation', async () => { options: { client: { dataReturnType: 'full', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, }, }, @@ -121,7 +121,7 @@ describe('queryGenerator operation', async () => { const options: PluginReactQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsCasing: undefined, diff --git a/packages/plugin-react-query/src/generators/suspenseQueryGenerator.test.tsx b/packages/plugin-react-query/src/generators/suspenseQueryGenerator.test.tsx index e98f4d095..1c0301854 100644 --- a/packages/plugin-react-query/src/generators/suspenseQueryGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/suspenseQueryGenerator.test.tsx @@ -34,7 +34,7 @@ describe('suspenseQueryGenerator operation', async () => { const options: PluginReactQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsCasing: undefined, diff --git a/packages/plugin-react-query/src/plugin.ts b/packages/plugin-react-query/src/plugin.ts index 30efe6b35..20213ff6e 100644 --- a/packages/plugin-react-query/src/plugin.ts +++ b/packages/plugin-react-query/src/plugin.ts @@ -42,7 +42,7 @@ export const pluginReactQuery = createPlugin((options) => { options: { output, client: { - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', dataReturnType: 'data', ...options.client, }, diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-solid-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts index eba9b1e76..5f61d08ad 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts index 4c36ebc6e..0b321bc5e 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts index e7bf701af..65fd826b6 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 4c36ebc6e..0b321bc5e 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index b5867f902..4c96e24c8 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/react-query"; import { queryOptions, createQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts index 4c36ebc6e..0b321bc5e 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts index 47eb60e0d..ce94ae5a5 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "custom-query"; import { queryOptions, createQuery } from "custom-query"; diff --git a/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx b/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx index 508a46f2c..ed8f07f4f 100644 --- a/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx @@ -72,7 +72,7 @@ describe('queryGenerator operation', async () => { options: { client: { dataReturnType: 'full', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, }, }, @@ -112,7 +112,7 @@ describe('queryGenerator operation', async () => { const options: PluginSolidQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsType: 'inline', diff --git a/packages/plugin-solid-query/src/plugin.ts b/packages/plugin-solid-query/src/plugin.ts index a59214a69..7490ef831 100644 --- a/packages/plugin-solid-query/src/plugin.ts +++ b/packages/plugin-solid-query/src/plugin.ts @@ -37,7 +37,7 @@ export const pluginSolidQuery = createPlugin((options) => { options: { output, client: { - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', dataReturnType: 'data', pathParamsType: 'inline', ...options.client, diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts index f94cbaf6b..7ab372587 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts index 1a98a2b9b..b30713fd5 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts index 30180c3ee..970c01801 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 1a98a2b9b..b30713fd5 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index af4fbe13e..bb158de99 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/react-query"; import { queryOptions, createQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts index 1a98a2b9b..b30713fd5 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; import { queryOptions, createQuery } from "@tanstack/svelte-query"; diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts index 592e79b58..b10ddb551 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "custom-query"; import { queryOptions, createQuery } from "custom-query"; diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts index e6c9c2671..c21b34945 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { CreateMutationOptions } from "@tanstack/svelte-query"; import { createMutation } from "@tanstack/svelte-query"; diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 24dd6b0b3..2e5d83574 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { CreateMutationOptions } from "@tanstack/svelte-query"; import { createMutation } from "@tanstack/svelte-query"; diff --git a/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx index c1d5f386e..171e45c10 100644 --- a/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx @@ -82,7 +82,7 @@ describe('mutationGenerator operation', async () => { const options: PluginSvelteQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsCasing: undefined, diff --git a/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx b/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx index 019018808..cd09296f3 100644 --- a/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx @@ -72,7 +72,7 @@ describe('queryGenerator operation', async () => { options: { client: { dataReturnType: 'full', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, }, }, @@ -112,7 +112,7 @@ describe('queryGenerator operation', async () => { const options: PluginSvelteQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsType: 'inline', diff --git a/packages/plugin-svelte-query/src/plugin.ts b/packages/plugin-svelte-query/src/plugin.ts index dfd7363aa..07f668ab1 100644 --- a/packages/plugin-svelte-query/src/plugin.ts +++ b/packages/plugin-svelte-query/src/plugin.ts @@ -39,7 +39,7 @@ export const pluginSvelteQuery = createPlugin((options) => { options: { output, client: { - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', dataReturnType: 'data', pathParamsType: 'inline', ...options.client, diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts index 7a4b25e97..ec7e6361f 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWR from "swr"; -import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/clients/axios"; export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts index e0f94464e..136b439b2 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWR from "swr"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts index e0f94464e..136b439b2 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWR from "swr"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts index e0f94464e..136b439b2 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWR from "swr"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts index fc96a539f..7ca328a5e 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWR from "swr"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; diff --git a/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts b/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts index 9f777c9ae..a0ae822c5 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWRMutation from "custom-swr/mutation"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; export const findPetsByTagsMutationKey = () => [{ "url": "/pet/findByTags" }] as const; diff --git a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts index 6189f7f07..f157d34e2 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWR from "custom-swr"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : [])] as const; diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts index 3e34be96d..a2fa7533d 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWRMutation from "swr/mutation"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const; diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index c44f0bfd7..df5dc87c5 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,6 +1,6 @@ -import client from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; import useSWRMutation from "swr/mutation"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const; diff --git a/packages/plugin-swr/src/generators/mutationGenerator.test.tsx b/packages/plugin-swr/src/generators/mutationGenerator.test.tsx index 5f4c76c93..db74d54b6 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.test.tsx @@ -82,7 +82,7 @@ describe('mutationGenerator operation', async () => { const options: PluginSwr['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, paramsCasing: undefined, parser: 'client', diff --git a/packages/plugin-swr/src/generators/queryGenerator.test.tsx b/packages/plugin-swr/src/generators/queryGenerator.test.tsx index 1ff7c67fe..bf7dc235b 100644 --- a/packages/plugin-swr/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-swr/src/generators/queryGenerator.test.tsx @@ -56,7 +56,7 @@ describe('queryGenerator operation', async () => { options: { client: { dataReturnType: 'full', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, }, }, @@ -96,7 +96,7 @@ describe('queryGenerator operation', async () => { const options: PluginSwr['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, paramsCasing: undefined, queryKey: QueryKey.getTransformer, diff --git a/packages/plugin-swr/src/plugin.ts b/packages/plugin-swr/src/plugin.ts index 3c93924f1..cc352e60f 100644 --- a/packages/plugin-swr/src/plugin.ts +++ b/packages/plugin-swr/src/plugin.ts @@ -40,7 +40,7 @@ export const pluginSwr = createPlugin((options) => { options: { output, client: { - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', dataReturnType: 'data', ...client, }, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-vue-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts index 4d6d13d4b..96ad2153f 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query"; import type { MaybeRef } from "vue"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts index 27984489a..088198964 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query"; import type { MaybeRef } from "vue"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts index 92d25e325..baa481ab9 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query"; import type { MaybeRef } from "vue"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 27984489a..088198964 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query"; import type { MaybeRef } from "vue"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index ac79a659f..f5bb2af6e 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query"; import type { MaybeRef } from "vue"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts index 27984489a..088198964 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query"; import type { MaybeRef } from "vue"; import { queryOptions, useQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts index de9b32e88..83c9efb2c 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from "@tanstack/react-query"; import type { MaybeRef } from "vue"; import { infiniteQueryOptions, useInfiniteQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts index e51365ac1..570478e06 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from "@tanstack/react-query"; import type { MaybeRef } from "vue"; import { infiniteQueryOptions, useInfiniteQuery } from "@tanstack/react-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts index 36a037cb2..791e6084b 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "custom-query"; import type { MaybeRef } from "vue"; import { queryOptions, useQuery } from "custom-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts index 5b6039793..75b27fa4d 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { MutationObserverOptions } from "@tanstack/vue-query"; import type { MaybeRef } from "vue"; import { useMutation } from "@tanstack/vue-query"; diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index bd52ee074..f044245d0 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,5 +1,5 @@ -import client from "@kubb/plugin-client/client"; -import type { RequestConfig } from "@kubb/plugin-client/client"; +import client from "@kubb/plugin-client/clients/axios"; +import type { RequestConfig } from "@kubb/plugin-client/clients/axios"; import type { MutationObserverOptions } from "@tanstack/vue-query"; import type { MaybeRef } from "vue"; import { useMutation } from "@tanstack/vue-query"; diff --git a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx index 94637e19a..635478962 100644 --- a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx @@ -51,7 +51,7 @@ describe('infiniteQueryGenerator operation', async () => { const options: PluginVueQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsType: 'inline', diff --git a/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx index de96fdf5e..aa0e1858b 100644 --- a/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx @@ -82,7 +82,7 @@ describe('mutationGenerator operation', async () => { const options: PluginVueQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsType: 'inline', diff --git a/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx b/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx index 1b41b3c43..87c9f759e 100644 --- a/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx @@ -72,7 +72,7 @@ describe('queryGenerator operation', async () => { options: { client: { dataReturnType: 'full', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, }, }, @@ -112,7 +112,7 @@ describe('queryGenerator operation', async () => { const options: PluginVueQuery['resolvedOptions'] = { client: { dataReturnType: 'data', - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', }, parser: 'zod', paramsType: 'inline', diff --git a/packages/plugin-vue-query/src/plugin.ts b/packages/plugin-vue-query/src/plugin.ts index e111700fd..e05e3d581 100644 --- a/packages/plugin-vue-query/src/plugin.ts +++ b/packages/plugin-vue-query/src/plugin.ts @@ -40,7 +40,7 @@ export const pluginVueQuery = createPlugin((options) => { options: { output, client: { - importPath: '@kubb/plugin-client/client', + importPath: '@kubb/plugin-client/clients/axios', dataReturnType: 'data', pathParamsType: 'inline', ...options.client, diff --git a/tsconfig.json b/tsconfig.json index 75a4ef0ea..f97aee6a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,7 +19,7 @@ "@kubb/plugin-ts/hooks": ["packages/plugin-ts/src/hooks/index.ts"], "@kubb/plugin-ts": ["packages/plugin-ts/src/index.ts"], "@kubb/react/jsx-runtime": ["packages/react/src/jsx-runtime.ts"], - "@kubb/plugin-client/client": ["packages/plugin-client/src/client.ts"], + "@kubb/plugin-client/clients/axios": ["packages/plugin-client/src/client.ts"], "@kubb/plugin-client/components": ["packages/plugin-client/src/components/index.ts"], "@kubb/plugin-client": ["packages/plugin-client/src/index.ts"], "@kubb/plugin-react-query": ["packages/plugin-react-query/src/index.ts"],