@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.
Files changed (63) hide show
  1. package/dist/{SuspenseQuery-BFn3x1kP.js → SuspenseQuery-BJRjCVPn.js} +26 -26
  2. package/dist/SuspenseQuery-BJRjCVPn.js.map +1 -0
  3. package/dist/{SuspenseQuery-Dqr3APYf.cjs → SuspenseQuery-BS2DyU8v.cjs} +26 -26
  4. package/dist/SuspenseQuery-BS2DyU8v.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.js +1 -1
  7. package/dist/generators.cjs +1 -1
  8. package/dist/generators.js +1 -1
  9. package/dist/index.cjs +2 -2
  10. package/dist/index.js +2 -2
  11. package/dist/{suspenseQueryGenerator-BjEGcQcE.js → suspenseQueryGenerator-X-e7npGw.js} +12 -12
  12. package/dist/suspenseQueryGenerator-X-e7npGw.js.map +1 -0
  13. package/dist/{suspenseQueryGenerator-CHrwd9jE.cjs → suspenseQueryGenerator-kZuBiph0.cjs} +12 -12
  14. package/dist/suspenseQueryGenerator-kZuBiph0.cjs.map +1 -0
  15. package/package.json +11 -10
  16. package/src/components/InfiniteQueryOptions.tsx +20 -10
  17. package/src/components/QueryOptions.tsx +9 -4
  18. package/src/components/SuspenseInfiniteQueryOptions.tsx +21 -11
  19. package/src/generators/infiniteQueryGenerator.tsx +4 -2
  20. package/src/generators/mutationGenerator.tsx +4 -2
  21. package/src/generators/queryGenerator.tsx +4 -2
  22. package/src/generators/suspenseInfiniteQueryGenerator.tsx +4 -2
  23. package/src/generators/suspenseQueryGenerator.tsx +4 -2
  24. package/dist/SuspenseQuery-BFn3x1kP.js.map +0 -1
  25. package/dist/SuspenseQuery-Dqr3APYf.cjs.map +0 -1
  26. package/dist/suspenseQueryGenerator-BjEGcQcE.js.map +0 -1
  27. package/dist/suspenseQueryGenerator-CHrwd9jE.cjs.map +0 -1
  28. package/dist/types-BvXj6Cu5.d.ts +0 -204
  29. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +0 -93
  30. package/src/generators/__snapshots__/clientGetImportPath.ts +0 -88
  31. package/src/generators/__snapshots__/clientPostImportPath.ts +0 -99
  32. package/src/generators/__snapshots__/createUsersWithListInput.ts +0 -83
  33. package/src/generators/__snapshots__/createUsersWithListInputAsQuery.ts +0 -87
  34. package/src/generators/__snapshots__/findByStatusAllOptional.ts +0 -81
  35. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +0 -78
  36. package/src/generators/__snapshots__/findByTags.ts +0 -88
  37. package/src/generators/__snapshots__/findByTagsObject.ts +0 -85
  38. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +0 -88
  39. package/src/generators/__snapshots__/findByTagsTemplateString.ts +0 -89
  40. package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +0 -91
  41. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +0 -88
  42. package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -88
  43. package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +0 -99
  44. package/src/generators/__snapshots__/findInfiniteByTags.ts +0 -102
  45. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +0 -102
  46. package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +0 -102
  47. package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +0 -101
  48. package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +0 -105
  49. package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +0 -81
  50. package/src/generators/__snapshots__/findSuspenseByTags.ts +0 -82
  51. package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +0 -85
  52. package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +0 -99
  53. package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +0 -103
  54. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +0 -103
  55. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +0 -106
  56. package/src/generators/__snapshots__/getAsMutation.ts +0 -31
  57. package/src/generators/__snapshots__/getPetIdCamelCase.ts +0 -76
  58. package/src/generators/__snapshots__/postAsQuery.ts +0 -96
  59. package/src/generators/__snapshots__/requiredOneOfRequestBody.ts +0 -94
  60. package/src/generators/__snapshots__/requiredOneOfRequestBodyWithClientPlugin.ts +0 -71
  61. package/src/generators/__snapshots__/updatePetById.ts +0 -99
  62. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +0 -99
  63. package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +0 -107
