@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,81 +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, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { queryOptions, useSuspenseQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByStatusSuspenseQueryKey = (params: FindPetsByStatusQueryParams = {}) =>
11
- [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const
12
-
13
- export type FindPetsByStatusSuspenseQueryKey = ReturnType<typeof findPetsByStatusSuspenseQueryKey>
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 findPetsByStatusSuspense(
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 findPetsByStatusSuspenseQueryOptions(
36
- { params }: { params?: FindPetsByStatusQueryParams } = {},
37
- config: Partial<RequestConfig> & { client?: Client } = {},
38
- ) {
39
- const queryKey = findPetsByStatusSuspenseQueryKey(params)
40
- return queryOptions<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, FindPetsByStatusQueryResponse, typeof queryKey>({
41
- queryKey,
42
- queryFn: async ({ signal }) => {
43
- if (!config.signal) {
44
- config.signal = signal
45
- }
46
- return findPetsByStatusSuspense({ params }, config)
47
- },
48
- })
49
- }
50
-
51
- /**
52
- * @description Multiple status values can be provided with comma separated strings
53
- * @summary Finds Pets by status
54
- * {@link /pet/findByStatus}
55
- */
56
- export function useFindPetsByStatusSuspense<TData = FindPetsByStatusQueryResponse, TQueryKey extends QueryKey = FindPetsByStatusSuspenseQueryKey>(
57
- { params }: { params?: FindPetsByStatusQueryParams } = {},
58
- options: {
59
- query?: Partial<UseSuspenseQueryOptions<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, TData, TQueryKey>> & {
60
- client?: QueryClient
61
- }
62
- client?: Partial<RequestConfig> & { client?: Client }
63
- } = {},
64
- ) {
65
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
66
- const { client: queryClient, ...queryOptions } = queryConfig
67
- const queryKey = queryOptions?.queryKey ?? findPetsByStatusSuspenseQueryKey(params)
68
-
69
- const query = useSuspenseQuery(
70
- {
71
- ...findPetsByStatusSuspenseQueryOptions({ params }, config),
72
- queryKey,
73
- ...queryOptions,
74
- } as unknown as UseSuspenseQueryOptions,
75
- queryClient,
76
- ) as UseSuspenseQueryResult<TData, ResponseErrorConfig<FindPetsByStatus400>> & { queryKey: TQueryKey }
77
-
78
- query.queryKey = queryKey as TQueryKey
79
-
80
- return query
81
- }
@@ -1,82 +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, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { queryOptions, useSuspenseQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsSuspenseQueryKey = (params: FindPetsByTagsQueryParams = {}) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsSuspenseQueryKey = ReturnType<typeof findPetsByTagsSuspenseQueryKey>
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 findPetsByTagsSuspense(
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 findPetsByTagsSuspenseQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsSuspenseQueryKey(params)
42
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
43
- queryKey,
44
- queryFn: async ({ signal }) => {
45
- if (!config.signal) {
46
- config.signal = signal
47
- }
48
- return findPetsByTagsSuspense(headers, params, config)
49
- },
50
- })
51
- }
52
-
53
- /**
54
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
55
- * @summary Finds Pets by tags
56
- * {@link /pet/findByTags}
57
- */
58
- export function useFindPetsByTagsSuspense<TData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsSuspenseQueryKey>(
59
- headers: FindPetsByTagsHeaderParams,
60
- params?: FindPetsByTagsQueryParams,
61
- options: {
62
- query?: Partial<UseSuspenseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryKey>> & { client?: QueryClient }
63
- client?: Partial<RequestConfig> & { client?: Client }
64
- } = {},
65
- ) {
66
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
67
- const { client: queryClient, ...queryOptions } = queryConfig
68
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseQueryKey(params)
69
-
70
- const query = useSuspenseQuery(
71
- {
72
- ...findPetsByTagsSuspenseQueryOptions(headers, params, config),
73
- queryKey,
74
- ...queryOptions,
75
- } as unknown as UseSuspenseQueryOptions,
76
- queryClient,
77
- ) as UseSuspenseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
78
-
79
- query.queryKey = queryKey as TQueryKey
80
-
81
- return query
82
- }
@@ -1,85 +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, UseSuspenseQueryOptions, UseSuspenseQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { queryOptions, useSuspenseQuery } from '@tanstack/react-query'
9
- import { useCustomHookOptions } from 'useCustomHookOptions.ts'
10
-
11
- export const findPetsByTagsSuspenseQueryKey = (params: FindPetsByTagsQueryParams = {}) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
12
-
13
- export type FindPetsByTagsSuspenseQueryKey = ReturnType<typeof findPetsByTagsSuspenseQueryKey>
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 findPetsByTagsSuspense(
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 findPetsByTagsSuspenseQueryOptions(
38
- headers: FindPetsByTagsHeaderParams,
39
- params?: FindPetsByTagsQueryParams,
40
- config: Partial<RequestConfig> & { client?: Client } = {},
41
- ) {
42
- const queryKey = findPetsByTagsSuspenseQueryKey(params)
43
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
44
- queryKey,
45
- queryFn: async ({ signal }) => {
46
- if (!config.signal) {
47
- config.signal = signal
48
- }
49
- return findPetsByTagsSuspense(headers, params, config)
50
- },
51
- })
52
- }
53
-
54
- /**
55
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
56
- * @summary Finds Pets by tags
57
- * {@link /pet/findByTags}
58
- */
59
- export function useFindPetsByTagsSuspense<TData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsSuspenseQueryKey>(
60
- headers: FindPetsByTagsHeaderParams,
61
- params?: FindPetsByTagsQueryParams,
62
- options: {
63
- query?: Partial<UseSuspenseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryKey>> & { client?: QueryClient }
64
- client?: Partial<RequestConfig> & { client?: Client }
65
- } = {},
66
- ) {
67
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
68
- const { client: queryClient, ...queryOptions } = queryConfig
69
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseQueryKey(params)
70
- const customOptions = useCustomHookOptions({ hookName: 'useFindPetsByTagsSuspense', operationId: 'findPetsByTags' })
71
-
72
- const query = useSuspenseQuery(
73
- {
74
- ...findPetsByTagsSuspenseQueryOptions(headers, params, config),
75
- ...customOptions,
76
- queryKey,
77
- ...queryOptions,
78
- } as unknown as UseSuspenseQueryOptions,
79
- queryClient,
80
- ) as UseSuspenseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
81
-
82
- query.queryKey = queryKey as TQueryKey
83
-
84
- return query
85
- }
@@ -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, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useSuspenseInfiniteQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByStatusSuspenseInfiniteQueryKey = (params: FindPetsByStatusQueryParams = {}) =>
11
- [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const
12
-
13
- export type FindPetsByStatusSuspenseInfiniteQueryKey = ReturnType<typeof findPetsByStatusSuspenseInfiniteQueryKey>
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 findPetsByStatusSuspenseInfinite(
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 findPetsByStatusSuspenseInfiniteQueryOptions(
36
- { params }: { params?: FindPetsByStatusQueryParams } = {},
37
- config: Partial<RequestConfig> & { client?: Client } = {},
38
- ) {
39
- const queryKey = findPetsByStatusSuspenseInfiniteQueryKey(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 findPetsByStatusSuspenseInfinite({ 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 useFindPetsByStatusSuspenseInfinite<
71
- TQueryFnData = FindPetsByStatusQueryResponse,
72
- TError = ResponseErrorConfig<FindPetsByStatus400>,
73
- TData = InfiniteData<TQueryFnData>,
74
- TQueryKey extends QueryKey = FindPetsByStatusSuspenseInfiniteQueryKey,
75
- TPageParam = NonNullable<FindPetsByStatusQueryParams['status']>,
76
- >(
77
- { params }: { params?: FindPetsByStatusQueryParams } = {},
78
- options: {
79
- query?: Partial<UseSuspenseInfiniteQueryOptions<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 ?? findPetsByStatusSuspenseInfiniteQueryKey(params)
86
-
87
- const query = useSuspenseInfiniteQuery(
88
- {
89
- ...findPetsByStatusSuspenseInfiniteQueryOptions({ params }, config),
90
- queryKey,
91
- ...queryOptions,
92
- } as unknown as UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
93
- queryClient,
94
- ) as UseSuspenseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
95
-
96
- query.queryKey = queryKey as TQueryKey
97
-
98
- return query
99
- }
@@ -1,103 +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, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useSuspenseInfiniteQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsSuspenseInfiniteQueryKey = (params: FindPetsByTagsQueryParams = {}) =>
11
- [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
12
-
13
- export type FindPetsByTagsSuspenseInfiniteQueryKey = ReturnType<typeof findPetsByTagsSuspenseInfiniteQueryKey>
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 findPetsByTagsSuspenseInfinite(
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 findPetsByTagsSuspenseInfiniteQueryOptions(
38
- headers: FindPetsByTagsHeaderParams,
39
- params?: FindPetsByTagsQueryParams,
40
- config: Partial<RequestConfig> & { client?: Client } = {},
41
- ) {
42
- const queryKey = findPetsByTagsSuspenseInfiniteQueryKey(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 findPetsByTagsSuspenseInfinite(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 useFindPetsByTagsSuspenseInfinite<
74
- TQueryFnData = FindPetsByTagsQueryResponse,
75
- TError = ResponseErrorConfig<FindPetsByTags400>,
76
- TData = InfiniteData<TQueryFnData>,
77
- TQueryKey extends QueryKey = FindPetsByTagsSuspenseInfiniteQueryKey,
78
- TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
79
- >(
80
- headers: FindPetsByTagsHeaderParams,
81
- params?: FindPetsByTagsQueryParams,
82
- options: {
83
- query?: Partial<UseSuspenseInfiniteQueryOptions<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 ?? findPetsByTagsSuspenseInfiniteQueryKey(params)
90
-
91
- const query = useSuspenseInfiniteQuery(
92
- {
93
- ...findPetsByTagsSuspenseInfiniteQueryOptions(headers, params, config),
94
- queryKey,
95
- ...queryOptions,
96
- } as unknown as UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
97
- queryClient,
98
- ) as UseSuspenseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
99
-
100
- query.queryKey = queryKey as TQueryKey
101
-
102
- return query
103
- }
@@ -1,103 +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, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useSuspenseInfiniteQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsSuspenseInfiniteQueryKey = (params: FindPetsByTagsQueryParams = {}) =>
11
- [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
12
-
13
- export type FindPetsByTagsSuspenseInfiniteQueryKey = ReturnType<typeof findPetsByTagsSuspenseInfiniteQueryKey>
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 findPetsByTagsSuspenseInfinite(
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 findPetsByTagsSuspenseInfiniteQueryOptions(
38
- headers: FindPetsByTagsHeaderParams,
39
- params?: FindPetsByTagsQueryParams,
40
- config: Partial<RequestConfig> & { client?: Client } = {},
41
- ) {
42
- const queryKey = findPetsByTagsSuspenseInfiniteQueryKey(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 findPetsByTagsSuspenseInfinite(headers, params, config)
61
- },
62
- initialPageParam: 0,
63
- getNextPageParam: (lastPage) => lastPage['cursor'],
64
- getPreviousPageParam: (firstPage) => firstPage['cursor'],
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 useFindPetsByTagsSuspenseInfinite<
74
- TQueryFnData = FindPetsByTagsQueryResponse,
75
- TError = ResponseErrorConfig<FindPetsByTags400>,
76
- TData = InfiniteData<TQueryFnData>,
77
- TQueryKey extends QueryKey = FindPetsByTagsSuspenseInfiniteQueryKey,
78
- TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
79
- >(
80
- headers: FindPetsByTagsHeaderParams,
81
- params?: FindPetsByTagsQueryParams,
82
- options: {
83
- query?: Partial<UseSuspenseInfiniteQueryOptions<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 ?? findPetsByTagsSuspenseInfiniteQueryKey(params)
90
-
91
- const query = useSuspenseInfiniteQuery(
92
- {
93
- ...findPetsByTagsSuspenseInfiniteQueryOptions(headers, params, config),
94
- queryKey,
95
- ...queryOptions,
96
- } as unknown as UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
97
- queryClient,
98
- ) as UseSuspenseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
99
-
100
- query.queryKey = queryKey as TQueryKey
101
-
102
- return query
103
- }
@@ -1,106 +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, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { infiniteQueryOptions, useSuspenseInfiniteQuery } from '@tanstack/react-query'
9
- import { useCustomHookOptions } from 'useCustomHookOptions.ts'
10
-
11
- export const findPetsByTagsSuspenseInfiniteQueryKey = (params: FindPetsByTagsQueryParams = {}) =>
12
- [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
13
-
14
- export type FindPetsByTagsSuspenseInfiniteQueryKey = ReturnType<typeof findPetsByTagsSuspenseInfiniteQueryKey>
15
-
16
- /**
17
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
18
- * @summary Finds Pets by tags
19
- * {@link /pet/findByTags}
20
- */
21
- export async function findPetsByTagsSuspenseInfinite(
22
- headers: FindPetsByTagsHeaderParams,
23
- params?: FindPetsByTagsQueryParams,
24
- config: Partial<RequestConfig> & { client?: Client } = {},
25
- ) {
26
- const { client: request = fetch, ...requestConfig } = config
27
-
28
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
29
- method: 'GET',
30
- url: `/pet/findByTags`,
31
- params,
32
- ...requestConfig,
33
- headers: { ...headers, ...requestConfig.headers },
34
- })
35
- return findPetsByTagsQueryResponse.parse(res.data)
36
- }
37
-
38
- export function findPetsByTagsSuspenseInfiniteQueryOptions(
39
- headers: FindPetsByTagsHeaderParams,
40
- params?: FindPetsByTagsQueryParams,
41
- config: Partial<RequestConfig> & { client?: Client } = {},
42
- ) {
43
- const queryKey = findPetsByTagsSuspenseInfiniteQueryKey(params)
44
- return infiniteQueryOptions<
45
- FindPetsByTagsQueryResponse,
46
- ResponseErrorConfig<FindPetsByTags400>,
47
- InfiniteData<FindPetsByTagsQueryResponse>,
48
- typeof queryKey,
49
- NonNullable<FindPetsByTagsQueryParams['pageSize']>
50
- >({
51
- queryKey,
52
- queryFn: async ({ signal, pageParam }) => {
53
- if (!config.signal) {
54
- config.signal = signal
55
- }
56
-
57
- params = {
58
- ...(params ?? {}),
59
- ['pageSize']: pageParam as unknown as FindPetsByTagsQueryParams['pageSize'],
60
- } as FindPetsByTagsQueryParams
61
- return findPetsByTagsSuspenseInfinite(headers, params, config)
62
- },
63
- initialPageParam: 0,
64
- getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1),
65
- getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1),
66
- })
67
- }
68
-
69
- /**
70
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
71
- * @summary Finds Pets by tags
72
- * {@link /pet/findByTags}
73
- */
74
- export function useFindPetsByTagsSuspenseInfinite<
75
- TQueryFnData = FindPetsByTagsQueryResponse,
76
- TError = ResponseErrorConfig<FindPetsByTags400>,
77
- TData = InfiniteData<TQueryFnData>,
78
- TQueryKey extends QueryKey = FindPetsByTagsSuspenseInfiniteQueryKey,
79
- TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
80
- >(
81
- headers: FindPetsByTagsHeaderParams,
82
- params?: FindPetsByTagsQueryParams,
83
- options: {
84
- query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
85
- client?: Partial<RequestConfig> & { client?: Client }
86
- } = {},
87
- ) {
88
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
89
- const { client: queryClient, ...queryOptions } = queryConfig
90
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseInfiniteQueryKey(params)
91
- const customOptions = useCustomHookOptions({ hookName: 'useFindPetsByTagsSuspenseInfinite', operationId: 'findPetsByTags' })
92
-
93
- const query = useSuspenseInfiniteQuery(
94
- {
95
- ...findPetsByTagsSuspenseInfiniteQueryOptions(headers, params, config),
96
- ...customOptions,
97
- queryKey,
98
- ...queryOptions,
99
- } as unknown as UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
100
- queryClient,
101
- ) as UseSuspenseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
102
-
103
- query.queryKey = queryKey as TQueryKey
104
-
105
- return query
106
- }