@kubb/plugin-vue-query 4.29.0 → 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 (28) hide show
  1. package/dist/generators.cjs +1 -1
  2. package/dist/generators.js +1 -1
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/{queryGenerator-gk8pNl_4.js → queryGenerator-Da1vIMnD.js} +7 -7
  6. package/dist/queryGenerator-Da1vIMnD.js.map +1 -0
  7. package/dist/{queryGenerator-e6WGv0jo.cjs → queryGenerator-Y2_A3T-a.cjs} +7 -7
  8. package/dist/queryGenerator-Y2_A3T-a.cjs.map +1 -0
  9. package/package.json +11 -10
  10. package/src/generators/infiniteQueryGenerator.tsx +4 -2
  11. package/src/generators/mutationGenerator.tsx +4 -2
  12. package/src/generators/queryGenerator.tsx +4 -2
  13. package/dist/queryGenerator-e6WGv0jo.cjs.map +0 -1
  14. package/dist/queryGenerator-gk8pNl_4.js.map +0 -1
  15. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +0 -102
  16. package/src/generators/__snapshots__/clientGetImportPath.ts +0 -91
  17. package/src/generators/__snapshots__/clientPostImportPath.ts +0 -77
  18. package/src/generators/__snapshots__/findByTags.ts +0 -91
  19. package/src/generators/__snapshots__/findByTagsObject.ts +0 -88
  20. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +0 -91
  21. package/src/generators/__snapshots__/findByTagsTemplateString.ts +0 -92
  22. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +0 -91
  23. package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -91
  24. package/src/generators/__snapshots__/findInfiniteByTags.ts +0 -105
  25. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +0 -105
  26. package/src/generators/__snapshots__/postAsQuery.ts +0 -104
  27. package/src/generators/__snapshots__/updatePetById.ts +0 -77
  28. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +0 -77
