@kubb/plugin-react-query 4.29.1 → 4.31.0

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 (54) hide show
  1. package/dist/components.d.ts +2 -3
  2. package/dist/generators.cjs +1 -1
  3. package/dist/generators.d.ts +3 -4
  4. package/dist/generators.js +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.d.ts +1 -2
  7. package/dist/index.js +1 -1
  8. package/dist/{suspenseQueryGenerator-CHrwd9jE.cjs → suspenseQueryGenerator-CwhqyJW_.cjs} +11 -11
  9. package/dist/suspenseQueryGenerator-CwhqyJW_.cjs.map +1 -0
  10. package/dist/{suspenseQueryGenerator-BjEGcQcE.js → suspenseQueryGenerator-DJeXy1-j.js} +11 -11
  11. package/dist/suspenseQueryGenerator-DJeXy1-j.js.map +1 -0
  12. package/package.json +11 -10
  13. package/src/generators/infiniteQueryGenerator.tsx +4 -2
  14. package/src/generators/mutationGenerator.tsx +4 -2
  15. package/src/generators/queryGenerator.tsx +4 -2
  16. package/src/generators/suspenseInfiniteQueryGenerator.tsx +4 -2
  17. package/src/generators/suspenseQueryGenerator.tsx +4 -2
  18. package/dist/suspenseQueryGenerator-BjEGcQcE.js.map +0 -1
  19. package/dist/suspenseQueryGenerator-CHrwd9jE.cjs.map +0 -1
  20. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +0 -93
  21. package/src/generators/__snapshots__/clientGetImportPath.ts +0 -88
  22. package/src/generators/__snapshots__/clientPostImportPath.ts +0 -99
  23. package/src/generators/__snapshots__/createUsersWithListInput.ts +0 -83
  24. package/src/generators/__snapshots__/createUsersWithListInputAsQuery.ts +0 -87
  25. package/src/generators/__snapshots__/findByStatusAllOptional.ts +0 -81
  26. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +0 -78
  27. package/src/generators/__snapshots__/findByTags.ts +0 -88
  28. package/src/generators/__snapshots__/findByTagsObject.ts +0 -85
  29. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +0 -88
  30. package/src/generators/__snapshots__/findByTagsTemplateString.ts +0 -89
  31. package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +0 -91
  32. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +0 -88
  33. package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -88
  34. package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +0 -99
  35. package/src/generators/__snapshots__/findInfiniteByTags.ts +0 -102
  36. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +0 -102
  37. package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +0 -102
  38. package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +0 -101
  39. package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +0 -105
  40. package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +0 -81
  41. package/src/generators/__snapshots__/findSuspenseByTags.ts +0 -82
  42. package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +0 -85
  43. package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +0 -99
  44. package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +0 -103
  45. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +0 -103
  46. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +0 -106
  47. package/src/generators/__snapshots__/getAsMutation.ts +0 -31
  48. package/src/generators/__snapshots__/getPetIdCamelCase.ts +0 -76
  49. package/src/generators/__snapshots__/postAsQuery.ts +0 -96
  50. package/src/generators/__snapshots__/requiredOneOfRequestBody.ts +0 -94
  51. package/src/generators/__snapshots__/requiredOneOfRequestBodyWithClientPlugin.ts +0 -71
  52. package/src/generators/__snapshots__/updatePetById.ts +0 -99
  53. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +0 -99
  54. package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +0 -107
@@ -1,88 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
- import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { queryOptions, useQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsQueryKey = (params: FindPetsByTagsQueryParams = {}) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
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 findPetsByTags(
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 findPetsByTagsQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsQueryKey(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 findPetsByTags(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 useFindPetsByTags<
59
- TData = FindPetsByTagsQueryResponse,
60
- TQueryData = FindPetsByTagsQueryResponse,
61
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
62
- >(
63
- headers: FindPetsByTagsHeaderParams,
64
- params?: FindPetsByTagsQueryParams,
65
- options: {
66
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
67
- client?: QueryClient
68
- }
69
- client?: Partial<RequestConfig> & { client?: Client }
70
- } = {},
71
- ) {
72
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
73
- const { client: queryClient, ...queryOptions } = queryConfig
74
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
75
-
76
- const query = useQuery(
77
- {
78
- ...findPetsByTagsQueryOptions(headers, params, config),
79
- queryKey,
80
- ...queryOptions,
81
- } as unknown as QueryObserverOptions,
82
- queryClient,
83
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
84
-
85
- query.queryKey = queryKey as TQueryKey
86
-
87
- return query
88
- }
@@ -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
- }