@@ -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 { InfiniteData, QueryKey, QueryClient, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByStatusInfiniteQueryKey = (params: FindPetsByStatusQueryParams = {}) =>
11
- [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const
12
-
13
- export type FindPetsByStatusInfiniteQueryKey = ReturnType<typeof findPetsByStatusInfiniteQueryKey>
14
-
15
- /**
16
- * @description Multiple status values can be provided with comma separated strings
17
- * @summary Finds Pets by status
18
- * {@link /pet/findByStatus}
19
- */
20
- export async function findPetsByStatusInfinite(
21
- { params }: { params?: FindPetsByStatusQueryParams } = {},
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByStatus`,
29
- params,
30
- ...requestConfig,
31
- })
32
- return findPetsByStatusQueryResponse.parse(res.data)
33
- }
34
-
35
- export function findPetsByStatusInfiniteQueryOptions(
36
- { params }: { params?: FindPetsByStatusQueryParams } = {},
37
- config: Partial<RequestConfig> & { client?: Client } = {},
38
- ) {
39
- const queryKey = findPetsByStatusInfiniteQueryKey(params)
40
- return infiniteQueryOptions<
41
- FindPetsByStatusQueryResponse,
42
- ResponseErrorConfig<FindPetsByStatus400>,
43
- InfiniteData<FindPetsByStatusQueryResponse>,
44
- typeof queryKey,
45
- NonNullable<FindPetsByStatusQueryParams['status']>
46
- >({
47
- queryKey,
48
- queryFn: async ({ signal, pageParam }) => {
49
- if (!config.signal) {
50
- config.signal = signal
51
- }
52
-
53
- params = {
54
- ...(params ?? {}),
55
- ['status']: pageParam as unknown as FindPetsByStatusQueryParams['status'],
56
- } as FindPetsByStatusQueryParams
57
- return findPetsByStatusInfinite({ params }, config)
58
- },
59
- initialPageParam: 'available',
60
- getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1),
61
- getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1),
62
- })
63
- }
64
-
65
- /**
66
- * @description Multiple status values can be provided with comma separated strings
67
- * @summary Finds Pets by status
68
- * {@link /pet/findByStatus}
69
- */
70
- export function useFindPetsByStatusInfinite<
71
- TQueryFnData = FindPetsByStatusQueryResponse,
72
- TError = ResponseErrorConfig<FindPetsByStatus400>,
73
- TData = InfiniteData<TQueryFnData>,
74
- TQueryKey extends QueryKey = FindPetsByStatusInfiniteQueryKey,
75
- TPageParam = NonNullable<FindPetsByStatusQueryParams['status']>,
76
- >(
77
- { params }: { params?: FindPetsByStatusQueryParams } = {},
78
- options: {
79
- query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
80
- client?: Partial<RequestConfig> & { client?: Client }
81
- } = {},
82
- ) {
83
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
84
- const { client: queryClient, ...queryOptions } = queryConfig
85
- const queryKey = queryOptions?.queryKey ?? findPetsByStatusInfiniteQueryKey(params)
86
-
87
- const query = useInfiniteQuery(
88
- {
89
- ...findPetsByStatusInfiniteQueryOptions({ params }, config),
90
- queryKey,
91
- ...queryOptions,
92
- } as unknown as InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
93
- queryClient,
94
- ) as UseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
95
-
96
- query.queryKey = queryKey as TQueryKey
97
-
98
- return query
99
- }
@@ -1,102 +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 { InfiniteData, QueryKey, QueryClient, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsInfiniteQueryKey = (params: FindPetsByTagsQueryParams = {}) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTagsInfinite(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- params,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return findPetsByTagsQueryResponse.parse(res.data)
34
- }
35
-
36
- export function findPetsByTagsInfiniteQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsInfiniteQueryKey(params)
42
- return infiniteQueryOptions<
43
- FindPetsByTagsQueryResponse,
44
- ResponseErrorConfig<FindPetsByTags400>,
45
- InfiniteData<FindPetsByTagsQueryResponse>,
46
- typeof queryKey,
47
- NonNullable<FindPetsByTagsQueryParams['pageSize']>
48
- >({
49
- queryKey,
50
- queryFn: async ({ signal, pageParam }) => {
51
- if (!config.signal) {
52
- config.signal = signal
53
- }
54
-
55
- params = {
56
- ...(params ?? {}),
57
- ['pageSize']: pageParam as unknown as FindPetsByTagsQueryParams['pageSize'],
58
- } as FindPetsByTagsQueryParams
59
- return findPetsByTagsInfinite(headers, params, config)
60
- },
61
- initialPageParam: 0,
62
- getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1),
63
- getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1),
64
- })
65
- }
66
-
67
- /**
68
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
69
- * @summary Finds Pets by tags
70
- * {@link /pet/findByTags}
71
- */
72
- export function useFindPetsByTagsInfinite<
73
- TQueryFnData = FindPetsByTagsQueryResponse,
74
- TError = ResponseErrorConfig<FindPetsByTags400>,
75
- TData = InfiniteData<TQueryFnData>,
76
- TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
77
- TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
78
- >(
79
- headers: FindPetsByTagsHeaderParams,
80
- params?: FindPetsByTagsQueryParams,
81
- options: {
82
- query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
83
- client?: Partial<RequestConfig> & { client?: Client }
84
- } = {},
85
- ) {
86
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
87
- const { client: queryClient, ...queryOptions } = queryConfig
88
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
89
-
90
- const query = useInfiniteQuery(
91
- {
92
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config),
93
- queryKey,
94
- ...queryOptions,
95
- } as unknown as InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
96
- queryClient,
97
- ) as UseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
98
-
99
- query.queryKey = queryKey as TQueryKey
100
-
101
- return query
102
- }
@@ -1,102 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import fetch from '@kubb/plugin-client/clients/axios'
6
- import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
- import type { InfiniteData, QueryKey, QueryClient, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
8
- import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTagsInfinite(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- params,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return findPetsByTagsQueryResponse.parse(res.data)
34
- }
35
-
36
- export function findPetsByTagsInfiniteQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsInfiniteQueryKey(params)
42
- return infiniteQueryOptions<
43
- FindPetsByTagsQueryResponse,
44
- ResponseErrorConfig<FindPetsByTags400>,
45
- InfiniteData<FindPetsByTagsQueryResponse>,
46
- typeof queryKey,
47
- NonNullable<FindPetsByTagsQueryParams['pageSize']>
48
- >({
49
- queryKey,
50
- queryFn: async ({ signal, pageParam }) => {
51
- if (!config.signal) {
52
- config.signal = signal
53
- }
54
-
55
- if (!params) {
56
- params = {}
57
- }
58
- params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize']
59
- return findPetsByTagsInfinite(headers, params, config)
60
- },
61
- initialPageParam: 0,
62
- getNextPageParam: (lastPage) => lastPage['cursor'],
63
- getPreviousPageParam: (firstPage) => firstPage['cursor'],
64
- })
65
- }
66
-
67
- /**
68
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
69
- * @summary Finds Pets by tags
70
- * {@link /pet/findByTags}
71
- */
72
- export function useFindPetsByTagsInfinite<
73
- TQueryFnData = FindPetsByTagsQueryResponse,
74
- TError = ResponseErrorConfig<FindPetsByTags400>,
75
- TData = InfiniteData<TQueryFnData>,
76
- TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
77
- TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
78
- >(
79
- headers: FindPetsByTagsHeaderParams,
80
- params?: FindPetsByTagsQueryParams,
81
- options: {
82
- query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
83
- client?: Partial<RequestConfig> & { client?: Client }
84
- } = {},
85
- ) {
86
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
87
- const { client: queryClient, ...queryOptions } = queryConfig
88
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
89
-
90
- const query = useInfiniteQuery(
91
- {
92
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config),
93
- queryKey,
94
- ...queryOptions,
95
- } as unknown as InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
96
- queryClient,
97
- ) as UseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
98
-
99
- query.queryKey = queryKey as TQueryKey
100
-
101
- return query
102
- }
@@ -1,102 +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 { InfiniteData, QueryKey, QueryClient, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsInfiniteQueryKey = (params: FindPetsByTagsQueryParams = {}) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTagsInfinite(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- params,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return findPetsByTagsQueryResponse.parse(res.data)
34
- }
35
-
36
- export function findPetsByTagsInfiniteQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsInfiniteQueryKey(params)
42
- return infiniteQueryOptions<
43
- FindPetsByTagsQueryResponse,
44
- ResponseErrorConfig<FindPetsByTags400>,
45
- InfiniteData<FindPetsByTagsQueryResponse>,
46
- typeof queryKey,
47
- NonNullable<FindPetsByTagsQueryParams['pageSize']>
48
- >({
49
- queryKey,
50
- queryFn: async ({ signal, pageParam }) => {
51
- if (!config.signal) {
52
- config.signal = signal
53
- }
54
-
55
- params = {
56
- ...(params ?? {}),
57
- ['pageSize']: pageParam as unknown as FindPetsByTagsQueryParams['pageSize'],
58
- } as FindPetsByTagsQueryParams
59
- return findPetsByTagsInfinite(headers, params, config)
60
- },
61
- initialPageParam: 0,
62
- getNextPageParam: (lastPage) => lastPage?.['pagination']?.['next']?.['id'],
63
- getPreviousPageParam: (firstPage) => firstPage?.['pagination']?.['prev']?.['id'],
64
- })
65
- }
66
-
67
- /**
68
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
69
- * @summary Finds Pets by tags
70
- * {@link /pet/findByTags}
71
- */
72
- export function useFindPetsByTagsInfinite<
73
- TQueryFnData = FindPetsByTagsQueryResponse,
74
- TError = ResponseErrorConfig<FindPetsByTags400>,
75
- TData = InfiniteData<TQueryFnData>,
76
- TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
77
- TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
78
- >(
79
- headers: FindPetsByTagsHeaderParams,
80
- params?: FindPetsByTagsQueryParams,
81
- options: {
82
- query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
83
- client?: Partial<RequestConfig> & { client?: Client }
84
- } = {},
85
- ) {
86
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
87
- const { client: queryClient, ...queryOptions } = queryConfig
88
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
89
-
90
- const query = useInfiniteQuery(
91
- {
92
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config),
93
- queryKey,
94
- ...queryOptions,
95
- } as unknown as InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
96
- queryClient,
97
- ) as UseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
98
-
99
- query.queryKey = queryKey as TQueryKey
100
-
101
- return query
102
- }
@@ -1,101 +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 { InfiniteData, QueryKey, QueryClient, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsInfiniteQueryKey = (params: FindPetsByTagsQueryParams = {}) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTagsInfinite(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- params,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return findPetsByTagsQueryResponse.parse(res.data)
34
- }
35
-
36
- export function findPetsByTagsInfiniteQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsInfiniteQueryKey(params)
42
- return infiniteQueryOptions<
43
- FindPetsByTagsQueryResponse,
44
- ResponseErrorConfig<FindPetsByTags400>,
45
- InfiniteData<FindPetsByTagsQueryResponse>,
46
- typeof queryKey,
47
- NonNullable<FindPetsByTagsQueryParams['pageSize']>
48
- >({
49
- queryKey,
50
- queryFn: async ({ signal, pageParam }) => {
51
- if (!config.signal) {
52
- config.signal = signal
53
- }
54
-
55
- params = {
56
- ...(params ?? {}),
57
- ['pageSize']: pageParam as unknown as FindPetsByTagsQueryParams['pageSize'],
58
- } as FindPetsByTagsQueryParams
59
- return findPetsByTagsInfinite(headers, params, config)
60
- },
61
- initialPageParam: 0,
62
- getNextPageParam: (lastPage) => lastPage?.['pagination']?.['next']?.['cursor'],
63
- })
64
- }
65
-
66
- /**
67
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
68
- * @summary Finds Pets by tags
69
- * {@link /pet/findByTags}
70
- */
71
- export function useFindPetsByTagsInfinite<
72
- TQueryFnData = FindPetsByTagsQueryResponse,
73
- TError = ResponseErrorConfig<FindPetsByTags400>,
74
- TData = InfiniteData<TQueryFnData>,
75
- TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
76
- TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
77
- >(
78
- headers: FindPetsByTagsHeaderParams,
79
- params?: FindPetsByTagsQueryParams,
80
- options: {
81
- query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
82
- client?: Partial<RequestConfig> & { client?: Client }
83
- } = {},
84
- ) {
85
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
86
- const { client: queryClient, ...queryOptions } = queryConfig
87
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
88
-
89
- const query = useInfiniteQuery(
90
- {
91
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config),
92
- queryKey,
93
- ...queryOptions,
94
- } as unknown as InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
95
- queryClient,
96
- ) as UseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
97
-
98
- query.queryKey = queryKey as TQueryKey
99
-
100
- return query
101
- }
@@ -1,105 +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 { InfiniteData, QueryKey, QueryClient, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
9
- import { useCustomHookOptions } from 'useCustomHookOptions.ts'
10
-
11
- export const findPetsByTagsInfiniteQueryKey = (params: FindPetsByTagsQueryParams = {}) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
12
-
13
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
14
-
15
- /**
16
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
17
- * @summary Finds Pets by tags
18
- * {@link /pet/findByTags}
19
- */
20
- export async function findPetsByTagsInfinite(
21
- headers: FindPetsByTagsHeaderParams,
22
- params?: FindPetsByTagsQueryParams,
23
- config: Partial<RequestConfig> & { client?: Client } = {},
24
- ) {
25
- const { client: request = fetch, ...requestConfig } = config
26
-
27
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
28
- method: 'GET',
29
- url: `/pet/findByTags`,
30
- params,
31
- ...requestConfig,
32
- headers: { ...headers, ...requestConfig.headers },
33
- })
34
- return findPetsByTagsQueryResponse.parse(res.data)
35
- }
36
-
37
- export function findPetsByTagsInfiniteQueryOptions(
38
- headers: FindPetsByTagsHeaderParams,
39
- params?: FindPetsByTagsQueryParams,
40
- config: Partial<RequestConfig> & { client?: Client } = {},
41
- ) {
42
- const queryKey = findPetsByTagsInfiniteQueryKey(params)
43
- return infiniteQueryOptions<
44
- FindPetsByTagsQueryResponse,
45
- ResponseErrorConfig<FindPetsByTags400>,
46
- InfiniteData<FindPetsByTagsQueryResponse>,
47
- typeof queryKey,
48
- NonNullable<FindPetsByTagsQueryParams['pageSize']>
49
- >({
50
- queryKey,
51
- queryFn: async ({ signal, pageParam }) => {
52
- if (!config.signal) {
53
- config.signal = signal
54
- }
55
-
56
- params = {
57
- ...(params ?? {}),
58
- ['pageSize']: pageParam as unknown as FindPetsByTagsQueryParams['pageSize'],
59
- } as FindPetsByTagsQueryParams
60
- return findPetsByTagsInfinite(headers, params, config)
61
- },
62
- initialPageParam: 0,
63
- getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1),
64
- getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1),
65
- })
66
- }
67
-
68
- /**
69
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
70
- * @summary Finds Pets by tags
71
- * {@link /pet/findByTags}
72
- */
73
- export function useFindPetsByTagsInfinite<
74
- TQueryFnData = FindPetsByTagsQueryResponse,
75
- TError = ResponseErrorConfig<FindPetsByTags400>,
76
- TData = InfiniteData<TQueryFnData>,
77
- TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
78
- TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
79
- >(
80
- headers: FindPetsByTagsHeaderParams,
81
- params?: FindPetsByTagsQueryParams,
82
- options: {
83
- query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
84
- client?: Partial<RequestConfig> & { client?: Client }
85
- } = {},
86
- ) {
87
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
88
- const { client: queryClient, ...queryOptions } = queryConfig
89
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
90
- const customOptions = useCustomHookOptions({ hookName: 'useFindPetsByTagsInfinite', operationId: 'findPetsByTags' })
91
-
92
- const query = useInfiniteQuery(
93
- {
94
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config),
95
- ...customOptions,
96
- queryKey,
97
- ...queryOptions,
98
- } as unknown as InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
99
- queryClient,
100
- ) as UseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
101
-
102
- query.queryKey = queryKey as TQueryKey
103
-
104
- return query
105
- }