@@ -1,92 +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, UseQueryOptions, UseQueryReturnType } from '@tanstack/react-query'
7
- import type { MaybeRefOrGetter } from 'vue'
8
- import { fetch } from './test/.kubb/fetch'
9
- import { queryOptions, useQuery } from '@tanstack/react-query'
10
- import { toValue } from 'vue'
11
-
12
- export const findPetsByTagsQueryKey = (params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>) =>
13
- [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
14
-
15
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
16
-
17
- /**
18
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
19
- * @summary Finds Pets by tags
20
- * {@link /pet/findByTags}
21
- */
22
- export async function findPetsByTags(
23
- headers: FindPetsByTagsHeaderParams,
24
- params?: FindPetsByTagsQueryParams,
25
- config: Partial<RequestConfig> & { client?: Client } = {},
26
- ) {
27
- const { client: request = fetch, ...requestConfig } = config
28
-
29
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
30
- method: 'GET',
31
- url: `/pet/findByTags`,
32
- baseURL: `${123456}`,
33
- params,
34
- ...requestConfig,
35
- headers: { ...headers, ...requestConfig.headers },
36
- })
37
- return findPetsByTagsQueryResponse.parse(res.data)
38
- }
39
-
40
- export function findPetsByTagsQueryOptions(
41
- headers: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
42
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
43
- config: Partial<RequestConfig> & { client?: Client } = {},
44
- ) {
45
- const queryKey = findPetsByTagsQueryKey(params)
46
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
47
- queryKey,
48
- queryFn: async ({ signal }) => {
49
- if (!config.signal) {
50
- config.signal = signal
51
- }
52
- return findPetsByTags(toValue(headers), toValue(params), toValue(config))
53
- },
54
- })
55
- }
56
-
57
- /**
58
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
59
- * @summary Finds Pets by tags
60
- * {@link /pet/findByTags}
61
- */
62
- export function useFindPetsByTags<
63
- TData = FindPetsByTagsQueryResponse,
64
- TQueryData = FindPetsByTagsQueryResponse,
65
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
66
- >(
67
- headers: MaybeRefOrGetter<FindPetsByTagsHeaderParams>,
68
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
69
- options: {
70
- query?: Partial<UseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
71
- client?: QueryClient
72
- }
73
- client?: Partial<RequestConfig> & { client?: Client }
74
- } = {},
75
- ) {
76
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
77
- const { client: queryClient, ...queryOptions } = queryConfig
78
- const queryKey = (queryOptions && 'queryKey' in queryOptions ? toValue(queryOptions.queryKey) : undefined) ?? findPetsByTagsQueryKey(params)
79
-
80
- const query = useQuery(
81
- {
82
- ...findPetsByTagsQueryOptions(headers, params, config),
83
- ...queryOptions,
84
- queryKey,
85
- } as unknown as UseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, FindPetsByTagsQueryResponse, TQueryKey>,
86
- toValue(queryClient),
87
- ) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
88
-
89
- query.queryKey = queryKey as TQueryKey
90
-
91
- return query
92
- }
@@ -1,91 +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, UseQueryOptions, UseQueryReturnType } from '@tanstack/react-query'
7
- import type { MaybeRefOrGetter } from 'vue'
8
- import { fetch } from './test/.kubb/fetch'
9
- import { queryOptions, useQuery } from '@tanstack/react-query'
10
- import { toValue } from 'vue'
11
-
12
- export const findPetsByTagsQueryKey = (params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>) =>
13
- ['test', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
14
-
15
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
16
-
17
- /**
18
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
19
- * @summary Finds Pets by tags
20
- * {@link /pet/findByTags}
21
- */
22
- export async function findPetsByTags(
23
- headers: FindPetsByTagsHeaderParams,
24
- params?: FindPetsByTagsQueryParams,
25
- config: Partial<RequestConfig> & { client?: Client } = {},
26
- ) {
27
- const { client: request = fetch, ...requestConfig } = config
28
-
29
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
30
- method: 'GET',
31
- url: `/pet/findByTags`,
32
- params,
33
- ...requestConfig,
34
- headers: { ...headers, ...requestConfig.headers },
35
- })
36
- return findPetsByTagsQueryResponse.parse(res.data)
37
- }
38
-
39
- export function findPetsByTagsQueryOptions(
40
- headers: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
41
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
42
- config: Partial<RequestConfig> & { client?: Client } = {},
43
- ) {
44
- const queryKey = findPetsByTagsQueryKey(params)
45
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
46
- queryKey,
47
- queryFn: async ({ signal }) => {
48
- if (!config.signal) {
49
- config.signal = signal
50
- }
51
- return findPetsByTags(toValue(headers), toValue(params), toValue(config))
52
- },
53
- })
54
- }
55
-
56
- /**
57
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
58
- * @summary Finds Pets by tags
59
- * {@link /pet/findByTags}
60
- */
61
- export function useFindPetsByTags<
62
- TData = FindPetsByTagsQueryResponse,
63
- TQueryData = FindPetsByTagsQueryResponse,
64
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
65
- >(
66
- headers: MaybeRefOrGetter<FindPetsByTagsHeaderParams>,
67
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
68
- options: {
69
- query?: Partial<UseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
70
- client?: QueryClient
71
- }
72
- client?: Partial<RequestConfig> & { client?: Client }
73
- } = {},
74
- ) {
75
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
76
- const { client: queryClient, ...queryOptions } = queryConfig
77
- const queryKey = (queryOptions && 'queryKey' in queryOptions ? toValue(queryOptions.queryKey) : undefined) ?? findPetsByTagsQueryKey(params)
78
-
79
- const query = useQuery(
80
- {
81
- ...findPetsByTagsQueryOptions(headers, params, config),
82
- ...queryOptions,
83
- queryKey,
84
- } as unknown as UseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, FindPetsByTagsQueryResponse, TQueryKey>,
85
- toValue(queryClient),
86
- ) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
87
-
88
- query.queryKey = queryKey as TQueryKey
89
-
90
- return query
91
- }
@@ -1,91 +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, UseQueryOptions, UseQueryReturnType } from '@tanstack/react-query'
7
- import type { MaybeRefOrGetter } from 'vue'
8
- import { fetch } from './test/.kubb/fetch'
9
- import { queryOptions, useQuery } from '@tanstack/react-query'
10
- import { toValue } from 'vue'
11
-
12
- export const findPetsByTagsQueryKey = (params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>) =>
13
- [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
14
-
15
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
16
-
17
- /**
18
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
19
- * @summary Finds Pets by tags
20
- * {@link /pet/findByTags}
21
- */
22
- export async function findPetsByTags(
23
- headers: FindPetsByTagsHeaderParams,
24
- params?: FindPetsByTagsQueryParams,
25
- config: Partial<RequestConfig> & { client?: Client } = {},
26
- ) {
27
- const { client: request = fetch, ...requestConfig } = config
28
-
29
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
30
- method: 'GET',
31
- url: `/pet/findByTags`,
32
- params,
33
- ...requestConfig,
34
- headers: { ...headers, ...requestConfig.headers },
35
- })
36
- return findPetsByTagsQueryResponse.parse(res.data)
37
- }
38
-
39
- export function findPetsByTagsQueryOptions(
40
- headers: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
41
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
42
- config: Partial<RequestConfig> & { client?: Client } = {},
43
- ) {
44
- const queryKey = findPetsByTagsQueryKey(params)
45
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
46
- queryKey,
47
- queryFn: async ({ signal }) => {
48
- if (!config.signal) {
49
- config.signal = signal
50
- }
51
- return findPetsByTags(toValue(headers), toValue(params), toValue(config))
52
- },
53
- })
54
- }
55
-
56
- /**
57
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
58
- * @summary Finds Pets by tags
59
- * {@link /pet/findByTags}
60
- */
61
- export function useFindPetsByTags<
62
- TData = FindPetsByTagsQueryResponse,
63
- TQueryData = FindPetsByTagsQueryResponse,
64
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
65
- >(
66
- headers: MaybeRefOrGetter<FindPetsByTagsHeaderParams>,
67
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
68
- options: {
69
- query?: Partial<UseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
70
- client?: QueryClient
71
- }
72
- client?: Partial<RequestConfig> & { client?: Client }
73
- } = {},
74
- ) {
75
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
76
- const { client: queryClient, ...queryOptions } = queryConfig
77
- const queryKey = (queryOptions && 'queryKey' in queryOptions ? toValue(queryOptions.queryKey) : undefined) ?? findPetsByTagsQueryKey(params)
78
-
79
- const query = useQuery(
80
- {
81
- ...findPetsByTagsQueryOptions(headers, params, config),
82
- ...queryOptions,
83
- queryKey,
84
- } as unknown as UseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, FindPetsByTagsQueryResponse, TQueryKey>,
85
- toValue(queryClient),
86
- ) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
87
-
88
- query.queryKey = queryKey as TQueryKey
89
-
90
- return query
91
- }
@@ -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, UseInfiniteQueryOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query'
7
- import type { MaybeRefOrGetter } from 'vue'
8
- import { fetch } from './test/.kubb/fetch'
9
- import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
10
- import { toValue } from 'vue'
11
-
12
- export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>) =>
13
- [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
14
-
15
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
16
-
17
- /**
18
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
19
- * @summary Finds Pets by tags
20
- * {@link /pet/findByTags}
21
- */
22
- export async function findPetsByTagsInfinite(
23
- headers: FindPetsByTagsHeaderParams,
24
- params?: FindPetsByTagsQueryParams,
25
- config: Partial<RequestConfig> & { client?: Client } = {},
26
- ) {
27
- const { client: request = fetch, ...requestConfig } = config
28
-
29
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
30
- method: 'GET',
31
- url: `/pet/findByTags`,
32
- params,
33
- ...requestConfig,
34
- headers: { ...headers, ...requestConfig.headers },
35
- })
36
- return findPetsByTagsQueryResponse.parse(res.data)
37
- }
38
-
39
- export function findPetsByTagsInfiniteQueryOptions(
40
- headers: MaybeRefOrGetter<FindPetsByTagsHeaderParams>,
41
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
42
- config: Partial<RequestConfig> & { client?: Client } = {},
43
- ) {
44
- const queryKey = findPetsByTagsInfiniteQueryKey(params)
45
- return infiniteQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey, number>({
46
- queryKey,
47
- queryFn: async ({ signal, pageParam }) => {
48
- if (!config.signal) {
49
- config.signal = signal
50
- }
51
-
52
- if (!params) {
53
- params = {}
54
- }
55
- params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize']
56
- return findPetsByTagsInfinite(toValue(headers), toValue(params), toValue(config))
57
- },
58
- initialPageParam: 0,
59
- getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1),
60
- getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1),
61
- })
62
- }
63
-
64
- /**
65
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
66
- * @summary Finds Pets by tags
67
- * {@link /pet/findByTags}
68
- */
69
- export function useFindPetsByTagsInfinite<
70
- TData = InfiniteData<FindPetsByTagsQueryResponse>,
71
- TQueryData = FindPetsByTagsQueryResponse,
72
- TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
73
- >(
74
- headers: MaybeRefOrGetter<FindPetsByTagsHeaderParams>,
75
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
76
- options: {
77
- query?: Partial<UseInfiniteQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TQueryData, TQueryKey, TQueryData>> & {
78
- client?: QueryClient
79
- }
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' in queryOptions ? toValue(queryOptions.queryKey) : undefined) ?? findPetsByTagsInfiniteQueryKey(params)
86
-
87
- const query = useInfiniteQuery(
88
- {
89
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config),
90
- ...queryOptions,
91
- queryKey,
92
- } as unknown as UseInfiniteQueryOptions<
93
- FindPetsByTagsQueryResponse,
94
- ResponseErrorConfig<FindPetsByTags400>,
95
- FindPetsByTagsQueryResponse,
96
- TQueryKey,
97
- FindPetsByTagsQueryResponse
98
- >,
99
- toValue(queryClient),
100
- ) as UseInfiniteQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
101
-
102
- query.queryKey = queryKey as TQueryKey
103
-
104
- return query
105
- }
@@ -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, UseInfiniteQueryOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query'
7
- import type { MaybeRefOrGetter } from 'vue'
8
- import { fetch } from './test/.kubb/fetch'
9
- import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
10
- import { toValue } from 'vue'
11
-
12
- export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>) =>
13
- [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
14
-
15
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
16
-
17
- /**
18
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
19
- * @summary Finds Pets by tags
20
- * {@link /pet/findByTags}
21
- */
22
- export async function findPetsByTagsInfinite(
23
- headers: FindPetsByTagsHeaderParams,
24
- params?: FindPetsByTagsQueryParams,
25
- config: Partial<RequestConfig> & { client?: Client } = {},
26
- ) {
27
- const { client: request = fetch, ...requestConfig } = config
28
-
29
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
30
- method: 'GET',
31
- url: `/pet/findByTags`,
32
- params,
33
- ...requestConfig,
34
- headers: { ...headers, ...requestConfig.headers },
35
- })
36
- return findPetsByTagsQueryResponse.parse(res.data)
37
- }
38
-
39
- export function findPetsByTagsInfiniteQueryOptions(
40
- headers: MaybeRefOrGetter<FindPetsByTagsHeaderParams>,
41
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
42
- config: Partial<RequestConfig> & { client?: Client } = {},
43
- ) {
44
- const queryKey = findPetsByTagsInfiniteQueryKey(params)
45
- return infiniteQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey, number>({
46
- queryKey,
47
- queryFn: async ({ signal, pageParam }) => {
48
- if (!config.signal) {
49
- config.signal = signal
50
- }
51
-
52
- if (!params) {
53
- params = {}
54
- }
55
- params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize']
56
- return findPetsByTagsInfinite(toValue(headers), toValue(params), toValue(config))
57
- },
58
- initialPageParam: 0,
59
- getNextPageParam: (lastPage) => lastPage['cursor'],
60
- getPreviousPageParam: (firstPage) => firstPage['cursor'],
61
- })
62
- }
63
-
64
- /**
65
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
66
- * @summary Finds Pets by tags
67
- * {@link /pet/findByTags}
68
- */
69
- export function useFindPetsByTagsInfinite<
70
- TData = InfiniteData<FindPetsByTagsQueryResponse>,
71
- TQueryData = FindPetsByTagsQueryResponse,
72
- TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
73
- >(
74
- headers: MaybeRefOrGetter<FindPetsByTagsHeaderParams>,
75
- params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
76
- options: {
77
- query?: Partial<UseInfiniteQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TQueryData, TQueryKey, TQueryData>> & {
78
- client?: QueryClient
79
- }
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' in queryOptions ? toValue(queryOptions.queryKey) : undefined) ?? findPetsByTagsInfiniteQueryKey(params)
86
-
87
- const query = useInfiniteQuery(
88
- {
89
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config),
90
- ...queryOptions,
91
- queryKey,
92
- } as unknown as UseInfiniteQueryOptions<
93
- FindPetsByTagsQueryResponse,
94
- ResponseErrorConfig<FindPetsByTags400>,
95
- FindPetsByTagsQueryResponse,
96
- TQueryKey,
97
- FindPetsByTagsQueryResponse
98
- >,
99
- toValue(queryClient),
100
- ) as UseInfiniteQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
101
-
102
- query.queryKey = queryKey as TQueryKey
103
-
104
- return query
105
- }
@@ -1,104 +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, UseQueryOptions, UseQueryReturnType } from 'custom-query'
7
- import type { MaybeRefOrGetter } from 'vue'
8
- import { fetch } from './test/.kubb/fetch'
9
- import { queryOptions, useQuery } from 'custom-query'
10
- import { toValue } from 'vue'
11
-
12
- export const updatePetWithFormQueryKey = (
13
- petId: MaybeRefOrGetter<UpdatePetWithFormPathParams['petId']>,
14
- data?: MaybeRefOrGetter<UpdatePetWithFormMutationRequest>,
15
- params?: MaybeRefOrGetter<UpdatePetWithFormQueryParams>,
16
- ) => [{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const
17
-
18
- export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>
19
-
20
- /**
21
- * @summary Updates a pet in the store with form data
22
- * {@link /pet/:petId}
23
- */
24
- export async function updatePetWithForm(
25
- petId: UpdatePetWithFormPathParams['petId'],
26
- data?: UpdatePetWithFormMutationRequest,
27
- params?: UpdatePetWithFormQueryParams,
28
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
29
- ) {
30
- const { client: request = fetch, ...requestConfig } = config
31
-
32
- const requestData = updatePetWithFormMutationRequest.parse(data)
33
-
34
- const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
35
- method: 'POST',
36
- url: `/pet/${petId}`,
37
- params,
38
- data: requestData,
39
- ...requestConfig,
40
- })
41
- return updatePetWithFormMutationResponse.parse(res.data)
42
- }
43
-
44
- export function updatePetWithFormQueryOptions(
45
- petId: MaybeRefOrGetter<UpdatePetWithFormPathParams['petId']>,
46
- data?: MaybeRefOrGetter<UpdatePetWithFormMutationRequest>,
47
- params?: MaybeRefOrGetter<UpdatePetWithFormQueryParams>,
48
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
49
- ) {
50
- const queryKey = updatePetWithFormQueryKey(petId, data, params)
51
- return queryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationResponse, typeof queryKey>({
52
- enabled: !!petId,
53
- queryKey,
54
- queryFn: async ({ signal }) => {
55
- if (!config.signal) {
56
- config.signal = signal
57
- }
58
- return updatePetWithForm(toValue(petId), toValue(data), toValue(params), toValue(config))
59
- },
60
- })
61
- }
62
-
63
- /**
64
- * @summary Updates a pet in the store with form data
65
- * {@link /pet/:petId}
66
- */
67
- export function useUpdatePetWithForm<
68
- TData = UpdatePetWithFormMutationResponse,
69
- TQueryData = UpdatePetWithFormMutationResponse,
70
- TQueryKey extends QueryKey = UpdatePetWithFormQueryKey,
71
- >(
72
- petId: MaybeRefOrGetter<UpdatePetWithFormPathParams['petId']>,
73
- data?: MaybeRefOrGetter<UpdatePetWithFormMutationRequest>,
74
- params?: MaybeRefOrGetter<UpdatePetWithFormQueryParams>,
75
- options: {
76
- query?: Partial<UseQueryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, TData, TQueryData, TQueryKey>> & {
77
- client?: QueryClient
78
- }
79
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
80
- } = {},
81
- ) {
82
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
83
- const { client: queryClient, ...queryOptions } = queryConfig
84
- const queryKey = (queryOptions && 'queryKey' in queryOptions ? toValue(queryOptions.queryKey) : undefined) ?? updatePetWithFormQueryKey(petId, data, params)
85
-
86
- const query = useQuery(
87
- {
88
- ...updatePetWithFormQueryOptions(petId, data, params, config),
89
- ...queryOptions,
90
- queryKey,
91
- } as unknown as UseQueryOptions<
92
- UpdatePetWithFormMutationResponse,
93
- ResponseErrorConfig<UpdatePetWithForm405>,
94
- TData,
95
- UpdatePetWithFormMutationResponse,
96
- TQueryKey
97
- >,
98
- toValue(queryClient),
99
- ) as UseQueryReturnType<TData, ResponseErrorConfig<UpdatePetWithForm405>> & { queryKey: TQueryKey }
100
-
101
- query.queryKey = queryKey as TQueryKey
102
-
103
- return query
104
- }
@@ -1,77 +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 { MutationObserverOptions, QueryClient } from '@tanstack/vue-query'
7
- import type { MaybeRefOrGetter } from 'vue'
8
- import { fetch } from './test/.kubb/fetch'
9
- import { useMutation } from '@tanstack/vue-query'
10
-
11
- export const updatePetWithFormMutationKey = () => [{ url: '/pet/:petId' }] as const
12
-
13
- export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
14
-
15
- /**
16
- * @summary Updates a pet in the store with form data
17
- * {@link /pet/:petId}
18
- */
19
- export async function updatePetWithForm(
20
- petId: UpdatePetWithFormPathParams['petId'],
21
- data?: UpdatePetWithFormMutationRequest,
22
- params?: UpdatePetWithFormQueryParams,
23
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
24
- ) {
25
- const { client: request = fetch, ...requestConfig } = config
26
-
27
- const requestData = updatePetWithFormMutationRequest.parse(data)
28
-
29
- const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
30
- method: 'POST',
31
- url: `/pet/${petId}`,
32
- params,
33
- data: requestData,
34
- ...requestConfig,
35
- })
36
- return updatePetWithFormMutationResponse.parse(res.data)
37
- }
38
-
39
- /**
40
- * @summary Updates a pet in the store with form data
41
- * {@link /pet/:petId}
42
- */
43
- export function useUpdatePetWithForm<TContext>(
44
- options: {
45
- mutation?: MutationObserverOptions<
46
- UpdatePetWithFormMutationResponse,
47
- ResponseErrorConfig<UpdatePetWithForm405>,
48
- {
49
- petId: MaybeRefOrGetter<UpdatePetWithFormPathParams['petId']>
50
- data?: MaybeRefOrGetter<UpdatePetWithFormMutationRequest>
51
- params?: MaybeRefOrGetter<UpdatePetWithFormQueryParams>
52
- },
53
- TContext
54
- > & { client?: QueryClient }
55
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
56
- } = {},
57
- ) {
58
- const { mutation = {}, client: config = {} } = options ?? {}
59
- const { client: queryClient, ...mutationOptions } = mutation
60
- const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
61
-
62
- return useMutation<
63
- UpdatePetWithFormMutationResponse,
64
- ResponseErrorConfig<UpdatePetWithForm405>,
65
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
66
- TContext
67
- >(
68
- {
69
- mutationFn: async ({ petId, data, params }) => {
70
- return updatePetWithForm(petId, data, params, config)
71
- },
72
- mutationKey,
73
- ...mutationOptions,
74
- },
75
- queryClient,
76
- )
77
- }