From babf1d5a3feccdde43a3e28778f1f475f231dc9d Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Tue, 21 Jan 2025 22:24:56 +0100 Subject: [PATCH 1/2] fix: allow exporting custom client fetch function in react-query --- .changeset/cool-apricots-hug.md | 10 +++++ docs/changelog.md | 9 ++++ examples/advanced/configs/kubb.config.ts | 4 +- .../clients/hooks/petController/useAddPet.ts | 13 +----- .../hooks/petController/useDeletePet.ts | 18 +------- .../petController/useFindPetsByStatus.ts | 17 +------- .../hooks/petController/useFindPetsByTags.ts | 22 +--------- .../useFindPetsByTagsInfinite.ts | 22 +--------- .../hooks/petController/useGetPetById.ts | 17 +------- .../hooks/petController/useUpdatePet.ts | 18 +------- .../petController/useUpdatePetWithForm.ts | 20 +-------- .../hooks/petController/useUploadFile.ts | 22 +--------- .../hooks/petsController/useCreatePets.ts | 27 +----------- .../hooks/userController/useCreateUser.ts | 13 +----- .../useCreateUsersWithListInput.ts | 21 +--------- .../hooks/userController/useDeleteUser.ts | 17 +------- .../hooks/userController/useGetUserByName.ts | 16 +------ .../hooks/userController/useLoginUser.ts | 12 +----- .../hooks/userController/useLogoutUser.ts | 12 +----- .../hooks/userController/useUpdateUser.ts | 21 +--------- .../clients/swr/petController/useAddPetSWR.ts | 29 ++++--------- .../swr/petController/useDeletePetSWR.ts | 27 +++--------- .../petController/useFindPetsByStatusSWR.ts | 37 ++++++---------- .../swr/petController/useFindPetsByTagsSWR.ts | 42 ++++++------------- .../swr/petController/useGetPetByIdSWR.ts | 37 ++++++---------- .../swr/petController/useUpdatePetSWR.ts | 27 +++--------- .../petController/useUpdatePetWithFormSWR.ts | 29 +++---------- .../swr/petController/useUploadFileSWR.ts | 33 ++++----------- .../swr/petsController/useCreatePetsSWR.ts | 38 ++++------------- .../swr/userController/useCreateUserSWR.ts | 29 ++++--------- .../useCreateUsersWithListInputSWR.ts | 30 +++---------- .../swr/userController/useDeleteUserSWR.ts | 28 ++++--------- .../swr/userController/useGetUserByNameSWR.ts | 25 +++-------- .../swr/userController/useLoginUserSWR.ts | 26 +++--------- .../swr/userController/useLogoutUserSWR.ts | 25 +++-------- .../swr/userController/useUpdateUserSWR.ts | 32 ++++---------- .../src/gen/hooks/pet/useAddPetHook.ts | 4 +- .../src/gen/hooks/pet/useDeletePetHook.ts | 4 +- .../gen/hooks/pet/useFindPetsByStatusHook.ts | 4 +- .../pet/useFindPetsByStatusSuspenseHook.ts | 4 +- .../gen/hooks/pet/useFindPetsByTagsHook.ts | 4 +- .../pet/useFindPetsByTagsInfiniteHook.ts | 4 +- .../pet/useFindPetsByTagsSuspenseHook.ts | 4 +- .../src/gen/hooks/pet/useGetPetByIdHook.ts | 4 +- .../hooks/pet/useGetPetByIdSuspenseHook.ts | 4 +- .../src/gen/hooks/pet/useUpdatePetHook.ts | 4 +- .../gen/hooks/pet/useUpdatePetWithFormHook.ts | 8 +--- .../pet/useUpdatePetWithFormSuspenseHook.ts | 8 +--- .../src/gen/hooks/pet/useUploadFileHook.ts | 4 +- .../src/gen/hooks/store/useDeleteOrderHook.ts | 4 +- .../gen/hooks/store/useGetInventoryHook.ts | 4 +- .../store/useGetInventorySuspenseHook.ts | 4 +- .../gen/hooks/store/useGetOrderByIdHook.ts | 4 +- .../store/useGetOrderByIdSuspenseHook.ts | 4 +- .../src/gen/hooks/store/usePlaceOrderHook.ts | 4 +- .../gen/hooks/store/usePlaceOrderPatchHook.ts | 4 +- .../src/gen/hooks/user/useCreateUserHook.ts | 4 +- .../user/useCreateUsersWithListInputHook.ts | 4 +- .../src/gen/hooks/user/useDeleteUserHook.ts | 4 +- .../gen/hooks/user/useGetUserByNameHook.ts | 4 +- .../user/useGetUserByNameSuspenseHook.ts | 4 +- .../src/gen/hooks/user/useLoginUserHook.ts | 4 +- .../hooks/user/useLoginUserSuspenseHook.ts | 4 +- .../src/gen/hooks/user/useLogoutUserHook.ts | 4 +- .../hooks/user/useLogoutUserSuspenseHook.ts | 4 +- .../src/gen/hooks/user/useUpdateUserHook.ts | 4 +- packages/core/mocks/index.ts | 4 ++ packages/core/src/PluginManager.ts | 21 ++++++---- .../plugin-client/src/components/Client.tsx | 9 +--- .../__snapshots__/clientDataReturnTypeFull.ts | 17 -------- .../__snapshots__/clientGetImportPath.ts | 17 -------- .../__snapshots__/clientPostImportPath.ts | 21 ---------- .../generators/__snapshots__/findByTags.ts | 17 -------- .../__snapshots__/findByTagsObject.ts | 20 --------- .../findByTagsPathParamsObject.ts | 17 -------- .../findByTagsWithCustomQueryKey.ts | 17 -------- .../__snapshots__/findByTagsWithZod.ts | 17 -------- .../__snapshots__/findInfiniteByTags.ts | 17 -------- .../__snapshots__/findInfiniteByTagsCursor.ts | 17 -------- .../__snapshots__/getPetIdCamelCase.ts | 15 ------- .../generators/__snapshots__/postAsQuery.ts | 21 ---------- .../generators/__snapshots__/updatePetById.ts | 21 ---------- .../updatePetByIdPathParamsObject.ts | 21 ---------- .../src/generators/infiniteQueryGenerator.tsx | 37 +++++++++------- .../src/generators/mutationGenerator.tsx | 37 +++++++++------- .../src/generators/queryGenerator.tsx | 37 +++++++++------- .../src/generators/suspenseQueryGenerator.tsx | 36 +++++++++------- .../__snapshots__/clientDataReturnTypeFull.ts | 17 -------- .../__snapshots__/clientGetImportPath.ts | 17 -------- .../generators/__snapshots__/findByTags.ts | 17 -------- .../__snapshots__/findByTagsObject.ts | 20 --------- .../findByTagsPathParamsObject.ts | 17 -------- .../findByTagsWithCustomQueryKey.ts | 17 -------- .../__snapshots__/findByTagsWithZod.ts | 17 -------- .../generators/__snapshots__/postAsQuery.ts | 21 ---------- .../src/generators/queryGenerator.tsx | 37 +++++++++------- .../__snapshots__/clientDataReturnTypeFull.ts | 17 -------- .../__snapshots__/clientGetImportPath.ts | 17 -------- .../__snapshots__/clientPostImportPath.ts | 21 ---------- .../generators/__snapshots__/findByTags.ts | 17 -------- .../__snapshots__/findByTagsObject.ts | 20 --------- .../findByTagsPathParamsObject.ts | 17 -------- .../findByTagsWithCustomQueryKey.ts | 17 -------- .../__snapshots__/findByTagsWithZod.ts | 17 -------- .../generators/__snapshots__/postAsQuery.ts | 21 ---------- .../generators/__snapshots__/updatePetById.ts | 21 ---------- .../updatePetByIdPathParamsObject.ts | 21 ---------- .../src/generators/mutationGenerator.tsx | 37 ++++++++-------- .../src/generators/queryGenerator.tsx | 37 +++++++++------- .../__snapshots__/clientDataReturnTypeFull.ts | 16 ------- .../__snapshots__/clientGetImportPath.ts | 16 ------- .../__snapshots__/clientPostImportPath.ts | 15 ------- .../generators/__snapshots__/findByTags.ts | 16 ------- .../__snapshots__/findByTagsObject.ts | 16 ------- .../findByTagsPathParamsObject.ts | 16 ------- .../__snapshots__/findByTagsWithZod.ts | 16 ------- .../generators/__snapshots__/postAsQuery.ts | 18 -------- .../generators/__snapshots__/updatePetById.ts | 15 ------- .../updatePetByIdPathParamsObject.ts | 19 --------- .../src/generators/mutationGenerator.tsx | 37 +++++++++------- .../src/generators/queryGenerator.tsx | 38 +++++++++-------- .../__snapshots__/clientDataReturnTypeFull.ts | 17 -------- .../__snapshots__/clientGetImportPath.ts | 17 -------- .../__snapshots__/clientPostImportPath.ts | 21 ---------- .../generators/__snapshots__/findByTags.ts | 17 -------- .../__snapshots__/findByTagsObject.ts | 20 --------- .../findByTagsPathParamsObject.ts | 17 -------- .../findByTagsWithCustomQueryKey.ts | 17 -------- .../__snapshots__/findByTagsWithZod.ts | 17 -------- .../__snapshots__/findInfiniteByTags.ts | 17 -------- .../__snapshots__/findInfiniteByTagsCursor.ts | 17 -------- .../generators/__snapshots__/postAsQuery.ts | 21 ---------- .../generators/__snapshots__/updatePetById.ts | 21 ---------- .../updatePetByIdPathParamsObject.ts | 21 ---------- .../src/generators/infiniteQueryGenerator.tsx | 37 +++++++++------- .../src/generators/mutationGenerator.tsx | 36 +++++++++------- .../src/generators/queryGenerator.tsx | 37 +++++++++------- 137 files changed, 481 insertions(+), 1956 deletions(-) create mode 100644 .changeset/cool-apricots-hug.md diff --git a/.changeset/cool-apricots-hug.md b/.changeset/cool-apricots-hug.md new file mode 100644 index 000000000..7b52a0a70 --- /dev/null +++ b/.changeset/cool-apricots-hug.md @@ -0,0 +1,10 @@ +--- +"@kubb/plugin-svelte-query": patch +"@kubb/plugin-react-query": patch +"@kubb/plugin-solid-query": patch +"@kubb/plugin-vue-query": patch +"@kubb/plugin-client": patch +"@kubb/plugin-swr": patch +--- + +allow exporting custom client fetch function in react-query diff --git a/docs/changelog.md b/docs/changelog.md index d473bd8f6..878886a6a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,15 @@ title: Changelog # Changelog +## 3.5.3 +- [`plugin-client`](/plugins/plugin-client): allow exporting custom client fetch function and use generated fetch when `pluginClient` is available +- [`plugin-react-query`](/plugins/plugin-react-query/): allow exporting custom client fetch function and use generated fetch when `pluginClient` is available +- [`plugin-svelte-query`](/plugins/plugin-svelte-query/): allow exporting custom client fetch function and use generated fetch when `pluginClient` is available +- [`plugin-vue-query`](/plugins/plugin-vue-query/): allow exporting custom client fetch function and use generated fetch when `pluginClient` is available +- [`plugin-solid-query`](/plugins/plugin-solid-query/): allow exporting custom client fetch function and use generated fetch when `pluginClient` is available +- [`plugin-swr`](/plugins/plugin-swr/): allow exporting custom client fetch function and use generated fetch when `pluginClient` is available + + ## 3.5.2 - [`plugin-faker`](/plugins/plugin-faker): `faker.number.float` with default min `Number.MIN_VALUE` and max set to `Number.MAX_VALUE`. - [`plugin-oas`](/plugins/plugin-oas): remove duplicated keys when using `allOf` and applying required on fields diff --git a/examples/advanced/configs/kubb.config.ts b/examples/advanced/configs/kubb.config.ts index a3e10b7d9..cc0a1206d 100644 --- a/examples/advanced/configs/kubb.config.ts +++ b/examples/advanced/configs/kubb.config.ts @@ -111,11 +111,11 @@ export default defineConfig(() => { group: { type: 'tag' }, client: { importPath: '../../../../swr-client.ts', - dataReturnType: 'data', + dataReturnType: 'full', baseURL: 'https://petstore3.swagger.io/api/v3', }, paramsType: 'object', - parser: 'zod', + pathParamsType: 'object', transformers: { name(name, type) { return `${name}SWR` diff --git a/examples/advanced/src/gen/clients/hooks/petController/useAddPet.ts b/examples/advanced/src/gen/clients/hooks/petController/useAddPet.ts index 29509c395..8f3437b46 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useAddPet.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useAddPet.ts @@ -1,24 +1,13 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../../models/ts/petController/AddPet.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { addPetMutationResponseSchema } from '../../../zod/petController/addPetSchema.ts' +import { addPet } from '../../axios/petService/addPet.ts' import { useMutation } from '@tanstack/react-query' export const addPetMutationKey = () => [{ url: '/pet' }] as const 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, AddPetMutationRequest>({ method: 'POST', url: '/pet', data, ...config }) - return { ...res, data: addPetMutationResponseSchema.parse(res.data) } -} - /** * @description Add a new pet to the store * @summary Add a new pet to the store diff --git a/examples/advanced/src/gen/clients/hooks/petController/useDeletePet.ts b/examples/advanced/src/gen/clients/hooks/petController/useDeletePet.ts index 6bda45002..63325938c 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useDeletePet.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useDeletePet.ts @@ -1,29 +1,13 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../../models/ts/petController/DeletePet.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { deletePetMutationResponseSchema } from '../../../zod/petController/deletePetSchema.ts' +import { deletePet } from '../../axios/petService/deletePet.ts' import { useMutation } from '@tanstack/react-query' export const deletePetMutationKey = () => [{ url: '/pet/{petId}' }] as const 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, unknown>({ - method: 'DELETE', - url: `/pet/${petId}`, - headers: { ...headers, ...config.headers }, - ...config, - }) - return { ...res, data: deletePetMutationResponseSchema.parse(res.data) } -} - /** * @description delete a pet * @summary Deletes a pet diff --git a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts index da20f3e96..97bfccd3b 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts @@ -1,29 +1,14 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../tanstack-query-client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '../../../../tanstack-query-hook' import type { FindPetsByStatusQueryResponse, FindPetsByStatusPathParams, FindPetsByStatus400 } from '../../../models/ts/petController/FindPetsByStatus.ts' import { queryOptions, useQuery } from '../../../../tanstack-query-hook' -import { findPetsByStatusQueryResponseSchema } from '../../../zod/petController/findPetsByStatusSchema.ts' +import { findPetsByStatus } from '../../axios/petService/findPetsByStatus.ts' export const findPetsByStatusQueryKey = ({ step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }) => [{ url: '/pet/findByStatus/:step_id', params: { step_id: step_id } }] as const export type FindPetsByStatusQueryKey = ReturnType -/** - * @description Multiple status values can be provided with comma separated strings - * @summary Finds Pets by status - * {@link /pet/findByStatus/:step_id} - */ -async function findPetsByStatus({ step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByStatus/${step_id}`, - ...config, - }) - return { ...res, data: findPetsByStatusQueryResponseSchema.parse(res.data) } -} - export function findPetsByStatusQueryOptions({ step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }, config: Partial = {}) { const queryKey = findPetsByStatusQueryKey({ step_id }) return queryOptions< diff --git a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts index c97683f20..9b7ed29a5 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts @@ -1,4 +1,3 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../tanstack-query-client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '../../../../tanstack-query-hook' import type { @@ -8,31 +7,12 @@ import type { FindPetsByTags400, } from '../../../models/ts/petController/FindPetsByTags.ts' import { queryOptions, useQuery } from '../../../../tanstack-query-hook' -import { findPetsByTagsQueryResponseSchema } from '../../../zod/petController/findPetsByTagsSchema.ts' +import { findPetsByTags } from '../../axios/petService/findPetsByTags.ts' export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const 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( - { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'GET', - url: '/pet/findByTags', - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return { ...res, data: findPetsByTagsQueryResponseSchema.parse(res.data) } -} - export function findPetsByTagsQueryOptions( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, diff --git a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTagsInfinite.ts b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTagsInfinite.ts index 56e6900e2..549ebef19 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTagsInfinite.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTagsInfinite.ts @@ -1,4 +1,3 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../tanstack-query-client' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '../../../../tanstack-query-hook' import type { @@ -8,31 +7,12 @@ import type { FindPetsByTags400, } from '../../../models/ts/petController/FindPetsByTags.ts' import { infiniteQueryOptions, useInfiniteQuery } from '../../../../tanstack-query-hook' -import { findPetsByTagsQueryResponseSchema } from '../../../zod/petController/findPetsByTagsSchema.ts' +import { findPetsByTags } from '../../axios/petService/findPetsByTags.ts' export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const 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 findPetsByTags( - { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'GET', - url: '/pet/findByTags', - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return { ...res, data: findPetsByTagsQueryResponseSchema.parse(res.data) } -} - export function findPetsByTagsInfiniteQueryOptions( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, diff --git a/examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts b/examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts index f875c7825..97cf32eb4 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts @@ -1,28 +1,13 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../tanstack-query-client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '../../../../tanstack-query-hook' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../../models/ts/petController/GetPetById.ts' import { queryOptions, useQuery } from '../../../../tanstack-query-hook' -import { getPetByIdQueryResponseSchema } from '../../../zod/petController/getPetByIdSchema.ts' +import { getPetById } from '../../axios/petService/getPetById.ts' export const getPetByIdQueryKey = ({ petId }: { petId: GetPetByIdPathParams['petId'] }) => [{ url: '/pet/:petId', params: { petId: petId } }] as const 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, unknown>({ - method: 'GET', - url: `/pet/${petId}`, - ...config, - }) - return { ...res, data: getPetByIdQueryResponseSchema.parse(res.data) } -} - export function getPetByIdQueryOptions({ petId }: { petId: GetPetByIdPathParams['petId'] }, config: Partial = {}) { const queryKey = getPetByIdQueryKey({ petId }) return queryOptions< diff --git a/examples/advanced/src/gen/clients/hooks/petController/useUpdatePet.ts b/examples/advanced/src/gen/clients/hooks/petController/useUpdatePet.ts index 2d9a6f631..c81058bd8 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useUpdatePet.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useUpdatePet.ts @@ -1,4 +1,3 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { UpdatePetMutationRequest, @@ -8,28 +7,13 @@ import type { UpdatePet405, } from '../../../models/ts/petController/UpdatePet.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { updatePetMutationResponseSchema } from '../../../zod/petController/updatePetSchema.ts' +import { updatePet } from '../../axios/petService/updatePet.ts' import { useMutation } from '@tanstack/react-query' export const updatePetMutationKey = () => [{ url: '/pet' }] as const 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, UpdatePetMutationRequest>({ - method: 'PUT', - url: '/pet', - data, - ...config, - }) - return { ...res, data: updatePetMutationResponseSchema.parse(res.data) } -} - /** * @description Update an existing pet by Id * @summary Update an existing pet diff --git a/examples/advanced/src/gen/clients/hooks/petController/useUpdatePetWithForm.ts b/examples/advanced/src/gen/clients/hooks/petController/useUpdatePetWithForm.ts index 2170ee768..3f37d5da6 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useUpdatePetWithForm.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useUpdatePetWithForm.ts @@ -1,4 +1,3 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { UpdatePetWithFormMutationResponse, @@ -7,30 +6,13 @@ import type { UpdatePetWithForm405, } from '../../../models/ts/petController/UpdatePetWithForm.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { updatePetWithFormMutationResponseSchema } from '../../../zod/petController/updatePetWithFormSchema.ts' +import { updatePetWithForm } from '../../axios/petService/updatePetWithForm.ts' import { useMutation } from '@tanstack/react-query' export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const 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, unknown>({ - method: 'POST', - url: `/pet/${petId}`, - params, - ...config, - }) - return { ...res, data: updatePetWithFormMutationResponseSchema.parse(res.data) } -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/examples/advanced/src/gen/clients/hooks/petController/useUploadFile.ts b/examples/advanced/src/gen/clients/hooks/petController/useUploadFile.ts index 6526dd0a9..44e8039c7 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useUploadFile.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useUploadFile.ts @@ -1,4 +1,3 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { UploadFileMutationRequest, @@ -7,32 +6,13 @@ import type { UploadFileQueryParams, } from '../../../models/ts/petController/UploadFile.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { uploadFileMutationResponseSchema } from '../../../zod/petController/uploadFileSchema.ts' +import { uploadFile } from '../../axios/petService/uploadFile.ts' import { useMutation } from '@tanstack/react-query' export const uploadFileMutationKey = () => [{ url: '/pet/{petId}/uploadImage' }] as const 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, UploadFileMutationRequest>({ - method: 'POST', - url: `/pet/${petId}/uploadImage`, - params, - data, - headers: { 'Content-Type': 'application/octet-stream', ...config.headers }, - ...config, - }) - return { ...res, data: uploadFileMutationResponseSchema.parse(res.data) } -} - /** * @summary uploads an image * {@link /pet/:petId/uploadImage} diff --git a/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts b/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts index 103f296cd..d5e5da652 100644 --- a/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts +++ b/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts @@ -1,4 +1,3 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { CreatePetsMutationRequest, @@ -8,37 +7,13 @@ import type { CreatePetsHeaderParams, } from '../../../models/ts/petsController/CreatePets.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { createPetsMutationResponseSchema } from '../../../zod/petsController/createPetsSchema.ts' +import { createPets } from '../../axios/petsService/createPets.ts' import { useMutation } from '@tanstack/react-query' export const createPetsMutationKey = () => [{ url: '/pets/{uuid}' }] as const export type CreatePetsMutationKey = ReturnType -/** - * @summary Create a pet - * {@link /pets/:uuid} - */ -async function createPets( - { - uuid, - data, - headers, - params, - }: { uuid: CreatePetsPathParams['uuid']; data: CreatePetsMutationRequest; headers: CreatePetsHeaderParams; params?: CreatePetsQueryParams }, - config: Partial> = {}, -) { - const res = await client, CreatePetsMutationRequest>({ - method: 'POST', - url: `/pets/${uuid}`, - params, - data, - headers: { ...headers, ...config.headers }, - ...config, - }) - return { ...res, data: createPetsMutationResponseSchema.parse(res.data) } -} - /** * @summary Create a pet * {@link /pets/:uuid} diff --git a/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts index 76f1f9589..b2ce23b71 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts @@ -1,24 +1,13 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { createUserMutationResponseSchema } from '../../../zod/userController/createUserSchema.ts' +import { createUser } from '../../axios/userService/createUser.ts' import { useMutation } from '@tanstack/react-query' export const createUserMutationKey = () => [{ url: '/user' }] as const 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, CreateUserMutationRequest>({ method: 'POST', url: '/user', data, ...config }) - return { ...res, data: createUserMutationResponseSchema.parse(res.data) } -} - /** * @description This can only be done by the logged in user. * @summary Create user diff --git a/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts b/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts index 6ae672617..f02813eb5 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts @@ -1,35 +1,16 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, } from '../../../models/ts/userController/CreateUsersWithListInput.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { createUsersWithListInputMutationResponseSchema } from '../../../zod/userController/createUsersWithListInputSchema.ts' +import { createUsersWithListInput } from '../../axios/userService/createUsersWithListInput.ts' import { useMutation } from '@tanstack/react-query' export const createUsersWithListInputMutationKey = () => [{ url: '/user/createWithList' }] as const 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, CreateUsersWithListInputMutationRequest>({ - method: 'POST', - url: '/user/createWithList', - data, - ...config, - }) - return { ...res, data: createUsersWithListInputMutationResponseSchema.parse(res.data) } -} - /** * @description Creates list of users with given input array * @summary Creates list of users with given input array diff --git a/examples/advanced/src/gen/clients/hooks/userController/useDeleteUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useDeleteUser.ts index 8d8c8e3aa..565fc66f9 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useDeleteUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useDeleteUser.ts @@ -1,28 +1,13 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../../../models/ts/userController/DeleteUser.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { deleteUserMutationResponseSchema } from '../../../zod/userController/deleteUserSchema.ts' +import { deleteUser } from '../../axios/userService/deleteUser.ts' import { useMutation } from '@tanstack/react-query' export const deleteUserMutationKey = () => [{ url: '/user/{username}' }] as const 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, unknown>({ - method: 'DELETE', - url: `/user/${username}`, - ...config, - }) - return { ...res, data: deleteUserMutationResponseSchema.parse(res.data) } -} - /** * @description This can only be done by the logged in user. * @summary Delete user diff --git a/examples/advanced/src/gen/clients/hooks/userController/useGetUserByName.ts b/examples/advanced/src/gen/clients/hooks/userController/useGetUserByName.ts index aea477a61..a442b65be 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useGetUserByName.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useGetUserByName.ts @@ -1,4 +1,3 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../tanstack-query-client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '../../../../tanstack-query-hook' import type { @@ -8,26 +7,13 @@ import type { GetUserByName404, } from '../../../models/ts/userController/GetUserByName.ts' import { queryOptions, useQuery } from '../../../../tanstack-query-hook' -import { getUserByNameQueryResponseSchema } from '../../../zod/userController/getUserByNameSchema.ts' +import { getUserByName } from '../../axios/userService/getUserByName.ts' export const getUserByNameQueryKey = ({ username }: { username: GetUserByNamePathParams['username'] }) => [{ url: '/user/:username', params: { username: username } }] as const 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, unknown>({ - method: 'GET', - url: `/user/${username}`, - ...config, - }) - return { ...res, data: getUserByNameQueryResponseSchema.parse(res.data) } -} - export function getUserByNameQueryOptions({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { const queryKey = getUserByNameQueryKey({ username }) return queryOptions< diff --git a/examples/advanced/src/gen/clients/hooks/userController/useLoginUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useLoginUser.ts index 22ec174fa..68fb55ddb 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useLoginUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useLoginUser.ts @@ -1,23 +1,13 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../tanstack-query-client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '../../../../tanstack-query-hook' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../../models/ts/userController/LoginUser.ts' import { queryOptions, useQuery } from '../../../../tanstack-query-hook' -import { loginUserQueryResponseSchema } from '../../../zod/userController/loginUserSchema.ts' +import { loginUser } from '../../axios/userService/loginUser.ts' export const loginUserQueryKey = (params?: LoginUserQueryParams) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const 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, unknown>({ method: 'GET', url: '/user/login', params, ...config }) - return { ...res, data: loginUserQueryResponseSchema.parse(res.data) } -} - export function loginUserQueryOptions({ params }: { params?: LoginUserQueryParams }, config: Partial = {}) { const queryKey = loginUserQueryKey(params) return queryOptions, ResponseErrorConfig, ResponseConfig, typeof queryKey>({ diff --git a/examples/advanced/src/gen/clients/hooks/userController/useLogoutUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useLogoutUser.ts index c8406c12d..4af490481 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useLogoutUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useLogoutUser.ts @@ -1,23 +1,13 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../tanstack-query-client' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '../../../../tanstack-query-hook' import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser.ts' import { queryOptions, useQuery } from '../../../../tanstack-query-hook' -import { logoutUserQueryResponseSchema } from '../../../zod/userController/logoutUserSchema.ts' +import { logoutUser } from '../../axios/userService/logoutUser.ts' export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const export type LogoutUserQueryKey = ReturnType -/** - * @summary Logs out current logged in user session - * {@link /user/logout} - */ -async function logoutUser(config: Partial = {}) { - const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) - return { ...res, data: logoutUserQueryResponseSchema.parse(res.data) } -} - export function logoutUserQueryOptions(config: Partial = {}) { const queryKey = logoutUserQueryKey() return queryOptions, ResponseErrorConfig, ResponseConfig, typeof queryKey>({ diff --git a/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts index a4b970810..52e5c3183 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts @@ -1,32 +1,13 @@ -import client from '../../../../tanstack-query-client' import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../tanstack-query-client' import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../../models/ts/userController/UpdateUser.ts' import type { UseMutationOptions } from '@tanstack/react-query' -import { updateUserMutationResponseSchema } from '../../../zod/userController/updateUserSchema.ts' +import { updateUser } from '../../axios/userService/updateUser.ts' import { useMutation } from '@tanstack/react-query' export const updateUserMutationKey = () => [{ url: '/user/{username}' }] as const 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, UpdateUserMutationRequest>({ - method: 'PUT', - url: `/user/${username}`, - data, - ...config, - }) - return { ...res, data: updateUserMutationResponseSchema.parse(res.data) } -} - /** * @description This can only be done by the logged in user. * @summary Update user diff --git a/examples/advanced/src/gen/clients/swr/petController/useAddPetSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useAddPetSWR.ts index 6e8abb8dc..b23fecc05 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useAddPetSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useAddPetSWR.ts @@ -1,29 +1,12 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../../../models/ts/petController/AddPet.ts' -import { addPetMutationResponseSchema } from '../../../zod/petController/addPetSchema.ts' +import { addPet } from '../../axios/petService/addPet.ts' export const addPetMutationKeySWR = () => [{ url: '/pet' }] as const export type AddPetMutationKeySWR = ReturnType -/** - * @description Add a new pet to the store - * @summary Add a new pet to the store - * {@link /pet} - */ -async function addPetSWR({ data }: { data: AddPetMutationRequest }, config: Partial> = {}) { - const res = await client, AddPetMutationRequest>({ - method: 'POST', - url: '/pet', - baseURL: 'https://petstore3.swagger.io/api/v3', - data, - ...config, - }) - return addPetMutationResponseSchema.parse(res.data) -} - /** * @description Add a new pet to the store * @summary Add a new pet to the store @@ -31,7 +14,9 @@ async function addPetSWR({ data }: { data: AddPetMutationRequest }, config: Part */ export function useAddPetSWR( options: { - mutation?: Parameters, AddPetMutationKeySWR, AddPetMutationRequest>>[2] + mutation?: Parameters< + typeof useSWRMutation, ResponseErrorConfig, AddPetMutationKeySWR, AddPetMutationRequest> + >[2] client?: Partial> shouldFetch?: boolean } = {}, @@ -39,10 +24,10 @@ export function useAddPetSWR( const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const mutationKey = addPetMutationKeySWR() - return useSWRMutation, AddPetMutationKeySWR | null, AddPetMutationRequest>( + return useSWRMutation, ResponseErrorConfig, AddPetMutationKeySWR | null, AddPetMutationRequest>( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return addPetSWR({ data }, config) + return addPet({ data }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petController/useDeletePetSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useDeletePetSWR.ts index 2ff65951a..e8379c74e 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useDeletePetSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useDeletePetSWR.ts @@ -1,29 +1,12 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../../../models/ts/petController/DeletePet.ts' -import { deletePetMutationResponseSchema } from '../../../zod/petController/deletePetSchema.ts' +import { deletePet } from '../../axios/petService/deletePet.ts' export const deletePetMutationKeySWR = () => [{ url: '/pet/{petId}' }] as const export type DeletePetMutationKeySWR = ReturnType -/** - * @description delete a pet - * @summary Deletes a pet - * {@link /pet/:petId} - */ -async function deletePetSWR({ petId, headers }: { petId: DeletePetPathParams['petId']; headers?: DeletePetHeaderParams }, config: Partial = {}) { - const res = await client, unknown>({ - method: 'DELETE', - url: `/pet/${petId}`, - baseURL: 'https://petstore3.swagger.io/api/v3', - headers: { ...headers, ...config.headers }, - ...config, - }) - return deletePetMutationResponseSchema.parse(res.data) -} - /** * @description delete a pet * @summary Deletes a pet @@ -33,7 +16,7 @@ export function useDeletePetSWR( { petId }: { petId: DeletePetPathParams['petId'] }, headers?: DeletePetHeaderParams, options: { - mutation?: Parameters, DeletePetMutationKeySWR>>[2] + mutation?: Parameters, ResponseErrorConfig, DeletePetMutationKeySWR>>[2] client?: Partial shouldFetch?: boolean } = {}, @@ -41,10 +24,10 @@ export function useDeletePetSWR( const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const mutationKey = deletePetMutationKeySWR() - return useSWRMutation, DeletePetMutationKeySWR | null>( + return useSWRMutation, ResponseErrorConfig, DeletePetMutationKeySWR | null>( shouldFetch ? mutationKey : null, async (_url) => { - return deletePetSWR({ petId, headers }, config) + return deletePet({ petId, headers }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petController/useFindPetsByStatusSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useFindPetsByStatusSWR.ts index c945eb4f7..ff67e8bf9 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useFindPetsByStatusSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useFindPetsByStatusSWR.ts @@ -1,33 +1,17 @@ -import client from '../../../../swr-client.ts' import useSWR from 'swr' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../swr-client.ts' import type { FindPetsByStatusQueryResponse, FindPetsByStatusPathParams, FindPetsByStatus400 } from '../../../models/ts/petController/FindPetsByStatus.ts' -import { findPetsByStatusQueryResponseSchema } from '../../../zod/petController/findPetsByStatusSchema.ts' +import { findPetsByStatus } from '../../axios/petService/findPetsByStatus.ts' export const findPetsByStatusQueryKeySWR = ({ step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }) => [{ url: '/pet/findByStatus/:step_id', params: { step_id: step_id } }] as const export type FindPetsByStatusQueryKeySWR = ReturnType -/** - * @description Multiple status values can be provided with comma separated strings - * @summary Finds Pets by status - * {@link /pet/findByStatus/:step_id} - */ -async function findPetsByStatusSWR({ step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByStatus/${step_id}`, - baseURL: 'https://petstore3.swagger.io/api/v3', - ...config, - }) - return findPetsByStatusQueryResponseSchema.parse(res.data) -} - export function findPetsByStatusQueryOptionsSWR({ step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }, config: Partial = {}) { return { fetcher: async () => { - return findPetsByStatusSWR({ step_id }, config) + return findPetsByStatus({ step_id }, config) }, } } @@ -40,7 +24,9 @@ export function findPetsByStatusQueryOptionsSWR({ step_id }: { step_id: FindPets export function useFindPetsByStatusSWR( { step_id }: { step_id: FindPetsByStatusPathParams['step_id'] }, options: { - query?: Parameters, FindPetsByStatusQueryKeySWR | null, any>>[2] + query?: Parameters< + typeof useSWR, ResponseErrorConfig, FindPetsByStatusQueryKeySWR | null, any> + >[2] client?: Partial shouldFetch?: boolean } = {}, @@ -49,8 +35,11 @@ export function useFindPetsByStatusSWR( const queryKey = findPetsByStatusQueryKeySWR({ step_id }) - return useSWR, FindPetsByStatusQueryKeySWR | null>(shouldFetch ? queryKey : null, { - ...findPetsByStatusQueryOptionsSWR({ step_id }, config), - ...queryOptions, - }) + return useSWR, ResponseErrorConfig, FindPetsByStatusQueryKeySWR | null>( + shouldFetch ? queryKey : null, + { + ...findPetsByStatusQueryOptionsSWR({ step_id }, config), + ...queryOptions, + }, + ) } diff --git a/examples/advanced/src/gen/clients/swr/petController/useFindPetsByTagsSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useFindPetsByTagsSWR.ts index f66c56462..59e0f7050 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useFindPetsByTagsSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useFindPetsByTagsSWR.ts @@ -1,45 +1,24 @@ -import client from '../../../../swr-client.ts' import useSWR from 'swr' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../swr-client.ts' import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTagsHeaderParams, FindPetsByTags400, } from '../../../models/ts/petController/FindPetsByTags.ts' -import { findPetsByTagsQueryResponseSchema } from '../../../zod/petController/findPetsByTagsSchema.ts' +import { findPetsByTags } from '../../axios/petService/findPetsByTags.ts' export const findPetsByTagsQueryKeySWR = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const export type FindPetsByTagsQueryKeySWR = 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 findPetsByTagsSWR( - { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'GET', - url: '/pet/findByTags', - baseURL: 'https://petstore3.swagger.io/api/v3', - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponseSchema.parse(res.data) -} - export function findPetsByTagsQueryOptionsSWR( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, ) { return { fetcher: async () => { - return findPetsByTagsSWR({ headers, params }, config) + return findPetsByTags({ headers, params }, config) }, } } @@ -52,7 +31,9 @@ export function findPetsByTagsQueryOptionsSWR( export function useFindPetsByTagsSWR( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, options: { - query?: Parameters, FindPetsByTagsQueryKeySWR | null, any>>[2] + query?: Parameters< + typeof useSWR, ResponseErrorConfig, FindPetsByTagsQueryKeySWR | null, any> + >[2] client?: Partial shouldFetch?: boolean } = {}, @@ -61,8 +42,11 @@ export function useFindPetsByTagsSWR( const queryKey = findPetsByTagsQueryKeySWR(params) - return useSWR, FindPetsByTagsQueryKeySWR | null>(shouldFetch ? queryKey : null, { - ...findPetsByTagsQueryOptionsSWR({ headers, params }, config), - ...queryOptions, - }) + return useSWR, ResponseErrorConfig, FindPetsByTagsQueryKeySWR | null>( + shouldFetch ? queryKey : null, + { + ...findPetsByTagsQueryOptionsSWR({ headers, params }, config), + ...queryOptions, + }, + ) } diff --git a/examples/advanced/src/gen/clients/swr/petController/useGetPetByIdSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useGetPetByIdSWR.ts index f75899907..9302d54c6 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useGetPetByIdSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useGetPetByIdSWR.ts @@ -1,32 +1,16 @@ -import client from '../../../../swr-client.ts' import useSWR from 'swr' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../swr-client.ts' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../../models/ts/petController/GetPetById.ts' -import { getPetByIdQueryResponseSchema } from '../../../zod/petController/getPetByIdSchema.ts' +import { getPetById } from '../../axios/petService/getPetById.ts' export const getPetByIdQueryKeySWR = ({ petId }: { petId: GetPetByIdPathParams['petId'] }) => [{ url: '/pet/:petId', params: { petId: petId } }] as const export type GetPetByIdQueryKeySWR = ReturnType -/** - * @description Returns a single pet - * @summary Find pet by ID - * {@link /pet/:petId} - */ -async function getPetByIdSWR({ petId }: { petId: GetPetByIdPathParams['petId'] }, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/${petId}`, - baseURL: 'https://petstore3.swagger.io/api/v3', - ...config, - }) - return getPetByIdQueryResponseSchema.parse(res.data) -} - export function getPetByIdQueryOptionsSWR({ petId }: { petId: GetPetByIdPathParams['petId'] }, config: Partial = {}) { return { fetcher: async () => { - return getPetByIdSWR({ petId }, config) + return getPetById({ petId }, config) }, } } @@ -39,7 +23,9 @@ export function getPetByIdQueryOptionsSWR({ petId }: { petId: GetPetByIdPathPara export function useGetPetByIdSWR( { petId }: { petId: GetPetByIdPathParams['petId'] }, options: { - query?: Parameters, GetPetByIdQueryKeySWR | null, any>>[2] + query?: Parameters< + typeof useSWR, ResponseErrorConfig, GetPetByIdQueryKeySWR | null, any> + >[2] client?: Partial shouldFetch?: boolean } = {}, @@ -48,8 +34,11 @@ export function useGetPetByIdSWR( const queryKey = getPetByIdQueryKeySWR({ petId }) - return useSWR, GetPetByIdQueryKeySWR | null>(shouldFetch ? queryKey : null, { - ...getPetByIdQueryOptionsSWR({ petId }, config), - ...queryOptions, - }) + return useSWR, ResponseErrorConfig, GetPetByIdQueryKeySWR | null>( + shouldFetch ? queryKey : null, + { + ...getPetByIdQueryOptionsSWR({ petId }, config), + ...queryOptions, + }, + ) } diff --git a/examples/advanced/src/gen/clients/swr/petController/useUpdatePetSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useUpdatePetSWR.ts index af8bc0992..cb57ead3a 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useUpdatePetSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useUpdatePetSWR.ts @@ -1,6 +1,5 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { UpdatePetMutationRequest, UpdatePetMutationResponse, @@ -8,28 +7,12 @@ import type { UpdatePet404, UpdatePet405, } from '../../../models/ts/petController/UpdatePet.ts' -import { updatePetMutationResponseSchema } from '../../../zod/petController/updatePetSchema.ts' +import { updatePet } from '../../axios/petService/updatePet.ts' export const updatePetMutationKeySWR = () => [{ url: '/pet' }] as const export type UpdatePetMutationKeySWR = ReturnType -/** - * @description Update an existing pet by Id - * @summary Update an existing pet - * {@link /pet} - */ -async function updatePetSWR({ data }: { data: UpdatePetMutationRequest }, config: Partial> = {}) { - const res = await client, UpdatePetMutationRequest>({ - method: 'PUT', - url: '/pet', - baseURL: 'https://petstore3.swagger.io/api/v3', - data, - ...config, - }) - return updatePetMutationResponseSchema.parse(res.data) -} - /** * @description Update an existing pet by Id * @summary Update an existing pet @@ -39,7 +22,7 @@ export function useUpdatePetSWR( options: { mutation?: Parameters< typeof useSWRMutation< - UpdatePetMutationResponse, + ResponseConfig, ResponseErrorConfig, UpdatePetMutationKeySWR, UpdatePetMutationRequest @@ -53,14 +36,14 @@ export function useUpdatePetSWR( const mutationKey = updatePetMutationKeySWR() return useSWRMutation< - UpdatePetMutationResponse, + ResponseConfig, ResponseErrorConfig, UpdatePetMutationKeySWR | null, UpdatePetMutationRequest >( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return updatePetSWR({ data }, config) + return updatePet({ data }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petController/useUpdatePetWithFormSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useUpdatePetWithFormSWR.ts index b58612937..737fb543b 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useUpdatePetWithFormSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useUpdatePetWithFormSWR.ts @@ -1,36 +1,17 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405, } from '../../../models/ts/petController/UpdatePetWithForm.ts' -import { updatePetWithFormMutationResponseSchema } from '../../../zod/petController/updatePetWithFormSchema.ts' +import { updatePetWithForm } from '../../axios/petService/updatePetWithForm.ts' export const updatePetWithFormMutationKeySWR = () => [{ url: '/pet/{petId}' }] as const export type UpdatePetWithFormMutationKeySWR = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithFormSWR( - { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams }, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'POST', - url: `/pet/${petId}`, - baseURL: 'https://petstore3.swagger.io/api/v3', - params, - ...config, - }) - return updatePetWithFormMutationResponseSchema.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} @@ -40,7 +21,7 @@ export function useUpdatePetWithFormSWR( params?: UpdatePetWithFormQueryParams, options: { mutation?: Parameters< - typeof useSWRMutation, UpdatePetWithFormMutationKeySWR> + typeof useSWRMutation, ResponseErrorConfig, UpdatePetWithFormMutationKeySWR> >[2] client?: Partial shouldFetch?: boolean @@ -49,10 +30,10 @@ export function useUpdatePetWithFormSWR( const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const mutationKey = updatePetWithFormMutationKeySWR() - return useSWRMutation, UpdatePetWithFormMutationKeySWR | null>( + return useSWRMutation, ResponseErrorConfig, UpdatePetWithFormMutationKeySWR | null>( shouldFetch ? mutationKey : null, async (_url) => { - return updatePetWithFormSWR({ petId, params }, config) + return updatePetWithForm({ petId, params }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petController/useUploadFileSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useUploadFileSWR.ts index aae6896c3..a1a5c7635 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useUploadFileSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useUploadFileSWR.ts @@ -1,38 +1,17 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams, } from '../../../models/ts/petController/UploadFile.ts' -import { uploadFileMutationResponseSchema } from '../../../zod/petController/uploadFileSchema.ts' +import { uploadFile } from '../../axios/petService/uploadFile.ts' export const uploadFileMutationKeySWR = () => [{ url: '/pet/{petId}/uploadImage' }] as const export type UploadFileMutationKeySWR = ReturnType -/** - * @summary uploads an image - * {@link /pet/:petId/uploadImage} - */ -async function uploadFileSWR( - { petId, data, params }: { petId: UploadFilePathParams['petId']; data?: UploadFileMutationRequest; params?: UploadFileQueryParams }, - config: Partial> = {}, -) { - const res = await client, UploadFileMutationRequest>({ - method: 'POST', - url: `/pet/${petId}/uploadImage`, - baseURL: 'https://petstore3.swagger.io/api/v3', - params, - data, - headers: { 'Content-Type': 'application/octet-stream', ...config.headers }, - ...config, - }) - return uploadFileMutationResponseSchema.parse(res.data) -} - /** * @summary uploads an image * {@link /pet/:petId/uploadImage} @@ -41,7 +20,9 @@ export function useUploadFileSWR( { petId }: { petId: UploadFilePathParams['petId'] }, params?: UploadFileQueryParams, options: { - mutation?: Parameters, UploadFileMutationKeySWR, UploadFileMutationRequest>>[2] + mutation?: Parameters< + typeof useSWRMutation, ResponseErrorConfig, UploadFileMutationKeySWR, UploadFileMutationRequest> + >[2] client?: Partial> shouldFetch?: boolean } = {}, @@ -49,10 +30,10 @@ export function useUploadFileSWR( const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const mutationKey = uploadFileMutationKeySWR() - return useSWRMutation, UploadFileMutationKeySWR | null, UploadFileMutationRequest>( + return useSWRMutation, ResponseErrorConfig, UploadFileMutationKeySWR | null, UploadFileMutationRequest>( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return uploadFileSWR({ petId, data, params }, config) + return uploadFile({ petId, data, params }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petsController/useCreatePetsSWR.ts b/examples/advanced/src/gen/clients/swr/petsController/useCreatePetsSWR.ts index 9174d1379..90ff9a846 100644 --- a/examples/advanced/src/gen/clients/swr/petsController/useCreatePetsSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petsController/useCreatePetsSWR.ts @@ -1,6 +1,5 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { CreatePetsMutationRequest, CreatePetsMutationResponse, @@ -8,37 +7,12 @@ import type { CreatePetsQueryParams, CreatePetsHeaderParams, } from '../../../models/ts/petsController/CreatePets.ts' -import { createPetsMutationResponseSchema } from '../../../zod/petsController/createPetsSchema.ts' +import { createPets } from '../../axios/petsService/createPets.ts' export const createPetsMutationKeySWR = () => [{ url: '/pets/{uuid}' }] as const export type CreatePetsMutationKeySWR = ReturnType -/** - * @summary Create a pet - * {@link /pets/:uuid} - */ -async function createPetsSWR( - { - uuid, - data, - headers, - params, - }: { uuid: CreatePetsPathParams['uuid']; data: CreatePetsMutationRequest; headers: CreatePetsHeaderParams; params?: CreatePetsQueryParams }, - config: Partial> = {}, -) { - const res = await client, CreatePetsMutationRequest>({ - method: 'POST', - url: `/pets/${uuid}`, - baseURL: 'https://petstore3.swagger.io/api/v3', - params, - data, - headers: { ...headers, ...config.headers }, - ...config, - }) - return createPetsMutationResponseSchema.parse(res.data) -} - /** * @summary Create a pet * {@link /pets/:uuid} @@ -48,7 +22,9 @@ export function useCreatePetsSWR( headers: CreatePetsHeaderParams, params?: CreatePetsQueryParams, options: { - mutation?: Parameters, CreatePetsMutationKeySWR, CreatePetsMutationRequest>>[2] + mutation?: Parameters< + typeof useSWRMutation, ResponseErrorConfig, CreatePetsMutationKeySWR, CreatePetsMutationRequest> + >[2] client?: Partial> shouldFetch?: boolean } = {}, @@ -56,10 +32,10 @@ export function useCreatePetsSWR( const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const mutationKey = createPetsMutationKeySWR() - return useSWRMutation, CreatePetsMutationKeySWR | null, CreatePetsMutationRequest>( + return useSWRMutation, ResponseErrorConfig, CreatePetsMutationKeySWR | null, CreatePetsMutationRequest>( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return createPetsSWR({ uuid, data, headers, params }, config) + return createPets({ uuid, data, headers, params }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/userController/useCreateUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useCreateUserSWR.ts index 4c233ce52..b31045ea3 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useCreateUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useCreateUserSWR.ts @@ -1,29 +1,12 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../../../models/ts/userController/CreateUser.ts' -import { createUserMutationResponseSchema } from '../../../zod/userController/createUserSchema.ts' +import { createUser } from '../../axios/userService/createUser.ts' export const createUserMutationKeySWR = () => [{ url: '/user' }] as const export type CreateUserMutationKeySWR = ReturnType -/** - * @description This can only be done by the logged in user. - * @summary Create user - * {@link /user} - */ -async function createUserSWR({ data }: { data?: CreateUserMutationRequest }, config: Partial> = {}) { - const res = await client, CreateUserMutationRequest>({ - method: 'POST', - url: '/user', - baseURL: 'https://petstore3.swagger.io/api/v3', - data, - ...config, - }) - return createUserMutationResponseSchema.parse(res.data) -} - /** * @description This can only be done by the logged in user. * @summary Create user @@ -31,7 +14,9 @@ async function createUserSWR({ data }: { data?: CreateUserMutationRequest }, con */ export function useCreateUserSWR( options: { - mutation?: Parameters, CreateUserMutationKeySWR, CreateUserMutationRequest>>[2] + mutation?: Parameters< + typeof useSWRMutation, ResponseErrorConfig, CreateUserMutationKeySWR, CreateUserMutationRequest> + >[2] client?: Partial> shouldFetch?: boolean } = {}, @@ -39,10 +24,10 @@ export function useCreateUserSWR( const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const mutationKey = createUserMutationKeySWR() - return useSWRMutation, CreateUserMutationKeySWR | null, CreateUserMutationRequest>( + return useSWRMutation, ResponseErrorConfig, CreateUserMutationKeySWR | null, CreateUserMutationRequest>( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return createUserSWR({ data }, config) + return createUser({ data }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/userController/useCreateUsersWithListInputSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useCreateUsersWithListInputSWR.ts index 7d2d71e64..4c8f6ec89 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useCreateUsersWithListInputSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useCreateUsersWithListInputSWR.ts @@ -1,35 +1,15 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse, } from '../../../models/ts/userController/CreateUsersWithListInput.ts' -import { createUsersWithListInputMutationResponseSchema } from '../../../zod/userController/createUsersWithListInputSchema.ts' +import { createUsersWithListInput } from '../../axios/userService/createUsersWithListInput.ts' export const createUsersWithListInputMutationKeySWR = () => [{ url: '/user/createWithList' }] as const export type CreateUsersWithListInputMutationKeySWR = ReturnType -/** - * @description Creates list of users with given input array - * @summary Creates list of users with given input array - * {@link /user/createWithList} - */ -async function createUsersWithListInputSWR( - { data }: { data?: CreateUsersWithListInputMutationRequest }, - config: Partial> = {}, -) { - const res = await client, CreateUsersWithListInputMutationRequest>({ - method: 'POST', - url: '/user/createWithList', - baseURL: 'https://petstore3.swagger.io/api/v3', - data, - ...config, - }) - return createUsersWithListInputMutationResponseSchema.parse(res.data) -} - /** * @description Creates list of users with given input array * @summary Creates list of users with given input array @@ -39,7 +19,7 @@ export function useCreateUsersWithListInputSWR( options: { mutation?: Parameters< typeof useSWRMutation< - CreateUsersWithListInputMutationResponse, + ResponseConfig, ResponseErrorConfig, CreateUsersWithListInputMutationKeySWR, CreateUsersWithListInputMutationRequest @@ -53,14 +33,14 @@ export function useCreateUsersWithListInputSWR( const mutationKey = createUsersWithListInputMutationKeySWR() return useSWRMutation< - CreateUsersWithListInputMutationResponse, + ResponseConfig, ResponseErrorConfig, CreateUsersWithListInputMutationKeySWR | null, CreateUsersWithListInputMutationRequest >( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return createUsersWithListInputSWR({ data }, config) + return createUsersWithListInput({ data }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/userController/useDeleteUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useDeleteUserSWR.ts index 05bbc357d..82eabd2e0 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useDeleteUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useDeleteUserSWR.ts @@ -1,28 +1,12 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../../../models/ts/userController/DeleteUser.ts' -import { deleteUserMutationResponseSchema } from '../../../zod/userController/deleteUserSchema.ts' +import { deleteUser } from '../../axios/userService/deleteUser.ts' export const deleteUserMutationKeySWR = () => [{ url: '/user/{username}' }] as const export type DeleteUserMutationKeySWR = ReturnType -/** - * @description This can only be done by the logged in user. - * @summary Delete user - * {@link /user/:username} - */ -async function deleteUserSWR({ username }: { username: DeleteUserPathParams['username'] }, config: Partial = {}) { - const res = await client, unknown>({ - method: 'DELETE', - url: `/user/${username}`, - baseURL: 'https://petstore3.swagger.io/api/v3', - ...config, - }) - return deleteUserMutationResponseSchema.parse(res.data) -} - /** * @description This can only be done by the logged in user. * @summary Delete user @@ -31,7 +15,9 @@ async function deleteUserSWR({ username }: { username: DeleteUserPathParams['use export function useDeleteUserSWR( { username }: { username: DeleteUserPathParams['username'] }, options: { - mutation?: Parameters, DeleteUserMutationKeySWR>>[2] + mutation?: Parameters< + typeof useSWRMutation, ResponseErrorConfig, DeleteUserMutationKeySWR> + >[2] client?: Partial shouldFetch?: boolean } = {}, @@ -39,10 +25,10 @@ export function useDeleteUserSWR( const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const mutationKey = deleteUserMutationKeySWR() - return useSWRMutation, DeleteUserMutationKeySWR | null>( + return useSWRMutation, ResponseErrorConfig, DeleteUserMutationKeySWR | null>( shouldFetch ? mutationKey : null, async (_url) => { - return deleteUserSWR({ username }, config) + return deleteUser({ username }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/userController/useGetUserByNameSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useGetUserByNameSWR.ts index 022f80a1f..e8c52b973 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useGetUserByNameSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useGetUserByNameSWR.ts @@ -1,37 +1,22 @@ -import client from '../../../../swr-client.ts' import useSWR from 'swr' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../swr-client.ts' import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404, } from '../../../models/ts/userController/GetUserByName.ts' -import { getUserByNameQueryResponseSchema } from '../../../zod/userController/getUserByNameSchema.ts' +import { getUserByName } from '../../axios/userService/getUserByName.ts' export const getUserByNameQueryKeySWR = ({ username }: { username: GetUserByNamePathParams['username'] }) => [{ url: '/user/:username', params: { username: username } }] as const export type GetUserByNameQueryKeySWR = ReturnType -/** - * @summary Get user by user name - * {@link /user/:username} - */ -async function getUserByNameSWR({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/user/${username}`, - baseURL: 'https://petstore3.swagger.io/api/v3', - ...config, - }) - return getUserByNameQueryResponseSchema.parse(res.data) -} - export function getUserByNameQueryOptionsSWR({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { return { fetcher: async () => { - return getUserByNameSWR({ username }, config) + return getUserByName({ username }, config) }, } } @@ -44,7 +29,7 @@ export function useGetUserByNameSWR( { username }: { username: GetUserByNamePathParams['username'] }, options: { query?: Parameters< - typeof useSWR, GetUserByNameQueryKeySWR | null, any> + typeof useSWR, ResponseErrorConfig, GetUserByNameQueryKeySWR | null, any> >[2] client?: Partial shouldFetch?: boolean @@ -54,7 +39,7 @@ export function useGetUserByNameSWR( const queryKey = getUserByNameQueryKeySWR({ username }) - return useSWR, GetUserByNameQueryKeySWR | null>( + return useSWR, ResponseErrorConfig, GetUserByNameQueryKeySWR | null>( shouldFetch ? queryKey : null, { ...getUserByNameQueryOptionsSWR({ username }, config), diff --git a/examples/advanced/src/gen/clients/swr/userController/useLoginUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useLoginUserSWR.ts index 88dab90b2..67a2bca21 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useLoginUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useLoginUserSWR.ts @@ -1,32 +1,16 @@ -import client from '../../../../swr-client.ts' import useSWR from 'swr' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../swr-client.ts' import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../../../models/ts/userController/LoginUser.ts' -import { loginUserQueryResponseSchema } from '../../../zod/userController/loginUserSchema.ts' +import { loginUser } from '../../axios/userService/loginUser.ts' export const loginUserQueryKeySWR = (params?: LoginUserQueryParams) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const export type LoginUserQueryKeySWR = ReturnType -/** - * @summary Logs user into the system - * {@link /user/login} - */ -async function loginUserSWR({ params }: { params?: LoginUserQueryParams }, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: '/user/login', - baseURL: 'https://petstore3.swagger.io/api/v3', - params, - ...config, - }) - return loginUserQueryResponseSchema.parse(res.data) -} - export function loginUserQueryOptionsSWR({ params }: { params?: LoginUserQueryParams }, config: Partial = {}) { return { fetcher: async () => { - return loginUserSWR({ params }, config) + return loginUser({ params }, config) }, } } @@ -38,7 +22,7 @@ export function loginUserQueryOptionsSWR({ params }: { params?: LoginUserQueryPa export function useLoginUserSWR( { params }: { params?: LoginUserQueryParams }, options: { - query?: Parameters, LoginUserQueryKeySWR | null, any>>[2] + query?: Parameters, ResponseErrorConfig, LoginUserQueryKeySWR | null, any>>[2] client?: Partial shouldFetch?: boolean } = {}, @@ -47,7 +31,7 @@ export function useLoginUserSWR( const queryKey = loginUserQueryKeySWR(params) - return useSWR, LoginUserQueryKeySWR | null>(shouldFetch ? queryKey : null, { + return useSWR, ResponseErrorConfig, LoginUserQueryKeySWR | null>(shouldFetch ? queryKey : null, { ...loginUserQueryOptionsSWR({ params }, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/userController/useLogoutUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useLogoutUserSWR.ts index fc7be013c..2ba4796cd 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useLogoutUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useLogoutUserSWR.ts @@ -1,31 +1,16 @@ -import client from '../../../../swr-client.ts' import useSWR from 'swr' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '../../../../swr-client.ts' import type { LogoutUserQueryResponse } from '../../../models/ts/userController/LogoutUser.ts' -import { logoutUserQueryResponseSchema } from '../../../zod/userController/logoutUserSchema.ts' +import { logoutUser } from '../../axios/userService/logoutUser.ts' export const logoutUserQueryKeySWR = () => [{ url: '/user/logout' }] as const export type LogoutUserQueryKeySWR = ReturnType -/** - * @summary Logs out current logged in user session - * {@link /user/logout} - */ -async function logoutUserSWR(config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: '/user/logout', - baseURL: 'https://petstore3.swagger.io/api/v3', - ...config, - }) - return logoutUserQueryResponseSchema.parse(res.data) -} - export function logoutUserQueryOptionsSWR(config: Partial = {}) { return { fetcher: async () => { - return logoutUserSWR(config) + return logoutUser(config) }, } } @@ -36,7 +21,7 @@ export function logoutUserQueryOptionsSWR(config: Partial = {}) { */ export function useLogoutUserSWR( options: { - query?: Parameters, LogoutUserQueryKeySWR | null, any>>[2] + query?: Parameters, ResponseErrorConfig, LogoutUserQueryKeySWR | null, any>>[2] client?: Partial shouldFetch?: boolean } = {}, @@ -45,7 +30,7 @@ export function useLogoutUserSWR( const queryKey = logoutUserQueryKeySWR() - return useSWR, LogoutUserQueryKeySWR | null>(shouldFetch ? queryKey : null, { + return useSWR, ResponseErrorConfig, LogoutUserQueryKeySWR | null>(shouldFetch ? queryKey : null, { ...logoutUserQueryOptionsSWR(config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/userController/useUpdateUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useUpdateUserSWR.ts index 97569c30f..5ace64801 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useUpdateUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useUpdateUserSWR.ts @@ -1,32 +1,12 @@ -import client from '../../../../swr-client.ts' import useSWRMutation from 'swr/mutation' -import type { RequestConfig, ResponseErrorConfig } from '../../../../swr-client.ts' +import type { RequestConfig, ResponseConfig, ResponseErrorConfig } from '../../../../swr-client.ts' import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../../../models/ts/userController/UpdateUser.ts' -import { updateUserMutationResponseSchema } from '../../../zod/userController/updateUserSchema.ts' +import { updateUser } from '../../axios/userService/updateUser.ts' export const updateUserMutationKeySWR = () => [{ url: '/user/{username}' }] as const export type UpdateUserMutationKeySWR = ReturnType -/** - * @description This can only be done by the logged in user. - * @summary Update user - * {@link /user/:username} - */ -async function updateUserSWR( - { username, data }: { username: UpdateUserPathParams['username']; data?: UpdateUserMutationRequest }, - config: Partial> = {}, -) { - const res = await client, UpdateUserMutationRequest>({ - method: 'PUT', - url: `/user/${username}`, - baseURL: 'https://petstore3.swagger.io/api/v3', - data, - ...config, - }) - return updateUserMutationResponseSchema.parse(res.data) -} - /** * @description This can only be done by the logged in user. * @summary Update user @@ -35,7 +15,9 @@ async function updateUserSWR( export function useUpdateUserSWR( { username }: { username: UpdateUserPathParams['username'] }, options: { - mutation?: Parameters, UpdateUserMutationKeySWR, UpdateUserMutationRequest>>[2] + mutation?: Parameters< + typeof useSWRMutation, ResponseErrorConfig, UpdateUserMutationKeySWR, UpdateUserMutationRequest> + >[2] client?: Partial> shouldFetch?: boolean } = {}, @@ -43,10 +25,10 @@ export function useUpdateUserSWR( const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} const mutationKey = updateUserMutationKeySWR() - return useSWRMutation, UpdateUserMutationKeySWR | null, UpdateUserMutationRequest>( + return useSWRMutation, ResponseErrorConfig, UpdateUserMutationKeySWR | null, UpdateUserMutationRequest>( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return updateUserSWR({ username, data }, config) + return updateUser({ username, data }, config) }, mutationOptions, ) diff --git a/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts index e159df591..7a135eec7 100644 --- a/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts @@ -13,7 +13,7 @@ export type AddPetMutationKey = ReturnType * @summary Add a new pet to the store * {@link /pet} */ -async function addPetHook(data: AddPetMutationRequest, config: Partial> = {}) { +async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { const res = await client, AddPetMutationRequest>({ method: 'POST', url: '/pet', data, ...config }) return res.data } @@ -34,7 +34,7 @@ export function useAddPetHook( return useMutation, { data: AddPetMutationRequest }>({ mutationFn: async ({ data }) => { - return addPetHook(data, config) + return addPet(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 67fab8b49..85332042f 100644 --- a/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts @@ -13,7 +13,7 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * {@link /pet/:pet_id} */ -async function deletePetHook({ pet_id }: { pet_id: DeletePetPathParams['pet_id'] }, headers?: DeletePetHeaderParams, config: Partial = {}) { +async function deletePet({ pet_id }: { pet_id: DeletePetPathParams['pet_id'] }, headers?: DeletePetHeaderParams, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/pet/${pet_id}`, @@ -43,7 +43,7 @@ export function useDeletePetHook( return useMutation, { pet_id: DeletePetPathParams['pet_id']; headers?: DeletePetHeaderParams }>({ mutationFn: async ({ pet_id, headers }) => { - return deletePetHook({ pet_id }, headers, config) + return deletePet({ 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 e984dedbd..4251d871e 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts @@ -13,7 +13,7 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', @@ -29,7 +29,7 @@ export function findPetsByStatusQueryOptionsHook(params?: FindPetsByStatusQueryP queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByStatusHook(params, config) + return findPetsByStatus(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts index 1b34a7bbd..1555e2f96 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts @@ -14,7 +14,7 @@ export type FindPetsByStatusSuspenseQueryKey = ReturnType = {}) { +async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', @@ -30,7 +30,7 @@ export function findPetsByStatusSuspenseQueryOptionsHook(params?: FindPetsByStat queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByStatusHook(params, config) + return findPetsByStatus(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts index 30404dfa5..63d2674da 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts @@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * {@link /pet/findByTags} */ -async function findPetsByTagsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', @@ -34,7 +34,7 @@ export function findPetsByTagsQueryOptionsHook(params?: FindPetsByTagsQueryParam queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByTagsHook(params, config) + return findPetsByTags(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts index 7dd54db0d..f466b43ee 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts @@ -13,7 +13,7 @@ export type FindPetsByTagsInfiniteQueryKey = ReturnType = {}) { +async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', @@ -39,7 +39,7 @@ export function findPetsByTagsInfiniteQueryOptionsHook(params?: FindPetsByTagsQu if (params) { params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize'] } - return findPetsByTagsHook(params, config) + return findPetsByTags(params, config) }, initialPageParam: 0, getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1), diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts index c27f95bca..ba04ea746 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts @@ -13,7 +13,7 @@ export type FindPetsByTagsSuspenseQueryKey = ReturnType = {}) { +async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', @@ -34,7 +34,7 @@ export function findPetsByTagsSuspenseQueryOptionsHook(params?: FindPetsByTagsQu queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByTagsHook(params, config) + return findPetsByTags(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts index 478c790bf..962fb49f2 100644 --- a/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts @@ -14,7 +14,7 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * {@link /pet/:pet_id} */ -async function getPetByIdHook({ pet_id }: { pet_id: GetPetByIdPathParams['pet_id'] }, config: Partial = {}) { +async function get_pet_by_id({ pet_id }: { pet_id: GetPetByIdPathParams['pet_id'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${pet_id}`, @@ -30,7 +30,7 @@ export function getPetByIdQueryOptionsHook({ pet_id }: { pet_id: GetPetByIdPathP queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getPetByIdHook({ pet_id }, config) + return get_pet_by_id({ pet_id }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts index b86901dba..fa760670e 100644 --- a/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts @@ -14,7 +14,7 @@ export type GetPetByIdSuspenseQueryKey = ReturnType = {}) { +async function get_pet_by_id({ pet_id }: { pet_id: GetPetByIdPathParams['pet_id'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${pet_id}`, @@ -30,7 +30,7 @@ export function getPetByIdSuspenseQueryOptionsHook({ pet_id }: { pet_id: GetPetB queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getPetByIdHook({ pet_id }, config) + return get_pet_by_id({ pet_id }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts index 72f2e10da..bd0735c73 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts @@ -13,7 +13,7 @@ export type UpdatePetMutationKey = ReturnType * @summary Update an existing pet * {@link /pet} */ -async function updatePetHook(data: UpdatePetMutationRequest, config: Partial> = {}) { +async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { const res = await client, UpdatePetMutationRequest>({ method: 'PUT', url: '/pet', @@ -43,7 +43,7 @@ export function useUpdatePetHook( return useMutation, { data: UpdatePetMutationRequest }>({ mutationFn: async ({ data }) => { - return updatePetHook(data, config) + return updatePet(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 751652eae..99df07a55 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts @@ -18,11 +18,7 @@ export type UpdatePetWithFormQueryKey = ReturnType = {}, -) { +async function updatePetWithForm(pet_id: UpdatePetWithFormPathParams['pet_id'], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'POST', url: `/pet/${pet_id}`, @@ -43,7 +39,7 @@ export function updatePetWithFormQueryOptionsHook( queryKey, queryFn: async ({ signal }) => { config.signal = signal - return updatePetWithFormHook(pet_id, params, config) + return updatePetWithForm(pet_id, params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts index 0c7677fb1..e7fae478a 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts @@ -18,11 +18,7 @@ export type UpdatePetWithFormSuspenseQueryKey = ReturnType = {}, -) { +async function updatePetWithForm(pet_id: UpdatePetWithFormPathParams['pet_id'], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'POST', url: `/pet/${pet_id}`, @@ -43,7 +39,7 @@ export function updatePetWithFormSuspenseQueryOptionsHook( queryKey, queryFn: async ({ signal }) => { config.signal = signal - return updatePetWithFormHook(pet_id, params, config) + return updatePetWithForm(pet_id, params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts index d467bba7e..8de6fc0d0 100644 --- a/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts @@ -12,7 +12,7 @@ export type UploadFileMutationKey = ReturnType * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -async function uploadFileHook( +async function uploadFile( { petId }: { petId: UploadFilePathParams['petId'] }, data?: UploadFileMutationRequest, params?: UploadFileQueryParams, @@ -52,7 +52,7 @@ export function useUploadFileHook( { petId: UploadFilePathParams['petId']; data?: UploadFileMutationRequest; params?: UploadFileQueryParams } >({ mutationFn: async ({ petId, data, params }) => { - return uploadFileHook({ petId }, data, params, config) + return uploadFile({ petId }, data, params, config) }, mutationKey, ...mutationOptions, diff --git a/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts index 0d97ba3e7..6e7d9b57a 100644 --- a/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts @@ -13,7 +13,7 @@ export type DeleteOrderMutationKey = ReturnType * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -async function deleteOrderHook({ orderId }: { orderId: DeleteOrderPathParams['orderId'] }, config: Partial = {}) { +async function deleteOrder({ orderId }: { orderId: DeleteOrderPathParams['orderId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/store/order/${orderId}`, @@ -42,7 +42,7 @@ export function useDeleteOrderHook( return useMutation, { orderId: DeleteOrderPathParams['orderId'] }>({ mutationFn: async ({ orderId }) => { - return deleteOrderHook({ orderId }, config) + return deleteOrder({ 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 39f0ab425..f3b4316b0 100644 --- a/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts @@ -12,7 +12,7 @@ export type GetInventoryQueryKey = ReturnType * @summary Returns pet inventories by status * {@link /store/inventory} */ -async function getInventoryHook(config: Partial = {}) { +async function getInventory(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } @@ -23,7 +23,7 @@ export function getInventoryQueryOptionsHook(config: Partial = {} queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getInventoryHook(config) + return getInventory(config) }, }) } diff --git a/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts index 17183e9ff..42e3dacf9 100644 --- a/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts @@ -13,7 +13,7 @@ export type GetInventorySuspenseQueryKey = ReturnType = {}) { +async function getInventory(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } @@ -24,7 +24,7 @@ export function getInventorySuspenseQueryOptionsHook(config: Partial { config.signal = signal - return getInventoryHook(config) + return getInventory(config) }, }) } diff --git a/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts index d9db6a0bf..e2d628224 100644 --- a/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts @@ -14,7 +14,7 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderByIdHook({ orderId }: { orderId: GetOrderByIdPathParams['orderId'] }, config: Partial = {}) { +async function getOrderById({ orderId }: { orderId: GetOrderByIdPathParams['orderId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, @@ -30,7 +30,7 @@ export function getOrderByIdQueryOptionsHook({ orderId }: { orderId: GetOrderByI queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getOrderByIdHook({ orderId }, config) + return getOrderById({ orderId }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts index 9fad313fd..bbf01c4de 100644 --- a/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts @@ -14,7 +14,7 @@ export type GetOrderByIdSuspenseQueryKey = ReturnType = {}) { +async function getOrderById({ orderId }: { orderId: GetOrderByIdPathParams['orderId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, @@ -30,7 +30,7 @@ export function getOrderByIdSuspenseQueryOptionsHook({ orderId }: { orderId: Get queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getOrderByIdHook({ orderId }, config) + return getOrderById({ orderId }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts index db62b9c9c..e03b3feba 100644 --- a/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts @@ -13,7 +13,7 @@ export type PlaceOrderMutationKey = ReturnType * @summary Place an order for a pet * {@link /store/order} */ -async function placeOrderHook(data?: PlaceOrderMutationRequest, config: Partial> = {}) { +async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderMutationRequest>({ method: 'POST', url: '/store/order', @@ -39,7 +39,7 @@ export function usePlaceOrderHook( return useMutation, { data?: PlaceOrderMutationRequest }>({ mutationFn: async ({ data }) => { - return placeOrderHook(data, config) + return placeOrder(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 5c89fe319..b3739a84e 100644 --- a/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts @@ -13,7 +13,7 @@ export type PlaceOrderPatchMutationKey = ReturnType> = {}) { +async function placeOrderPatch(data?: PlaceOrderPatchMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderPatchMutationRequest>({ method: 'PATCH', url: '/store/order', @@ -39,7 +39,7 @@ export function usePlaceOrderPatchHook( return useMutation, { data?: PlaceOrderPatchMutationRequest }>({ mutationFn: async ({ data }) => { - return placeOrderPatchHook(data, config) + return placeOrderPatch(data, config) }, mutationKey, ...mutationOptions, diff --git a/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts index 81f0f4b6f..e7bb327df 100644 --- a/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts @@ -13,7 +13,7 @@ export type CreateUserMutationKey = ReturnType * @summary Create user * {@link /user} */ -async function createUserHook(data?: CreateUserMutationRequest, config: Partial> = {}) { +async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { const res = await client, CreateUserMutationRequest>({ method: 'POST', url: '/user', data, ...config }) return res.data } @@ -34,7 +34,7 @@ export function useCreateUserHook( return useMutation, { data?: CreateUserMutationRequest }>({ mutationFn: async ({ data }) => { - return createUserHook(data, config) + return createUser(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 d82ca66d1..d276669ca 100644 --- a/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts @@ -13,7 +13,7 @@ export type CreateUsersWithListInputMutationKey = ReturnType> = {}, ) { @@ -42,7 +42,7 @@ export function useCreateUsersWithListInputHook( return useMutation, { data?: CreateUsersWithListInputMutationRequest }>({ mutationFn: async ({ data }) => { - return createUsersWithListInputHook(data, config) + return createUsersWithListInput(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 24b336839..4e897d04f 100644 --- a/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts @@ -13,7 +13,7 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * {@link /user/:username} */ -async function deleteUserHook({ username }: { username: DeleteUserPathParams['username'] }, config: Partial = {}) { +async function deleteUser({ username }: { username: DeleteUserPathParams['username'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/user/${username}`, @@ -42,7 +42,7 @@ export function useDeleteUserHook( return useMutation, { username: DeleteUserPathParams['username'] }>({ mutationFn: async ({ username }) => { - return deleteUserHook({ username }, config) + return deleteUser({ 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 cde7f111d..696699e11 100644 --- a/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts @@ -13,7 +13,7 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * {@link /user/:username} */ -async function getUserByNameHook({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { +async function getUserByName({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, @@ -29,7 +29,7 @@ export function getUserByNameQueryOptionsHook({ username }: { username: GetUserB queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getUserByNameHook({ username }, config) + return getUserByName({ username }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts index d4959efac..86f8f8e6f 100644 --- a/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts @@ -13,7 +13,7 @@ export type GetUserByNameSuspenseQueryKey = ReturnType = {}) { +async function getUserByName({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, @@ -29,7 +29,7 @@ export function getUserByNameSuspenseQueryOptionsHook({ username }: { username: queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getUserByNameHook({ username }, config) + return getUserByName({ username }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts index aab876c9d..082aa08dd 100644 --- a/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts @@ -12,7 +12,7 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * {@link /user/login} */ -async function loginUserHook(params?: LoginUserQueryParams, config: Partial = {}) { +async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } @@ -23,7 +23,7 @@ export function loginUserQueryOptionsHook(params?: LoginUserQueryParams, config: queryKey, queryFn: async ({ signal }) => { config.signal = signal - return loginUserHook(params, config) + return loginUser(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts index ced1de2bc..330591eb3 100644 --- a/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts @@ -12,7 +12,7 @@ export type LoginUserSuspenseQueryKey = ReturnType = {}) { +async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } @@ -23,7 +23,7 @@ export function loginUserSuspenseQueryOptionsHook(params?: LoginUserQueryParams, queryKey, queryFn: async ({ signal }) => { config.signal = signal - return loginUserHook(params, config) + return loginUser(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts index 1cfaf7801..e65520825 100644 --- a/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts @@ -12,7 +12,7 @@ export type LogoutUserQueryKey = ReturnType * @summary Logs out current logged in user session * {@link /user/logout} */ -async function logoutUserHook(config: Partial = {}) { +async function logoutUser(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } @@ -23,7 +23,7 @@ export function logoutUserQueryOptionsHook(config: Partial = {}) queryKey, queryFn: async ({ signal }) => { config.signal = signal - return logoutUserHook(config) + return logoutUser(config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts index 2e56ae190..116942c71 100644 --- a/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts @@ -12,7 +12,7 @@ export type LogoutUserSuspenseQueryKey = ReturnType = {}) { +async function logoutUser(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } @@ -23,7 +23,7 @@ export function logoutUserSuspenseQueryOptionsHook(config: Partial { config.signal = signal - return logoutUserHook(config) + return logoutUser(config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts index 7fe45f852..b54272b81 100644 --- a/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts @@ -13,7 +13,7 @@ export type UpdateUserMutationKey = ReturnType * @summary Update user * {@link /user/:username} */ -async function updateUserHook( +async function updateUser( { username }: { username: UpdateUserPathParams['username'] }, data?: UpdateUserMutationRequest, config: Partial> = {}, @@ -47,7 +47,7 @@ export function useUpdateUserHook( return useMutation, { username: UpdateUserPathParams['username']; data?: UpdateUserMutationRequest }>({ mutationFn: async ({ username, data }) => { - return updateUserHook({ username }, data, config) + return updateUser({ username }, data, config) }, mutationKey, ...mutationOptions, diff --git a/packages/core/mocks/index.ts b/packages/core/mocks/index.ts index 53f870c21..2f5515000 100644 --- a/packages/core/mocks/index.ts +++ b/packages/core/mocks/index.ts @@ -1,6 +1,7 @@ import { camelCase, pascalCase } from '../src/transformers/casing.ts' import path from 'node:path' +import type { Plugin } from '@kubb/core' import type { File, ResolvedFile } from '@kubb/fs/types' import { getSource } from '../src/FileManager' import type { PluginManager } from '../src/PluginManager.ts' @@ -43,6 +44,9 @@ export const createMockedPluginManager = (name?: string) => on(eventName, args) {}, logLevel: 3, }, + getPluginByKey: (_pluginKey: Plugin['key']) => { + return {} as Plugin + }, getFile: ({ name, extname, pluginKey }) => { const baseName = `${name}${extname}` diff --git a/packages/core/src/PluginManager.ts b/packages/core/src/PluginManager.ts index 888c7a44a..2b500e3d6 100644 --- a/packages/core/src/PluginManager.ts +++ b/packages/core/src/PluginManager.ts @@ -114,14 +114,6 @@ export class PluginManager { return this } - getOptions({ pluginKey }: GetOptionsProps) { - const plugins = [...this.plugins] - - plugins.find((plugin) => { - return plugin.key === pluginKey - }) - } - getFile({ name, mode, extname, pluginKey, options }: GetFileProps): KubbFile.File<{ pluginKey: Plugin['key'] }> { const baseName = `${name}${extname}` as const const path = this.resolvePath({ baseName, mode, pluginKey, options }) @@ -458,7 +450,18 @@ export class PluginManager { }) } - getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: Plugin['key']): Plugin[] { + getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined { + const plugins = [...this.plugins] + const [searchPluginName, searchIdentifier] = pluginKey + + return plugins.find((item) => { + const [name] = item.key + + return name === searchPluginName + }) + } + + getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[] { const plugins = [...this.plugins] const [searchPluginName, searchIdentifier] = pluginKey diff --git a/packages/plugin-client/src/components/Client.tsx b/packages/plugin-client/src/components/Client.tsx index 0710a2ec3..2881b8081 100644 --- a/packages/plugin-client/src/components/Client.tsx +++ b/packages/plugin-client/src/components/Client.tsx @@ -13,9 +13,6 @@ type Props = { */ name: string urlName?: string - isExportable?: boolean - isIndexable?: boolean - baseURL: string | undefined dataReturnType: PluginClient['resolvedOptions']['dataReturnType'] paramsCasing: PluginClient['resolvedOptions']['paramsCasing'] @@ -103,8 +100,6 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: Ge export function Client({ name, - isExportable = true, - isIndexable = true, typeSchemas, baseURL, dataReturnType, @@ -183,11 +178,11 @@ export function Client({ : '' return ( - + [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) } -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions< diff --git a/packages/plugin-react-query/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-react-query/src/generators/__snapshots__/clientGetImportPath.ts index 95210128f..db0d8513c 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-react-query/src/generators/__snapshots__/clientPostImportPath.ts index a9c12b487..258deefa5 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import type { UseMutationOptions } from '@tanstack/react-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { useMutation } from '@tanstack/react-query' @@ -7,26 +6,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{pet_id}' }] as export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:pet_id} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${pet_id}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts index f44b5a656..173b8a502 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts index 261555b10..d3cd8b284 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -7,25 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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( - { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index f44b5a656..173b8a502 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index 741ba554a..3eca4a607 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [' 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts index f44b5a656..173b8a502 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts index e247852ce..ce7c033af 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query' import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParam 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 findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsInfiniteQueryOptions( headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts index e0518f5bf..284967668 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query' import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParam 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 findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsInfiniteQueryOptions( headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, diff --git a/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts b/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts index 683141d24..02dedc079 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -7,20 +6,6 @@ export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['pet_id']) => [{ export type GetPetByIdQueryKey = ReturnType -/** - * @description Returns a single pet - * @summary Find pet by ID - * {@link /pet/:pet_id} - */ -async function getPetById(petId: GetPetByIdPathParams['pet_id'], config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/${petId}`, - ...config, - }) - return getPetByIdQueryResponse.parse(res.data) -} - export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['pet_id'], config: Partial = {}) { const queryKey = getPetByIdQueryKey(petId) return queryOptions, GetPetByIdQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts index bdb8c2f85..6e0cf82bd 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from 'custom-query' import { queryOptions, useQuery } from 'custom-query' @@ -11,26 +10,6 @@ export const updatePetWithFormQueryKey = ( export type UpdatePetWithFormQueryKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:pet_id} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${pet_id}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - export function updatePetWithFormQueryOptions( petId: UpdatePetWithFormPathParams['petId'], data?: UpdatePetWithFormMutationRequest, diff --git a/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts index d006de88d..f676059df 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' @@ -7,26 +6,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{pet_id}' }] as export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:pet_id} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${pet_id}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} diff --git a/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index e0164cd0a..a4faf7035 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' @@ -7,26 +6,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{pet_id}' }] as export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:pet_id} - */ -async function updatePetWithForm( - { petId }: { petId: UpdatePetWithFormPathParams['petId'] }, - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${pet_id}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} diff --git a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx index 32f99ca89..cdeac7c56 100644 --- a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx +++ b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx @@ -1,3 +1,4 @@ +import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks' @@ -16,6 +17,7 @@ export const infiniteQueryGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -35,7 +37,9 @@ export const infiniteQueryGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -71,7 +75,8 @@ export const infiniteQueryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } {options.client.dataReturnType === 'full' && } ({ typeSchemas={type.schemas} transformer={options.queryKey} /> - + {!client.plugin && ( + + )} {options.infinite && ( <> diff --git a/packages/plugin-react-query/src/generators/mutationGenerator.tsx b/packages/plugin-react-query/src/generators/mutationGenerator.tsx index 15bb5455b..65a86aac7 100644 --- a/packages/plugin-react-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-react-query/src/generators/mutationGenerator.tsx @@ -1,3 +1,4 @@ +import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks' @@ -16,6 +17,7 @@ export const mutationGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -45,7 +47,9 @@ export const mutationGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const mutationKey = { @@ -66,7 +70,8 @@ export const mutationGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } ({ transformer={options.mutationKey} /> - + {!client.plugin && ( + + )} {options.mutation && ( <> diff --git a/packages/plugin-react-query/src/generators/queryGenerator.tsx b/packages/plugin-react-query/src/generators/queryGenerator.tsx index f549d63f1..d935210a0 100644 --- a/packages/plugin-react-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-react-query/src/generators/queryGenerator.tsx @@ -1,3 +1,4 @@ +import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks' @@ -16,6 +17,7 @@ export const queryGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -34,7 +36,9 @@ export const queryGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -71,7 +75,8 @@ export const queryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } {options.client.dataReturnType === 'full' && } ({ paramsCasing={options.paramsCasing} transformer={options.queryKey} /> - + {!client.plugin && ( + + )} ({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -37,7 +38,9 @@ export const suspenseQueryGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -73,7 +76,8 @@ export const suspenseQueryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } {options.client.dataReturnType === 'full' && } ({ transformer={options.queryKey} /> - + {!client.plugin && ( + + )} [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) } -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions< diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-solid-query/src/generators/__snapshots__/clientGetImportPath.ts index 7e1bd719d..0698ae358 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts index 2ac9f7452..cf7774962 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts index 6742d6cb1..117f290d5 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,25 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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( - { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 2ac9f7452..cf7774962 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index 96385a636..b37689ec7 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/react-query' import { queryOptions, createQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [' 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts index 2ac9f7452..cf7774962 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts index 6730e0905..b34d187c5 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from 'custom-query' import { queryOptions, createQuery } from 'custom-query' @@ -11,26 +10,6 @@ export const updatePetWithFormQueryKey = ( export type UpdatePetWithFormQueryKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - export function updatePetWithFormQueryOptions( petId: UpdatePetWithFormPathParams['petId'], data?: UpdatePetWithFormMutationRequest, diff --git a/packages/plugin-solid-query/src/generators/queryGenerator.tsx b/packages/plugin-solid-query/src/generators/queryGenerator.tsx index cd432bcd7..682ef4a38 100644 --- a/packages/plugin-solid-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-solid-query/src/generators/queryGenerator.tsx @@ -1,3 +1,4 @@ +import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks' @@ -16,6 +17,7 @@ export const queryGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -31,7 +33,9 @@ export const queryGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -67,7 +71,8 @@ export const queryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } {options.client.dataReturnType === 'full' && } ({ typeSchemas={type.schemas} transformer={options.queryKey} /> - + {!client.plugin && ( + + )} [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) } -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions< diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/clientGetImportPath.ts index 59e910c6c..ae3e6f23d 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/clientPostImportPath.ts index 8f349f0ae..c037cd7e4 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { createMutation } from '@tanstack/svelte-query' @@ -7,26 +6,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts index ccd287544..efbc778a1 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts index e1b3c223c..d33cd2a7f 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,25 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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( - { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index ccd287544..efbc778a1 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index ddf2756f2..6ac9886ed 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/react-query' import { queryOptions, createQuery } from '@tanstack/react-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [' 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts index ccd287544..efbc778a1 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -7,22 +6,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts index a2dd1d0ea..2d94b25bb 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from 'custom-query' import { queryOptions, createQuery } from 'custom-query' @@ -11,26 +10,6 @@ export const updatePetWithFormQueryKey = ( export type UpdatePetWithFormQueryKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - export function updatePetWithFormQueryOptions( petId: UpdatePetWithFormPathParams['petId'], data?: UpdatePetWithFormMutationRequest, diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts index 68e6af977..a65f7311a 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' @@ -7,26 +6,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index aaaf0e85b..6dcd3198e 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' @@ -7,26 +6,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - { petId }: { petId: UpdatePetWithFormPathParams['petId'] }, - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx b/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx index ac4271642..ae7518216 100644 --- a/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx @@ -17,6 +17,7 @@ export const mutationGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -46,7 +47,9 @@ export const mutationGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const mutationKey = { @@ -67,8 +70,8 @@ export const mutationGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - - + {!client.plugin && } + {!!client.plugin && } ({ typeSchemas={type.schemas} transformer={options.mutationKey} /> - + {!client.plugin && ( + + )} {options.mutation && ( <> diff --git a/packages/plugin-svelte-query/src/generators/queryGenerator.tsx b/packages/plugin-svelte-query/src/generators/queryGenerator.tsx index e9077c974..75a3ffc08 100644 --- a/packages/plugin-svelte-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-svelte-query/src/generators/queryGenerator.tsx @@ -1,3 +1,4 @@ +import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks' @@ -16,6 +17,7 @@ export const queryGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -33,7 +35,9 @@ export const queryGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -69,7 +73,8 @@ export const queryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } {options.client.dataReturnType === 'full' && } ({ transformer={options.queryKey} /> - + {!client.plugin && ( + + )} [{ 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, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - ...config, - }) - return res -} - export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts index f0e1dcd45..4e3f66498 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from 'axios' @@ -6,21 +5,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - ...config, - }) - return res.data -} - export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts index 37282874a..9bc453068 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import useSWRMutation from 'swr/mutation' import type { RequestConfig, ResponseErrorConfig } from 'axios' @@ -6,20 +5,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'POST', - url: `/pet/${petId}`, - params, - ...config, - }) - return res.data -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts index c26ed5cb4..4f9b93dfb 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -6,21 +5,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - ...config, - }) - return res.data -} - export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts index c26ed5cb4..4f9b93dfb 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -6,21 +5,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - ...config, - }) - return res.data -} - export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts index c26ed5cb4..4f9b93dfb 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -6,21 +5,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - ...config, - }) - return res.data -} - export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts index d01daf85c..4f9b93dfb 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -6,21 +5,6 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts index 29efc333f..ec2749ad0 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import useSWR from 'custom-swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -7,23 +6,6 @@ export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams['pe export type UpdatePetWithFormQueryKey = 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, unknown>({ - method: 'POST', - url: `/pet/${petId}`, - params, - ...config, - }) - return res.data -} - export function updatePetWithFormQueryOptions( { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams }, config: Partial = {}, diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts index 3b9c24b00..26efd29ab 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -6,20 +5,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'POST', - url: `/pet/${petId}`, - params, - ...config, - }) - return res.data -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index ddde907a2..bd54efa0b 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -6,24 +5,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - { petId }: { petId: UpdatePetWithFormPathParams['petId'] }, - params?: UpdatePetWithFormQueryParams, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'POST', - url: `/pet/${petId}`, - params, - ...config, - }) - return res.data -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-swr/src/generators/mutationGenerator.tsx b/packages/plugin-swr/src/generators/mutationGenerator.tsx index 438379186..77f7407e6 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.tsx @@ -1,3 +1,4 @@ +import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks' @@ -17,6 +18,7 @@ export const mutationGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -46,7 +48,9 @@ export const mutationGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const mutationKey = { @@ -69,7 +73,8 @@ export const mutationGenerator = createReactGenerator({ {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } ({ transformer={options.mutationKey} /> - + {!client.plugin && ( + + )} {options.mutation && ( ({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -34,7 +36,9 @@ export const queryGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -69,8 +73,8 @@ export const queryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - - + {!client.plugin && } + {!!client.plugin && } {options.client.dataReturnType === 'full' && } @@ -96,20 +100,20 @@ export const queryGenerator = createReactGenerator({ paramsCasing={options.paramsCasing} transformer={options.queryKey} /> - + {!client.plugin && ( + + )} -/** - * @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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) } -} - export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-vue-query/src/generators/__snapshots__/clientGetImportPath.ts index 29f71b831..cfc488026 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import type { MaybeRef } from 'vue' @@ -9,22 +8,6 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef -/** - * @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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-vue-query/src/generators/__snapshots__/clientPostImportPath.ts index 49977ddc8..69673473f 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,4 +1,3 @@ -import client from 'axios' import type { MutationObserverOptions } from '@tanstack/vue-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import type { MaybeRef } from 'vue' @@ -8,26 +7,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts index 8d79b360b..d327f5424 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -9,22 +8,6 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef -/** - * @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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts index f04121e24..80d92526d 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -9,25 +8,6 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef -/** - * @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( - { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, - config: Partial = {}, -) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( { headers, params }: { headers: MaybeRef; params?: MaybeRef }, config: Partial = {}, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 8d79b360b..d327f5424 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -9,22 +8,6 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef -/** - * @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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index ea379acef..82c88c232 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -10,22 +9,6 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef -/** - * @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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts index 8d79b360b..d327f5424 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -9,22 +8,6 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef -/** - * @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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts index 00aaafa1e..cc8cb2b3f 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -9,22 +8,6 @@ export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef -/** - * @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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsInfiniteQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts index b8581e5f2..cff5dd128 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -9,22 +8,6 @@ export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef -/** - * @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(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client, unknown>({ - method: 'GET', - url: `/pet/findByTags`, - params, - headers: { ...headers, ...config.headers }, - ...config, - }) - return findPetsByTagsQueryResponse.parse(res.data) -} - export function findPetsByTagsInfiniteQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts index 86b7c3b02..467c3a2b5 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from 'custom-query' import type { MaybeRef } from 'vue' @@ -13,26 +12,6 @@ export const updatePetWithFormQueryKey = ( export type UpdatePetWithFormQueryKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - export function updatePetWithFormQueryOptions( petId: MaybeRef, data?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts index 57e21d07e..38df4aa1f 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { MutationObserverOptions } from '@tanstack/vue-query' import type { MaybeRef } from 'vue' @@ -8,26 +7,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - petId: UpdatePetWithFormPathParams['petId'], - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index b7dd83922..6ee049726 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,4 +1,3 @@ -import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { MutationObserverOptions } from '@tanstack/vue-query' import type { MaybeRef } from 'vue' @@ -8,26 +7,6 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType -/** - * @summary Updates a pet in the store with form data - * {@link /pet/:petId} - */ -async function updatePetWithForm( - { petId }: { petId: UpdatePetWithFormPathParams['petId'] }, - data?: UpdatePetWithFormMutationRequest, - params?: UpdatePetWithFormQueryParams, - config: Partial> = {}, -) { - const res = await client, UpdatePetWithFormMutationRequest>({ - method: 'POST', - url: `/pet/${petId}`, - params, - data, - ...config, - }) - return updatePetWithFormMutationResponse.parse(res.data) -} - /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx index 4bebbf5a4..ff8efa064 100644 --- a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx +++ b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx @@ -1,3 +1,4 @@ +import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks' @@ -16,6 +17,7 @@ export const infiniteQueryGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -34,7 +36,9 @@ export const infiniteQueryGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -72,7 +76,8 @@ export const infiniteQueryGenerator = createReactGenerator({ {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } {options.client.dataReturnType === 'full' && } ({ typeSchemas={type.schemas} transformer={options.queryKey} /> - + {!client.plugin && ( + + )} {options.infinite && ( <> diff --git a/packages/plugin-vue-query/src/generators/mutationGenerator.tsx b/packages/plugin-vue-query/src/generators/mutationGenerator.tsx index abcf4dca4..04a1d1791 100644 --- a/packages/plugin-vue-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-vue-query/src/generators/mutationGenerator.tsx @@ -17,6 +17,7 @@ export const mutationGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -46,7 +47,9 @@ export const mutationGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const mutationKey = { @@ -68,7 +71,8 @@ export const mutationGenerator = createReactGenerator({ > {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } ({ typeSchemas={type.schemas} transformer={options.mutationKey} /> - + {!client.plugin && ( + + )} {options.mutation && ( <> diff --git a/packages/plugin-vue-query/src/generators/queryGenerator.tsx b/packages/plugin-vue-query/src/generators/queryGenerator.tsx index 35461473b..b2585080d 100644 --- a/packages/plugin-vue-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-vue-query/src/generators/queryGenerator.tsx @@ -1,3 +1,4 @@ +import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks' @@ -16,6 +17,7 @@ export const queryGenerator = createReactGenerator({ plugin: { options: { output }, }, + pluginManager, } = useApp() const oas = useOas() const { getSchemas, getName, getFile } = useOperationManager() @@ -33,7 +35,9 @@ export const queryGenerator = createReactGenerator({ } const client = { - name: getName(operation, { type: 'function' }), + name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + file: getFile(operation, { pluginKey: [pluginClientName] }), + plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -71,7 +75,8 @@ export const queryGenerator = createReactGenerator({ {options.parser === 'zod' && } - + {!client.plugin && } + {!!client.plugin && } {options.client.dataReturnType === 'full' && } ({ typeSchemas={type.schemas} transformer={options.queryKey} /> - + {!client.plugin && ( + + )} Date: Tue, 21 Jan 2025 23:22:04 +0100 Subject: [PATCH 2/2] chore: update examples --- examples/react-query/src/gen/hooks/index.ts | 103 +++++++++--- .../react-query/src/gen/hooks/pet/index.ts | 39 +++-- .../src/gen/hooks/pet/useAddPetHook.ts | 4 +- .../src/gen/hooks/pet/useDeletePetHook.ts | 8 +- .../gen/hooks/pet/useFindPetsByStatusHook.ts | 4 +- .../pet/useFindPetsByStatusSuspenseHook.ts | 4 +- .../gen/hooks/pet/useFindPetsByTagsHook.ts | 4 +- .../pet/useFindPetsByTagsInfiniteHook.ts | 4 +- .../pet/useFindPetsByTagsSuspenseHook.ts | 4 +- .../src/gen/hooks/pet/useGetPetByIdHook.ts | 4 +- .../hooks/pet/useGetPetByIdSuspenseHook.ts | 4 +- .../src/gen/hooks/pet/useUpdatePetHook.ts | 4 +- .../gen/hooks/pet/useUpdatePetWithFormHook.ts | 8 +- .../pet/useUpdatePetWithFormSuspenseHook.ts | 8 +- .../src/gen/hooks/pet/useUploadFileHook.ts | 4 +- .../react-query/src/gen/hooks/store/index.ts | 24 ++- .../src/gen/hooks/store/useDeleteOrderHook.ts | 4 +- .../gen/hooks/store/useGetInventoryHook.ts | 4 +- .../store/useGetInventorySuspenseHook.ts | 4 +- .../gen/hooks/store/useGetOrderByIdHook.ts | 4 +- .../store/useGetOrderByIdSuspenseHook.ts | 4 +- .../src/gen/hooks/store/usePlaceOrderHook.ts | 4 +- .../gen/hooks/store/usePlaceOrderPatchHook.ts | 4 +- .../react-query/src/gen/hooks/user/index.ts | 30 ++-- .../src/gen/hooks/user/useCreateUserHook.ts | 4 +- .../user/useCreateUsersWithListInputHook.ts | 4 +- .../src/gen/hooks/user/useDeleteUserHook.ts | 4 +- .../gen/hooks/user/useGetUserByNameHook.ts | 4 +- .../user/useGetUserByNameSuspenseHook.ts | 4 +- .../src/gen/hooks/user/useLoginUserHook.ts | 4 +- .../hooks/user/useLoginUserSuspenseHook.ts | 4 +- .../src/gen/hooks/user/useLogoutUserHook.ts | 4 +- .../hooks/user/useLogoutUserSuspenseHook.ts | 4 +- .../src/gen/hooks/user/useUpdateUserHook.ts | 4 +- examples/react-query/src/gen/index.ts | 94 ++++++++--- examples/simple-single/src/gen/hooks.ts | 159 +++++++++++++++--- .../src/gen/hooks/createFindPetsByStatus.ts | 2 +- .../src/gen/hooks/createFindPetsByTags.ts | 2 +- .../src/gen/hooks/createGetInventory.ts | 2 +- .../src/gen/hooks/createGetOrderById.ts | 2 +- .../src/gen/hooks/createGetPetById.ts | 2 +- .../src/gen/hooks/createGetUserByName.ts | 2 +- .../src/gen/hooks/createLoginUser.ts | 2 +- .../src/gen/hooks/createLogoutUser.ts | 2 +- .../src/gen/hooks/createUpdatePetWithForm.ts | 6 +- examples/solid-query/src/gen/hooks/index.ts | 18 +- examples/solid-query/src/gen/index.ts | 18 +- .../src/gen/hooks/createAddPet.ts | 2 +- .../src/gen/hooks/createCreateUser.ts | 2 +- .../hooks/createCreateUsersWithListInput.ts | 2 +- .../src/gen/hooks/createDeleteOrder.ts | 2 +- .../src/gen/hooks/createDeletePet.ts | 2 +- .../src/gen/hooks/createDeleteUser.ts | 2 +- .../src/gen/hooks/createFindPetsByStatus.ts | 2 +- .../src/gen/hooks/createFindPetsByTags.ts | 2 +- .../src/gen/hooks/createGetInventory.ts | 2 +- .../src/gen/hooks/createGetOrderById.ts | 2 +- .../src/gen/hooks/createGetPetById.ts | 2 +- .../src/gen/hooks/createGetUserByName.ts | 2 +- .../src/gen/hooks/createLoginUser.ts | 2 +- .../src/gen/hooks/createLogoutUser.ts | 2 +- .../src/gen/hooks/createPlaceOrder.ts | 2 +- .../src/gen/hooks/createPlaceOrderPatch.ts | 2 +- .../src/gen/hooks/createUpdatePet.ts | 2 +- .../src/gen/hooks/createUpdatePetWithForm.ts | 6 +- .../src/gen/hooks/createUpdateUser.ts | 2 +- .../src/gen/hooks/createUploadFile.ts | 2 +- examples/svelte-query/src/gen/hooks/index.ts | 40 ++--- examples/svelte-query/src/gen/index.ts | 40 ++--- examples/swr/src/gen/hooks/index.ts | 40 ++--- examples/swr/src/gen/hooks/useAddPet.ts | 2 +- examples/swr/src/gen/hooks/useCreateUser.ts | 2 +- .../gen/hooks/useCreateUsersWithListInput.ts | 2 +- examples/swr/src/gen/hooks/useDeleteOrder.ts | 2 +- examples/swr/src/gen/hooks/useDeletePet.ts | 2 +- examples/swr/src/gen/hooks/useDeleteUser.ts | 2 +- .../swr/src/gen/hooks/useFindPetsByStatus.ts | 2 +- .../swr/src/gen/hooks/useFindPetsByTags.ts | 2 +- examples/swr/src/gen/hooks/useGetInventory.ts | 2 +- examples/swr/src/gen/hooks/useGetOrderById.ts | 2 +- examples/swr/src/gen/hooks/useGetPetById.ts | 2 +- .../swr/src/gen/hooks/useGetUserByName.ts | 2 +- examples/swr/src/gen/hooks/useLoginUser.ts | 2 +- examples/swr/src/gen/hooks/useLogoutUser.ts | 2 +- examples/swr/src/gen/hooks/usePlaceOrder.ts | 2 +- .../swr/src/gen/hooks/usePlaceOrderPatch.ts | 2 +- examples/swr/src/gen/hooks/useUpdatePet.ts | 2 +- .../swr/src/gen/hooks/useUpdatePetWithForm.ts | 6 +- examples/swr/src/gen/hooks/useUpdateUser.ts | 2 +- examples/swr/src/gen/hooks/useUploadFile.ts | 2 +- examples/swr/src/gen/index.ts | 40 ++--- examples/vue-query/src/gen/hooks/index.ts | 38 ++--- examples/vue-query/src/gen/hooks/useAddPet.ts | 2 +- .../vue-query/src/gen/hooks/useCreateUser.ts | 2 +- .../gen/hooks/useCreateUsersWithListInput.ts | 2 +- .../vue-query/src/gen/hooks/useDeleteOrder.ts | 2 +- .../vue-query/src/gen/hooks/useDeletePet.ts | 5 +- .../vue-query/src/gen/hooks/useDeleteUser.ts | 2 +- .../src/gen/hooks/useFindPetsByStatus.ts | 2 +- .../src/gen/hooks/useFindPetsByTags.ts | 2 +- .../src/gen/hooks/useGetInventory.ts | 2 +- .../src/gen/hooks/useGetOrderById.ts | 2 +- .../vue-query/src/gen/hooks/useGetPetById.ts | 2 +- .../src/gen/hooks/useGetUserByName.ts | 2 +- .../vue-query/src/gen/hooks/useLoginUser.ts | 2 +- .../vue-query/src/gen/hooks/useLogoutUser.ts | 2 +- .../vue-query/src/gen/hooks/usePlaceOrder.ts | 2 +- .../vue-query/src/gen/hooks/useUpdatePet.ts | 2 +- .../src/gen/hooks/useUpdatePetWithForm.ts | 2 +- .../vue-query/src/gen/hooks/useUpdateUser.ts | 2 +- .../vue-query/src/gen/hooks/useUploadFile.ts | 2 +- examples/vue-query/src/gen/index.ts | 38 ++--- packages/core/mocks/index.ts | 4 +- .../__snapshots__/clientDataReturnTypeFull.ts | 17 ++ .../__snapshots__/clientGetImportPath.ts | 17 ++ .../__snapshots__/clientPostImportPath.ts | 21 +++ .../generators/__snapshots__/findByTags.ts | 17 ++ .../__snapshots__/findByTagsObject.ts | 20 +++ .../findByTagsPathParamsObject.ts | 17 ++ .../findByTagsWithCustomQueryKey.ts | 17 ++ .../__snapshots__/findByTagsWithZod.ts | 17 ++ .../__snapshots__/findInfiniteByTags.ts | 19 ++- .../__snapshots__/findInfiniteByTagsCursor.ts | 19 ++- .../__snapshots__/getPetIdCamelCase.ts | 15 ++ .../generators/__snapshots__/postAsQuery.ts | 21 +++ .../generators/__snapshots__/updatePetById.ts | 21 +++ .../updatePetByIdPathParamsObject.ts | 21 +++ .../src/generators/infiniteQueryGenerator.tsx | 18 +- .../src/generators/mutationGenerator.tsx | 17 +- .../src/generators/queryGenerator.tsx | 17 +- .../src/generators/suspenseQueryGenerator.tsx | 18 +- .../__snapshots__/clientDataReturnTypeFull.ts | 17 ++ .../__snapshots__/clientGetImportPath.ts | 17 ++ .../generators/__snapshots__/findByTags.ts | 17 ++ .../__snapshots__/findByTagsObject.ts | 20 +++ .../findByTagsPathParamsObject.ts | 17 ++ .../findByTagsWithCustomQueryKey.ts | 17 ++ .../__snapshots__/findByTagsWithZod.ts | 17 ++ .../generators/__snapshots__/postAsQuery.ts | 21 +++ .../src/generators/queryGenerator.tsx | 17 +- .../__snapshots__/clientDataReturnTypeFull.ts | 17 ++ .../__snapshots__/clientGetImportPath.ts | 17 ++ .../__snapshots__/clientPostImportPath.ts | 21 +++ .../generators/__snapshots__/findByTags.ts | 17 ++ .../__snapshots__/findByTagsObject.ts | 20 +++ .../findByTagsPathParamsObject.ts | 17 ++ .../findByTagsWithCustomQueryKey.ts | 17 ++ .../__snapshots__/findByTagsWithZod.ts | 17 ++ .../generators/__snapshots__/postAsQuery.ts | 21 +++ .../generators/__snapshots__/updatePetById.ts | 21 +++ .../updatePetByIdPathParamsObject.ts | 21 +++ .../src/generators/mutationGenerator.tsx | 17 +- .../src/generators/queryGenerator.tsx | 17 +- .../__snapshots__/clientDataReturnTypeFull.ts | 16 ++ .../__snapshots__/clientGetImportPath.ts | 16 ++ .../__snapshots__/clientPostImportPath.ts | 19 +++ .../generators/__snapshots__/findByTags.ts | 16 ++ .../__snapshots__/findByTagsObject.ts | 16 ++ .../findByTagsPathParamsObject.ts | 16 ++ .../__snapshots__/findByTagsWithZod.ts | 16 ++ .../generators/__snapshots__/postAsQuery.ts | 18 ++ .../generators/__snapshots__/updatePetById.ts | 19 +++ .../updatePetByIdPathParamsObject.ts | 19 +++ .../src/generators/mutationGenerator.tsx | 17 +- .../src/generators/queryGenerator.tsx | 17 +- .../__snapshots__/clientDataReturnTypeFull.ts | 17 ++ .../__snapshots__/clientGetImportPath.ts | 17 ++ .../__snapshots__/clientPostImportPath.ts | 21 +++ .../generators/__snapshots__/findByTags.ts | 17 ++ .../__snapshots__/findByTagsObject.ts | 20 +++ .../findByTagsPathParamsObject.ts | 17 ++ .../findByTagsWithCustomQueryKey.ts | 17 ++ .../__snapshots__/findByTagsWithZod.ts | 17 ++ .../__snapshots__/findInfiniteByTags.ts | 19 ++- .../__snapshots__/findInfiniteByTagsCursor.ts | 19 ++- .../generators/__snapshots__/postAsQuery.ts | 21 +++ .../generators/__snapshots__/updatePetById.ts | 21 +++ .../updatePetByIdPathParamsObject.ts | 21 +++ .../src/generators/infiniteQueryGenerator.tsx | 18 +- .../src/generators/mutationGenerator.tsx | 17 +- .../src/generators/queryGenerator.tsx | 17 +- 181 files changed, 1799 insertions(+), 439 deletions(-) diff --git a/examples/react-query/src/gen/hooks/index.ts b/examples/react-query/src/gen/hooks/index.ts index 8d9537715..2440c14fb 100644 --- a/examples/react-query/src/gen/hooks/index.ts +++ b/examples/react-query/src/gen/hooks/index.ts @@ -28,41 +28,88 @@ export type { LoginUserSuspenseQueryKey } from './user/useLoginUserSuspenseHook. 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 { addPetMutationKey, addPetHook, useAddPetHook } from './pet/useAddPetHook.ts' +export { deletePetMutationKey, deletePetHook, useDeletePetHook } from './pet/useDeletePetHook.ts' +export { findPetsByStatusQueryKey, findPetsByStatusHook, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './pet/useFindPetsByStatusHook.ts' export { findPetsByStatusSuspenseQueryKey, + findPetsByStatusSuspenseHook, 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 { findPetsByTagsQueryKey, findPetsByTagsHook, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './pet/useFindPetsByTagsHook.ts' +export { + findPetsByTagsInfiniteQueryKey, + findPetsByTagsInfiniteHook, + findPetsByTagsInfiniteQueryOptionsHook, + useFindPetsByTagsInfiniteHook, +} from './pet/useFindPetsByTagsInfiniteHook.ts' +export { + findPetsByTagsSuspenseQueryKey, + findPetsByTagsSuspenseHook, + findPetsByTagsSuspenseQueryOptionsHook, + useFindPetsByTagsSuspenseHook, +} from './pet/useFindPetsByTagsSuspenseHook.ts' +export { getPetByIdQueryKey, getPetByIdHook, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './pet/useGetPetByIdHook.ts' +export { + getPetByIdSuspenseQueryKey, + getPetByIdSuspenseHook, + getPetByIdSuspenseQueryOptionsHook, + useGetPetByIdSuspenseHook, +} from './pet/useGetPetByIdSuspenseHook.ts' +export { updatePetMutationKey, updatePetHook, useUpdatePetHook } from './pet/useUpdatePetHook.ts' +export { + updatePetWithFormQueryKey, + updatePetWithFormHook, + updatePetWithFormQueryOptionsHook, + useUpdatePetWithFormHook, +} from './pet/useUpdatePetWithFormHook.ts' export { updatePetWithFormSuspenseQueryKey, + updatePetWithFormSuspenseHook, updatePetWithFormSuspenseQueryOptionsHook, useUpdatePetWithFormSuspenseHook, } from './pet/useUpdatePetWithFormSuspenseHook.ts' -export { uploadFileMutationKey, useUploadFileHook } from './pet/useUploadFileHook.ts' -export { deleteOrderMutationKey, useDeleteOrderHook } from './store/useDeleteOrderHook.ts' -export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './store/useGetInventoryHook.ts' -export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './store/useGetInventorySuspenseHook.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './store/useGetOrderByIdHook.ts' -export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './store/useGetOrderByIdSuspenseHook.ts' -export { placeOrderMutationKey, usePlaceOrderHook } from './store/usePlaceOrderHook.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './store/usePlaceOrderPatchHook.ts' -export { createUserMutationKey, useCreateUserHook } from './user/useCreateUserHook.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './user/useCreateUsersWithListInputHook.ts' -export { deleteUserMutationKey, useDeleteUserHook } from './user/useDeleteUserHook.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './user/useGetUserByNameHook.ts' -export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from './user/useGetUserByNameSuspenseHook.ts' -export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './user/useLoginUserHook.ts' -export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './user/useLoginUserSuspenseHook.ts' -export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './user/useLogoutUserHook.ts' -export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './user/useLogoutUserSuspenseHook.ts' -export { updateUserMutationKey, useUpdateUserHook } from './user/useUpdateUserHook.ts' +export { uploadFileMutationKey, uploadFileHook, useUploadFileHook } from './pet/useUploadFileHook.ts' +export { deleteOrderMutationKey, deleteOrderHook, useDeleteOrderHook } from './store/useDeleteOrderHook.ts' +export { getInventoryQueryKey, getInventoryHook, getInventoryQueryOptionsHook } from './store/useGetInventoryHook.ts' +export { + getInventorySuspenseQueryKey, + getInventorySuspenseHook, + getInventorySuspenseQueryOptionsHook, + useGetInventorySuspenseHook, +} from './store/useGetInventorySuspenseHook.ts' +export { getOrderByIdQueryKey, getOrderByIdHook, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './store/useGetOrderByIdHook.ts' +export { + getOrderByIdSuspenseQueryKey, + getOrderByIdSuspenseHook, + getOrderByIdSuspenseQueryOptionsHook, + useGetOrderByIdSuspenseHook, +} from './store/useGetOrderByIdSuspenseHook.ts' +export { placeOrderMutationKey, placeOrderHook, usePlaceOrderHook } from './store/usePlaceOrderHook.ts' +export { placeOrderPatchMutationKey, placeOrderPatchHook, usePlaceOrderPatchHook } from './store/usePlaceOrderPatchHook.ts' +export { createUserMutationKey, createUserHook, useCreateUserHook } from './user/useCreateUserHook.ts' +export { createUsersWithListInputMutationKey, createUsersWithListInputHook, useCreateUsersWithListInputHook } from './user/useCreateUsersWithListInputHook.ts' +export { deleteUserMutationKey, deleteUserHook, useDeleteUserHook } from './user/useDeleteUserHook.ts' +export { getUserByNameQueryKey, getUserByNameHook, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './user/useGetUserByNameHook.ts' +export { + getUserByNameSuspenseQueryKey, + getUserByNameSuspenseHook, + getUserByNameSuspenseQueryOptionsHook, + useGetUserByNameSuspenseHook, +} from './user/useGetUserByNameSuspenseHook.ts' +export { loginUserQueryKey, loginUserHook, loginUserQueryOptionsHook, useLoginUserHook } from './user/useLoginUserHook.ts' +export { + loginUserSuspenseQueryKey, + loginUserSuspenseHook, + loginUserSuspenseQueryOptionsHook, + useLoginUserSuspenseHook, +} from './user/useLoginUserSuspenseHook.ts' +export { logoutUserQueryKey, logoutUserHook, logoutUserQueryOptionsHook, useLogoutUserHook } from './user/useLogoutUserHook.ts' +export { + logoutUserSuspenseQueryKey, + logoutUserSuspenseHook, + logoutUserSuspenseQueryOptionsHook, + useLogoutUserSuspenseHook, +} from './user/useLogoutUserSuspenseHook.ts' +export { updateUserMutationKey, updateUserHook, 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 216f4d5e3..fb1bb9a29 100644 --- a/examples/react-query/src/gen/hooks/pet/index.ts +++ b/examples/react-query/src/gen/hooks/pet/index.ts @@ -11,24 +11,41 @@ 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 { addPetMutationKey, addPetHook, useAddPetHook } from './useAddPetHook.ts' +export { deletePetMutationKey, deletePetHook, useDeletePetHook } from './useDeletePetHook.ts' +export { findPetsByStatusQueryKey, findPetsByStatusHook, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './useFindPetsByStatusHook.ts' export { findPetsByStatusSuspenseQueryKey, + findPetsByStatusSuspenseHook, 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 { findPetsByTagsQueryKey, findPetsByTagsHook, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './useFindPetsByTagsHook.ts' +export { + findPetsByTagsInfiniteQueryKey, + findPetsByTagsInfiniteHook, + findPetsByTagsInfiniteQueryOptionsHook, + useFindPetsByTagsInfiniteHook, +} from './useFindPetsByTagsInfiniteHook.ts' +export { + findPetsByTagsSuspenseQueryKey, + findPetsByTagsSuspenseHook, + findPetsByTagsSuspenseQueryOptionsHook, + useFindPetsByTagsSuspenseHook, +} from './useFindPetsByTagsSuspenseHook.ts' +export { getPetByIdQueryKey, getPetByIdHook, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './useGetPetByIdHook.ts' +export { + getPetByIdSuspenseQueryKey, + getPetByIdSuspenseHook, + getPetByIdSuspenseQueryOptionsHook, + useGetPetByIdSuspenseHook, +} from './useGetPetByIdSuspenseHook.ts' +export { updatePetMutationKey, updatePetHook, useUpdatePetHook } from './useUpdatePetHook.ts' +export { updatePetWithFormQueryKey, updatePetWithFormHook, updatePetWithFormQueryOptionsHook, useUpdatePetWithFormHook } from './useUpdatePetWithFormHook.ts' export { updatePetWithFormSuspenseQueryKey, + updatePetWithFormSuspenseHook, updatePetWithFormSuspenseQueryOptionsHook, useUpdatePetWithFormSuspenseHook, } from './useUpdatePetWithFormSuspenseHook.ts' -export { uploadFileMutationKey, useUploadFileHook } from './useUploadFileHook.ts' +export { uploadFileMutationKey, uploadFileHook, 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 7a135eec7..66a903d13 100644 --- a/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useAddPetHook.ts @@ -13,7 +13,7 @@ export type AddPetMutationKey = ReturnType * @summary Add a new pet to the store * {@link /pet} */ -async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { +export async function addPetHook(data: AddPetMutationRequest, config: Partial> = {}) { const res = await client, AddPetMutationRequest>({ method: 'POST', url: '/pet', data, ...config }) return res.data } @@ -34,7 +34,7 @@ export function useAddPetHook( return useMutation, { data: AddPetMutationRequest }>({ mutationFn: async ({ data }) => { - return addPet(data, config) + 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 85332042f..abfa0095c 100644 --- a/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useDeletePetHook.ts @@ -13,7 +13,11 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * {@link /pet/:pet_id} */ -async function deletePet({ pet_id }: { pet_id: DeletePetPathParams['pet_id'] }, headers?: DeletePetHeaderParams, config: Partial = {}) { +export async function deletePetHook( + { pet_id }: { pet_id: DeletePetPathParams['pet_id'] }, + headers?: DeletePetHeaderParams, + config: Partial = {}, +) { const res = await client, unknown>({ method: 'DELETE', url: `/pet/${pet_id}`, @@ -43,7 +47,7 @@ export function useDeletePetHook( return useMutation, { pet_id: DeletePetPathParams['pet_id']; headers?: DeletePetHeaderParams }>({ mutationFn: async ({ pet_id, headers }) => { - return deletePet({ pet_id }, headers, config) + 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 4251d871e..7cced29f1 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusHook.ts @@ -13,7 +13,7 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +export async function findPetsByStatusHook(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', @@ -29,7 +29,7 @@ export function findPetsByStatusQueryOptionsHook(params?: FindPetsByStatusQueryP queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByStatus(params, config) + return findPetsByStatusHook(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts index 1555e2f96..c668b597d 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByStatusSuspenseHook.ts @@ -14,7 +14,7 @@ export type FindPetsByStatusSuspenseQueryKey = ReturnType = {}) { +export async function findPetsByStatusSuspenseHook(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', @@ -30,7 +30,7 @@ export function findPetsByStatusSuspenseQueryOptionsHook(params?: FindPetsByStat queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByStatus(params, config) + return findPetsByStatusSuspenseHook(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts index 63d2674da..58e22b4b9 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsHook.ts @@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * {@link /pet/findByTags} */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +export async function findPetsByTagsHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', @@ -34,7 +34,7 @@ export function findPetsByTagsQueryOptionsHook(params?: FindPetsByTagsQueryParam queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByTags(params, config) + return findPetsByTagsHook(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts index f466b43ee..83153dc47 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsInfiniteHook.ts @@ -13,7 +13,7 @@ export type FindPetsByTagsInfiniteQueryKey = ReturnType = {}) { +export async function findPetsByTagsInfiniteHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', @@ -39,7 +39,7 @@ export function findPetsByTagsInfiniteQueryOptionsHook(params?: FindPetsByTagsQu if (params) { params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize'] } - return findPetsByTags(params, config) + return findPetsByTagsInfiniteHook(params, config) }, initialPageParam: 0, getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1), diff --git a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts index ba04ea746..692bdd727 100644 --- a/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useFindPetsByTagsSuspenseHook.ts @@ -13,7 +13,7 @@ export type FindPetsByTagsSuspenseQueryKey = ReturnType = {}) { +export async function findPetsByTagsSuspenseHook(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', @@ -34,7 +34,7 @@ export function findPetsByTagsSuspenseQueryOptionsHook(params?: FindPetsByTagsQu queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByTags(params, config) + return findPetsByTagsSuspenseHook(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts index 962fb49f2..dfb171c16 100644 --- a/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdHook.ts @@ -14,7 +14,7 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * {@link /pet/:pet_id} */ -async function get_pet_by_id({ pet_id }: { pet_id: GetPetByIdPathParams['pet_id'] }, config: Partial = {}) { +export async function getPetByIdHook({ pet_id }: { pet_id: GetPetByIdPathParams['pet_id'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${pet_id}`, @@ -30,7 +30,7 @@ export function getPetByIdQueryOptionsHook({ pet_id }: { pet_id: GetPetByIdPathP queryKey, queryFn: async ({ signal }) => { config.signal = signal - return get_pet_by_id({ pet_id }, config) + return getPetByIdHook({ pet_id }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts index fa760670e..b370b22a2 100644 --- a/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useGetPetByIdSuspenseHook.ts @@ -14,7 +14,7 @@ export type GetPetByIdSuspenseQueryKey = ReturnType = {}) { +export async function getPetByIdSuspenseHook({ pet_id }: { pet_id: GetPetByIdPathParams['pet_id'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${pet_id}`, @@ -30,7 +30,7 @@ export function getPetByIdSuspenseQueryOptionsHook({ pet_id }: { pet_id: GetPetB queryKey, queryFn: async ({ signal }) => { config.signal = signal - return get_pet_by_id({ pet_id }, config) + return getPetByIdSuspenseHook({ pet_id }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts index bd0735c73..7a556dca2 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetHook.ts @@ -13,7 +13,7 @@ export type UpdatePetMutationKey = ReturnType * @summary Update an existing pet * {@link /pet} */ -async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { +export async function updatePetHook(data: UpdatePetMutationRequest, config: Partial> = {}) { const res = await client, UpdatePetMutationRequest>({ method: 'PUT', url: '/pet', @@ -43,7 +43,7 @@ export function useUpdatePetHook( return useMutation, { data: UpdatePetMutationRequest }>({ mutationFn: async ({ data }) => { - return updatePet(data, config) + 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 99df07a55..2eb08220d 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormHook.ts @@ -18,7 +18,11 @@ export type UpdatePetWithFormQueryKey = ReturnType = {}) { +export async function updatePetWithFormHook( + pet_id: UpdatePetWithFormPathParams['pet_id'], + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { const res = await client, unknown>({ method: 'POST', url: `/pet/${pet_id}`, @@ -39,7 +43,7 @@ export function updatePetWithFormQueryOptionsHook( queryKey, queryFn: async ({ signal }) => { config.signal = signal - return updatePetWithForm(pet_id, params, config) + return updatePetWithFormHook(pet_id, params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts index e7fae478a..1afb1d561 100644 --- a/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUpdatePetWithFormSuspenseHook.ts @@ -18,7 +18,11 @@ export type UpdatePetWithFormSuspenseQueryKey = ReturnType = {}) { +export async function updatePetWithFormSuspenseHook( + pet_id: UpdatePetWithFormPathParams['pet_id'], + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { const res = await client, unknown>({ method: 'POST', url: `/pet/${pet_id}`, @@ -39,7 +43,7 @@ export function updatePetWithFormSuspenseQueryOptionsHook( queryKey, queryFn: async ({ signal }) => { config.signal = signal - return updatePetWithForm(pet_id, params, config) + return updatePetWithFormSuspenseHook(pet_id, params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts index 8de6fc0d0..43eae3999 100644 --- a/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts +++ b/examples/react-query/src/gen/hooks/pet/useUploadFileHook.ts @@ -12,7 +12,7 @@ export type UploadFileMutationKey = ReturnType * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -async function uploadFile( +export async function uploadFileHook( { petId }: { petId: UploadFilePathParams['petId'] }, data?: UploadFileMutationRequest, params?: UploadFileQueryParams, @@ -52,7 +52,7 @@ export function useUploadFileHook( { petId: UploadFilePathParams['petId']; data?: UploadFileMutationRequest; params?: UploadFileQueryParams } >({ mutationFn: async ({ petId, data, params }) => { - return uploadFile({ petId }, data, params, config) + 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 2856659e6..31b399755 100644 --- a/examples/react-query/src/gen/hooks/store/index.ts +++ b/examples/react-query/src/gen/hooks/store/index.ts @@ -5,10 +5,20 @@ export type { GetOrderByIdQueryKey } from './useGetOrderByIdHook.ts' export type { GetOrderByIdSuspenseQueryKey } from './useGetOrderByIdSuspenseHook.ts' export type { PlaceOrderMutationKey } from './usePlaceOrderHook.ts' export type { PlaceOrderPatchMutationKey } from './usePlaceOrderPatchHook.ts' -export { deleteOrderMutationKey, useDeleteOrderHook } from './useDeleteOrderHook.ts' -export { getInventoryQueryKey, getInventoryQueryOptionsHook } from './useGetInventoryHook.ts' -export { getInventorySuspenseQueryKey, getInventorySuspenseQueryOptionsHook, useGetInventorySuspenseHook } from './useGetInventorySuspenseHook.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './useGetOrderByIdHook.ts' -export { getOrderByIdSuspenseQueryKey, getOrderByIdSuspenseQueryOptionsHook, useGetOrderByIdSuspenseHook } from './useGetOrderByIdSuspenseHook.ts' -export { placeOrderMutationKey, usePlaceOrderHook } from './usePlaceOrderHook.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatchHook } from './usePlaceOrderPatchHook.ts' +export { deleteOrderMutationKey, deleteOrderHook, useDeleteOrderHook } from './useDeleteOrderHook.ts' +export { getInventoryQueryKey, getInventoryHook, getInventoryQueryOptionsHook } from './useGetInventoryHook.ts' +export { + getInventorySuspenseQueryKey, + getInventorySuspenseHook, + getInventorySuspenseQueryOptionsHook, + useGetInventorySuspenseHook, +} from './useGetInventorySuspenseHook.ts' +export { getOrderByIdQueryKey, getOrderByIdHook, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './useGetOrderByIdHook.ts' +export { + getOrderByIdSuspenseQueryKey, + getOrderByIdSuspenseHook, + getOrderByIdSuspenseQueryOptionsHook, + useGetOrderByIdSuspenseHook, +} from './useGetOrderByIdSuspenseHook.ts' +export { placeOrderMutationKey, placeOrderHook, usePlaceOrderHook } from './usePlaceOrderHook.ts' +export { placeOrderPatchMutationKey, placeOrderPatchHook, 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 6e7d9b57a..544fbea25 100644 --- a/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/useDeleteOrderHook.ts @@ -13,7 +13,7 @@ export type DeleteOrderMutationKey = ReturnType * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -async function deleteOrder({ orderId }: { orderId: DeleteOrderPathParams['orderId'] }, config: Partial = {}) { +export async function deleteOrderHook({ orderId }: { orderId: DeleteOrderPathParams['orderId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/store/order/${orderId}`, @@ -42,7 +42,7 @@ export function useDeleteOrderHook( return useMutation, { orderId: DeleteOrderPathParams['orderId'] }>({ mutationFn: async ({ orderId }) => { - return deleteOrder({ orderId }, config) + 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 f3b4316b0..3009af8e4 100644 --- a/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventoryHook.ts @@ -12,7 +12,7 @@ export type GetInventoryQueryKey = ReturnType * @summary Returns pet inventories by status * {@link /store/inventory} */ -async function getInventory(config: Partial = {}) { +export async function getInventoryHook(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } @@ -23,7 +23,7 @@ export function getInventoryQueryOptionsHook(config: Partial = {} queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getInventory(config) + 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 42e3dacf9..efce461ac 100644 --- a/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetInventorySuspenseHook.ts @@ -13,7 +13,7 @@ export type GetInventorySuspenseQueryKey = ReturnType = {}) { +export async function getInventorySuspenseHook(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } @@ -24,7 +24,7 @@ export function getInventorySuspenseQueryOptionsHook(config: Partial { config.signal = signal - return getInventory(config) + return getInventorySuspenseHook(config) }, }) } diff --git a/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts index e2d628224..0fa3beea7 100644 --- a/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdHook.ts @@ -14,7 +14,7 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderById({ orderId }: { orderId: GetOrderByIdPathParams['orderId'] }, config: Partial = {}) { +export async function getOrderByIdHook({ orderId }: { orderId: GetOrderByIdPathParams['orderId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, @@ -30,7 +30,7 @@ export function getOrderByIdQueryOptionsHook({ orderId }: { orderId: GetOrderByI queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getOrderById({ orderId }, config) + return getOrderByIdHook({ orderId }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts index bbf01c4de..584ea6626 100644 --- a/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/store/useGetOrderByIdSuspenseHook.ts @@ -14,7 +14,7 @@ export type GetOrderByIdSuspenseQueryKey = ReturnType = {}) { +export async function getOrderByIdSuspenseHook({ orderId }: { orderId: GetOrderByIdPathParams['orderId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, @@ -30,7 +30,7 @@ export function getOrderByIdSuspenseQueryOptionsHook({ orderId }: { orderId: Get queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getOrderById({ orderId }, config) + return getOrderByIdSuspenseHook({ orderId }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts index e03b3feba..2e459d991 100644 --- a/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderHook.ts @@ -13,7 +13,7 @@ export type PlaceOrderMutationKey = ReturnType * @summary Place an order for a pet * {@link /store/order} */ -async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { +export async function placeOrderHook(data?: PlaceOrderMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderMutationRequest>({ method: 'POST', url: '/store/order', @@ -39,7 +39,7 @@ export function usePlaceOrderHook( return useMutation, { data?: PlaceOrderMutationRequest }>({ mutationFn: async ({ data }) => { - return placeOrder(data, config) + 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 b3739a84e..5e93e00f4 100644 --- a/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts +++ b/examples/react-query/src/gen/hooks/store/usePlaceOrderPatchHook.ts @@ -13,7 +13,7 @@ export type PlaceOrderPatchMutationKey = ReturnType> = {}) { +export async function placeOrderPatchHook(data?: PlaceOrderPatchMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderPatchMutationRequest>({ method: 'PATCH', url: '/store/order', @@ -39,7 +39,7 @@ export function usePlaceOrderPatchHook( return useMutation, { data?: PlaceOrderPatchMutationRequest }>({ mutationFn: async ({ data }) => { - return placeOrderPatch(data, config) + 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 6988fc7a3..ff4bffb1d 100644 --- a/examples/react-query/src/gen/hooks/user/index.ts +++ b/examples/react-query/src/gen/hooks/user/index.ts @@ -8,13 +8,23 @@ export type { LoginUserSuspenseQueryKey } from './useLoginUserSuspenseHook.ts' export type { LogoutUserQueryKey } from './useLogoutUserHook.ts' export type { LogoutUserSuspenseQueryKey } from './useLogoutUserSuspenseHook.ts' export type { UpdateUserMutationKey } from './useUpdateUserHook.ts' -export { createUserMutationKey, useCreateUserHook } from './useCreateUserHook.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInputHook } from './useCreateUsersWithListInputHook.ts' -export { deleteUserMutationKey, useDeleteUserHook } from './useDeleteUserHook.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './useGetUserByNameHook.ts' -export { getUserByNameSuspenseQueryKey, getUserByNameSuspenseQueryOptionsHook, useGetUserByNameSuspenseHook } from './useGetUserByNameSuspenseHook.ts' -export { loginUserQueryKey, loginUserQueryOptionsHook, useLoginUserHook } from './useLoginUserHook.ts' -export { loginUserSuspenseQueryKey, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './useLoginUserSuspenseHook.ts' -export { logoutUserQueryKey, logoutUserQueryOptionsHook, useLogoutUserHook } from './useLogoutUserHook.ts' -export { logoutUserSuspenseQueryKey, logoutUserSuspenseQueryOptionsHook, useLogoutUserSuspenseHook } from './useLogoutUserSuspenseHook.ts' -export { updateUserMutationKey, useUpdateUserHook } from './useUpdateUserHook.ts' +export { createUserMutationKey, createUserHook, useCreateUserHook } from './useCreateUserHook.ts' +export { createUsersWithListInputMutationKey, createUsersWithListInputHook, useCreateUsersWithListInputHook } from './useCreateUsersWithListInputHook.ts' +export { deleteUserMutationKey, deleteUserHook, useDeleteUserHook } from './useDeleteUserHook.ts' +export { getUserByNameQueryKey, getUserByNameHook, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './useGetUserByNameHook.ts' +export { + getUserByNameSuspenseQueryKey, + getUserByNameSuspenseHook, + getUserByNameSuspenseQueryOptionsHook, + useGetUserByNameSuspenseHook, +} from './useGetUserByNameSuspenseHook.ts' +export { loginUserQueryKey, loginUserHook, loginUserQueryOptionsHook, useLoginUserHook } from './useLoginUserHook.ts' +export { loginUserSuspenseQueryKey, loginUserSuspenseHook, loginUserSuspenseQueryOptionsHook, useLoginUserSuspenseHook } from './useLoginUserSuspenseHook.ts' +export { logoutUserQueryKey, logoutUserHook, logoutUserQueryOptionsHook, useLogoutUserHook } from './useLogoutUserHook.ts' +export { + logoutUserSuspenseQueryKey, + logoutUserSuspenseHook, + logoutUserSuspenseQueryOptionsHook, + useLogoutUserSuspenseHook, +} from './useLogoutUserSuspenseHook.ts' +export { updateUserMutationKey, updateUserHook, 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 e7bb327df..4b78e395d 100644 --- a/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUserHook.ts @@ -13,7 +13,7 @@ export type CreateUserMutationKey = ReturnType * @summary Create user * {@link /user} */ -async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { +export async function createUserHook(data?: CreateUserMutationRequest, config: Partial> = {}) { const res = await client, CreateUserMutationRequest>({ method: 'POST', url: '/user', data, ...config }) return res.data } @@ -34,7 +34,7 @@ export function useCreateUserHook( return useMutation, { data?: CreateUserMutationRequest }>({ mutationFn: async ({ data }) => { - return createUser(data, config) + 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 d276669ca..7b2471cb1 100644 --- a/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts +++ b/examples/react-query/src/gen/hooks/user/useCreateUsersWithListInputHook.ts @@ -13,7 +13,7 @@ export type CreateUsersWithListInputMutationKey = ReturnType> = {}, ) { @@ -42,7 +42,7 @@ export function useCreateUsersWithListInputHook( return useMutation, { data?: CreateUsersWithListInputMutationRequest }>({ mutationFn: async ({ data }) => { - return createUsersWithListInput(data, config) + 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 4e897d04f..fd7293b61 100644 --- a/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useDeleteUserHook.ts @@ -13,7 +13,7 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * {@link /user/:username} */ -async function deleteUser({ username }: { username: DeleteUserPathParams['username'] }, config: Partial = {}) { +export async function deleteUserHook({ username }: { username: DeleteUserPathParams['username'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/user/${username}`, @@ -42,7 +42,7 @@ export function useDeleteUserHook( return useMutation, { username: DeleteUserPathParams['username'] }>({ mutationFn: async ({ username }) => { - return deleteUser({ username }, config) + 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 696699e11..b00ad1517 100644 --- a/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameHook.ts @@ -13,7 +13,7 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * {@link /user/:username} */ -async function getUserByName({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { +export async function getUserByNameHook({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, @@ -29,7 +29,7 @@ export function getUserByNameQueryOptionsHook({ username }: { username: GetUserB queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getUserByName({ username }, config) + return getUserByNameHook({ username }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts index 86f8f8e6f..8afc815ed 100644 --- a/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useGetUserByNameSuspenseHook.ts @@ -13,7 +13,7 @@ export type GetUserByNameSuspenseQueryKey = ReturnType = {}) { +export async function getUserByNameSuspenseHook({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, @@ -29,7 +29,7 @@ export function getUserByNameSuspenseQueryOptionsHook({ username }: { username: queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getUserByName({ username }, config) + return getUserByNameSuspenseHook({ username }, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts index 082aa08dd..a5477c5c0 100644 --- a/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserHook.ts @@ -12,7 +12,7 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * {@link /user/login} */ -async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +export async function loginUserHook(params?: LoginUserQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } @@ -23,7 +23,7 @@ export function loginUserQueryOptionsHook(params?: LoginUserQueryParams, config: queryKey, queryFn: async ({ signal }) => { config.signal = signal - return loginUser(params, config) + return loginUserHook(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts index 330591eb3..e934f3dac 100644 --- a/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLoginUserSuspenseHook.ts @@ -12,7 +12,7 @@ export type LoginUserSuspenseQueryKey = ReturnType = {}) { +export async function loginUserSuspenseHook(params?: LoginUserQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } @@ -23,7 +23,7 @@ export function loginUserSuspenseQueryOptionsHook(params?: LoginUserQueryParams, queryKey, queryFn: async ({ signal }) => { config.signal = signal - return loginUser(params, config) + return loginUserSuspenseHook(params, config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts index e65520825..d5b3de355 100644 --- a/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserHook.ts @@ -12,7 +12,7 @@ export type LogoutUserQueryKey = ReturnType * @summary Logs out current logged in user session * {@link /user/logout} */ -async function logoutUser(config: Partial = {}) { +export async function logoutUserHook(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } @@ -23,7 +23,7 @@ export function logoutUserQueryOptionsHook(config: Partial = {}) queryKey, queryFn: async ({ signal }) => { config.signal = signal - return logoutUser(config) + return logoutUserHook(config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts index 116942c71..dbf06d36a 100644 --- a/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/user/useLogoutUserSuspenseHook.ts @@ -12,7 +12,7 @@ export type LogoutUserSuspenseQueryKey = ReturnType = {}) { +export async function logoutUserSuspenseHook(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } @@ -23,7 +23,7 @@ export function logoutUserSuspenseQueryOptionsHook(config: Partial { config.signal = signal - return logoutUser(config) + return logoutUserSuspenseHook(config) }, }) } diff --git a/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts index b54272b81..3ac0e2670 100644 --- a/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts +++ b/examples/react-query/src/gen/hooks/user/useUpdateUserHook.ts @@ -13,7 +13,7 @@ export type UpdateUserMutationKey = ReturnType * @summary Update user * {@link /user/:username} */ -async function updateUser( +export async function updateUserHook( { username }: { username: UpdateUserPathParams['username'] }, data?: UpdateUserMutationRequest, config: Partial> = {}, @@ -47,7 +47,7 @@ export function useUpdateUserHook( return useMutation, { username: UpdateUserPathParams['username']; data?: UpdateUserMutationRequest }>({ mutationFn: async ({ username, data }) => { - return updateUser({ username }, data, config) + 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 index 17f6a3417..0483557c6 100644 --- a/examples/react-query/src/gen/index.ts +++ b/examples/react-query/src/gen/index.ts @@ -119,56 +119,100 @@ export type { } from './models/UploadFile.ts' export type { User } from './models/User.ts' export type { UserArray } from './models/UserArray.ts' -export { addPetMutationKey, useAddPetHook } from './hooks/pet/useAddPetHook.ts' -export { deletePetMutationKey, useDeletePetHook } from './hooks/pet/useDeletePetHook.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptionsHook, useFindPetsByStatusHook } from './hooks/pet/useFindPetsByStatusHook.ts' +export { addPetMutationKey, addPetHook, useAddPetHook } from './hooks/pet/useAddPetHook.ts' +export { deletePetMutationKey, deletePetHook, useDeletePetHook } from './hooks/pet/useDeletePetHook.ts' +export { + findPetsByStatusQueryKey, + findPetsByStatusHook, + findPetsByStatusQueryOptionsHook, + useFindPetsByStatusHook, +} from './hooks/pet/useFindPetsByStatusHook.ts' export { findPetsByStatusSuspenseQueryKey, + findPetsByStatusSuspenseHook, findPetsByStatusSuspenseQueryOptionsHook, useFindPetsByStatusSuspenseHook, } from './hooks/pet/useFindPetsByStatusSuspenseHook.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './hooks/pet/useFindPetsByTagsHook.ts' +export { findPetsByTagsQueryKey, findPetsByTagsHook, findPetsByTagsQueryOptionsHook, useFindPetsByTagsHook } from './hooks/pet/useFindPetsByTagsHook.ts' export { findPetsByTagsInfiniteQueryKey, + findPetsByTagsInfiniteHook, findPetsByTagsInfiniteQueryOptionsHook, useFindPetsByTagsInfiniteHook, } from './hooks/pet/useFindPetsByTagsInfiniteHook.ts' export { findPetsByTagsSuspenseQueryKey, + findPetsByTagsSuspenseHook, 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 { getPetByIdQueryKey, getPetByIdHook, getPetByIdQueryOptionsHook, useGetPetByIdHook } from './hooks/pet/useGetPetByIdHook.ts' +export { + getPetByIdSuspenseQueryKey, + getPetByIdSuspenseHook, + getPetByIdSuspenseQueryOptionsHook, + useGetPetByIdSuspenseHook, +} from './hooks/pet/useGetPetByIdSuspenseHook.ts' +export { updatePetMutationKey, updatePetHook, useUpdatePetHook } from './hooks/pet/useUpdatePetHook.ts' +export { + updatePetWithFormQueryKey, + updatePetWithFormHook, + updatePetWithFormQueryOptionsHook, + useUpdatePetWithFormHook, +} from './hooks/pet/useUpdatePetWithFormHook.ts' export { updatePetWithFormSuspenseQueryKey, + updatePetWithFormSuspenseHook, 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 { uploadFileMutationKey, uploadFileHook, useUploadFileHook } from './hooks/pet/useUploadFileHook.ts' +export { deleteOrderMutationKey, deleteOrderHook, useDeleteOrderHook } from './hooks/store/useDeleteOrderHook.ts' +export { getInventoryQueryKey, getInventoryHook, getInventoryQueryOptionsHook } from './hooks/store/useGetInventoryHook.ts' +export { + getInventorySuspenseQueryKey, + getInventorySuspenseHook, + getInventorySuspenseQueryOptionsHook, + useGetInventorySuspenseHook, +} from './hooks/store/useGetInventorySuspenseHook.ts' +export { getOrderByIdQueryKey, getOrderByIdHook, getOrderByIdQueryOptionsHook, useGetOrderByIdHook } from './hooks/store/useGetOrderByIdHook.ts' +export { + getOrderByIdSuspenseQueryKey, + getOrderByIdSuspenseHook, + getOrderByIdSuspenseQueryOptionsHook, + useGetOrderByIdSuspenseHook, +} from './hooks/store/useGetOrderByIdSuspenseHook.ts' +export { placeOrderMutationKey, placeOrderHook, usePlaceOrderHook } from './hooks/store/usePlaceOrderHook.ts' +export { placeOrderPatchMutationKey, placeOrderPatchHook, usePlaceOrderPatchHook } from './hooks/store/usePlaceOrderPatchHook.ts' +export { createUserMutationKey, createUserHook, useCreateUserHook } from './hooks/user/useCreateUserHook.ts' +export { + createUsersWithListInputMutationKey, + createUsersWithListInputHook, + useCreateUsersWithListInputHook, +} from './hooks/user/useCreateUsersWithListInputHook.ts' +export { deleteUserMutationKey, deleteUserHook, useDeleteUserHook } from './hooks/user/useDeleteUserHook.ts' +export { getUserByNameQueryKey, getUserByNameHook, getUserByNameQueryOptionsHook, useGetUserByNameHook } from './hooks/user/useGetUserByNameHook.ts' export { getUserByNameSuspenseQueryKey, + getUserByNameSuspenseHook, 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 { loginUserQueryKey, loginUserHook, loginUserQueryOptionsHook, useLoginUserHook } from './hooks/user/useLoginUserHook.ts' +export { + loginUserSuspenseQueryKey, + loginUserSuspenseHook, + loginUserSuspenseQueryOptionsHook, + useLoginUserSuspenseHook, +} from './hooks/user/useLoginUserSuspenseHook.ts' +export { logoutUserQueryKey, logoutUserHook, logoutUserQueryOptionsHook, useLogoutUserHook } from './hooks/user/useLogoutUserHook.ts' +export { + logoutUserSuspenseQueryKey, + logoutUserSuspenseHook, + logoutUserSuspenseQueryOptionsHook, + useLogoutUserSuspenseHook, +} from './hooks/user/useLogoutUserSuspenseHook.ts' +export { updateUserMutationKey, updateUserHook, useUpdateUserHook } from './hooks/user/useUpdateUserHook.ts' export { addPetRequestStatusEnum } from './models/AddPetRequest.ts' export { findPetsByStatusQueryParamsStatusEnum } from './models/FindPetsByStatus.ts' export { orderStatusEnum, orderHttpStatusEnum } from './models/Order.ts' diff --git a/examples/simple-single/src/gen/hooks.ts b/examples/simple-single/src/gen/hooks.ts index 21dbb6d1a..d7b5c5a32 100644 --- a/examples/simple-single/src/gen/hooks.ts +++ b/examples/simple-single/src/gen/hooks.ts @@ -78,7 +78,7 @@ export type UpdatePetMutationKey = ReturnType * @summary Update an existing pet * {@link /pet} */ -async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { +export async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { const res = await client, UpdatePetMutationRequest>({ method: 'PUT', url: '/pet', @@ -124,7 +124,7 @@ export type AddPetMutationKey = ReturnType * @summary Add a new pet to the store * {@link /pet} */ -async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { +export async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { const res = await client, AddPetMutationRequest>({ method: 'POST', url: '/pet', data, ...config }) return res.data } @@ -161,7 +161,7 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', @@ -216,13 +216,28 @@ export const findPetsByStatusSuspenseQueryKey = (params?: FindPetsByStatusQueryP export type FindPetsByStatusSuspenseQueryKey = ReturnType +/** + * @description Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * {@link /pet/findByStatus} + */ +export async function findPetsByStatusSuspense(params?: FindPetsByStatusQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: '/pet/findByStatus', + params, + ...config, + }) + return res.data +} + export function findPetsByStatusSuspenseQueryOptions(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const queryKey = findPetsByStatusSuspenseQueryKey(params) return queryOptions, FindPetsByStatusQueryResponse, typeof queryKey>({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByStatus(params, config) + return findPetsByStatusSuspense(params, config) }, }) } @@ -266,7 +281,7 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * {@link /pet/findByTags} */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', @@ -321,13 +336,28 @@ export const findPetsByTagsSuspenseQueryKey = (params?: FindPetsByTagsQueryParam 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} + */ +export async function findPetsByTagsSuspense(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: '/pet/findByTags', + params, + ...config, + }) + return res.data +} + export function findPetsByTagsSuspenseQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsSuspenseQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByTags(params, config) + return findPetsByTagsSuspense(params, config) }, }) } @@ -371,7 +401,7 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * {@link /pet/:petId} */ -async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { +export async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${petId}`, @@ -422,6 +452,20 @@ export const getPetByIdSuspenseQueryKey = (petId: GetPetByIdPathParams['petId']) export type GetPetByIdSuspenseQueryKey = ReturnType +/** + * @description Returns a single pet + * @summary Find pet by ID + * {@link /pet/:petId} + */ +export async function getPetByIdSuspense(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/${petId}`, + ...config, + }) + return res.data +} + export function getPetByIdSuspenseQueryOptions(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { const queryKey = getPetByIdSuspenseQueryKey(petId) return queryOptions, GetPetByIdQueryResponse, typeof queryKey>({ @@ -429,7 +473,7 @@ export function getPetByIdSuspenseQueryOptions(petId: GetPetByIdPathParams['petI queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getPetById(petId, config) + return getPetByIdSuspense(petId, config) }, }) } @@ -472,7 +516,11 @@ export type UpdatePetWithFormMutationKey = ReturnType = {}) { +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { const res = await client, unknown>({ method: 'POST', url: `/pet/${petId}`, @@ -521,7 +569,7 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * {@link /pet/:petId} */ -async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial = {}) { +export async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/pet/${petId}`, @@ -566,7 +614,7 @@ export type UploadFileMutationKey = ReturnType * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -async function uploadFile( +export async function uploadFile( petId: UploadFilePathParams['petId'], data?: UploadFileMutationRequest, params?: UploadFileQueryParams, @@ -622,7 +670,7 @@ export type GetInventoryQueryKey = ReturnType * @summary Returns pet inventories by status * {@link /store/inventory} */ -async function getInventory(config: Partial = {}) { +export async function getInventory(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } @@ -667,13 +715,23 @@ export const getInventorySuspenseQueryKey = () => [{ url: '/store/inventory' }] export type GetInventorySuspenseQueryKey = ReturnType +/** + * @description Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * {@link /store/inventory} + */ +export async function getInventorySuspense(config: Partial = {}) { + const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) + return res.data +} + export function getInventorySuspenseQueryOptions(config: Partial = {}) { const queryKey = getInventorySuspenseQueryKey() return queryOptions, GetInventoryQueryResponse, typeof queryKey>({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getInventory(config) + return getInventorySuspense(config) }, }) } @@ -716,7 +774,7 @@ export type PlaceOrderMutationKey = ReturnType * @summary Place an order for a pet * {@link /store/order} */ -async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { +export async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderMutationRequest>({ method: 'POST', url: '/store/order', @@ -758,7 +816,7 @@ export type PlaceOrderPatchMutationKey = ReturnType> = {}) { +export async function placeOrderPatch(data?: PlaceOrderPatchMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderPatchMutationRequest>({ method: 'PATCH', url: '/store/order', @@ -800,7 +858,7 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { +export async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, @@ -852,6 +910,20 @@ export const getOrderByIdSuspenseQueryKey = (orderId: GetOrderByIdPathParams['or 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} + */ +export async function getOrderByIdSuspense(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/store/order/${orderId}`, + ...config, + }) + return res.data +} + export function getOrderByIdSuspenseQueryOptions(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { const queryKey = getOrderByIdSuspenseQueryKey(orderId) return queryOptions, GetOrderByIdQueryResponse, typeof queryKey>({ @@ -859,7 +931,7 @@ export function getOrderByIdSuspenseQueryOptions(orderId: GetOrderByIdPathParams queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getOrderById(orderId, config) + return getOrderByIdSuspense(orderId, config) }, }) } @@ -903,7 +975,7 @@ export type DeleteOrderMutationKey = ReturnType * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial = {}) { +export async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/store/order/${orderId}`, @@ -948,7 +1020,7 @@ export type CreateUserMutationKey = ReturnType * @summary Create user * {@link /user} */ -async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { +export async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { const res = await client, CreateUserMutationRequest>({ method: 'POST', url: '/user', data, ...config }) return res.data } @@ -985,7 +1057,7 @@ export type CreateUsersWithListInputMutationKey = ReturnType> = {}, ) { @@ -1029,7 +1101,7 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * {@link /user/login} */ -async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +export async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } @@ -1074,13 +1146,22 @@ export const loginUserSuspenseQueryKey = (params?: LoginUserQueryParams) => [{ u export type LoginUserSuspenseQueryKey = ReturnType +/** + * @summary Logs user into the system + * {@link /user/login} + */ +export async function loginUserSuspense(params?: LoginUserQueryParams, config: Partial = {}) { + const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) + return res.data +} + export function loginUserSuspenseQueryOptions(params?: LoginUserQueryParams, config: Partial = {}) { const queryKey = loginUserSuspenseQueryKey(params) return queryOptions, LoginUserQueryResponse, typeof queryKey>({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return loginUser(params, config) + return loginUserSuspense(params, config) }, }) } @@ -1122,7 +1203,7 @@ export type LogoutUserQueryKey = ReturnType * @summary Logs out current logged in user session * {@link /user/logout} */ -async function logoutUser(config: Partial = {}) { +export async function logoutUser(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } @@ -1166,13 +1247,22 @@ export const logoutUserSuspenseQueryKey = () => [{ url: '/user/logout' }] as con export type LogoutUserSuspenseQueryKey = ReturnType +/** + * @summary Logs out current logged in user session + * {@link /user/logout} + */ +export async function logoutUserSuspense(config: Partial = {}) { + const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) + return res.data +} + export function logoutUserSuspenseQueryOptions(config: Partial = {}) { const queryKey = logoutUserSuspenseQueryKey() return queryOptions, LogoutUserQueryResponse, typeof queryKey>({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return logoutUser(config) + return logoutUserSuspense(config) }, }) } @@ -1213,7 +1303,7 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * {@link /user/:username} */ -async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { +export async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, @@ -1268,6 +1358,19 @@ export const getUserByNameSuspenseQueryKey = (username: GetUserByNamePathParams[ export type GetUserByNameSuspenseQueryKey = ReturnType +/** + * @summary Get user by user name + * {@link /user/:username} + */ +export async function getUserByNameSuspense(username: GetUserByNamePathParams['username'], config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/user/${username}`, + ...config, + }) + return res.data +} + export function getUserByNameSuspenseQueryOptions(username: GetUserByNamePathParams['username'], config: Partial = {}) { const queryKey = getUserByNameSuspenseQueryKey(username) return queryOptions, GetUserByNameQueryResponse, typeof queryKey>({ @@ -1275,7 +1378,7 @@ export function getUserByNameSuspenseQueryOptions(username: GetUserByNamePathPar queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getUserByName(username, config) + return getUserByNameSuspense(username, config) }, }) } @@ -1318,7 +1421,7 @@ export type UpdateUserMutationKey = ReturnType * @summary Update user * {@link /user/:username} */ -async function updateUser( +export async function updateUser( username: UpdateUserPathParams['username'], data?: UpdateUserMutationRequest, config: Partial> = {}, @@ -1368,7 +1471,7 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * {@link /user/:username} */ -async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { +export async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/user/${username}`, diff --git a/examples/solid-query/src/gen/hooks/createFindPetsByStatus.ts b/examples/solid-query/src/gen/hooks/createFindPetsByStatus.ts index ca37a94a1..f4a933673 100644 --- a/examples/solid-query/src/gen/hooks/createFindPetsByStatus.ts +++ b/examples/solid-query/src/gen/hooks/createFindPetsByStatus.ts @@ -12,7 +12,7 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', diff --git a/examples/solid-query/src/gen/hooks/createFindPetsByTags.ts b/examples/solid-query/src/gen/hooks/createFindPetsByTags.ts index c708faec5..403bbe4bb 100644 --- a/examples/solid-query/src/gen/hooks/createFindPetsByTags.ts +++ b/examples/solid-query/src/gen/hooks/createFindPetsByTags.ts @@ -12,7 +12,7 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * {@link /pet/findByTags} */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', diff --git a/examples/solid-query/src/gen/hooks/createGetInventory.ts b/examples/solid-query/src/gen/hooks/createGetInventory.ts index 8b90b4b27..2585652bc 100644 --- a/examples/solid-query/src/gen/hooks/createGetInventory.ts +++ b/examples/solid-query/src/gen/hooks/createGetInventory.ts @@ -12,7 +12,7 @@ export type GetInventoryQueryKey = ReturnType * @summary Returns pet inventories by status * {@link /store/inventory} */ -async function getInventory(config: Partial = {}) { +export async function getInventory(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } diff --git a/examples/solid-query/src/gen/hooks/createGetOrderById.ts b/examples/solid-query/src/gen/hooks/createGetOrderById.ts index 9338ab372..dfe333d19 100644 --- a/examples/solid-query/src/gen/hooks/createGetOrderById.ts +++ b/examples/solid-query/src/gen/hooks/createGetOrderById.ts @@ -12,7 +12,7 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { +export async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, diff --git a/examples/solid-query/src/gen/hooks/createGetPetById.ts b/examples/solid-query/src/gen/hooks/createGetPetById.ts index f27be18d8..3761887e3 100644 --- a/examples/solid-query/src/gen/hooks/createGetPetById.ts +++ b/examples/solid-query/src/gen/hooks/createGetPetById.ts @@ -12,7 +12,7 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * {@link /pet/:petId} */ -async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { +export async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${petId}`, diff --git a/examples/solid-query/src/gen/hooks/createGetUserByName.ts b/examples/solid-query/src/gen/hooks/createGetUserByName.ts index 74b94490e..ce7ec3478 100644 --- a/examples/solid-query/src/gen/hooks/createGetUserByName.ts +++ b/examples/solid-query/src/gen/hooks/createGetUserByName.ts @@ -11,7 +11,7 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * {@link /user/:username} */ -async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { +export async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, diff --git a/examples/solid-query/src/gen/hooks/createLoginUser.ts b/examples/solid-query/src/gen/hooks/createLoginUser.ts index fbb8dab79..18f807c42 100644 --- a/examples/solid-query/src/gen/hooks/createLoginUser.ts +++ b/examples/solid-query/src/gen/hooks/createLoginUser.ts @@ -11,7 +11,7 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * {@link /user/login} */ -async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +export async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } diff --git a/examples/solid-query/src/gen/hooks/createLogoutUser.ts b/examples/solid-query/src/gen/hooks/createLogoutUser.ts index 97dee6d0c..82dc037da 100644 --- a/examples/solid-query/src/gen/hooks/createLogoutUser.ts +++ b/examples/solid-query/src/gen/hooks/createLogoutUser.ts @@ -11,7 +11,7 @@ export type LogoutUserQueryKey = ReturnType * @summary Logs out current logged in user session * {@link /user/logout} */ -async function logoutUser(config: Partial = {}) { +export async function logoutUser(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } diff --git a/examples/solid-query/src/gen/hooks/createUpdatePetWithForm.ts b/examples/solid-query/src/gen/hooks/createUpdatePetWithForm.ts index 6897fb80e..1486ef32b 100644 --- a/examples/solid-query/src/gen/hooks/createUpdatePetWithForm.ts +++ b/examples/solid-query/src/gen/hooks/createUpdatePetWithForm.ts @@ -18,7 +18,11 @@ export type UpdatePetWithFormQueryKey = ReturnType = {}) { +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { const res = await client, unknown>({ method: 'POST', url: `/pet/${petId}`, diff --git a/examples/solid-query/src/gen/hooks/index.ts b/examples/solid-query/src/gen/hooks/index.ts index 4616de452..a24d0a1df 100644 --- a/examples/solid-query/src/gen/hooks/index.ts +++ b/examples/solid-query/src/gen/hooks/index.ts @@ -7,12 +7,12 @@ export type { GetUserByNameQueryKey } from './createGetUserByName.ts' export type { LoginUserQueryKey } from './createLoginUser.ts' export type { LogoutUserQueryKey } from './createLogoutUser.ts' export type { UpdatePetWithFormQueryKey } from './createUpdatePetWithForm.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions } from './createFindPetsByStatus.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions } from './createFindPetsByTags.ts' -export { getInventoryQueryKey, getInventoryQueryOptions } from './createGetInventory.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions } from './createGetOrderById.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptions } from './createGetPetById.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptions } from './createGetUserByName.ts' -export { loginUserQueryKey, loginUserQueryOptions } from './createLoginUser.ts' -export { logoutUserQueryKey, logoutUserQueryOptions } from './createLogoutUser.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptions, createUpdatePetWithForm } from './createUpdatePetWithForm.ts' +export { findPetsByStatusQueryKey, findPetsByStatus, findPetsByStatusQueryOptions } from './createFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTags, findPetsByTagsQueryOptions } from './createFindPetsByTags.ts' +export { getInventoryQueryKey, getInventory, getInventoryQueryOptions } from './createGetInventory.ts' +export { getOrderByIdQueryKey, getOrderById, getOrderByIdQueryOptions } from './createGetOrderById.ts' +export { getPetByIdQueryKey, getPetById, getPetByIdQueryOptions } from './createGetPetById.ts' +export { getUserByNameQueryKey, getUserByName, getUserByNameQueryOptions } from './createGetUserByName.ts' +export { loginUserQueryKey, loginUser, loginUserQueryOptions } from './createLoginUser.ts' +export { logoutUserQueryKey, logoutUser, logoutUserQueryOptions } from './createLogoutUser.ts' +export { updatePetWithFormQueryKey, updatePetWithForm, updatePetWithFormQueryOptions, createUpdatePetWithForm } from './createUpdatePetWithForm.ts' diff --git a/examples/solid-query/src/gen/index.ts b/examples/solid-query/src/gen/index.ts index 0547d23d0..41ecd0d9f 100644 --- a/examples/solid-query/src/gen/index.ts +++ b/examples/solid-query/src/gen/index.ts @@ -98,15 +98,15 @@ export type { } from './models/UploadFile.ts' export type { User } from './models/User.ts' export type { UserArray } from './models/UserArray.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions } from './hooks/createFindPetsByStatus.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions } from './hooks/createFindPetsByTags.ts' -export { getInventoryQueryKey, getInventoryQueryOptions } from './hooks/createGetInventory.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions } from './hooks/createGetOrderById.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptions } from './hooks/createGetPetById.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptions } from './hooks/createGetUserByName.ts' -export { loginUserQueryKey, loginUserQueryOptions } from './hooks/createLoginUser.ts' -export { logoutUserQueryKey, logoutUserQueryOptions } from './hooks/createLogoutUser.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptions, createUpdatePetWithForm } from './hooks/createUpdatePetWithForm.ts' +export { findPetsByStatusQueryKey, findPetsByStatus, findPetsByStatusQueryOptions } from './hooks/createFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTags, findPetsByTagsQueryOptions } from './hooks/createFindPetsByTags.ts' +export { getInventoryQueryKey, getInventory, getInventoryQueryOptions } from './hooks/createGetInventory.ts' +export { getOrderByIdQueryKey, getOrderById, getOrderByIdQueryOptions } from './hooks/createGetOrderById.ts' +export { getPetByIdQueryKey, getPetById, getPetByIdQueryOptions } from './hooks/createGetPetById.ts' +export { getUserByNameQueryKey, getUserByName, getUserByNameQueryOptions } from './hooks/createGetUserByName.ts' +export { loginUserQueryKey, loginUser, loginUserQueryOptions } from './hooks/createLoginUser.ts' +export { logoutUserQueryKey, logoutUser, logoutUserQueryOptions } from './hooks/createLogoutUser.ts' +export { updatePetWithFormQueryKey, updatePetWithForm, updatePetWithFormQueryOptions, createUpdatePetWithForm } from './hooks/createUpdatePetWithForm.ts' export { addPetRequestStatusEnum } from './models/AddPetRequest.ts' export { findPetsByStatusQueryParamsStatusEnum } from './models/FindPetsByStatus.ts' export { orderStatusEnum, orderHttpStatusEnum } from './models/Order.ts' diff --git a/examples/svelte-query/src/gen/hooks/createAddPet.ts b/examples/svelte-query/src/gen/hooks/createAddPet.ts index 6e257c0e4..4922854e6 100644 --- a/examples/svelte-query/src/gen/hooks/createAddPet.ts +++ b/examples/svelte-query/src/gen/hooks/createAddPet.ts @@ -13,7 +13,7 @@ export type AddPetMutationKey = ReturnType * @summary Add a new pet to the store * {@link /pet} */ -async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { +export async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { const res = await client, AddPetMutationRequest>({ method: 'POST', url: '/pet', data, ...config }) return res.data } diff --git a/examples/svelte-query/src/gen/hooks/createCreateUser.ts b/examples/svelte-query/src/gen/hooks/createCreateUser.ts index d76c202d8..b69b2f9da 100644 --- a/examples/svelte-query/src/gen/hooks/createCreateUser.ts +++ b/examples/svelte-query/src/gen/hooks/createCreateUser.ts @@ -13,7 +13,7 @@ export type CreateUserMutationKey = ReturnType * @summary Create user * {@link /user} */ -async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { +export async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { const res = await client, CreateUserMutationRequest>({ method: 'POST', url: '/user', data, ...config }) return res.data } diff --git a/examples/svelte-query/src/gen/hooks/createCreateUsersWithListInput.ts b/examples/svelte-query/src/gen/hooks/createCreateUsersWithListInput.ts index 820ce713d..e1fd7ffba 100644 --- a/examples/svelte-query/src/gen/hooks/createCreateUsersWithListInput.ts +++ b/examples/svelte-query/src/gen/hooks/createCreateUsersWithListInput.ts @@ -13,7 +13,7 @@ export type CreateUsersWithListInputMutationKey = ReturnType> = {}, ) { diff --git a/examples/svelte-query/src/gen/hooks/createDeleteOrder.ts b/examples/svelte-query/src/gen/hooks/createDeleteOrder.ts index 6c46a016d..d2e9293ba 100644 --- a/examples/svelte-query/src/gen/hooks/createDeleteOrder.ts +++ b/examples/svelte-query/src/gen/hooks/createDeleteOrder.ts @@ -13,7 +13,7 @@ export type DeleteOrderMutationKey = ReturnType * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial = {}) { +export async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/store/order/${orderId}`, diff --git a/examples/svelte-query/src/gen/hooks/createDeletePet.ts b/examples/svelte-query/src/gen/hooks/createDeletePet.ts index b5a9b2a10..11e09f7a2 100644 --- a/examples/svelte-query/src/gen/hooks/createDeletePet.ts +++ b/examples/svelte-query/src/gen/hooks/createDeletePet.ts @@ -13,7 +13,7 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * {@link /pet/:pet_id} */ -async function deletePet(pet_id: DeletePetPathParams['pet_id'], headers?: DeletePetHeaderParams, config: Partial = {}) { +export async function deletePet(pet_id: DeletePetPathParams['pet_id'], headers?: DeletePetHeaderParams, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/pet/${pet_id}`, diff --git a/examples/svelte-query/src/gen/hooks/createDeleteUser.ts b/examples/svelte-query/src/gen/hooks/createDeleteUser.ts index a2b2a6fd5..fd1f2a23b 100644 --- a/examples/svelte-query/src/gen/hooks/createDeleteUser.ts +++ b/examples/svelte-query/src/gen/hooks/createDeleteUser.ts @@ -13,7 +13,7 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * {@link /user/:username} */ -async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { +export async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/user/${username}`, diff --git a/examples/svelte-query/src/gen/hooks/createFindPetsByStatus.ts b/examples/svelte-query/src/gen/hooks/createFindPetsByStatus.ts index 168a44837..d43348c6e 100644 --- a/examples/svelte-query/src/gen/hooks/createFindPetsByStatus.ts +++ b/examples/svelte-query/src/gen/hooks/createFindPetsByStatus.ts @@ -13,7 +13,7 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', diff --git a/examples/svelte-query/src/gen/hooks/createFindPetsByTags.ts b/examples/svelte-query/src/gen/hooks/createFindPetsByTags.ts index 147fa41f0..3f062669b 100644 --- a/examples/svelte-query/src/gen/hooks/createFindPetsByTags.ts +++ b/examples/svelte-query/src/gen/hooks/createFindPetsByTags.ts @@ -13,7 +13,7 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * {@link /pet/findByTags} */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', diff --git a/examples/svelte-query/src/gen/hooks/createGetInventory.ts b/examples/svelte-query/src/gen/hooks/createGetInventory.ts index 2df774199..06062d303 100644 --- a/examples/svelte-query/src/gen/hooks/createGetInventory.ts +++ b/examples/svelte-query/src/gen/hooks/createGetInventory.ts @@ -13,7 +13,7 @@ export type GetInventoryQueryKey = ReturnType * @summary Returns pet inventories by status * {@link /store/inventory} */ -async function getInventory(config: Partial = {}) { +export async function getInventory(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } diff --git a/examples/svelte-query/src/gen/hooks/createGetOrderById.ts b/examples/svelte-query/src/gen/hooks/createGetOrderById.ts index 8ca4d2c2a..d9166eb3b 100644 --- a/examples/svelte-query/src/gen/hooks/createGetOrderById.ts +++ b/examples/svelte-query/src/gen/hooks/createGetOrderById.ts @@ -13,7 +13,7 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { +export async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, diff --git a/examples/svelte-query/src/gen/hooks/createGetPetById.ts b/examples/svelte-query/src/gen/hooks/createGetPetById.ts index 5e918a788..80bd2f73b 100644 --- a/examples/svelte-query/src/gen/hooks/createGetPetById.ts +++ b/examples/svelte-query/src/gen/hooks/createGetPetById.ts @@ -13,7 +13,7 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * {@link /pet/:pet_id} */ -async function getPetById(pet_id: GetPetByIdPathParams['pet_id'], config: Partial = {}) { +export async function getPetById(pet_id: GetPetByIdPathParams['pet_id'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${pet_id}`, diff --git a/examples/svelte-query/src/gen/hooks/createGetUserByName.ts b/examples/svelte-query/src/gen/hooks/createGetUserByName.ts index 8515c32ed..c3ecb8148 100644 --- a/examples/svelte-query/src/gen/hooks/createGetUserByName.ts +++ b/examples/svelte-query/src/gen/hooks/createGetUserByName.ts @@ -12,7 +12,7 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * {@link /user/:username} */ -async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { +export async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, diff --git a/examples/svelte-query/src/gen/hooks/createLoginUser.ts b/examples/svelte-query/src/gen/hooks/createLoginUser.ts index c7a316786..cc8804712 100644 --- a/examples/svelte-query/src/gen/hooks/createLoginUser.ts +++ b/examples/svelte-query/src/gen/hooks/createLoginUser.ts @@ -12,7 +12,7 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * {@link /user/login} */ -async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +export async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } diff --git a/examples/svelte-query/src/gen/hooks/createLogoutUser.ts b/examples/svelte-query/src/gen/hooks/createLogoutUser.ts index ea165b46f..4e171e8cd 100644 --- a/examples/svelte-query/src/gen/hooks/createLogoutUser.ts +++ b/examples/svelte-query/src/gen/hooks/createLogoutUser.ts @@ -12,7 +12,7 @@ export type LogoutUserQueryKey = ReturnType * @summary Logs out current logged in user session * {@link /user/logout} */ -async function logoutUser(config: Partial = {}) { +export async function logoutUser(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } diff --git a/examples/svelte-query/src/gen/hooks/createPlaceOrder.ts b/examples/svelte-query/src/gen/hooks/createPlaceOrder.ts index 6db2b8c3c..a01570334 100644 --- a/examples/svelte-query/src/gen/hooks/createPlaceOrder.ts +++ b/examples/svelte-query/src/gen/hooks/createPlaceOrder.ts @@ -13,7 +13,7 @@ export type PlaceOrderMutationKey = ReturnType * @summary Place an order for a pet * {@link /store/order} */ -async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { +export async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderMutationRequest>({ method: 'POST', url: '/store/order', diff --git a/examples/svelte-query/src/gen/hooks/createPlaceOrderPatch.ts b/examples/svelte-query/src/gen/hooks/createPlaceOrderPatch.ts index 6e40be4f1..d9af84bc6 100644 --- a/examples/svelte-query/src/gen/hooks/createPlaceOrderPatch.ts +++ b/examples/svelte-query/src/gen/hooks/createPlaceOrderPatch.ts @@ -13,7 +13,7 @@ export type PlaceOrderPatchMutationKey = ReturnType> = {}) { +export async function placeOrderPatch(data?: PlaceOrderPatchMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderPatchMutationRequest>({ method: 'PATCH', url: '/store/order', diff --git a/examples/svelte-query/src/gen/hooks/createUpdatePet.ts b/examples/svelte-query/src/gen/hooks/createUpdatePet.ts index 4cc4fe021..555553a62 100644 --- a/examples/svelte-query/src/gen/hooks/createUpdatePet.ts +++ b/examples/svelte-query/src/gen/hooks/createUpdatePet.ts @@ -13,7 +13,7 @@ export type UpdatePetMutationKey = ReturnType * @summary Update an existing pet * {@link /pet} */ -async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { +export async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { const res = await client, UpdatePetMutationRequest>({ method: 'PUT', url: '/pet', diff --git a/examples/svelte-query/src/gen/hooks/createUpdatePetWithForm.ts b/examples/svelte-query/src/gen/hooks/createUpdatePetWithForm.ts index 81dbb0e55..d14e51151 100644 --- a/examples/svelte-query/src/gen/hooks/createUpdatePetWithForm.ts +++ b/examples/svelte-query/src/gen/hooks/createUpdatePetWithForm.ts @@ -18,7 +18,11 @@ export type UpdatePetWithFormQueryKey = ReturnType = {}) { +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['pet_id'], + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { const res = await client, unknown>({ method: 'POST', url: `/pet/${petId}`, diff --git a/examples/svelte-query/src/gen/hooks/createUpdateUser.ts b/examples/svelte-query/src/gen/hooks/createUpdateUser.ts index 7dc854bf5..f92e2be26 100644 --- a/examples/svelte-query/src/gen/hooks/createUpdateUser.ts +++ b/examples/svelte-query/src/gen/hooks/createUpdateUser.ts @@ -13,7 +13,7 @@ export type UpdateUserMutationKey = ReturnType * @summary Update user * {@link /user/:username} */ -async function updateUser( +export async function updateUser( username: UpdateUserPathParams['username'], data?: UpdateUserMutationRequest, config: Partial> = {}, diff --git a/examples/svelte-query/src/gen/hooks/createUploadFile.ts b/examples/svelte-query/src/gen/hooks/createUploadFile.ts index f88763ccf..d61947847 100644 --- a/examples/svelte-query/src/gen/hooks/createUploadFile.ts +++ b/examples/svelte-query/src/gen/hooks/createUploadFile.ts @@ -12,7 +12,7 @@ export type UploadFileMutationKey = ReturnType * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -async function uploadFile( +export async function uploadFile( petId: UploadFilePathParams['petId'], data?: UploadFileMutationRequest, params?: UploadFileQueryParams, diff --git a/examples/svelte-query/src/gen/hooks/index.ts b/examples/svelte-query/src/gen/hooks/index.ts index 7bc1edeb0..049b09298 100644 --- a/examples/svelte-query/src/gen/hooks/index.ts +++ b/examples/svelte-query/src/gen/hooks/index.ts @@ -18,23 +18,23 @@ export type { UpdatePetMutationKey } from './createUpdatePet.ts' export type { UpdatePetWithFormQueryKey } from './createUpdatePetWithForm.ts' export type { UpdateUserMutationKey } from './createUpdateUser.ts' export type { UploadFileMutationKey } from './createUploadFile.ts' -export { addPetMutationKey, createAddPet } from './createAddPet.ts' -export { createUserMutationKey, createCreateUser } from './createCreateUser.ts' -export { createUsersWithListInputMutationKey, createCreateUsersWithListInput } from './createCreateUsersWithListInput.ts' -export { deleteOrderMutationKey, createDeleteOrder } from './createDeleteOrder.ts' -export { deletePetMutationKey, createDeletePet } from './createDeletePet.ts' -export { deleteUserMutationKey, createDeleteUser } from './createDeleteUser.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, createFindPetsByStatus } from './createFindPetsByStatus.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, createFindPetsByTags } from './createFindPetsByTags.ts' -export { getInventoryQueryKey, getInventoryQueryOptions, createGetInventory } from './createGetInventory.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions, createGetOrderById } from './createGetOrderById.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptions, createGetPetById } from './createGetPetById.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptions, createGetUserByName } from './createGetUserByName.ts' -export { loginUserQueryKey, loginUserQueryOptions, createLoginUser } from './createLoginUser.ts' -export { logoutUserQueryKey, logoutUserQueryOptions, createLogoutUser } from './createLogoutUser.ts' -export { placeOrderMutationKey, createPlaceOrder } from './createPlaceOrder.ts' -export { placeOrderPatchMutationKey, createPlaceOrderPatch } from './createPlaceOrderPatch.ts' -export { updatePetMutationKey, createUpdatePet } from './createUpdatePet.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptions, createUpdatePetWithForm } from './createUpdatePetWithForm.ts' -export { updateUserMutationKey, createUpdateUser } from './createUpdateUser.ts' -export { uploadFileMutationKey, createUploadFile } from './createUploadFile.ts' +export { addPetMutationKey, addPet, createAddPet } from './createAddPet.ts' +export { createUserMutationKey, createUser, createCreateUser } from './createCreateUser.ts' +export { createUsersWithListInputMutationKey, createUsersWithListInput, createCreateUsersWithListInput } from './createCreateUsersWithListInput.ts' +export { deleteOrderMutationKey, deleteOrder, createDeleteOrder } from './createDeleteOrder.ts' +export { deletePetMutationKey, deletePet, createDeletePet } from './createDeletePet.ts' +export { deleteUserMutationKey, deleteUser, createDeleteUser } from './createDeleteUser.ts' +export { findPetsByStatusQueryKey, findPetsByStatus, findPetsByStatusQueryOptions, createFindPetsByStatus } from './createFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTags, findPetsByTagsQueryOptions, createFindPetsByTags } from './createFindPetsByTags.ts' +export { getInventoryQueryKey, getInventory, getInventoryQueryOptions, createGetInventory } from './createGetInventory.ts' +export { getOrderByIdQueryKey, getOrderById, getOrderByIdQueryOptions, createGetOrderById } from './createGetOrderById.ts' +export { getPetByIdQueryKey, getPetById, getPetByIdQueryOptions, createGetPetById } from './createGetPetById.ts' +export { getUserByNameQueryKey, getUserByName, getUserByNameQueryOptions, createGetUserByName } from './createGetUserByName.ts' +export { loginUserQueryKey, loginUser, loginUserQueryOptions, createLoginUser } from './createLoginUser.ts' +export { logoutUserQueryKey, logoutUser, logoutUserQueryOptions, createLogoutUser } from './createLogoutUser.ts' +export { placeOrderMutationKey, placeOrder, createPlaceOrder } from './createPlaceOrder.ts' +export { placeOrderPatchMutationKey, placeOrderPatch, createPlaceOrderPatch } from './createPlaceOrderPatch.ts' +export { updatePetMutationKey, updatePet, createUpdatePet } from './createUpdatePet.ts' +export { updatePetWithFormQueryKey, updatePetWithForm, updatePetWithFormQueryOptions, createUpdatePetWithForm } from './createUpdatePetWithForm.ts' +export { updateUserMutationKey, updateUser, createUpdateUser } from './createUpdateUser.ts' +export { uploadFileMutationKey, uploadFile, createUploadFile } from './createUploadFile.ts' diff --git a/examples/svelte-query/src/gen/index.ts b/examples/svelte-query/src/gen/index.ts index b9bfed41f..3f7d43e1f 100644 --- a/examples/svelte-query/src/gen/index.ts +++ b/examples/svelte-query/src/gen/index.ts @@ -109,26 +109,26 @@ export type { } from './models/UploadFile.ts' export type { User } from './models/User.ts' export type { UserArray } from './models/UserArray.ts' -export { addPetMutationKey, createAddPet } from './hooks/createAddPet.ts' -export { createUserMutationKey, createCreateUser } from './hooks/createCreateUser.ts' -export { createUsersWithListInputMutationKey, createCreateUsersWithListInput } from './hooks/createCreateUsersWithListInput.ts' -export { deleteOrderMutationKey, createDeleteOrder } from './hooks/createDeleteOrder.ts' -export { deletePetMutationKey, createDeletePet } from './hooks/createDeletePet.ts' -export { deleteUserMutationKey, createDeleteUser } from './hooks/createDeleteUser.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, createFindPetsByStatus } from './hooks/createFindPetsByStatus.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, createFindPetsByTags } from './hooks/createFindPetsByTags.ts' -export { getInventoryQueryKey, getInventoryQueryOptions, createGetInventory } from './hooks/createGetInventory.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions, createGetOrderById } from './hooks/createGetOrderById.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptions, createGetPetById } from './hooks/createGetPetById.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptions, createGetUserByName } from './hooks/createGetUserByName.ts' -export { loginUserQueryKey, loginUserQueryOptions, createLoginUser } from './hooks/createLoginUser.ts' -export { logoutUserQueryKey, logoutUserQueryOptions, createLogoutUser } from './hooks/createLogoutUser.ts' -export { placeOrderMutationKey, createPlaceOrder } from './hooks/createPlaceOrder.ts' -export { placeOrderPatchMutationKey, createPlaceOrderPatch } from './hooks/createPlaceOrderPatch.ts' -export { updatePetMutationKey, createUpdatePet } from './hooks/createUpdatePet.ts' -export { updatePetWithFormQueryKey, updatePetWithFormQueryOptions, createUpdatePetWithForm } from './hooks/createUpdatePetWithForm.ts' -export { updateUserMutationKey, createUpdateUser } from './hooks/createUpdateUser.ts' -export { uploadFileMutationKey, createUploadFile } from './hooks/createUploadFile.ts' +export { addPetMutationKey, addPet, createAddPet } from './hooks/createAddPet.ts' +export { createUserMutationKey, createUser, createCreateUser } from './hooks/createCreateUser.ts' +export { createUsersWithListInputMutationKey, createUsersWithListInput, createCreateUsersWithListInput } from './hooks/createCreateUsersWithListInput.ts' +export { deleteOrderMutationKey, deleteOrder, createDeleteOrder } from './hooks/createDeleteOrder.ts' +export { deletePetMutationKey, deletePet, createDeletePet } from './hooks/createDeletePet.ts' +export { deleteUserMutationKey, deleteUser, createDeleteUser } from './hooks/createDeleteUser.ts' +export { findPetsByStatusQueryKey, findPetsByStatus, findPetsByStatusQueryOptions, createFindPetsByStatus } from './hooks/createFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTags, findPetsByTagsQueryOptions, createFindPetsByTags } from './hooks/createFindPetsByTags.ts' +export { getInventoryQueryKey, getInventory, getInventoryQueryOptions, createGetInventory } from './hooks/createGetInventory.ts' +export { getOrderByIdQueryKey, getOrderById, getOrderByIdQueryOptions, createGetOrderById } from './hooks/createGetOrderById.ts' +export { getPetByIdQueryKey, getPetById, getPetByIdQueryOptions, createGetPetById } from './hooks/createGetPetById.ts' +export { getUserByNameQueryKey, getUserByName, getUserByNameQueryOptions, createGetUserByName } from './hooks/createGetUserByName.ts' +export { loginUserQueryKey, loginUser, loginUserQueryOptions, createLoginUser } from './hooks/createLoginUser.ts' +export { logoutUserQueryKey, logoutUser, logoutUserQueryOptions, createLogoutUser } from './hooks/createLogoutUser.ts' +export { placeOrderMutationKey, placeOrder, createPlaceOrder } from './hooks/createPlaceOrder.ts' +export { placeOrderPatchMutationKey, placeOrderPatch, createPlaceOrderPatch } from './hooks/createPlaceOrderPatch.ts' +export { updatePetMutationKey, updatePet, createUpdatePet } from './hooks/createUpdatePet.ts' +export { updatePetWithFormQueryKey, updatePetWithForm, updatePetWithFormQueryOptions, createUpdatePetWithForm } from './hooks/createUpdatePetWithForm.ts' +export { updateUserMutationKey, updateUser, createUpdateUser } from './hooks/createUpdateUser.ts' +export { uploadFileMutationKey, uploadFile, createUploadFile } from './hooks/createUploadFile.ts' export { addPetRequestStatusEnum } from './models/AddPetRequest.ts' export { findPetsByStatusQueryParamsStatusEnum } from './models/FindPetsByStatus.ts' export { orderStatusEnum, orderHttpStatusEnum } from './models/Order.ts' diff --git a/examples/swr/src/gen/hooks/index.ts b/examples/swr/src/gen/hooks/index.ts index b6c5660a5..5af3b8b47 100644 --- a/examples/swr/src/gen/hooks/index.ts +++ b/examples/swr/src/gen/hooks/index.ts @@ -18,23 +18,23 @@ export type { UpdatePetMutationKey } from './useUpdatePet.ts' export type { UpdatePetWithFormMutationKey } from './useUpdatePetWithForm.ts' export type { UpdateUserMutationKey } from './useUpdateUser.ts' export type { UploadFileMutationKey } from './useUploadFile.ts' -export { addPetMutationKey, useAddPet } from './useAddPet.ts' -export { createUserMutationKey, useCreateUser } from './useCreateUser.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './useCreateUsersWithListInput.ts' -export { deleteOrderMutationKey, useDeleteOrder } from './useDeleteOrder.ts' -export { deletePetMutationKey, useDeletePet } from './useDeletePet.ts' -export { deleteUserMutationKey, useDeleteUser } from './useDeleteUser.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags.ts' -export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './useGetInventory.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './useGetPetById.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName.ts' -export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './useLoginUser.ts' -export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './useLogoutUser.ts' -export { placeOrderMutationKey, usePlaceOrder } from './usePlaceOrder.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatch } from './usePlaceOrderPatch.ts' -export { updatePetMutationKey, useUpdatePet } from './useUpdatePet.ts' -export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './useUpdatePetWithForm.ts' -export { updateUserMutationKey, useUpdateUser } from './useUpdateUser.ts' -export { uploadFileMutationKey, useUploadFile } from './useUploadFile.ts' +export { addPetMutationKey, addPet, useAddPet } from './useAddPet.ts' +export { createUserMutationKey, createUser, useCreateUser } from './useCreateUser.ts' +export { createUsersWithListInputMutationKey, createUsersWithListInput, useCreateUsersWithListInput } from './useCreateUsersWithListInput.ts' +export { deleteOrderMutationKey, deleteOrder, useDeleteOrder } from './useDeleteOrder.ts' +export { deletePetMutationKey, deletePet, useDeletePet } from './useDeletePet.ts' +export { deleteUserMutationKey, deleteUser, useDeleteUser } from './useDeleteUser.ts' +export { findPetsByStatusQueryKey, findPetsByStatus, findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTags, findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags.ts' +export { getInventoryQueryKey, getInventory, getInventoryQueryOptions, useGetInventory } from './useGetInventory.ts' +export { getOrderByIdQueryKey, getOrderById, getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById.ts' +export { getPetByIdQueryKey, getPetById, getPetByIdQueryOptions, useGetPetById } from './useGetPetById.ts' +export { getUserByNameQueryKey, getUserByName, getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName.ts' +export { loginUserQueryKey, loginUser, loginUserQueryOptions, useLoginUser } from './useLoginUser.ts' +export { logoutUserQueryKey, logoutUser, logoutUserQueryOptions, useLogoutUser } from './useLogoutUser.ts' +export { placeOrderMutationKey, placeOrder, usePlaceOrder } from './usePlaceOrder.ts' +export { placeOrderPatchMutationKey, placeOrderPatch, usePlaceOrderPatch } from './usePlaceOrderPatch.ts' +export { updatePetMutationKey, updatePet, useUpdatePet } from './useUpdatePet.ts' +export { updatePetWithFormMutationKey, updatePetWithForm, useUpdatePetWithForm } from './useUpdatePetWithForm.ts' +export { updateUserMutationKey, updateUser, useUpdateUser } from './useUpdateUser.ts' +export { uploadFileMutationKey, uploadFile, useUploadFile } from './useUploadFile.ts' diff --git a/examples/swr/src/gen/hooks/useAddPet.ts b/examples/swr/src/gen/hooks/useAddPet.ts index dd7b44cd2..a9aa0cd9e 100644 --- a/examples/swr/src/gen/hooks/useAddPet.ts +++ b/examples/swr/src/gen/hooks/useAddPet.ts @@ -12,7 +12,7 @@ export type AddPetMutationKey = ReturnType * @summary Add a new pet to the store * {@link /pet} */ -async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { +export async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { const res = await client, AddPetMutationRequest>({ method: 'POST', url: '/pet', data, ...config }) return res.data } diff --git a/examples/swr/src/gen/hooks/useCreateUser.ts b/examples/swr/src/gen/hooks/useCreateUser.ts index 6725395b9..57add4fcd 100644 --- a/examples/swr/src/gen/hooks/useCreateUser.ts +++ b/examples/swr/src/gen/hooks/useCreateUser.ts @@ -12,7 +12,7 @@ export type CreateUserMutationKey = ReturnType * @summary Create user * {@link /user} */ -async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { +export async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { const res = await client, CreateUserMutationRequest>({ method: 'POST', url: '/user', data, ...config }) return res.data } diff --git a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts index 463bdf020..d08797384 100644 --- a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts @@ -12,7 +12,7 @@ export type CreateUsersWithListInputMutationKey = ReturnType> = {}, ) { diff --git a/examples/swr/src/gen/hooks/useDeleteOrder.ts b/examples/swr/src/gen/hooks/useDeleteOrder.ts index a9d01af80..029d9fd42 100644 --- a/examples/swr/src/gen/hooks/useDeleteOrder.ts +++ b/examples/swr/src/gen/hooks/useDeleteOrder.ts @@ -12,7 +12,7 @@ export type DeleteOrderMutationKey = ReturnType * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial = {}) { +export async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/store/order/${orderId}`, diff --git a/examples/swr/src/gen/hooks/useDeletePet.ts b/examples/swr/src/gen/hooks/useDeletePet.ts index 5b85dd694..74c700629 100644 --- a/examples/swr/src/gen/hooks/useDeletePet.ts +++ b/examples/swr/src/gen/hooks/useDeletePet.ts @@ -12,7 +12,7 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * {@link /pet/:petId} */ -async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial = {}) { +export async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/pet/${petId}`, diff --git a/examples/swr/src/gen/hooks/useDeleteUser.ts b/examples/swr/src/gen/hooks/useDeleteUser.ts index 3f2b772ee..e0edad493 100644 --- a/examples/swr/src/gen/hooks/useDeleteUser.ts +++ b/examples/swr/src/gen/hooks/useDeleteUser.ts @@ -12,7 +12,7 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * {@link /user/:username} */ -async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { +export async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/user/${username}`, diff --git a/examples/swr/src/gen/hooks/useFindPetsByStatus.ts b/examples/swr/src/gen/hooks/useFindPetsByStatus.ts index 2bfcd7534..91d2b60ef 100644 --- a/examples/swr/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/swr/src/gen/hooks/useFindPetsByStatus.ts @@ -12,7 +12,7 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', diff --git a/examples/swr/src/gen/hooks/useFindPetsByTags.ts b/examples/swr/src/gen/hooks/useFindPetsByTags.ts index 370370cb2..276c27b9c 100644 --- a/examples/swr/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/swr/src/gen/hooks/useFindPetsByTags.ts @@ -12,7 +12,7 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * {@link /pet/findByTags} */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', diff --git a/examples/swr/src/gen/hooks/useGetInventory.ts b/examples/swr/src/gen/hooks/useGetInventory.ts index e95f9a916..7a35c2d79 100644 --- a/examples/swr/src/gen/hooks/useGetInventory.ts +++ b/examples/swr/src/gen/hooks/useGetInventory.ts @@ -12,7 +12,7 @@ export type GetInventoryQueryKey = ReturnType * @summary Returns pet inventories by status * {@link /store/inventory} */ -async function getInventory(config: Partial = {}) { +export async function getInventory(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } diff --git a/examples/swr/src/gen/hooks/useGetOrderById.ts b/examples/swr/src/gen/hooks/useGetOrderById.ts index b5c4091b9..edaaebebb 100644 --- a/examples/swr/src/gen/hooks/useGetOrderById.ts +++ b/examples/swr/src/gen/hooks/useGetOrderById.ts @@ -12,7 +12,7 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { +export async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, diff --git a/examples/swr/src/gen/hooks/useGetPetById.ts b/examples/swr/src/gen/hooks/useGetPetById.ts index 78e2105c0..5acf723bd 100644 --- a/examples/swr/src/gen/hooks/useGetPetById.ts +++ b/examples/swr/src/gen/hooks/useGetPetById.ts @@ -12,7 +12,7 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * {@link /pet/:petId} */ -async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { +export async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${petId}`, diff --git a/examples/swr/src/gen/hooks/useGetUserByName.ts b/examples/swr/src/gen/hooks/useGetUserByName.ts index 01a943533..2bc292b64 100644 --- a/examples/swr/src/gen/hooks/useGetUserByName.ts +++ b/examples/swr/src/gen/hooks/useGetUserByName.ts @@ -11,7 +11,7 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * {@link /user/:username} */ -async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { +export async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, diff --git a/examples/swr/src/gen/hooks/useLoginUser.ts b/examples/swr/src/gen/hooks/useLoginUser.ts index 496d05bdd..740240c4a 100644 --- a/examples/swr/src/gen/hooks/useLoginUser.ts +++ b/examples/swr/src/gen/hooks/useLoginUser.ts @@ -11,7 +11,7 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * {@link /user/login} */ -async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +export async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } diff --git a/examples/swr/src/gen/hooks/useLogoutUser.ts b/examples/swr/src/gen/hooks/useLogoutUser.ts index b288deb77..cd283eca4 100644 --- a/examples/swr/src/gen/hooks/useLogoutUser.ts +++ b/examples/swr/src/gen/hooks/useLogoutUser.ts @@ -11,7 +11,7 @@ export type LogoutUserQueryKey = ReturnType * @summary Logs out current logged in user session * {@link /user/logout} */ -async function logoutUser(config: Partial = {}) { +export async function logoutUser(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } diff --git a/examples/swr/src/gen/hooks/usePlaceOrder.ts b/examples/swr/src/gen/hooks/usePlaceOrder.ts index 862ceb712..cbd71079c 100644 --- a/examples/swr/src/gen/hooks/usePlaceOrder.ts +++ b/examples/swr/src/gen/hooks/usePlaceOrder.ts @@ -12,7 +12,7 @@ export type PlaceOrderMutationKey = ReturnType * @summary Place an order for a pet * {@link /store/order} */ -async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { +export async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderMutationRequest>({ method: 'POST', url: '/store/order', diff --git a/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts b/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts index 77071b005..0437bacf3 100644 --- a/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts +++ b/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts @@ -12,7 +12,7 @@ export type PlaceOrderPatchMutationKey = ReturnType> = {}) { +export async function placeOrderPatch(data?: PlaceOrderPatchMutationRequest, config: Partial> = {}) { const res = await client, PlaceOrderPatchMutationRequest>({ method: 'PATCH', url: '/store/order', diff --git a/examples/swr/src/gen/hooks/useUpdatePet.ts b/examples/swr/src/gen/hooks/useUpdatePet.ts index 28fc2f8fb..60f3e33f3 100644 --- a/examples/swr/src/gen/hooks/useUpdatePet.ts +++ b/examples/swr/src/gen/hooks/useUpdatePet.ts @@ -12,7 +12,7 @@ export type UpdatePetMutationKey = ReturnType * @summary Update an existing pet * {@link /pet} */ -async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { +export async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { const res = await client, UpdatePetMutationRequest>({ method: 'PUT', url: '/pet', diff --git a/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts b/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts index fa2188acb..cccedfa62 100644 --- a/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts @@ -16,7 +16,11 @@ export type UpdatePetWithFormMutationKey = ReturnType = {}) { +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { const res = await client, unknown>({ method: 'POST', url: `/pet/${petId}`, diff --git a/examples/swr/src/gen/hooks/useUpdateUser.ts b/examples/swr/src/gen/hooks/useUpdateUser.ts index 734bc8fbe..5b1e52f92 100644 --- a/examples/swr/src/gen/hooks/useUpdateUser.ts +++ b/examples/swr/src/gen/hooks/useUpdateUser.ts @@ -12,7 +12,7 @@ export type UpdateUserMutationKey = ReturnType * @summary Update user * {@link /user/:username} */ -async function updateUser( +export async function updateUser( username: UpdateUserPathParams['username'], data?: UpdateUserMutationRequest, config: Partial> = {}, diff --git a/examples/swr/src/gen/hooks/useUploadFile.ts b/examples/swr/src/gen/hooks/useUploadFile.ts index 9f0e5f1e6..79f753853 100644 --- a/examples/swr/src/gen/hooks/useUploadFile.ts +++ b/examples/swr/src/gen/hooks/useUploadFile.ts @@ -11,7 +11,7 @@ export type UploadFileMutationKey = ReturnType * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -async function uploadFile( +export async function uploadFile( petId: UploadFilePathParams['petId'], data?: UploadFileMutationRequest, params?: UploadFileQueryParams, diff --git a/examples/swr/src/gen/index.ts b/examples/swr/src/gen/index.ts index a69148f00..7677f914a 100644 --- a/examples/swr/src/gen/index.ts +++ b/examples/swr/src/gen/index.ts @@ -109,26 +109,26 @@ export type { } from './models/UploadFile.ts' export type { User } from './models/User.ts' export type { UserArray } from './models/UserArray.ts' -export { addPetMutationKey, useAddPet } from './hooks/useAddPet.ts' -export { createUserMutationKey, useCreateUser } from './hooks/useCreateUser.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './hooks/useCreateUsersWithListInput.ts' -export { deleteOrderMutationKey, useDeleteOrder } from './hooks/useDeleteOrder.ts' -export { deletePetMutationKey, useDeletePet } from './hooks/useDeletePet.ts' -export { deleteUserMutationKey, useDeleteUser } from './hooks/useDeleteUser.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './hooks/useFindPetsByStatus.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './hooks/useFindPetsByTags.ts' -export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './hooks/useGetInventory.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './hooks/useGetOrderById.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './hooks/useGetPetById.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './hooks/useGetUserByName.ts' -export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './hooks/useLoginUser.ts' -export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './hooks/useLogoutUser.ts' -export { placeOrderMutationKey, usePlaceOrder } from './hooks/usePlaceOrder.ts' -export { placeOrderPatchMutationKey, usePlaceOrderPatch } from './hooks/usePlaceOrderPatch.ts' -export { updatePetMutationKey, useUpdatePet } from './hooks/useUpdatePet.ts' -export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './hooks/useUpdatePetWithForm.ts' -export { updateUserMutationKey, useUpdateUser } from './hooks/useUpdateUser.ts' -export { uploadFileMutationKey, useUploadFile } from './hooks/useUploadFile.ts' +export { addPetMutationKey, addPet, useAddPet } from './hooks/useAddPet.ts' +export { createUserMutationKey, createUser, useCreateUser } from './hooks/useCreateUser.ts' +export { createUsersWithListInputMutationKey, createUsersWithListInput, useCreateUsersWithListInput } from './hooks/useCreateUsersWithListInput.ts' +export { deleteOrderMutationKey, deleteOrder, useDeleteOrder } from './hooks/useDeleteOrder.ts' +export { deletePetMutationKey, deletePet, useDeletePet } from './hooks/useDeletePet.ts' +export { deleteUserMutationKey, deleteUser, useDeleteUser } from './hooks/useDeleteUser.ts' +export { findPetsByStatusQueryKey, findPetsByStatus, findPetsByStatusQueryOptions, useFindPetsByStatus } from './hooks/useFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTags, findPetsByTagsQueryOptions, useFindPetsByTags } from './hooks/useFindPetsByTags.ts' +export { getInventoryQueryKey, getInventory, getInventoryQueryOptions, useGetInventory } from './hooks/useGetInventory.ts' +export { getOrderByIdQueryKey, getOrderById, getOrderByIdQueryOptions, useGetOrderById } from './hooks/useGetOrderById.ts' +export { getPetByIdQueryKey, getPetById, getPetByIdQueryOptions, useGetPetById } from './hooks/useGetPetById.ts' +export { getUserByNameQueryKey, getUserByName, getUserByNameQueryOptions, useGetUserByName } from './hooks/useGetUserByName.ts' +export { loginUserQueryKey, loginUser, loginUserQueryOptions, useLoginUser } from './hooks/useLoginUser.ts' +export { logoutUserQueryKey, logoutUser, logoutUserQueryOptions, useLogoutUser } from './hooks/useLogoutUser.ts' +export { placeOrderMutationKey, placeOrder, usePlaceOrder } from './hooks/usePlaceOrder.ts' +export { placeOrderPatchMutationKey, placeOrderPatch, usePlaceOrderPatch } from './hooks/usePlaceOrderPatch.ts' +export { updatePetMutationKey, updatePet, useUpdatePet } from './hooks/useUpdatePet.ts' +export { updatePetWithFormMutationKey, updatePetWithForm, useUpdatePetWithForm } from './hooks/useUpdatePetWithForm.ts' +export { updateUserMutationKey, updateUser, useUpdateUser } from './hooks/useUpdateUser.ts' +export { uploadFileMutationKey, uploadFile, useUploadFile } from './hooks/useUploadFile.ts' export { addPetRequestStatusEnum } from './models/AddPetRequest.ts' export { findPetsByStatusQueryParamsStatusEnum } from './models/FindPetsByStatus.ts' export { orderStatusEnum, orderHttpStatusEnum } from './models/Order.ts' diff --git a/examples/vue-query/src/gen/hooks/index.ts b/examples/vue-query/src/gen/hooks/index.ts index 151f8e82a..34498481f 100644 --- a/examples/vue-query/src/gen/hooks/index.ts +++ b/examples/vue-query/src/gen/hooks/index.ts @@ -17,22 +17,22 @@ export type { UpdatePetMutationKey } from './useUpdatePet.ts' export type { UpdatePetWithFormMutationKey } from './useUpdatePetWithForm.ts' export type { UpdateUserMutationKey } from './useUpdateUser.ts' export type { UploadFileMutationKey } from './useUploadFile.ts' -export { addPetMutationKey, useAddPet } from './useAddPet.ts' -export { createUserMutationKey, useCreateUser } from './useCreateUser.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './useCreateUsersWithListInput.ts' -export { deleteOrderMutationKey, useDeleteOrder } from './useDeleteOrder.ts' -export { deletePetMutationKey, useDeletePet } from './useDeletePet.ts' -export { deleteUserMutationKey, useDeleteUser } from './useDeleteUser.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags.ts' -export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './useGetInventory.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './useGetPetById.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName.ts' -export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './useLoginUser.ts' -export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './useLogoutUser.ts' -export { placeOrderMutationKey, usePlaceOrder } from './usePlaceOrder.ts' -export { updatePetMutationKey, useUpdatePet } from './useUpdatePet.ts' -export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './useUpdatePetWithForm.ts' -export { updateUserMutationKey, useUpdateUser } from './useUpdateUser.ts' -export { uploadFileMutationKey, useUploadFile } from './useUploadFile.ts' +export { addPetMutationKey, addPet, useAddPet } from './useAddPet.ts' +export { createUserMutationKey, createUser, useCreateUser } from './useCreateUser.ts' +export { createUsersWithListInputMutationKey, createUsersWithListInput, useCreateUsersWithListInput } from './useCreateUsersWithListInput.ts' +export { deleteOrderMutationKey, deleteOrder, useDeleteOrder } from './useDeleteOrder.ts' +export { deletePetMutationKey, deletePet, useDeletePet } from './useDeletePet.ts' +export { deleteUserMutationKey, deleteUser, useDeleteUser } from './useDeleteUser.ts' +export { findPetsByStatusQueryKey, findPetsByStatus, findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTags, findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags.ts' +export { getInventoryQueryKey, getInventory, getInventoryQueryOptions, useGetInventory } from './useGetInventory.ts' +export { getOrderByIdQueryKey, getOrderById, getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById.ts' +export { getPetByIdQueryKey, getPetById, getPetByIdQueryOptions, useGetPetById } from './useGetPetById.ts' +export { getUserByNameQueryKey, getUserByName, getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName.ts' +export { loginUserQueryKey, loginUser, loginUserQueryOptions, useLoginUser } from './useLoginUser.ts' +export { logoutUserQueryKey, logoutUser, logoutUserQueryOptions, useLogoutUser } from './useLogoutUser.ts' +export { placeOrderMutationKey, placeOrder, usePlaceOrder } from './usePlaceOrder.ts' +export { updatePetMutationKey, updatePet, useUpdatePet } from './useUpdatePet.ts' +export { updatePetWithFormMutationKey, updatePetWithForm, useUpdatePetWithForm } from './useUpdatePetWithForm.ts' +export { updateUserMutationKey, updateUser, useUpdateUser } from './useUpdateUser.ts' +export { uploadFileMutationKey, uploadFile, useUploadFile } from './useUploadFile.ts' diff --git a/examples/vue-query/src/gen/hooks/useAddPet.ts b/examples/vue-query/src/gen/hooks/useAddPet.ts index d92c8d5ad..35aedba42 100644 --- a/examples/vue-query/src/gen/hooks/useAddPet.ts +++ b/examples/vue-query/src/gen/hooks/useAddPet.ts @@ -14,7 +14,7 @@ export type AddPetMutationKey = ReturnType * @summary Add a new pet to the store * {@link /pet} */ -async function addPet({ data }: { data: AddPetMutationRequest }, config: Partial> = {}) { +export async function addPet({ data }: { data: AddPetMutationRequest }, config: Partial> = {}) { const res = await client, AddPetMutationRequest>({ method: 'POST', url: '/pet', data, ...config }) return res.data } diff --git a/examples/vue-query/src/gen/hooks/useCreateUser.ts b/examples/vue-query/src/gen/hooks/useCreateUser.ts index c31207e78..caf369222 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUser.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUser.ts @@ -14,7 +14,7 @@ export type CreateUserMutationKey = ReturnType * @summary Create user * {@link /user} */ -async function createUser({ data }: { data?: CreateUserMutationRequest }, config: Partial> = {}) { +export async function createUser({ data }: { data?: CreateUserMutationRequest }, config: Partial> = {}) { const res = await client, CreateUserMutationRequest>({ method: 'POST', url: '/user', data, ...config }) return res.data } diff --git a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts index 99ff21064..33a57389f 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts @@ -14,7 +14,7 @@ export type CreateUsersWithListInputMutationKey = ReturnType> = {}, ) { diff --git a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts index d7502faac..0c36791e6 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts @@ -14,7 +14,7 @@ export type DeleteOrderMutationKey = ReturnType * @summary Delete purchase order by ID * {@link /store/order/:orderId} */ -async function deleteOrder({ orderId }: { orderId: DeleteOrderPathParams['orderId'] }, config: Partial = {}) { +export async function deleteOrder({ orderId }: { orderId: DeleteOrderPathParams['orderId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/store/order/${orderId}`, diff --git a/examples/vue-query/src/gen/hooks/useDeletePet.ts b/examples/vue-query/src/gen/hooks/useDeletePet.ts index e8090c1d4..f66e03093 100644 --- a/examples/vue-query/src/gen/hooks/useDeletePet.ts +++ b/examples/vue-query/src/gen/hooks/useDeletePet.ts @@ -14,7 +14,10 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * {@link /pet/:petId} */ -async function deletePet({ petId, headers }: { petId: DeletePetPathParams['petId']; headers?: DeletePetHeaderParams }, config: Partial = {}) { +export async function deletePet( + { petId, headers }: { petId: DeletePetPathParams['petId']; headers?: DeletePetHeaderParams }, + config: Partial = {}, +) { const res = await client, unknown>({ method: 'DELETE', url: `/pet/${petId}`, diff --git a/examples/vue-query/src/gen/hooks/useDeleteUser.ts b/examples/vue-query/src/gen/hooks/useDeleteUser.ts index 90a72d1d7..d6ac19c25 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteUser.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteUser.ts @@ -14,7 +14,7 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * {@link /user/:username} */ -async function deleteUser({ username }: { username: DeleteUserPathParams['username'] }, config: Partial = {}) { +export async function deleteUser({ username }: { username: DeleteUserPathParams['username'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'DELETE', url: `/user/${username}`, diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts index 364595efa..0691bda82 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts @@ -15,7 +15,7 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +export async function findPetsByStatus({ params }: { params?: FindPetsByStatusQueryParams }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByStatus', diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts index 4800c1987..224331e03 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts @@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * {@link /pet/findByTags} */ -async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { +export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/pet/findByTags', diff --git a/examples/vue-query/src/gen/hooks/useGetInventory.ts b/examples/vue-query/src/gen/hooks/useGetInventory.ts index b72b54754..164b93e97 100644 --- a/examples/vue-query/src/gen/hooks/useGetInventory.ts +++ b/examples/vue-query/src/gen/hooks/useGetInventory.ts @@ -14,7 +14,7 @@ export type GetInventoryQueryKey = ReturnType * @summary Returns pet inventories by status * {@link /store/inventory} */ -async function getInventory(config: Partial = {}) { +export async function getInventory(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/store/inventory', ...config }) return res.data } diff --git a/examples/vue-query/src/gen/hooks/useGetOrderById.ts b/examples/vue-query/src/gen/hooks/useGetOrderById.ts index c51112fc7..459f8bc1e 100644 --- a/examples/vue-query/src/gen/hooks/useGetOrderById.ts +++ b/examples/vue-query/src/gen/hooks/useGetOrderById.ts @@ -16,7 +16,7 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * {@link /store/order/:orderId} */ -async function getOrderById({ orderId }: { orderId: GetOrderByIdPathParams['orderId'] }, config: Partial = {}) { +export async function getOrderById({ orderId }: { orderId: GetOrderByIdPathParams['orderId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/store/order/${orderId}`, diff --git a/examples/vue-query/src/gen/hooks/useGetPetById.ts b/examples/vue-query/src/gen/hooks/useGetPetById.ts index 773e114bb..e4e95a81c 100644 --- a/examples/vue-query/src/gen/hooks/useGetPetById.ts +++ b/examples/vue-query/src/gen/hooks/useGetPetById.ts @@ -15,7 +15,7 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * {@link /pet/:petId} */ -async function getPetById({ petId }: { petId: GetPetByIdPathParams['petId'] }, config: Partial = {}) { +export async function getPetById({ petId }: { petId: GetPetByIdPathParams['petId'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/pet/${petId}`, diff --git a/examples/vue-query/src/gen/hooks/useGetUserByName.ts b/examples/vue-query/src/gen/hooks/useGetUserByName.ts index 7407af27c..66976cd79 100644 --- a/examples/vue-query/src/gen/hooks/useGetUserByName.ts +++ b/examples/vue-query/src/gen/hooks/useGetUserByName.ts @@ -15,7 +15,7 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * {@link /user/:username} */ -async function getUserByName({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { +export async function getUserByName({ username }: { username: GetUserByNamePathParams['username'] }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: `/user/${username}`, diff --git a/examples/vue-query/src/gen/hooks/useLoginUser.ts b/examples/vue-query/src/gen/hooks/useLoginUser.ts index 5ad5ba6d6..b5848a486 100644 --- a/examples/vue-query/src/gen/hooks/useLoginUser.ts +++ b/examples/vue-query/src/gen/hooks/useLoginUser.ts @@ -14,7 +14,7 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * {@link /user/login} */ -async function loginUser({ params }: { params?: LoginUserQueryParams }, config: Partial = {}) { +export async function loginUser({ params }: { params?: LoginUserQueryParams }, config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/login', params, ...config }) return res.data } diff --git a/examples/vue-query/src/gen/hooks/useLogoutUser.ts b/examples/vue-query/src/gen/hooks/useLogoutUser.ts index 82196738d..df8f83c5d 100644 --- a/examples/vue-query/src/gen/hooks/useLogoutUser.ts +++ b/examples/vue-query/src/gen/hooks/useLogoutUser.ts @@ -13,7 +13,7 @@ export type LogoutUserQueryKey = ReturnType * @summary Logs out current logged in user session * {@link /user/logout} */ -async function logoutUser(config: Partial = {}) { +export async function logoutUser(config: Partial = {}) { const res = await client, unknown>({ method: 'GET', url: '/user/logout', ...config }) return res.data } diff --git a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts index e75cce93c..9d0462578 100644 --- a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts +++ b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts @@ -14,7 +14,7 @@ export type PlaceOrderMutationKey = ReturnType * @summary Place an order for a pet * {@link /store/order} */ -async function placeOrder({ data }: { data?: PlaceOrderMutationRequest }, config: Partial> = {}) { +export async function placeOrder({ data }: { data?: PlaceOrderMutationRequest }, config: Partial> = {}) { const res = await client, PlaceOrderMutationRequest>({ method: 'POST', url: '/store/order', diff --git a/examples/vue-query/src/gen/hooks/useUpdatePet.ts b/examples/vue-query/src/gen/hooks/useUpdatePet.ts index 3cc89ac50..caa231c3b 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePet.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePet.ts @@ -14,7 +14,7 @@ export type UpdatePetMutationKey = ReturnType * @summary Update an existing pet * {@link /pet} */ -async function updatePet({ data }: { data: UpdatePetMutationRequest }, config: Partial> = {}) { +export async function updatePet({ data }: { data: UpdatePetMutationRequest }, config: Partial> = {}) { const res = await client, UpdatePetMutationRequest>({ method: 'PUT', url: '/pet', diff --git a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts index 81b060dda..bcf80bef2 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts @@ -18,7 +18,7 @@ export type UpdatePetWithFormMutationKey = ReturnType = {}, ) { diff --git a/examples/vue-query/src/gen/hooks/useUpdateUser.ts b/examples/vue-query/src/gen/hooks/useUpdateUser.ts index fb10ab078..683ecae70 100644 --- a/examples/vue-query/src/gen/hooks/useUpdateUser.ts +++ b/examples/vue-query/src/gen/hooks/useUpdateUser.ts @@ -14,7 +14,7 @@ export type UpdateUserMutationKey = ReturnType * @summary Update user * {@link /user/:username} */ -async function updateUser( +export async function updateUser( { username, data }: { username: UpdateUserPathParams['username']; data?: UpdateUserMutationRequest }, config: Partial> = {}, ) { diff --git a/examples/vue-query/src/gen/hooks/useUploadFile.ts b/examples/vue-query/src/gen/hooks/useUploadFile.ts index 2b6951680..cc198e8ae 100644 --- a/examples/vue-query/src/gen/hooks/useUploadFile.ts +++ b/examples/vue-query/src/gen/hooks/useUploadFile.ts @@ -13,7 +13,7 @@ export type UploadFileMutationKey = ReturnType * @summary uploads an image * {@link /pet/:petId/uploadImage} */ -async function uploadFile( +export async function uploadFile( { petId, data, params }: { petId: UploadFilePathParams['petId']; data?: UploadFileMutationRequest; params?: UploadFileQueryParams }, config: Partial> = {}, ) { diff --git a/examples/vue-query/src/gen/index.ts b/examples/vue-query/src/gen/index.ts index 3e9603276..3e3774491 100644 --- a/examples/vue-query/src/gen/index.ts +++ b/examples/vue-query/src/gen/index.ts @@ -99,25 +99,25 @@ export type { } from './models/UploadFile.ts' export type { User } from './models/User.ts' export type { UserArray } from './models/UserArray.ts' -export { addPetMutationKey, useAddPet } from './hooks/useAddPet.ts' -export { createUserMutationKey, useCreateUser } from './hooks/useCreateUser.ts' -export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './hooks/useCreateUsersWithListInput.ts' -export { deleteOrderMutationKey, useDeleteOrder } from './hooks/useDeleteOrder.ts' -export { deletePetMutationKey, useDeletePet } from './hooks/useDeletePet.ts' -export { deleteUserMutationKey, useDeleteUser } from './hooks/useDeleteUser.ts' -export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './hooks/useFindPetsByStatus.ts' -export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './hooks/useFindPetsByTags.ts' -export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './hooks/useGetInventory.ts' -export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './hooks/useGetOrderById.ts' -export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './hooks/useGetPetById.ts' -export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './hooks/useGetUserByName.ts' -export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './hooks/useLoginUser.ts' -export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './hooks/useLogoutUser.ts' -export { placeOrderMutationKey, usePlaceOrder } from './hooks/usePlaceOrder.ts' -export { updatePetMutationKey, useUpdatePet } from './hooks/useUpdatePet.ts' -export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './hooks/useUpdatePetWithForm.ts' -export { updateUserMutationKey, useUpdateUser } from './hooks/useUpdateUser.ts' -export { uploadFileMutationKey, useUploadFile } from './hooks/useUploadFile.ts' +export { addPetMutationKey, addPet, useAddPet } from './hooks/useAddPet.ts' +export { createUserMutationKey, createUser, useCreateUser } from './hooks/useCreateUser.ts' +export { createUsersWithListInputMutationKey, createUsersWithListInput, useCreateUsersWithListInput } from './hooks/useCreateUsersWithListInput.ts' +export { deleteOrderMutationKey, deleteOrder, useDeleteOrder } from './hooks/useDeleteOrder.ts' +export { deletePetMutationKey, deletePet, useDeletePet } from './hooks/useDeletePet.ts' +export { deleteUserMutationKey, deleteUser, useDeleteUser } from './hooks/useDeleteUser.ts' +export { findPetsByStatusQueryKey, findPetsByStatus, findPetsByStatusQueryOptions, useFindPetsByStatus } from './hooks/useFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTags, findPetsByTagsQueryOptions, useFindPetsByTags } from './hooks/useFindPetsByTags.ts' +export { getInventoryQueryKey, getInventory, getInventoryQueryOptions, useGetInventory } from './hooks/useGetInventory.ts' +export { getOrderByIdQueryKey, getOrderById, getOrderByIdQueryOptions, useGetOrderById } from './hooks/useGetOrderById.ts' +export { getPetByIdQueryKey, getPetById, getPetByIdQueryOptions, useGetPetById } from './hooks/useGetPetById.ts' +export { getUserByNameQueryKey, getUserByName, getUserByNameQueryOptions, useGetUserByName } from './hooks/useGetUserByName.ts' +export { loginUserQueryKey, loginUser, loginUserQueryOptions, useLoginUser } from './hooks/useLoginUser.ts' +export { logoutUserQueryKey, logoutUser, logoutUserQueryOptions, useLogoutUser } from './hooks/useLogoutUser.ts' +export { placeOrderMutationKey, placeOrder, usePlaceOrder } from './hooks/usePlaceOrder.ts' +export { updatePetMutationKey, updatePet, useUpdatePet } from './hooks/useUpdatePet.ts' +export { updatePetWithFormMutationKey, updatePetWithForm, useUpdatePetWithForm } from './hooks/useUpdatePetWithForm.ts' +export { updateUserMutationKey, updateUser, useUpdateUser } from './hooks/useUpdateUser.ts' +export { uploadFileMutationKey, uploadFile, useUploadFile } from './hooks/useUploadFile.ts' export { addressIdentifierEnum } from './models/Address.ts' export { findPetsByStatusQueryParamsStatusEnum } from './models/FindPetsByStatus.ts' export { orderStatusEnum } from './models/Order.ts' diff --git a/packages/core/mocks/index.ts b/packages/core/mocks/index.ts index 2f5515000..35b785598 100644 --- a/packages/core/mocks/index.ts +++ b/packages/core/mocks/index.ts @@ -1,11 +1,11 @@ import { camelCase, pascalCase } from '../src/transformers/casing.ts' import path from 'node:path' -import type { Plugin } from '@kubb/core' import type { File, ResolvedFile } from '@kubb/fs/types' import { getSource } from '../src/FileManager' import type { PluginManager } from '../src/PluginManager.ts' import type { Logger } from '../src/logger' +import type { Plugin } from '../src/types.ts' import { createFile } from '../src/utils' export const mockedLogger = { @@ -45,7 +45,7 @@ export const createMockedPluginManager = (name?: string) => logLevel: 3, }, getPluginByKey: (_pluginKey: Plugin['key']) => { - return {} as Plugin + return undefined }, getFile: ({ name, extname, pluginKey }) => { const baseName = `${name}${extname}` diff --git a/packages/plugin-react-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-react-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts index f68e34d90..464e32f24 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) } +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions< diff --git a/packages/plugin-react-query/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-react-query/src/generators/__snapshots__/clientGetImportPath.ts index db0d8513c..8329ca8be 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-react-query/src/generators/__snapshots__/clientPostImportPath.ts index 258deefa5..4dd509595 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import type { UseMutationOptions } from '@tanstack/react-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { useMutation } from '@tanstack/react-query' @@ -6,6 +7,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{pet_id}' }] as export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:pet_id} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${pet_id}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts index 173b8a502..7f9c3d43d 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTags.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts index d3cd8b284..c131d14d4 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -6,6 +7,25 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags( + { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, + config: Partial = {}, +) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 173b8a502..7f9c3d43d 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index 3eca4a607..3a545bbb3 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [' 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts index 173b8a502..7f9c3d43d 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts index ce7c033af..1a6bd99cc 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTags.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query' import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParam 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} + */ +export async function findPetsByTagsInfinite(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsInfiniteQueryOptions( headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, @@ -20,7 +37,7 @@ export function findPetsByTagsInfiniteQueryOptions( if (params) { params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize'] } - return findPetsByTags(headers, params, config) + return findPetsByTagsInfinite(headers, params, config) }, initialPageParam: 0, getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1), diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts index 284967668..7f2de9236 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query' import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParam 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} + */ +export async function findPetsByTagsInfinite(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsInfiniteQueryOptions( headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, @@ -20,7 +37,7 @@ export function findPetsByTagsInfiniteQueryOptions( if (params) { params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize'] } - return findPetsByTags(headers, params, config) + return findPetsByTagsInfinite(headers, params, config) }, initialPageParam: 0, getNextPageParam: (lastPage) => lastPage['cursor'], diff --git a/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts b/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts index 02dedc079..928859326 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/getPetIdCamelCase.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query' import { queryOptions, useQuery } from '@tanstack/react-query' @@ -6,6 +7,20 @@ export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['pet_id']) => [{ export type GetPetByIdQueryKey = ReturnType +/** + * @description Returns a single pet + * @summary Find pet by ID + * {@link /pet/:pet_id} + */ +export async function getPetById(petId: GetPetByIdPathParams['pet_id'], config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/${petId}`, + ...config, + }) + return getPetByIdQueryResponse.parse(res.data) +} + export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['pet_id'], config: Partial = {}) { const queryKey = getPetByIdQueryKey(petId) return queryOptions, GetPetByIdQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts index 6e0cf82bd..22a61b812 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryResult } from 'custom-query' import { queryOptions, useQuery } from 'custom-query' @@ -10,6 +11,26 @@ export const updatePetWithFormQueryKey = ( export type UpdatePetWithFormQueryKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:pet_id} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${pet_id}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + export function updatePetWithFormQueryOptions( petId: UpdatePetWithFormPathParams['petId'], data?: UpdatePetWithFormMutationRequest, diff --git a/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts index f676059df..a10a0ebe5 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/updatePetById.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' @@ -6,6 +7,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{pet_id}' }] as export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:pet_id} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${pet_id}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} diff --git a/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index a4faf7035..f6181c087 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { UseMutationOptions } from '@tanstack/react-query' import { useMutation } from '@tanstack/react-query' @@ -6,6 +7,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{pet_id}' }] as export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:pet_id} + */ +export async function updatePetWithForm( + { petId }: { petId: UpdatePetWithFormPathParams['petId'] }, + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${pet_id}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:pet_id} diff --git a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx index cdeac7c56..ebc27f0f1 100644 --- a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx +++ b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx @@ -36,10 +36,18 @@ export const infiniteQueryGenerator = createReactGenerator({ file: getFile(operation, { prefix: 'use', suffix: 'infinite' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + suffix: 'infinite', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -75,8 +83,8 @@ export const infiniteQueryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {hasClientPlugin && } {options.client.dataReturnType === 'full' && } ({ typeSchemas={type.schemas} transformer={options.queryKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( ({ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const mutationKey = { @@ -70,8 +77,8 @@ export const mutationGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {!!hasClientPlugin && } ({ transformer={options.mutationKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( ({ file: getFile(operation, { prefix: 'use' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -75,8 +82,8 @@ export const queryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {hasClientPlugin && } {options.client.dataReturnType === 'full' && } ({ paramsCasing={options.paramsCasing} transformer={options.queryKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( ({ file: getFile(operation, { prefix: 'use', suffix: 'suspense' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + suffix: 'suspense', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -76,8 +84,8 @@ export const suspenseQueryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {hasClientPlugin && } {options.client.dataReturnType === 'full' && } ({ transformer={options.queryKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) } +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions< diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-solid-query/src/generators/__snapshots__/clientGetImportPath.ts index 0698ae358..9c7a01924 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts index cf7774962..7824cbb37 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTags.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts index 117f290d5..c5b1a8864 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,25 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags( + { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, + config: Partial = {}, +) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index cf7774962..7824cbb37 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index b37689ec7..de662b11c 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/react-query' import { queryOptions, createQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [' 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts index cf7774962..7824cbb37 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts index b34d187c5..ba99e559a 100644 --- a/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-solid-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from 'custom-query' import { queryOptions, createQuery } from 'custom-query' @@ -10,6 +11,26 @@ export const updatePetWithFormQueryKey = ( export type UpdatePetWithFormQueryKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + export function updatePetWithFormQueryOptions( petId: UpdatePetWithFormPathParams['petId'], data?: UpdatePetWithFormMutationRequest, diff --git a/packages/plugin-solid-query/src/generators/queryGenerator.tsx b/packages/plugin-solid-query/src/generators/queryGenerator.tsx index 682ef4a38..5dd24fe3a 100644 --- a/packages/plugin-solid-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-solid-query/src/generators/queryGenerator.tsx @@ -32,10 +32,17 @@ export const queryGenerator = createReactGenerator({ file: getFile(operation, { prefix: 'create' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -71,8 +78,8 @@ export const queryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {!!hasClientPlugin && } {options.client.dataReturnType === 'full' && } ({ typeSchemas={type.schemas} transformer={options.queryKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) } +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions< diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/clientGetImportPath.ts index ae3e6f23d..09b9beca2 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/clientPostImportPath.ts index c037cd7e4..4381eecb4 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import { createMutation } from '@tanstack/svelte-query' @@ -6,6 +7,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts index efbc778a1..67418ec6c 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTags.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts index d33cd2a7f..bfda4eefd 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,25 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags( + { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, + config: Partial = {}, +) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, config: Partial = {}, diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index efbc778a1..67418ec6c 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index 6ac9886ed..7b00f2f95 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/react-query' import { queryOptions, createQuery } from '@tanstack/react-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [' 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts index efbc778a1..67418ec6c 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query' import { queryOptions, createQuery } from '@tanstack/svelte-query' @@ -6,6 +7,22 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions, FindPetsByTagsQueryResponse, typeof queryKey>({ diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts index 2d94b25bb..f2ff86b44 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from 'custom-query' import { queryOptions, createQuery } from 'custom-query' @@ -10,6 +11,26 @@ export const updatePetWithFormQueryKey = ( export type UpdatePetWithFormQueryKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + export function updatePetWithFormQueryOptions( petId: UpdatePetWithFormPathParams['petId'], data?: UpdatePetWithFormMutationRequest, diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts index a65f7311a..da4554b38 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetById.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' @@ -6,6 +7,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 6dcd3198e..a017d6588 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { CreateMutationOptions } from '@tanstack/svelte-query' import { createMutation } from '@tanstack/svelte-query' @@ -6,6 +7,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + { petId }: { petId: UpdatePetWithFormPathParams['petId'] }, + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx b/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx index ae7518216..51b7b1d77 100644 --- a/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx @@ -46,10 +46,17 @@ export const mutationGenerator = createReactGenerator({ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const mutationKey = { @@ -70,8 +77,8 @@ export const mutationGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {!!hasClientPlugin && } ({ typeSchemas={type.schemas} transformer={options.mutationKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( ({ file: getFile(operation, { prefix: 'create' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -73,8 +80,8 @@ export const queryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {!!hasClientPlugin && } {options.client.dataReturnType === 'full' && } ({ transformer={options.queryKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( [{ 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} + */ +export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + ...config, + }) + return res +} + export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts index 4e3f66498..fd56d9310 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from 'axios' @@ -5,6 +6,21 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + ...config, + }) + return res.data +} + export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts index 9bc453068..0e2bce386 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import useSWRMutation from 'swr/mutation' import type { RequestConfig, ResponseErrorConfig } from 'axios' @@ -5,6 +6,24 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { + const res = await client, unknown>({ + method: 'POST', + url: `/pet/${petId}`, + params, + ...config, + }) + return res.data +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts index 4f9b93dfb..f322894b5 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -5,6 +6,21 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + ...config, + }) + return res.data +} + export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts index 4f9b93dfb..f322894b5 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -5,6 +6,21 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + ...config, + }) + return res.data +} + export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 4f9b93dfb..f322894b5 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -5,6 +6,21 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + ...config, + }) + return res.data +} + export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts index 4f9b93dfb..47585bd14 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -5,6 +6,21 @@ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ 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} + */ +export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial = {}) { return { fetcher: async () => { diff --git a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts index ec2749ad0..ade05f641 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import useSWR from 'custom-swr' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -6,6 +7,23 @@ export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams['pe export type UpdatePetWithFormQueryKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams }, + config: Partial = {}, +) { + const res = await client, unknown>({ + method: 'POST', + url: `/pet/${petId}`, + params, + ...config, + }) + return res.data +} + export function updatePetWithFormQueryOptions( { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams }, config: Partial = {}, diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts index 26efd29ab..0694820d9 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -5,6 +6,24 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { + const res = await client, unknown>({ + method: 'POST', + url: `/pet/${petId}`, + params, + ...config, + }) + return res.data +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index bd54efa0b..d25f71c11 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import useSWRMutation from 'swr/mutation' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' @@ -5,6 +6,24 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + { petId }: { petId: UpdatePetWithFormPathParams['petId'] }, + params?: UpdatePetWithFormQueryParams, + config: Partial = {}, +) { + const res = await client, unknown>({ + method: 'POST', + url: `/pet/${petId}`, + params, + ...config, + }) + return res.data +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-swr/src/generators/mutationGenerator.tsx b/packages/plugin-swr/src/generators/mutationGenerator.tsx index 77f7407e6..9f0a292e7 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.tsx @@ -47,10 +47,17 @@ export const mutationGenerator = createReactGenerator({ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const mutationKey = { @@ -73,8 +80,8 @@ export const mutationGenerator = createReactGenerator({ {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {!!hasClientPlugin && } ({ transformer={options.mutationKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( ({ file: getFile(operation, { prefix: 'use' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -73,8 +80,8 @@ export const queryGenerator = createReactGenerator({ footer={getFooter({ oas, output })} > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {!!hasClientPlugin && } {options.client.dataReturnType === 'full' && } @@ -100,7 +107,7 @@ export const queryGenerator = createReactGenerator({ paramsCasing={options.paramsCasing} transformer={options.queryKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( +/** + * @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 async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) } +} + export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-vue-query/src/generators/__snapshots__/clientGetImportPath.ts index cfc488026..e242fba3d 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/clientGetImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import type { MaybeRef } from 'vue' @@ -8,6 +9,22 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef +/** + * @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 async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-vue-query/src/generators/__snapshots__/clientPostImportPath.ts index 69673473f..329903f9b 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/clientPostImportPath.ts @@ -1,3 +1,4 @@ +import client from 'axios' import type { MutationObserverOptions } from '@tanstack/vue-query' import type { RequestConfig, ResponseErrorConfig } from 'axios' import type { MaybeRef } from 'vue' @@ -7,6 +8,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts index d327f5424..58959fc49 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTags.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -8,6 +9,22 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef +/** + * @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 async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts index 80d92526d..ab896ad3f 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -8,6 +9,25 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef +/** + * @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 async function findPetsByTags( + { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }, + config: Partial = {}, +) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( { headers, params }: { headers: MaybeRef; params?: MaybeRef }, config: Partial = {}, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts index d327f5424..58959fc49 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -8,6 +9,22 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef +/** + * @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 async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts index 82c88c232..f2d05b749 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -9,6 +10,22 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef +/** + * @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 async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts index d327f5424..58959fc49 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsWithZod.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -8,6 +9,22 @@ export const findPetsByTagsQueryKey = (params?: MaybeRef +/** + * @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 async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsQueryOptions( headers: MaybeRef, params?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts index cc8cb2b3f..4111595e4 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTags.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -8,6 +9,22 @@ export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef +/** + * @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 async function findPetsByTagsInfinite(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsInfiniteQueryOptions( headers: MaybeRef, params?: MaybeRef, @@ -22,7 +39,7 @@ export function findPetsByTagsInfiniteQueryOptions( if (params) { params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize'] } - return findPetsByTags(headers, params, config) + return findPetsByTagsInfinite(headers, params, config) }, initialPageParam: 0, getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1), diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts index cff5dd128..0cf67e27f 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findInfiniteByTagsCursor.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query' import type { MaybeRef } from 'vue' @@ -8,6 +9,22 @@ export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef +/** + * @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 async function findPetsByTagsInfinite(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { + const res = await client, unknown>({ + method: 'GET', + url: `/pet/findByTags`, + params, + headers: { ...headers, ...config.headers }, + ...config, + }) + return findPetsByTagsQueryResponse.parse(res.data) +} + export function findPetsByTagsInfiniteQueryOptions( headers: MaybeRef, params?: MaybeRef, @@ -22,7 +39,7 @@ export function findPetsByTagsInfiniteQueryOptions( if (params) { params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize'] } - return findPetsByTags(headers, params, config) + return findPetsByTagsInfinite(headers, params, config) }, initialPageParam: 0, getNextPageParam: (lastPage) => lastPage['cursor'], diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts index 467c3a2b5..6829d5779 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/postAsQuery.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from 'custom-query' import type { MaybeRef } from 'vue' @@ -12,6 +13,26 @@ export const updatePetWithFormQueryKey = ( export type UpdatePetWithFormQueryKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + export function updatePetWithFormQueryOptions( petId: MaybeRef, data?: MaybeRef, diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts index 38df4aa1f..d928cdfe9 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetById.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { MutationObserverOptions } from '@tanstack/vue-query' import type { MaybeRef } from 'vue' @@ -7,6 +8,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + petId: UpdatePetWithFormPathParams['petId'], + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 6ee049726..32724b48a 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -1,3 +1,4 @@ +import client from '@kubb/plugin-client/clients/axios' import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios' import type { MutationObserverOptions } from '@tanstack/vue-query' import type { MaybeRef } from 'vue' @@ -7,6 +8,26 @@ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as c export type UpdatePetWithFormMutationKey = ReturnType +/** + * @summary Updates a pet in the store with form data + * {@link /pet/:petId} + */ +export async function updatePetWithForm( + { petId }: { petId: UpdatePetWithFormPathParams['petId'] }, + data?: UpdatePetWithFormMutationRequest, + params?: UpdatePetWithFormQueryParams, + config: Partial> = {}, +) { + const res = await client, UpdatePetWithFormMutationRequest>({ + method: 'POST', + url: `/pet/${petId}`, + params, + data, + ...config, + }) + return updatePetWithFormMutationResponse.parse(res.data) +} + /** * @summary Updates a pet in the store with form data * {@link /pet/:petId} diff --git a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx index ff8efa064..d24c0a672 100644 --- a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx +++ b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx @@ -35,10 +35,18 @@ export const infiniteQueryGenerator = createReactGenerator({ file: getFile(operation, { prefix: 'use', suffix: 'infinite' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + suffix: 'infinite', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -76,8 +84,8 @@ export const infiniteQueryGenerator = createReactGenerator({ {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {hasClientPlugin && } {options.client.dataReturnType === 'full' && } ({ typeSchemas={type.schemas} transformer={options.queryKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( ({ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const mutationKey = { @@ -71,8 +78,8 @@ export const mutationGenerator = createReactGenerator({ > {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {!!hasClientPlugin && } ({ typeSchemas={type.schemas} transformer={options.mutationKey} /> - {!client.plugin && ( + {!hasClientPlugin && ( ({ file: getFile(operation, { prefix: 'use' }), } + const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) const client = { - name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), + name: hasClientPlugin + ? getName(operation, { + type: 'function', + pluginKey: [pluginClientName], + }) + : getName(operation, { + type: 'function', + }), file: getFile(operation, { pluginKey: [pluginClientName] }), - plugin: pluginManager.getPluginByKey([pluginClientName]), } const queryOptions = { @@ -75,8 +82,8 @@ export const queryGenerator = createReactGenerator({ {options.parser === 'zod' && } - {!client.plugin && } - {!!client.plugin && } + {!hasClientPlugin && } + {!!hasClientPlugin && } {options.client.dataReturnType === 'full' && } ({ typeSchemas={type.schemas} transformer={options.queryKey} /> - {!client.plugin && ( + {!hasClientPlugin && (