@kubb/plugin-react-query 4.29.1 → 4.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SuspenseQuery-BFn3x1kP.js → SuspenseQuery-BJRjCVPn.js} +26 -26
- package/dist/SuspenseQuery-BJRjCVPn.js.map +1 -0
- package/dist/{SuspenseQuery-Dqr3APYf.cjs → SuspenseQuery-BS2DyU8v.cjs} +26 -26
- package/dist/SuspenseQuery-BS2DyU8v.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/{suspenseQueryGenerator-BjEGcQcE.js → suspenseQueryGenerator-X-e7npGw.js} +12 -12
- package/dist/suspenseQueryGenerator-X-e7npGw.js.map +1 -0
- package/dist/{suspenseQueryGenerator-CHrwd9jE.cjs → suspenseQueryGenerator-kZuBiph0.cjs} +12 -12
- package/dist/suspenseQueryGenerator-kZuBiph0.cjs.map +1 -0
- package/package.json +11 -10
- package/src/components/InfiniteQueryOptions.tsx +20 -10
- package/src/components/QueryOptions.tsx +9 -4
- package/src/components/SuspenseInfiniteQueryOptions.tsx +21 -11
- package/src/generators/infiniteQueryGenerator.tsx +4 -2
- package/src/generators/mutationGenerator.tsx +4 -2
- package/src/generators/queryGenerator.tsx +4 -2
- package/src/generators/suspenseInfiniteQueryGenerator.tsx +4 -2
- package/src/generators/suspenseQueryGenerator.tsx +4 -2
- package/dist/SuspenseQuery-BFn3x1kP.js.map +0 -1
- package/dist/SuspenseQuery-Dqr3APYf.cjs.map +0 -1
- package/dist/suspenseQueryGenerator-BjEGcQcE.js.map +0 -1
- package/dist/suspenseQueryGenerator-CHrwd9jE.cjs.map +0 -1
- package/dist/types-BvXj6Cu5.d.ts +0 -204
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +0 -93
- package/src/generators/__snapshots__/clientGetImportPath.ts +0 -88
- package/src/generators/__snapshots__/clientPostImportPath.ts +0 -99
- package/src/generators/__snapshots__/createUsersWithListInput.ts +0 -83
- package/src/generators/__snapshots__/createUsersWithListInputAsQuery.ts +0 -87
- package/src/generators/__snapshots__/findByStatusAllOptional.ts +0 -81
- package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +0 -78
- package/src/generators/__snapshots__/findByTags.ts +0 -88
- package/src/generators/__snapshots__/findByTagsObject.ts +0 -85
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +0 -88
- package/src/generators/__snapshots__/findByTagsTemplateString.ts +0 -89
- package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +0 -91
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +0 -88
- package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -88
- package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +0 -99
- package/src/generators/__snapshots__/findInfiniteByTags.ts +0 -102
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +0 -102
- package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +0 -102
- package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +0 -101
- package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +0 -105
- package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +0 -81
- package/src/generators/__snapshots__/findSuspenseByTags.ts +0 -82
- package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +0 -85
- package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +0 -99
- package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +0 -103
- package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +0 -103
- package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +0 -106
- package/src/generators/__snapshots__/getAsMutation.ts +0 -31
- package/src/generators/__snapshots__/getPetIdCamelCase.ts +0 -76
- package/src/generators/__snapshots__/postAsQuery.ts +0 -96
- package/src/generators/__snapshots__/requiredOneOfRequestBody.ts +0 -94
- package/src/generators/__snapshots__/requiredOneOfRequestBodyWithClientPlugin.ts +0 -71
- package/src/generators/__snapshots__/updatePetById.ts +0 -99
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +0 -99
- package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +0 -107
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { UseMutationOptions } from 'custom-swr/mutation'
|
|
4
|
-
import { useMutation } from 'custom-swr/mutation'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
8
|
-
* @summary Finds Pets by tags
|
|
9
|
-
* @link /pet/findByTags
|
|
10
|
-
*/
|
|
11
|
-
export function findPetsByTags(
|
|
12
|
-
options: {
|
|
13
|
-
mutation?: UseMutationOptions<
|
|
14
|
-
FindPetsByTagsQueryResponse,
|
|
15
|
-
FindPetsByTags400,
|
|
16
|
-
{
|
|
17
|
-
headers: FindPetsByTagsHeaderParams
|
|
18
|
-
params?: FindPetsByTagsQueryParams
|
|
19
|
-
}
|
|
20
|
-
>
|
|
21
|
-
client?: Partial<RequestConfig>
|
|
22
|
-
} = {},
|
|
23
|
-
) {
|
|
24
|
-
const { mutation: mutationOptions, client: config = {} } = options ?? {}
|
|
25
|
-
return useMutation({
|
|
26
|
-
mutationFn: async ({ headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }) => {
|
|
27
|
-
return findPetsByTags(headers, params, config)
|
|
28
|
-
},
|
|
29
|
-
...mutationOptions,
|
|
30
|
-
})
|
|
31
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
-
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
7
|
-
import { fetch } from './test/.kubb/fetch'
|
|
8
|
-
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
9
|
-
|
|
10
|
-
export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:pet_id', params: { petId: petId } }] as const
|
|
11
|
-
|
|
12
|
-
export type GetPetByIdQueryKey = ReturnType<typeof getPetByIdQueryKey>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @description Returns a single pet
|
|
16
|
-
* @summary Find pet by ID
|
|
17
|
-
* {@link /pet/:pet_id}
|
|
18
|
-
*/
|
|
19
|
-
export async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
20
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
21
|
-
|
|
22
|
-
const pet_id = petId
|
|
23
|
-
|
|
24
|
-
const res = await request<GetPetByIdQueryResponse, ResponseErrorConfig<GetPetById400 | GetPetById404>, unknown>({
|
|
25
|
-
method: 'GET',
|
|
26
|
-
url: `/pet/${pet_id}`,
|
|
27
|
-
...requestConfig,
|
|
28
|
-
})
|
|
29
|
-
return getPetByIdQueryResponse.parse(res.data)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['petId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
33
|
-
const queryKey = getPetByIdQueryKey(petId)
|
|
34
|
-
return queryOptions<GetPetByIdQueryResponse, ResponseErrorConfig<GetPetById400 | GetPetById404>, GetPetByIdQueryResponse, typeof queryKey>({
|
|
35
|
-
enabled: !!petId,
|
|
36
|
-
queryKey,
|
|
37
|
-
queryFn: async ({ signal }) => {
|
|
38
|
-
if (!config.signal) {
|
|
39
|
-
config.signal = signal
|
|
40
|
-
}
|
|
41
|
-
return getPetById(petId, config)
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @description Returns a single pet
|
|
48
|
-
* @summary Find pet by ID
|
|
49
|
-
* {@link /pet/:pet_id}
|
|
50
|
-
*/
|
|
51
|
-
export function useGetPetById<TData = GetPetByIdQueryResponse, TQueryData = GetPetByIdQueryResponse, TQueryKey extends QueryKey = GetPetByIdQueryKey>(
|
|
52
|
-
petId: GetPetByIdPathParams['petId'],
|
|
53
|
-
options: {
|
|
54
|
-
query?: Partial<QueryObserverOptions<GetPetByIdQueryResponse, ResponseErrorConfig<GetPetById400 | GetPetById404>, TData, TQueryData, TQueryKey>> & {
|
|
55
|
-
client?: QueryClient
|
|
56
|
-
}
|
|
57
|
-
client?: Partial<RequestConfig> & { client?: Client }
|
|
58
|
-
} = {},
|
|
59
|
-
) {
|
|
60
|
-
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
61
|
-
const { client: queryClient, ...queryOptions } = queryConfig
|
|
62
|
-
const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId)
|
|
63
|
-
|
|
64
|
-
const query = useQuery(
|
|
65
|
-
{
|
|
66
|
-
...getPetByIdQueryOptions(petId, config),
|
|
67
|
-
queryKey,
|
|
68
|
-
...queryOptions,
|
|
69
|
-
} as unknown as QueryObserverOptions,
|
|
70
|
-
queryClient,
|
|
71
|
-
) as UseQueryResult<TData, ResponseErrorConfig<GetPetById400 | GetPetById404>> & { queryKey: TQueryKey }
|
|
72
|
-
|
|
73
|
-
query.queryKey = queryKey as TQueryKey
|
|
74
|
-
|
|
75
|
-
return query
|
|
76
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
-
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from 'custom-query'
|
|
7
|
-
import { fetch } from './test/.kubb/fetch'
|
|
8
|
-
import { queryOptions, useQuery } from 'custom-query'
|
|
9
|
-
|
|
10
|
-
export const updatePetWithFormQueryKey = (
|
|
11
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
12
|
-
data: UpdatePetWithFormMutationRequest = {},
|
|
13
|
-
params: UpdatePetWithFormQueryParams = {},
|
|
14
|
-
) => [{ url: '/pet/:pet_id', params: { pet_id: pet_id } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const
|
|
15
|
-
|
|
16
|
-
export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @summary Updates a pet in the store with form data
|
|
20
|
-
* {@link /pet/:pet_id}
|
|
21
|
-
*/
|
|
22
|
-
export async function updatePetWithForm(
|
|
23
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
24
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
25
|
-
params?: UpdatePetWithFormQueryParams,
|
|
26
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
27
|
-
) {
|
|
28
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
29
|
-
|
|
30
|
-
const requestData = updatePetWithFormMutationRequest.parse(data)
|
|
31
|
-
|
|
32
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
|
|
33
|
-
method: 'POST',
|
|
34
|
-
url: `/pet/${pet_id}`,
|
|
35
|
-
params,
|
|
36
|
-
data: requestData,
|
|
37
|
-
...requestConfig,
|
|
38
|
-
})
|
|
39
|
-
return updatePetWithFormMutationResponse.parse(res.data)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function updatePetWithFormQueryOptions(
|
|
43
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
44
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
45
|
-
params?: UpdatePetWithFormQueryParams,
|
|
46
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
47
|
-
) {
|
|
48
|
-
const queryKey = updatePetWithFormQueryKey(petId, data, params)
|
|
49
|
-
return queryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationResponse, typeof queryKey>({
|
|
50
|
-
enabled: !!petId,
|
|
51
|
-
queryKey,
|
|
52
|
-
queryFn: async ({ signal }) => {
|
|
53
|
-
if (!config.signal) {
|
|
54
|
-
config.signal = signal
|
|
55
|
-
}
|
|
56
|
-
return updatePetWithForm(petId, data, params, config)
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @summary Updates a pet in the store with form data
|
|
63
|
-
* {@link /pet/:pet_id}
|
|
64
|
-
*/
|
|
65
|
-
export function useUpdatePetWithForm<
|
|
66
|
-
TData = UpdatePetWithFormMutationResponse,
|
|
67
|
-
TQueryData = UpdatePetWithFormMutationResponse,
|
|
68
|
-
TQueryKey extends QueryKey = UpdatePetWithFormQueryKey,
|
|
69
|
-
>(
|
|
70
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
71
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
72
|
-
params?: UpdatePetWithFormQueryParams,
|
|
73
|
-
options: {
|
|
74
|
-
query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, TData, TQueryData, TQueryKey>> & {
|
|
75
|
-
client?: QueryClient
|
|
76
|
-
}
|
|
77
|
-
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
|
|
78
|
-
} = {},
|
|
79
|
-
) {
|
|
80
|
-
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
81
|
-
const { client: queryClient, ...queryOptions } = queryConfig
|
|
82
|
-
const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params)
|
|
83
|
-
|
|
84
|
-
const query = useQuery(
|
|
85
|
-
{
|
|
86
|
-
...updatePetWithFormQueryOptions(petId, data, params, config),
|
|
87
|
-
queryKey,
|
|
88
|
-
...queryOptions,
|
|
89
|
-
} as unknown as QueryObserverOptions,
|
|
90
|
-
queryClient,
|
|
91
|
-
) as UseQueryResult<TData, ResponseErrorConfig<UpdatePetWithForm405>> & { queryKey: TQueryKey }
|
|
92
|
-
|
|
93
|
-
query.queryKey = queryKey as TQueryKey
|
|
94
|
-
|
|
95
|
-
return query
|
|
96
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
-
import type { UseMutationOptions, UseMutationResult, QueryClient } from '@tanstack/react-query'
|
|
7
|
-
import { fetch } from './test/.kubb/fetch'
|
|
8
|
-
import { mutationOptions, useMutation } from '@tanstack/react-query'
|
|
9
|
-
|
|
10
|
-
export const createOrderMutationKey = () => [{ url: '/orders' }] as const
|
|
11
|
-
|
|
12
|
-
export type CreateOrderMutationKey = ReturnType<typeof createOrderMutationKey>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* {@link /orders}
|
|
16
|
-
*/
|
|
17
|
-
export async function createOrder(
|
|
18
|
-
data: CreateOrderMutationRequest,
|
|
19
|
-
headers?: CreateOrderHeaderParams,
|
|
20
|
-
config: Partial<RequestConfig<CreateOrderMutationRequest>> & { client?: Client } = {},
|
|
21
|
-
) {
|
|
22
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
23
|
-
|
|
24
|
-
const requestData = createOrderMutationRequest.parse(data)
|
|
25
|
-
|
|
26
|
-
const res = await request<CreateOrderMutationResponse, ResponseErrorConfig<Error>, CreateOrderMutationRequest>({
|
|
27
|
-
method: 'POST',
|
|
28
|
-
url: `/orders`,
|
|
29
|
-
data: requestData,
|
|
30
|
-
...requestConfig,
|
|
31
|
-
headers: { ...headers, ...requestConfig.headers },
|
|
32
|
-
})
|
|
33
|
-
return createOrderMutationResponse.parse(res.data)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function createOrderMutationOptions<TContext = unknown>(config: Partial<RequestConfig<CreateOrderMutationRequest>> & { client?: Client } = {}) {
|
|
37
|
-
const mutationKey = createOrderMutationKey()
|
|
38
|
-
return mutationOptions<
|
|
39
|
-
CreateOrderMutationResponse,
|
|
40
|
-
ResponseErrorConfig<Error>,
|
|
41
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
42
|
-
TContext
|
|
43
|
-
>({
|
|
44
|
-
mutationKey,
|
|
45
|
-
mutationFn: async ({ data, headers }) => {
|
|
46
|
-
return createOrder(data, headers, config)
|
|
47
|
-
},
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* {@link /orders}
|
|
53
|
-
*/
|
|
54
|
-
export function useCreateOrder<TContext>(
|
|
55
|
-
options: {
|
|
56
|
-
mutation?: UseMutationOptions<
|
|
57
|
-
CreateOrderMutationResponse,
|
|
58
|
-
ResponseErrorConfig<Error>,
|
|
59
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
60
|
-
TContext
|
|
61
|
-
> & { client?: QueryClient }
|
|
62
|
-
client?: Partial<RequestConfig<CreateOrderMutationRequest>> & { client?: Client }
|
|
63
|
-
} = {},
|
|
64
|
-
) {
|
|
65
|
-
const { mutation = {}, client: config = {} } = options ?? {}
|
|
66
|
-
const { client: queryClient, ...mutationOptions } = mutation
|
|
67
|
-
const mutationKey = mutationOptions.mutationKey ?? createOrderMutationKey()
|
|
68
|
-
|
|
69
|
-
const baseOptions = createOrderMutationOptions(config) as UseMutationOptions<
|
|
70
|
-
CreateOrderMutationResponse,
|
|
71
|
-
ResponseErrorConfig<Error>,
|
|
72
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
73
|
-
TContext
|
|
74
|
-
>
|
|
75
|
-
|
|
76
|
-
return useMutation<
|
|
77
|
-
CreateOrderMutationResponse,
|
|
78
|
-
ResponseErrorConfig<Error>,
|
|
79
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
80
|
-
TContext
|
|
81
|
-
>(
|
|
82
|
-
{
|
|
83
|
-
...baseOptions,
|
|
84
|
-
mutationKey,
|
|
85
|
-
...mutationOptions,
|
|
86
|
-
},
|
|
87
|
-
queryClient,
|
|
88
|
-
) as UseMutationResult<
|
|
89
|
-
CreateOrderMutationResponse,
|
|
90
|
-
ResponseErrorConfig<Error>,
|
|
91
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
92
|
-
TContext
|
|
93
|
-
>
|
|
94
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
-
import type { UseMutationOptions, UseMutationResult, QueryClient } from '@tanstack/react-query'
|
|
7
|
-
import { mutationOptions, useMutation } from '@tanstack/react-query'
|
|
8
|
-
|
|
9
|
-
export const createOrderMutationKey = () => [{ url: '/orders' }] as const
|
|
10
|
-
|
|
11
|
-
export type CreateOrderMutationKey = ReturnType<typeof createOrderMutationKey>
|
|
12
|
-
|
|
13
|
-
export function createOrderMutationOptions<TContext = unknown>(config: Partial<RequestConfig<CreateOrderMutationRequest>> & { client?: Client } = {}) {
|
|
14
|
-
const mutationKey = createOrderMutationKey()
|
|
15
|
-
return mutationOptions<
|
|
16
|
-
CreateOrderMutationResponse,
|
|
17
|
-
ResponseErrorConfig<Error>,
|
|
18
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
19
|
-
TContext
|
|
20
|
-
>({
|
|
21
|
-
mutationKey,
|
|
22
|
-
mutationFn: async ({ data, headers }) => {
|
|
23
|
-
return createOrder(data, headers, config)
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* {@link /orders}
|
|
30
|
-
*/
|
|
31
|
-
export function useCreateOrder<TContext>(
|
|
32
|
-
options: {
|
|
33
|
-
mutation?: UseMutationOptions<
|
|
34
|
-
CreateOrderMutationResponse,
|
|
35
|
-
ResponseErrorConfig<Error>,
|
|
36
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
37
|
-
TContext
|
|
38
|
-
> & { client?: QueryClient }
|
|
39
|
-
client?: Partial<RequestConfig<CreateOrderMutationRequest>> & { client?: Client }
|
|
40
|
-
} = {},
|
|
41
|
-
) {
|
|
42
|
-
const { mutation = {}, client: config = {} } = options ?? {}
|
|
43
|
-
const { client: queryClient, ...mutationOptions } = mutation
|
|
44
|
-
const mutationKey = mutationOptions.mutationKey ?? createOrderMutationKey()
|
|
45
|
-
|
|
46
|
-
const baseOptions = createOrderMutationOptions(config) as UseMutationOptions<
|
|
47
|
-
CreateOrderMutationResponse,
|
|
48
|
-
ResponseErrorConfig<Error>,
|
|
49
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
50
|
-
TContext
|
|
51
|
-
>
|
|
52
|
-
|
|
53
|
-
return useMutation<
|
|
54
|
-
CreateOrderMutationResponse,
|
|
55
|
-
ResponseErrorConfig<Error>,
|
|
56
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
57
|
-
TContext
|
|
58
|
-
>(
|
|
59
|
-
{
|
|
60
|
-
...baseOptions,
|
|
61
|
-
mutationKey,
|
|
62
|
-
...mutationOptions,
|
|
63
|
-
},
|
|
64
|
-
queryClient,
|
|
65
|
-
) as UseMutationResult<
|
|
66
|
-
CreateOrderMutationResponse,
|
|
67
|
-
ResponseErrorConfig<Error>,
|
|
68
|
-
{ data: CreateOrderMutationRequest; headers?: CreateOrderHeaderParams },
|
|
69
|
-
TContext
|
|
70
|
-
>
|
|
71
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
-
import type { UseMutationOptions, UseMutationResult, QueryClient } from '@tanstack/react-query'
|
|
7
|
-
import { fetch } from './test/.kubb/fetch'
|
|
8
|
-
import { mutationOptions, useMutation } from '@tanstack/react-query'
|
|
9
|
-
|
|
10
|
-
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:pet_id' }] as const
|
|
11
|
-
|
|
12
|
-
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @summary Updates a pet in the store with form data
|
|
16
|
-
* {@link /pet/:pet_id}
|
|
17
|
-
*/
|
|
18
|
-
export async function updatePetWithForm(
|
|
19
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
20
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
21
|
-
params?: UpdatePetWithFormQueryParams,
|
|
22
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
23
|
-
) {
|
|
24
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
25
|
-
|
|
26
|
-
const requestData = updatePetWithFormMutationRequest.parse(data)
|
|
27
|
-
|
|
28
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
|
|
29
|
-
method: 'POST',
|
|
30
|
-
url: `/pet/${pet_id}`,
|
|
31
|
-
params,
|
|
32
|
-
data: requestData,
|
|
33
|
-
...requestConfig,
|
|
34
|
-
})
|
|
35
|
-
return updatePetWithFormMutationResponse.parse(res.data)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function updatePetWithFormMutationOptions<TContext = unknown>(
|
|
39
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
40
|
-
) {
|
|
41
|
-
const mutationKey = updatePetWithFormMutationKey()
|
|
42
|
-
return mutationOptions<
|
|
43
|
-
UpdatePetWithFormMutationResponse,
|
|
44
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
45
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
46
|
-
TContext
|
|
47
|
-
>({
|
|
48
|
-
mutationKey,
|
|
49
|
-
mutationFn: async ({ petId, data, params }) => {
|
|
50
|
-
return updatePetWithForm(petId, data, params, config)
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @summary Updates a pet in the store with form data
|
|
57
|
-
* {@link /pet/:pet_id}
|
|
58
|
-
*/
|
|
59
|
-
export function useUpdatePetWithForm<TContext>(
|
|
60
|
-
options: {
|
|
61
|
-
mutation?: UseMutationOptions<
|
|
62
|
-
UpdatePetWithFormMutationResponse,
|
|
63
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
64
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
65
|
-
TContext
|
|
66
|
-
> & { client?: QueryClient }
|
|
67
|
-
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
|
|
68
|
-
} = {},
|
|
69
|
-
) {
|
|
70
|
-
const { mutation = {}, client: config = {} } = options ?? {}
|
|
71
|
-
const { client: queryClient, ...mutationOptions } = mutation
|
|
72
|
-
const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
|
|
73
|
-
|
|
74
|
-
const baseOptions = updatePetWithFormMutationOptions(config) as UseMutationOptions<
|
|
75
|
-
UpdatePetWithFormMutationResponse,
|
|
76
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
77
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
78
|
-
TContext
|
|
79
|
-
>
|
|
80
|
-
|
|
81
|
-
return useMutation<
|
|
82
|
-
UpdatePetWithFormMutationResponse,
|
|
83
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
84
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
85
|
-
TContext
|
|
86
|
-
>(
|
|
87
|
-
{
|
|
88
|
-
...baseOptions,
|
|
89
|
-
mutationKey,
|
|
90
|
-
...mutationOptions,
|
|
91
|
-
},
|
|
92
|
-
queryClient,
|
|
93
|
-
) as UseMutationResult<
|
|
94
|
-
UpdatePetWithFormMutationResponse,
|
|
95
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
96
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
97
|
-
TContext
|
|
98
|
-
>
|
|
99
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
-
import type { UseMutationOptions, UseMutationResult, QueryClient } from '@tanstack/react-query'
|
|
7
|
-
import { fetch } from './test/.kubb/fetch'
|
|
8
|
-
import { mutationOptions, useMutation } from '@tanstack/react-query'
|
|
9
|
-
|
|
10
|
-
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:pet_id' }] as const
|
|
11
|
-
|
|
12
|
-
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @summary Updates a pet in the store with form data
|
|
16
|
-
* {@link /pet/:pet_id}
|
|
17
|
-
*/
|
|
18
|
-
export async function updatePetWithForm(
|
|
19
|
-
{ petId }: { petId: UpdatePetWithFormPathParams['petId'] },
|
|
20
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
21
|
-
params?: UpdatePetWithFormQueryParams,
|
|
22
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
23
|
-
) {
|
|
24
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
25
|
-
|
|
26
|
-
const requestData = updatePetWithFormMutationRequest.parse(data)
|
|
27
|
-
|
|
28
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
|
|
29
|
-
method: 'POST',
|
|
30
|
-
url: `/pet/${pet_id}`,
|
|
31
|
-
params,
|
|
32
|
-
data: requestData,
|
|
33
|
-
...requestConfig,
|
|
34
|
-
})
|
|
35
|
-
return updatePetWithFormMutationResponse.parse(res.data)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function updatePetWithFormMutationOptions<TContext = unknown>(
|
|
39
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
40
|
-
) {
|
|
41
|
-
const mutationKey = updatePetWithFormMutationKey()
|
|
42
|
-
return mutationOptions<
|
|
43
|
-
UpdatePetWithFormMutationResponse,
|
|
44
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
45
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
46
|
-
TContext
|
|
47
|
-
>({
|
|
48
|
-
mutationKey,
|
|
49
|
-
mutationFn: async ({ petId, data, params }) => {
|
|
50
|
-
return updatePetWithForm({ petId }, data, params, config)
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @summary Updates a pet in the store with form data
|
|
57
|
-
* {@link /pet/:pet_id}
|
|
58
|
-
*/
|
|
59
|
-
export function useUpdatePetWithForm<TContext>(
|
|
60
|
-
options: {
|
|
61
|
-
mutation?: UseMutationOptions<
|
|
62
|
-
UpdatePetWithFormMutationResponse,
|
|
63
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
64
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
65
|
-
TContext
|
|
66
|
-
> & { client?: QueryClient }
|
|
67
|
-
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
|
|
68
|
-
} = {},
|
|
69
|
-
) {
|
|
70
|
-
const { mutation = {}, client: config = {} } = options ?? {}
|
|
71
|
-
const { client: queryClient, ...mutationOptions } = mutation
|
|
72
|
-
const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
|
|
73
|
-
|
|
74
|
-
const baseOptions = updatePetWithFormMutationOptions(config) as UseMutationOptions<
|
|
75
|
-
UpdatePetWithFormMutationResponse,
|
|
76
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
77
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
78
|
-
TContext
|
|
79
|
-
>
|
|
80
|
-
|
|
81
|
-
return useMutation<
|
|
82
|
-
UpdatePetWithFormMutationResponse,
|
|
83
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
84
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
85
|
-
TContext
|
|
86
|
-
>(
|
|
87
|
-
{
|
|
88
|
-
...baseOptions,
|
|
89
|
-
mutationKey,
|
|
90
|
-
...mutationOptions,
|
|
91
|
-
},
|
|
92
|
-
queryClient,
|
|
93
|
-
) as UseMutationResult<
|
|
94
|
-
UpdatePetWithFormMutationResponse,
|
|
95
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
96
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
97
|
-
TContext
|
|
98
|
-
>
|
|
99
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
-
import type { UseMutationOptions, UseMutationResult, QueryClient } from '@tanstack/react-query'
|
|
7
|
-
import { fetch } from './test/.kubb/fetch'
|
|
8
|
-
import { mutationOptions, useMutation } from '@tanstack/react-query'
|
|
9
|
-
import { useCustomHookOptions } from 'useCustomHookOptions.ts'
|
|
10
|
-
|
|
11
|
-
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:pet_id' }] as const
|
|
12
|
-
|
|
13
|
-
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @summary Updates a pet in the store with form data
|
|
17
|
-
* {@link /pet/:pet_id}
|
|
18
|
-
*/
|
|
19
|
-
export async function updatePetWithForm(
|
|
20
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
21
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
22
|
-
params?: UpdatePetWithFormQueryParams,
|
|
23
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
24
|
-
) {
|
|
25
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
26
|
-
|
|
27
|
-
const requestData = updatePetWithFormMutationRequest.parse(data)
|
|
28
|
-
|
|
29
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
|
|
30
|
-
method: 'POST',
|
|
31
|
-
url: `/pet/${pet_id}`,
|
|
32
|
-
params,
|
|
33
|
-
data: requestData,
|
|
34
|
-
...requestConfig,
|
|
35
|
-
})
|
|
36
|
-
return updatePetWithFormMutationResponse.parse(res.data)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function updatePetWithFormMutationOptions<TContext = unknown>(
|
|
40
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
41
|
-
) {
|
|
42
|
-
const mutationKey = updatePetWithFormMutationKey()
|
|
43
|
-
return mutationOptions<
|
|
44
|
-
UpdatePetWithFormMutationResponse,
|
|
45
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
46
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
47
|
-
TContext
|
|
48
|
-
>({
|
|
49
|
-
mutationKey,
|
|
50
|
-
mutationFn: async ({ petId, data, params }) => {
|
|
51
|
-
return updatePetWithForm(petId, data, params, config)
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @summary Updates a pet in the store with form data
|
|
58
|
-
* {@link /pet/:pet_id}
|
|
59
|
-
*/
|
|
60
|
-
export function useUpdatePetWithForm<TContext>(
|
|
61
|
-
options: {
|
|
62
|
-
mutation?: UseMutationOptions<
|
|
63
|
-
UpdatePetWithFormMutationResponse,
|
|
64
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
65
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
66
|
-
TContext
|
|
67
|
-
> & { client?: QueryClient }
|
|
68
|
-
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
|
|
69
|
-
} = {},
|
|
70
|
-
) {
|
|
71
|
-
const { mutation = {}, client: config = {} } = options ?? {}
|
|
72
|
-
const { client: queryClient, ...mutationOptions } = mutation
|
|
73
|
-
const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
|
|
74
|
-
|
|
75
|
-
const baseOptions = updatePetWithFormMutationOptions(config) as UseMutationOptions<
|
|
76
|
-
UpdatePetWithFormMutationResponse,
|
|
77
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
78
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
79
|
-
TContext
|
|
80
|
-
>
|
|
81
|
-
const customOptions = useCustomHookOptions({ hookName: 'useUpdatePetWithForm', operationId: 'updatePetWithForm' }) as UseMutationOptions<
|
|
82
|
-
UpdatePetWithFormMutationResponse,
|
|
83
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
84
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
85
|
-
TContext
|
|
86
|
-
>
|
|
87
|
-
|
|
88
|
-
return useMutation<
|
|
89
|
-
UpdatePetWithFormMutationResponse,
|
|
90
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
91
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
92
|
-
TContext
|
|
93
|
-
>(
|
|
94
|
-
{
|
|
95
|
-
...baseOptions,
|
|
96
|
-
...customOptions,
|
|
97
|
-
mutationKey,
|
|
98
|
-
...mutationOptions,
|
|
99
|
-
},
|
|
100
|
-
queryClient,
|
|
101
|
-
) as UseMutationResult<
|
|
102
|
-
UpdatePetWithFormMutationResponse,
|
|
103
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
104
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
105
|
-
TContext
|
|
106
|
-
>
|
|
107
|
-
}
|