@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,93 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import type { Client, RequestConfig, ResponseErrorConfig, ResponseConfig } 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 { ...res, data: 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<
43
- ResponseConfig<FindPetsByTagsQueryResponse>,
44
- ResponseErrorConfig<FindPetsByTags400>,
45
- ResponseConfig<FindPetsByTagsQueryResponse>,
46
- typeof queryKey
47
- >({
48
- queryKey,
49
- queryFn: async ({ signal }) => {
50
- if (!config.signal) {
51
- config.signal = signal
52
- }
53
- return findPetsByTags(headers, params, config)
54
- },
55
- })
56
- }
57
-
58
- /**
59
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
60
- * @summary Finds Pets by tags
61
- * {@link /pet/findByTags}
62
- */
63
- export function useFindPetsByTags<
64
- TData = ResponseConfig<FindPetsByTagsQueryResponse>,
65
- TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>,
66
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
67
- >(
68
- headers: FindPetsByTagsHeaderParams,
69
- params?: FindPetsByTagsQueryParams,
70
- options: {
71
- query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
72
- client?: QueryClient
73
- }
74
- client?: Partial<RequestConfig> & { client?: Client }
75
- } = {},
76
- ) {
77
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
78
- const { client: queryClient, ...queryOptions } = queryConfig
79
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
80
-
81
- const query = useQuery(
82
- {
83
- ...findPetsByTagsQueryOptions(headers, params, config),
84
- queryKey,
85
- ...queryOptions,
86
- } as unknown as QueryObserverOptions,
87
- queryClient,
88
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
89
-
90
- query.queryKey = queryKey as TQueryKey
91
-
92
- return query
93
- }
@@ -1,88 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import fetch from 'axios'
6
- import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
7
- import type { Client, RequestConfig, ResponseErrorConfig } from 'axios'
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 fetch from 'axios'
6
- import type { UseMutationOptions, UseMutationResult, QueryClient } from '@tanstack/react-query'
7
- import type { Client, RequestConfig, ResponseErrorConfig } from 'axios'
8
- import { mutationOptions, useMutation } from '@tanstack/react-query'
9
-
10
- export const updatePetWithFormMutationKey = () => [{ url: '/pet/:pet_id' }] as const
11
-
12
- export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
13
-
14
- /**
15
- * @summary Updates a pet in the store with form data
16
- * {@link /pet/:pet_id}
17
- */
18
- export async function updatePetWithForm(
19
- petId: UpdatePetWithFormPathParams['petId'],
20
- data?: UpdatePetWithFormMutationRequest,
21
- params?: UpdatePetWithFormQueryParams,
22
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const requestData = updatePetWithFormMutationRequest.parse(data)
27
-
28
- const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
29
- method: 'POST',
30
- url: `/pet/${pet_id}`,
31
- params,
32
- data: requestData,
33
- ...requestConfig,
34
- })
35
- return updatePetWithFormMutationResponse.parse(res.data)
36
- }
37
-
38
- export function updatePetWithFormMutationOptions<TContext = unknown>(
39
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
40
- ) {
41
- const mutationKey = updatePetWithFormMutationKey()
42
- return mutationOptions<
43
- UpdatePetWithFormMutationResponse,
44
- ResponseErrorConfig<UpdatePetWithForm405>,
45
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
46
- TContext
47
- >({
48
- mutationKey,
49
- mutationFn: async ({ petId, data, params }) => {
50
- return updatePetWithForm(petId, data, params, config)
51
- },
52
- })
53
- }
54
-
55
- /**
56
- * @summary Updates a pet in the store with form data
57
- * {@link /pet/:pet_id}
58
- */
59
- export function useUpdatePetWithForm<TContext>(
60
- options: {
61
- mutation?: UseMutationOptions<
62
- UpdatePetWithFormMutationResponse,
63
- ResponseErrorConfig<UpdatePetWithForm405>,
64
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
65
- TContext
66
- > & { client?: QueryClient }
67
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
68
- } = {},
69
- ) {
70
- const { mutation = {}, client: config = {} } = options ?? {}
71
- const { client: queryClient, ...mutationOptions } = mutation
72
- const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
73
-
74
- const baseOptions = updatePetWithFormMutationOptions(config) as UseMutationOptions<
75
- UpdatePetWithFormMutationResponse,
76
- ResponseErrorConfig<UpdatePetWithForm405>,
77
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
78
- TContext
79
- >
80
-
81
- return useMutation<
82
- UpdatePetWithFormMutationResponse,
83
- ResponseErrorConfig<UpdatePetWithForm405>,
84
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
85
- TContext
86
- >(
87
- {
88
- ...baseOptions,
89
- mutationKey,
90
- ...mutationOptions,
91
- },
92
- queryClient,
93
- ) as UseMutationResult<
94
- UpdatePetWithFormMutationResponse,
95
- ResponseErrorConfig<UpdatePetWithForm405>,
96
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
97
- TContext
98
- >
99
- }
@@ -1,83 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
- import type { UseMutationOptions, UseMutationResult, QueryClient } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { mutationOptions, useMutation } from '@tanstack/react-query'
9
-
10
- export const createUsersWithListInputMutationKey = () => [{ url: '/user/createWithList' }] as const
11
-
12
- export type CreateUsersWithListInputMutationKey = ReturnType<typeof createUsersWithListInputMutationKey>
13
-
14
- /**
15
- * @description Creates list of users with given input array
16
- * @summary Creates list of users with given input array
17
- * {@link /user/createWithList}
18
- */
19
- export async function createUsersWithListInput(
20
- data?: CreateUsersWithListInputMutationRequest,
21
- config: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: Client } = {},
22
- ) {
23
- const { client: request = fetch, ...requestConfig } = config
24
-
25
- const requestData = createUsersWithListInputMutationRequest.parse(data)
26
-
27
- const res = await request<CreateUsersWithListInputMutationResponse, ResponseErrorConfig<Error>, CreateUsersWithListInputMutationRequest>({
28
- method: 'POST',
29
- url: `/user/createWithList`,
30
- data: requestData,
31
- ...requestConfig,
32
- })
33
- return createUsersWithListInputMutationResponse.parse(res.data)
34
- }
35
-
36
- export function createUsersWithListInputMutationOptions<TContext = unknown>(
37
- config: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: Client } = {},
38
- ) {
39
- const mutationKey = createUsersWithListInputMutationKey()
40
- return mutationOptions<CreateUsersWithListInputMutationResponse, ResponseErrorConfig<Error>, { data?: CreateUsersWithListInputMutationRequest }, TContext>({
41
- mutationKey,
42
- mutationFn: async ({ data }) => {
43
- return createUsersWithListInput(data, config)
44
- },
45
- })
46
- }
47
-
48
- /**
49
- * @description Creates list of users with given input array
50
- * @summary Creates list of users with given input array
51
- * {@link /user/createWithList}
52
- */
53
- export function useCreateUsersWithListInput<TContext>(
54
- options: {
55
- mutation?: UseMutationOptions<
56
- CreateUsersWithListInputMutationResponse,
57
- ResponseErrorConfig<Error>,
58
- { data?: CreateUsersWithListInputMutationRequest },
59
- TContext
60
- > & { client?: QueryClient }
61
- client?: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: Client }
62
- } = {},
63
- ) {
64
- const { mutation = {}, client: config = {} } = options ?? {}
65
- const { client: queryClient, ...mutationOptions } = mutation
66
- const mutationKey = mutationOptions.mutationKey ?? createUsersWithListInputMutationKey()
67
-
68
- const baseOptions = createUsersWithListInputMutationOptions(config) as UseMutationOptions<
69
- CreateUsersWithListInputMutationResponse,
70
- ResponseErrorConfig<Error>,
71
- { data?: CreateUsersWithListInputMutationRequest },
72
- TContext
73
- >
74
-
75
- return useMutation<CreateUsersWithListInputMutationResponse, ResponseErrorConfig<Error>, { data?: CreateUsersWithListInputMutationRequest }, TContext>(
76
- {
77
- ...baseOptions,
78
- mutationKey,
79
- ...mutationOptions,
80
- },
81
- queryClient,
82
- ) as UseMutationResult<CreateUsersWithListInputMutationResponse, ResponseErrorConfig<Error>, { data?: CreateUsersWithListInputMutationRequest }, TContext>
83
- }
@@ -1,87 +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 createUsersWithListInputQueryKey = (data: CreateUsersWithListInputMutationRequest = []) =>
11
- [{ url: '/user/createWithList' }, ...(data ? [data] : [])] as const
12
-
13
- export type CreateUsersWithListInputQueryKey = ReturnType<typeof createUsersWithListInputQueryKey>
14
-
15
- /**
16
- * @description Creates list of users with given input array
17
- * @summary Creates list of users with given input array
18
- * {@link /user/createWithList}
19
- */
20
- export async function createUsersWithListInput(
21
- data?: CreateUsersWithListInputMutationRequest,
22
- config: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const requestData = createUsersWithListInputMutationRequest.parse(data)
27
-
28
- const res = await request<CreateUsersWithListInputMutationResponse, ResponseErrorConfig<Error>, CreateUsersWithListInputMutationRequest>({
29
- method: 'POST',
30
- url: `/user/createWithList`,
31
- data: requestData,
32
- ...requestConfig,
33
- })
34
- return createUsersWithListInputMutationResponse.parse(res.data)
35
- }
36
-
37
- export function createUsersWithListInputQueryOptions(
38
- data?: CreateUsersWithListInputMutationRequest,
39
- config: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: Client } = {},
40
- ) {
41
- const queryKey = createUsersWithListInputQueryKey(data)
42
- return queryOptions<CreateUsersWithListInputMutationResponse, ResponseErrorConfig<Error>, CreateUsersWithListInputMutationResponse, typeof queryKey>({
43
- queryKey,
44
- queryFn: async ({ signal }) => {
45
- if (!config.signal) {
46
- config.signal = signal
47
- }
48
- return createUsersWithListInput(data, config)
49
- },
50
- })
51
- }
52
-
53
- /**
54
- * @description Creates list of users with given input array
55
- * @summary Creates list of users with given input array
56
- * {@link /user/createWithList}
57
- */
58
- export function useCreateUsersWithListInput<
59
- TData = CreateUsersWithListInputMutationResponse,
60
- TQueryData = CreateUsersWithListInputMutationResponse,
61
- TQueryKey extends QueryKey = CreateUsersWithListInputQueryKey,
62
- >(
63
- data?: CreateUsersWithListInputMutationRequest,
64
- options: {
65
- query?: Partial<QueryObserverOptions<CreateUsersWithListInputMutationResponse, ResponseErrorConfig<Error>, TData, TQueryData, TQueryKey>> & {
66
- client?: QueryClient
67
- }
68
- client?: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: Client }
69
- } = {},
70
- ) {
71
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
72
- const { client: queryClient, ...queryOptions } = queryConfig
73
- const queryKey = queryOptions?.queryKey ?? createUsersWithListInputQueryKey(data)
74
-
75
- const query = useQuery(
76
- {
77
- ...createUsersWithListInputQueryOptions(data, config),
78
- queryKey,
79
- ...queryOptions,
80
- } as unknown as QueryObserverOptions,
81
- queryClient,
82
- ) as UseQueryResult<TData, ResponseErrorConfig<Error>> & { queryKey: TQueryKey }
83
-
84
- query.queryKey = queryKey as TQueryKey
85
-
86
- return query
87
- }
@@ -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, 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 findPetsByStatusQueryKey = (params: FindPetsByStatusQueryParams = {}) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByStatusQueryKey = ReturnType<typeof findPetsByStatusQueryKey>
13
-
14
- /**
15
- * @description Multiple status values can be provided with comma separated strings
16
- * @summary Finds Pets by status
17
- * {@link /pet/findByStatus}
18
- */
19
- export async function findPetsByStatus({ params }: { params?: FindPetsByStatusQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
23
- method: 'GET',
24
- url: `/pet/findByStatus`,
25
- params,
26
- ...requestConfig,
27
- })
28
- return findPetsByStatusQueryResponse.parse(res.data)
29
- }
30
-
31
- export function findPetsByStatusQueryOptions(
32
- { params }: { params?: FindPetsByStatusQueryParams } = {},
33
- config: Partial<RequestConfig> & { client?: Client } = {},
34
- ) {
35
- const queryKey = findPetsByStatusQueryKey(params)
36
- return queryOptions<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, FindPetsByStatusQueryResponse, typeof queryKey>({
37
- queryKey,
38
- queryFn: async ({ signal }) => {
39
- if (!config.signal) {
40
- config.signal = signal
41
- }
42
- return findPetsByStatus({ params }, config)
43
- },
44
- })
45
- }
46
-
47
- /**
48
- * @description Multiple status values can be provided with comma separated strings
49
- * @summary Finds Pets by status
50
- * {@link /pet/findByStatus}
51
- */
52
- export function useFindPetsByStatus<
53
- TData = FindPetsByStatusQueryResponse,
54
- TQueryData = FindPetsByStatusQueryResponse,
55
- TQueryKey extends QueryKey = FindPetsByStatusQueryKey,
56
- >(
57
- { params }: { params?: FindPetsByStatusQueryParams } = {},
58
- options: {
59
- query?: Partial<QueryObserverOptions<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, TData, TQueryData, 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 ?? findPetsByStatusQueryKey(params)
68
-
69
- const query = useQuery(
70
- {
71
- ...findPetsByStatusQueryOptions({ params }, config),
72
- queryKey,
73
- ...queryOptions,
74
- } as unknown as QueryObserverOptions,
75
- queryClient,
76
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByStatus400>> & { queryKey: TQueryKey }
77
-
78
- query.queryKey = queryKey as TQueryKey
79
-
80
- return query
81
- }
@@ -1,78 +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 findPetsByStatusQueryKey = (params: FindPetsByStatusQueryParams = {}) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByStatusQueryKey = ReturnType<typeof findPetsByStatusQueryKey>
13
-
14
- /**
15
- * @description Multiple status values can be provided with comma separated strings
16
- * @summary Finds Pets by status
17
- * {@link /pet/findByStatus}
18
- */
19
- export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
23
- method: 'GET',
24
- url: `/pet/findByStatus`,
25
- params,
26
- ...requestConfig,
27
- })
28
- return findPetsByStatusQueryResponse.parse(res.data)
29
- }
30
-
31
- export function findPetsByStatusQueryOptions(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
32
- const queryKey = findPetsByStatusQueryKey(params)
33
- return queryOptions<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, FindPetsByStatusQueryResponse, typeof queryKey>({
34
- queryKey,
35
- queryFn: async ({ signal }) => {
36
- if (!config.signal) {
37
- config.signal = signal
38
- }
39
- return findPetsByStatus(params, config)
40
- },
41
- })
42
- }
43
-
44
- /**
45
- * @description Multiple status values can be provided with comma separated strings
46
- * @summary Finds Pets by status
47
- * {@link /pet/findByStatus}
48
- */
49
- export function useFindPetsByStatus<
50
- TData = FindPetsByStatusQueryResponse,
51
- TQueryData = FindPetsByStatusQueryResponse,
52
- TQueryKey extends QueryKey = FindPetsByStatusQueryKey,
53
- >(
54
- params?: FindPetsByStatusQueryParams,
55
- options: {
56
- query?: Partial<QueryObserverOptions<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, TData, TQueryData, TQueryKey>> & {
57
- client?: QueryClient
58
- }
59
- client?: Partial<RequestConfig> & { client?: Client }
60
- } = {},
61
- ) {
62
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
63
- const { client: queryClient, ...queryOptions } = queryConfig
64
- const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params)
65
-
66
- const query = useQuery(
67
- {
68
- ...findPetsByStatusQueryOptions(params, config),
69
- queryKey,
70
- ...queryOptions,
71
- } as unknown as QueryObserverOptions,
72
- queryClient,
73
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByStatus400>> & { queryKey: TQueryKey }
74
-
75
- query.queryKey = queryKey as TQueryKey
76
-
77
- return query
78
- }