@kubb/plugin-react-query 3.0.0-alpha.9 → 3.0.0-beta.10
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/README.md +14 -5
- package/dist/chunk-24SL7I66.cjs +683 -0
- package/dist/chunk-24SL7I66.cjs.map +1 -0
- package/dist/chunk-BML6BZ4F.cjs +878 -0
- package/dist/chunk-BML6BZ4F.cjs.map +1 -0
- package/dist/chunk-JFIGHRBM.js +867 -0
- package/dist/chunk-JFIGHRBM.js.map +1 -0
- package/dist/chunk-LBVGJA4Q.js +674 -0
- package/dist/chunk-LBVGJA4Q.js.map +1 -0
- package/dist/components.cjs +39 -12
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +172 -6
- package/dist/components.d.ts +172 -6
- package/dist/components.js +2 -12
- package/dist/components.js.map +1 -1
- package/dist/generators.cjs +25 -0
- package/dist/generators.cjs.map +1 -0
- package/dist/generators.d.cts +14 -0
- package/dist/generators.d.ts +14 -0
- package/dist/generators.js +4 -0
- package/dist/generators.js.map +1 -0
- package/dist/index.cjs +80 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.js +63 -120
- package/dist/index.js.map +1 -1
- package/dist/types-Dlwxp28D.d.cts +230 -0
- package/dist/types-Dlwxp28D.d.ts +230 -0
- package/package.json +22 -17
- package/src/components/InfiniteQuery.tsx +176 -0
- package/src/components/InfiniteQueryOptions.tsx +185 -0
- package/src/components/Mutation.tsx +142 -320
- package/src/components/MutationKey.tsx +48 -0
- package/src/components/Query.tsx +145 -592
- package/src/components/QueryKey.tsx +51 -182
- package/src/components/QueryOptions.tsx +110 -472
- package/src/components/SuspenseQuery.tsx +176 -0
- package/src/components/index.ts +4 -0
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +51 -0
- package/src/generators/__snapshots__/clientGetImportPath.ts +51 -0
- package/src/generators/__snapshots__/clientPostImportPath.ts +44 -0
- package/src/generators/__snapshots__/findByTags.ts +51 -0
- package/src/generators/__snapshots__/findByTagsObject.ts +60 -0
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +51 -0
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +51 -0
- package/src/generators/__snapshots__/findByTagsWithZod.ts +51 -0
- package/src/generators/__snapshots__/findInfiniteByTags.ts +57 -0
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +57 -0
- package/src/generators/__snapshots__/getAsMutation.ts +31 -0
- package/src/generators/__snapshots__/postAsQuery.ts +50 -0
- package/src/generators/__snapshots__/updatePetById.ts +44 -0
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +44 -0
- package/src/generators/index.ts +4 -0
- package/src/generators/infiniteQueryGenerator.tsx +126 -0
- package/src/generators/mutationGenerator.tsx +109 -0
- package/src/generators/queryGenerator.tsx +123 -0
- package/src/generators/suspenseQueryGenerator.tsx +123 -0
- package/src/plugin.ts +62 -76
- package/src/types.ts +49 -126
- package/dist/chunk-7ZODZVKP.cjs +0 -1470
- package/dist/chunk-7ZODZVKP.cjs.map +0 -1
- package/dist/chunk-ZYTZV43V.js +0 -1470
- package/dist/chunk-ZYTZV43V.js.map +0 -1
- package/dist/index-5kpkk-7M.d.cts +0 -545
- package/dist/index-5kpkk-7M.d.ts +0 -545
- package/src/OperationGenerator.tsx +0 -57
- package/src/__snapshots__/mutateAsQuery/updatePetWithForm.ts +0 -69
- package/src/__snapshots__/pathParamsTypeInline/getPetById.ts +0 -62
- package/src/__snapshots__/pathParamsTypeObject/getPetById.ts +0 -68
- package/src/__snapshots__/queryOptions/getPetById.ts +0 -41
- package/src/__snapshots__/queryWithoutQueryOptions/getPetById.ts +0 -51
- package/src/__snapshots__/variablesTypeMutate/deletePet.ts +0 -24
- package/src/components/QueryImports.tsx +0 -167
- package/src/components/SchemaType.tsx +0 -59
- package/src/components/__snapshots__/gen/showPetById.ts +0 -67
- package/src/components/__snapshots__/gen/useCreatePets.ts +0 -46
- package/src/components/__snapshots__/gen/useCreatePetsMutate.ts +0 -46
- package/src/utils.ts +0 -96
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { File, Function, FunctionParams } from '@kubb/react'
|
|
2
|
+
|
|
3
|
+
import { type Operation, isOptional } from '@kubb/oas'
|
|
4
|
+
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
5
|
+
import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
|
|
6
|
+
import type { ReactNode } from 'react'
|
|
7
|
+
import type { PluginReactQuery } from '../types.ts'
|
|
8
|
+
import { QueryKey } from './QueryKey.tsx'
|
|
9
|
+
import { QueryOptions } from './QueryOptions.tsx'
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
/**
|
|
13
|
+
* Name of the function
|
|
14
|
+
*/
|
|
15
|
+
name: string
|
|
16
|
+
queryOptionsName: string
|
|
17
|
+
queryKeyName: string
|
|
18
|
+
queryKeyTypeName: string
|
|
19
|
+
typeSchemas: OperationSchemas
|
|
20
|
+
operation: Operation
|
|
21
|
+
paramsType: PluginReactQuery['resolvedOptions']['paramsType']
|
|
22
|
+
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']
|
|
23
|
+
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type GetParamsProps = {
|
|
27
|
+
paramsType: PluginReactQuery['resolvedOptions']['paramsType']
|
|
28
|
+
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']
|
|
29
|
+
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']
|
|
30
|
+
typeSchemas: OperationSchemas
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
|
|
34
|
+
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
35
|
+
|
|
36
|
+
if (paramsType === 'object') {
|
|
37
|
+
return FunctionParams.factory({
|
|
38
|
+
data: {
|
|
39
|
+
mode: 'object',
|
|
40
|
+
children: {
|
|
41
|
+
...getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
42
|
+
data: typeSchemas.request?.name
|
|
43
|
+
? {
|
|
44
|
+
type: typeSchemas.request?.name,
|
|
45
|
+
optional: isOptional(typeSchemas.request?.schema),
|
|
46
|
+
}
|
|
47
|
+
: undefined,
|
|
48
|
+
params: typeSchemas.queryParams?.name
|
|
49
|
+
? {
|
|
50
|
+
type: typeSchemas.queryParams?.name,
|
|
51
|
+
optional: isOptional(typeSchemas.queryParams?.schema),
|
|
52
|
+
}
|
|
53
|
+
: undefined,
|
|
54
|
+
headers: typeSchemas.headerParams?.name
|
|
55
|
+
? {
|
|
56
|
+
type: typeSchemas.headerParams?.name,
|
|
57
|
+
optional: isOptional(typeSchemas.headerParams?.schema),
|
|
58
|
+
}
|
|
59
|
+
: undefined,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
options: {
|
|
63
|
+
type: `
|
|
64
|
+
{
|
|
65
|
+
query?: Partial<UseSuspenseQueryOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'TData', 'TQueryKey'].join(', ')}>>,
|
|
66
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'}
|
|
67
|
+
}
|
|
68
|
+
`,
|
|
69
|
+
default: '{}',
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return FunctionParams.factory({
|
|
75
|
+
pathParams: typeSchemas.pathParams?.name
|
|
76
|
+
? {
|
|
77
|
+
mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
|
|
78
|
+
children: getPathParams(typeSchemas.pathParams, { typed: true }),
|
|
79
|
+
type: typeSchemas.pathParams?.name,
|
|
80
|
+
optional: isOptional(typeSchemas.pathParams?.schema),
|
|
81
|
+
}
|
|
82
|
+
: undefined,
|
|
83
|
+
data: typeSchemas.request?.name
|
|
84
|
+
? {
|
|
85
|
+
type: typeSchemas.request?.name,
|
|
86
|
+
optional: isOptional(typeSchemas.request?.schema),
|
|
87
|
+
}
|
|
88
|
+
: undefined,
|
|
89
|
+
params: typeSchemas.queryParams?.name
|
|
90
|
+
? {
|
|
91
|
+
type: typeSchemas.queryParams?.name,
|
|
92
|
+
optional: isOptional(typeSchemas.queryParams?.schema),
|
|
93
|
+
}
|
|
94
|
+
: undefined,
|
|
95
|
+
headers: typeSchemas.headerParams?.name
|
|
96
|
+
? {
|
|
97
|
+
type: typeSchemas.headerParams?.name,
|
|
98
|
+
optional: isOptional(typeSchemas.headerParams?.schema),
|
|
99
|
+
}
|
|
100
|
+
: undefined,
|
|
101
|
+
options: {
|
|
102
|
+
type: `
|
|
103
|
+
{
|
|
104
|
+
query?: Partial<UseSuspenseQueryOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'TData', 'TQueryKey'].join(', ')}>>,
|
|
105
|
+
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'}
|
|
106
|
+
}
|
|
107
|
+
`,
|
|
108
|
+
default: '{}',
|
|
109
|
+
},
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function SuspenseQuery({
|
|
114
|
+
name,
|
|
115
|
+
queryKeyTypeName,
|
|
116
|
+
queryOptionsName,
|
|
117
|
+
queryKeyName,
|
|
118
|
+
paramsType,
|
|
119
|
+
pathParamsType,
|
|
120
|
+
dataReturnType,
|
|
121
|
+
typeSchemas,
|
|
122
|
+
operation,
|
|
123
|
+
}: Props): ReactNode {
|
|
124
|
+
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
125
|
+
const returnType = `UseSuspenseQueryResult<${['TData', typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'].join(', ')}> & { queryKey: TQueryKey }`
|
|
126
|
+
const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]
|
|
127
|
+
|
|
128
|
+
const queryKeyParams = QueryKey.getParams({
|
|
129
|
+
pathParamsType,
|
|
130
|
+
typeSchemas,
|
|
131
|
+
})
|
|
132
|
+
const queryOptionsParams = QueryOptions.getParams({
|
|
133
|
+
paramsType,
|
|
134
|
+
pathParamsType,
|
|
135
|
+
typeSchemas,
|
|
136
|
+
})
|
|
137
|
+
const params = getParams({
|
|
138
|
+
paramsType,
|
|
139
|
+
pathParamsType,
|
|
140
|
+
dataReturnType,
|
|
141
|
+
typeSchemas,
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()}) as unknown as UseSuspenseQueryOptions`
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<File.Source name={name} isExportable isIndexable>
|
|
148
|
+
<Function
|
|
149
|
+
name={name}
|
|
150
|
+
export
|
|
151
|
+
generics={generics.join(', ')}
|
|
152
|
+
params={params.toConstructor()}
|
|
153
|
+
JSDoc={{
|
|
154
|
+
comments: getComments(operation),
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
{`
|
|
158
|
+
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
159
|
+
const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})
|
|
160
|
+
|
|
161
|
+
const query = useSuspenseQuery({
|
|
162
|
+
...${queryOptions},
|
|
163
|
+
queryKey,
|
|
164
|
+
...queryOptions as unknown as Omit<UseSuspenseQueryOptions, "queryKey">
|
|
165
|
+
}) as ${returnType}
|
|
166
|
+
|
|
167
|
+
query.queryKey = queryKey as TQueryKey
|
|
168
|
+
|
|
169
|
+
return query
|
|
170
|
+
`}
|
|
171
|
+
</Function>
|
|
172
|
+
</File.Source>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
SuspenseQuery.getParams = getParams
|
package/src/components/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { Mutation } from './Mutation.tsx'
|
|
2
2
|
export { Query } from './Query.tsx'
|
|
3
3
|
export { QueryKey } from './QueryKey.tsx'
|
|
4
|
+
export { MutationKey } from './MutationKey.tsx'
|
|
4
5
|
export { QueryOptions } from './QueryOptions.tsx'
|
|
6
|
+
export { InfiniteQueryOptions } from './InfiniteQueryOptions.tsx'
|
|
7
|
+
export { InfiniteQuery } from './InfiniteQuery.tsx'
|
|
8
|
+
export { SuspenseQuery } from './SuspenseQuery.tsx'
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import client from "@kubb/plugin-client/client";
|
|
2
|
+
import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client";
|
|
3
|
+
import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
|
|
4
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
|
|
7
|
+
|
|
8
|
+
export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
12
|
+
* @summary Finds Pets by tags
|
|
13
|
+
* @link /pet/findByTags
|
|
14
|
+
*/
|
|
15
|
+
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
|
|
17
|
+
return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
21
|
+
const queryKey = findPetsByTagsQueryKey(params);
|
|
22
|
+
return queryOptions({
|
|
23
|
+
queryKey,
|
|
24
|
+
queryFn: async ({ signal }) => {
|
|
25
|
+
config.signal = signal;
|
|
26
|
+
return findPetsByTags(headers, params, config);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
33
|
+
* @summary Finds Pets by tags
|
|
34
|
+
* @link /pet/findByTags
|
|
35
|
+
*/
|
|
36
|
+
export function useFindPetsByTags<TData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
|
|
37
|
+
query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
|
|
38
|
+
client?: Partial<RequestConfig>;
|
|
39
|
+
} = {}) {
|
|
40
|
+
const { query: queryOptions, client: config = {} } = options ?? {};
|
|
41
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
|
|
42
|
+
const query = useQuery({
|
|
43
|
+
...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
|
|
44
|
+
queryKey,
|
|
45
|
+
...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
|
|
46
|
+
}) as UseQueryResult<TData, FindPetsByTags400> & {
|
|
47
|
+
queryKey: TQueryKey;
|
|
48
|
+
};
|
|
49
|
+
query.queryKey = queryKey as TQueryKey;
|
|
50
|
+
return query;
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import client from "axios";
|
|
2
|
+
import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
|
|
3
|
+
import type { RequestConfig } from "axios";
|
|
4
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
|
|
7
|
+
|
|
8
|
+
export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
12
|
+
* @summary Finds Pets by tags
|
|
13
|
+
* @link /pet/findByTags
|
|
14
|
+
*/
|
|
15
|
+
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
|
|
17
|
+
return findPetsByTagsQueryResponse.parse(res.data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
21
|
+
const queryKey = findPetsByTagsQueryKey(params);
|
|
22
|
+
return queryOptions({
|
|
23
|
+
queryKey,
|
|
24
|
+
queryFn: async ({ signal }) => {
|
|
25
|
+
config.signal = signal;
|
|
26
|
+
return findPetsByTags(headers, params, config);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
33
|
+
* @summary Finds Pets by tags
|
|
34
|
+
* @link /pet/findByTags
|
|
35
|
+
*/
|
|
36
|
+
export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
|
|
37
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
|
|
38
|
+
client?: Partial<RequestConfig>;
|
|
39
|
+
} = {}) {
|
|
40
|
+
const { query: queryOptions, client: config = {} } = options ?? {};
|
|
41
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
|
|
42
|
+
const query = useQuery({
|
|
43
|
+
...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
|
|
44
|
+
queryKey,
|
|
45
|
+
...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
|
|
46
|
+
}) as UseQueryResult<TData, FindPetsByTags400> & {
|
|
47
|
+
queryKey: TQueryKey;
|
|
48
|
+
};
|
|
49
|
+
query.queryKey = queryKey as TQueryKey;
|
|
50
|
+
return query;
|
|
51
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import client from "axios";
|
|
2
|
+
import type { UseMutationOptions } from "@tanstack/react-query";
|
|
3
|
+
import type { RequestConfig } from "axios";
|
|
4
|
+
import { useMutation } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const;
|
|
7
|
+
|
|
8
|
+
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @summary Updates a pet in the store with form data
|
|
12
|
+
* @link /pet/:petId
|
|
13
|
+
*/
|
|
14
|
+
async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
|
|
15
|
+
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "POST", url: `/pet/${petId}`, params, data, ...config });
|
|
16
|
+
return updatePetWithFormMutationResponse.parse(res.data);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @summary Updates a pet in the store with form data
|
|
21
|
+
* @link /pet/:petId
|
|
22
|
+
*/
|
|
23
|
+
export function useUpdatePetWithForm(options: {
|
|
24
|
+
mutation?: UseMutationOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
|
|
25
|
+
petId: UpdatePetWithFormPathParams["petId"];
|
|
26
|
+
data?: UpdatePetWithFormMutationRequest;
|
|
27
|
+
params?: UpdatePetWithFormQueryParams;
|
|
28
|
+
}>;
|
|
29
|
+
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
|
|
30
|
+
} = {}) {
|
|
31
|
+
const { mutation: mutationOptions, client: config = {} } = options ?? {};
|
|
32
|
+
const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey();
|
|
33
|
+
return useMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
|
|
34
|
+
petId: UpdatePetWithFormPathParams["petId"];
|
|
35
|
+
data?: UpdatePetWithFormMutationRequest;
|
|
36
|
+
params?: UpdatePetWithFormQueryParams;
|
|
37
|
+
}>({
|
|
38
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
39
|
+
return updatePetWithForm(petId, data, params, config);
|
|
40
|
+
},
|
|
41
|
+
mutationKey,
|
|
42
|
+
...mutationOptions
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import client from "@kubb/plugin-client/client";
|
|
2
|
+
import type { RequestConfig } from "@kubb/plugin-client/client";
|
|
3
|
+
import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
|
|
4
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
|
|
7
|
+
|
|
8
|
+
export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
12
|
+
* @summary Finds Pets by tags
|
|
13
|
+
* @link /pet/findByTags
|
|
14
|
+
*/
|
|
15
|
+
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
|
|
17
|
+
return findPetsByTagsQueryResponse.parse(res.data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
21
|
+
const queryKey = findPetsByTagsQueryKey(params);
|
|
22
|
+
return queryOptions({
|
|
23
|
+
queryKey,
|
|
24
|
+
queryFn: async ({ signal }) => {
|
|
25
|
+
config.signal = signal;
|
|
26
|
+
return findPetsByTags(headers, params, config);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
33
|
+
* @summary Finds Pets by tags
|
|
34
|
+
* @link /pet/findByTags
|
|
35
|
+
*/
|
|
36
|
+
export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
|
|
37
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
|
|
38
|
+
client?: Partial<RequestConfig>;
|
|
39
|
+
} = {}) {
|
|
40
|
+
const { query: queryOptions, client: config = {} } = options ?? {};
|
|
41
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
|
|
42
|
+
const query = useQuery({
|
|
43
|
+
...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
|
|
44
|
+
queryKey,
|
|
45
|
+
...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
|
|
46
|
+
}) as UseQueryResult<TData, FindPetsByTags400> & {
|
|
47
|
+
queryKey: TQueryKey;
|
|
48
|
+
};
|
|
49
|
+
query.queryKey = queryKey as TQueryKey;
|
|
50
|
+
return query;
|
|
51
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import client from "@kubb/plugin-client/client";
|
|
2
|
+
import type { RequestConfig } from "@kubb/plugin-client/client";
|
|
3
|
+
import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
|
|
4
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
|
|
7
|
+
|
|
8
|
+
export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
12
|
+
* @summary Finds Pets by tags
|
|
13
|
+
* @link /pet/findByTags
|
|
14
|
+
*/
|
|
15
|
+
async function findPetsByTags({ headers, params }: {
|
|
16
|
+
headers: FindPetsByTagsHeaderParams;
|
|
17
|
+
params?: FindPetsByTagsQueryParams;
|
|
18
|
+
}, config: Partial<RequestConfig> = {}) {
|
|
19
|
+
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
|
|
20
|
+
return findPetsByTagsQueryResponse.parse(res.data);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function findPetsByTagsQueryOptions({ headers, params }: {
|
|
24
|
+
headers: FindPetsByTagsHeaderParams;
|
|
25
|
+
params?: FindPetsByTagsQueryParams;
|
|
26
|
+
}, config: Partial<RequestConfig> = {}) {
|
|
27
|
+
const queryKey = findPetsByTagsQueryKey(params);
|
|
28
|
+
return queryOptions({
|
|
29
|
+
queryKey,
|
|
30
|
+
queryFn: async ({ signal }) => {
|
|
31
|
+
config.signal = signal;
|
|
32
|
+
return findPetsByTags({ headers, params }, config);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
39
|
+
* @summary Finds Pets by tags
|
|
40
|
+
* @link /pet/findByTags
|
|
41
|
+
*/
|
|
42
|
+
export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>({ headers, params }: {
|
|
43
|
+
headers: FindPetsByTagsHeaderParams;
|
|
44
|
+
params?: FindPetsByTagsQueryParams;
|
|
45
|
+
}, options: {
|
|
46
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
|
|
47
|
+
client?: Partial<RequestConfig>;
|
|
48
|
+
} = {}) {
|
|
49
|
+
const { query: queryOptions, client: config = {} } = options ?? {};
|
|
50
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
|
|
51
|
+
const query = useQuery({
|
|
52
|
+
...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions,
|
|
53
|
+
queryKey,
|
|
54
|
+
...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
|
|
55
|
+
}) as UseQueryResult<TData, FindPetsByTags400> & {
|
|
56
|
+
queryKey: TQueryKey;
|
|
57
|
+
};
|
|
58
|
+
query.queryKey = queryKey as TQueryKey;
|
|
59
|
+
return query;
|
|
60
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import client from "@kubb/plugin-client/client";
|
|
2
|
+
import type { RequestConfig } from "@kubb/plugin-client/client";
|
|
3
|
+
import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
|
|
4
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
|
|
7
|
+
|
|
8
|
+
export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
12
|
+
* @summary Finds Pets by tags
|
|
13
|
+
* @link /pet/findByTags
|
|
14
|
+
*/
|
|
15
|
+
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
|
|
17
|
+
return findPetsByTagsQueryResponse.parse(res.data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
21
|
+
const queryKey = findPetsByTagsQueryKey(params);
|
|
22
|
+
return queryOptions({
|
|
23
|
+
queryKey,
|
|
24
|
+
queryFn: async ({ signal }) => {
|
|
25
|
+
config.signal = signal;
|
|
26
|
+
return findPetsByTags(headers, params, config);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
33
|
+
* @summary Finds Pets by tags
|
|
34
|
+
* @link /pet/findByTags
|
|
35
|
+
*/
|
|
36
|
+
export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
|
|
37
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
|
|
38
|
+
client?: Partial<RequestConfig>;
|
|
39
|
+
} = {}) {
|
|
40
|
+
const { query: queryOptions, client: config = {} } = options ?? {};
|
|
41
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
|
|
42
|
+
const query = useQuery({
|
|
43
|
+
...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
|
|
44
|
+
queryKey,
|
|
45
|
+
...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
|
|
46
|
+
}) as UseQueryResult<TData, FindPetsByTags400> & {
|
|
47
|
+
queryKey: TQueryKey;
|
|
48
|
+
};
|
|
49
|
+
query.queryKey = queryKey as TQueryKey;
|
|
50
|
+
return query;
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import client from "@kubb/plugin-client/client";
|
|
2
|
+
import type { RequestConfig } from "@kubb/plugin-client/client";
|
|
3
|
+
import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
|
|
4
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [test, { url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
|
|
7
|
+
|
|
8
|
+
export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
12
|
+
* @summary Finds Pets by tags
|
|
13
|
+
* @link /pet/findByTags
|
|
14
|
+
*/
|
|
15
|
+
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
|
|
17
|
+
return findPetsByTagsQueryResponse.parse(res.data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
21
|
+
const queryKey = findPetsByTagsQueryKey(params);
|
|
22
|
+
return queryOptions({
|
|
23
|
+
queryKey,
|
|
24
|
+
queryFn: async ({ signal }) => {
|
|
25
|
+
config.signal = signal;
|
|
26
|
+
return findPetsByTags(headers, params, config);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
33
|
+
* @summary Finds Pets by tags
|
|
34
|
+
* @link /pet/findByTags
|
|
35
|
+
*/
|
|
36
|
+
export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
|
|
37
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
|
|
38
|
+
client?: Partial<RequestConfig>;
|
|
39
|
+
} = {}) {
|
|
40
|
+
const { query: queryOptions, client: config = {} } = options ?? {};
|
|
41
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
|
|
42
|
+
const query = useQuery({
|
|
43
|
+
...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
|
|
44
|
+
queryKey,
|
|
45
|
+
...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
|
|
46
|
+
}) as UseQueryResult<TData, FindPetsByTags400> & {
|
|
47
|
+
queryKey: TQueryKey;
|
|
48
|
+
};
|
|
49
|
+
query.queryKey = queryKey as TQueryKey;
|
|
50
|
+
return query;
|
|
51
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import client from "@kubb/plugin-client/client";
|
|
2
|
+
import type { RequestConfig } from "@kubb/plugin-client/client";
|
|
3
|
+
import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
|
|
4
|
+
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
|
|
7
|
+
|
|
8
|
+
export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
12
|
+
* @summary Finds Pets by tags
|
|
13
|
+
* @link /pet/findByTags
|
|
14
|
+
*/
|
|
15
|
+
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
|
|
17
|
+
return findPetsByTagsQueryResponse.parse(res.data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
21
|
+
const queryKey = findPetsByTagsQueryKey(params);
|
|
22
|
+
return queryOptions({
|
|
23
|
+
queryKey,
|
|
24
|
+
queryFn: async ({ signal }) => {
|
|
25
|
+
config.signal = signal;
|
|
26
|
+
return findPetsByTags(headers, params, config);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
33
|
+
* @summary Finds Pets by tags
|
|
34
|
+
* @link /pet/findByTags
|
|
35
|
+
*/
|
|
36
|
+
export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
|
|
37
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
|
|
38
|
+
client?: Partial<RequestConfig>;
|
|
39
|
+
} = {}) {
|
|
40
|
+
const { query: queryOptions, client: config = {} } = options ?? {};
|
|
41
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
|
|
42
|
+
const query = useQuery({
|
|
43
|
+
...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
|
|
44
|
+
queryKey,
|
|
45
|
+
...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
|
|
46
|
+
}) as UseQueryResult<TData, FindPetsByTags400> & {
|
|
47
|
+
queryKey: TQueryKey;
|
|
48
|
+
};
|
|
49
|
+
query.queryKey = queryKey as TQueryKey;
|
|
50
|
+
return query;
|
|
51
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import client from "@kubb/plugin-client/client";
|
|
2
|
+
import type { RequestConfig } from "@kubb/plugin-client/client";
|
|
3
|
+
import type { QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from "@tanstack/react-query";
|
|
4
|
+
import { useInfiniteQuery, infiniteQueryOptions } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
|
|
7
|
+
|
|
8
|
+
export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
12
|
+
* @summary Finds Pets by tags
|
|
13
|
+
* @link /pet/findByTags
|
|
14
|
+
*/
|
|
15
|
+
async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
16
|
+
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
|
|
17
|
+
return findPetsByTagsQueryResponse.parse(res.data);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function findPetsByTagsInfiniteQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
|
|
21
|
+
const queryKey = findPetsByTagsInfiniteQueryKey(params);
|
|
22
|
+
return infiniteQueryOptions({
|
|
23
|
+
queryKey,
|
|
24
|
+
queryFn: async ({ signal, pageParam }) => {
|
|
25
|
+
config.signal = signal;
|
|
26
|
+
if (params) {
|
|
27
|
+
params["pageSize"] = pageParam as unknown as FindPetsByTagsQueryParams["pageSize"];
|
|
28
|
+
}
|
|
29
|
+
return findPetsByTags(headers, params, config);
|
|
30
|
+
},
|
|
31
|
+
initialPageParam: 0,
|
|
32
|
+
getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1,
|
|
33
|
+
getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
39
|
+
* @summary Finds Pets by tags
|
|
40
|
+
* @link /pet/findByTags
|
|
41
|
+
*/
|
|
42
|
+
export function useFindPetsByTagsInfinite<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
|
|
43
|
+
query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
|
|
44
|
+
client?: Partial<RequestConfig>;
|
|
45
|
+
} = {}) {
|
|
46
|
+
const { query: queryOptions, client: config = {} } = options ?? {};
|
|
47
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params);
|
|
48
|
+
const query = useInfiniteQuery({
|
|
49
|
+
...findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions,
|
|
50
|
+
queryKey,
|
|
51
|
+
...queryOptions as unknown as Omit<InfiniteQueryObserverOptions, "queryKey">
|
|
52
|
+
}) as UseInfiniteQueryResult<TData, FindPetsByTags400> & {
|
|
53
|
+
queryKey: TQueryKey;
|
|
54
|
+
};
|
|
55
|
+
query.queryKey = queryKey as TQueryKey;
|
|
56
|
+
return query;
|
|
57
|
+
}
|