@kubb/plugin-vue-query 3.1.0 → 3.3.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/{chunk-HWT3VLRR.js → chunk-FPSHQREX.js} +69 -32
  2. package/dist/chunk-FPSHQREX.js.map +1 -0
  3. package/dist/{chunk-YWUOBXLY.js → chunk-GNUJZEZD.js} +14 -3
  4. package/dist/chunk-GNUJZEZD.js.map +1 -0
  5. package/dist/{chunk-63EIV54R.cjs → chunk-M7ME77VI.cjs} +25 -14
  6. package/dist/chunk-M7ME77VI.cjs.map +1 -0
  7. package/dist/{chunk-JYBDVID2.cjs → chunk-X3AYO2AG.cjs} +69 -32
  8. package/dist/chunk-X3AYO2AG.cjs.map +1 -0
  9. package/dist/components.cjs +8 -8
  10. package/dist/components.d.cts +25 -13
  11. package/dist/components.d.ts +25 -13
  12. package/dist/components.js +1 -1
  13. package/dist/generators.cjs +5 -5
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +2 -2
  17. package/dist/index.cjs +8 -6
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +5 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-DAqaLrlX.d.cts → types-B6HlLDzG.d.cts} +30 -3
  24. package/dist/{types-DAqaLrlX.d.ts → types-B6HlLDzG.d.ts} +30 -3
  25. package/package.json +11 -11
  26. package/src/components/InfiniteQuery.tsx +9 -1
  27. package/src/components/InfiniteQueryOptions.tsx +9 -2
  28. package/src/components/Mutation.tsx +18 -3
  29. package/src/components/MutationKey.tsx +5 -4
  30. package/src/components/Query.tsx +9 -1
  31. package/src/components/QueryKey.tsx +9 -5
  32. package/src/components/QueryOptions.tsx +9 -3
  33. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +55 -36
  34. package/src/generators/__snapshots__/clientGetImportPath.ts +55 -36
  35. package/src/generators/__snapshots__/clientPostImportPath.ts +51 -33
  36. package/src/generators/__snapshots__/findByTags.ts +55 -36
  37. package/src/generators/__snapshots__/findByTagsObject.ts +57 -46
  38. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +55 -36
  39. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +56 -36
  40. package/src/generators/__snapshots__/findByTagsWithZod.ts +55 -36
  41. package/src/generators/__snapshots__/findInfiniteByTags.ts +62 -41
  42. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +62 -41
  43. package/src/generators/__snapshots__/postAsQuery.ts +68 -38
  44. package/src/generators/__snapshots__/updatePetById.ts +51 -33
  45. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +51 -35
  46. package/src/generators/infiniteQueryGenerator.tsx +4 -0
  47. package/src/generators/mutationGenerator.tsx +3 -0
  48. package/src/generators/queryGenerator.tsx +4 -0
  49. package/src/plugin.ts +3 -1
  50. package/src/types.ts +7 -0
  51. package/dist/chunk-63EIV54R.cjs.map +0 -1
  52. package/dist/chunk-HWT3VLRR.js.map +0 -1
  53. package/dist/chunk-JYBDVID2.cjs.map +0 -1
  54. package/dist/chunk-YWUOBXLY.js.map +0 -1
@@ -1,53 +1,72 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query";
4
- import type { MaybeRef } from "vue";
5
- import { queryOptions, useQuery } from "@tanstack/react-query";
6
- import { unref } from "vue";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
+ import type { MaybeRef } from 'vue'
5
+ import { queryOptions, useQuery } from '@tanstack/react-query'
6
+ import { unref } from 'vue'
7
7
 
8
- export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
9
9
 
10
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
11
11
 
12
- /**
12
+ /**
13
13
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
14
  * @summary Finds Pets by tags
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
19
- return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) };
18
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
19
+ method: 'GET',
20
+ url: `/pet/findByTags`,
21
+ params,
22
+ headers: { ...headers, ...config.headers },
23
+ ...config,
24
+ })
25
+ return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) }
20
26
  }
21
27
 
22
- export function findPetsByTagsQueryOptions(headers: MaybeRef<FindPetsByTagsQueryParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, config: Partial<RequestConfig> = {}) {
23
- const queryKey = findPetsByTagsQueryKey(params);
24
- return queryOptions({
25
- queryKey,
26
- queryFn: async ({ signal }) => {
27
- config.signal = signal;
28
- return findPetsByTags(unref(headers), unref(params), unref(config));
29
- },
30
- });
28
+ export function findPetsByTagsQueryOptions(
29
+ headers: MaybeRef<FindPetsByTagsQueryParams>,
30
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
31
+ config: Partial<RequestConfig> = {},
32
+ ) {
33
+ const queryKey = findPetsByTagsQueryKey(params)
34
+ return queryOptions({
35
+ queryKey,
36
+ queryFn: async ({ signal }) => {
37
+ config.signal = signal
38
+ return findPetsByTags(unref(headers), unref(params), unref(config))
39
+ },
40
+ })
31
41
  }
32
42
 
33
- /**
43
+ /**
34
44
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
35
45
  * @summary Finds Pets by tags
36
46
  * {@link /pet/findByTags}
37
47
  */
38
- export function useFindPetsByTags<TData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
39
- query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
40
- client?: Partial<RequestConfig>;
41
- } = {}) {
42
- const { query: queryOptions, client: config = {} } = options ?? {};
43
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
44
- const query = useQuery({
45
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
46
- queryKey: queryKey as QueryKey,
47
- ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
48
- }) as UseQueryReturnType<TData, FindPetsByTags400> & {
49
- queryKey: TQueryKey;
50
- };
51
- query.queryKey = queryKey as TQueryKey;
52
- return query;
48
+ export function useFindPetsByTags<
49
+ TData = ResponseConfig<FindPetsByTagsQueryResponse>,
50
+ TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>,
51
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
52
+ >(
53
+ headers: MaybeRef<FindPetsByTagsHeaderParams>,
54
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
55
+ options: {
56
+ query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>
57
+ client?: Partial<RequestConfig>
58
+ } = {},
59
+ ) {
60
+ const { query: queryOptions, client: config = {} } = options ?? {}
61
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
62
+
63
+ const query = useQuery({
64
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
65
+ queryKey: queryKey as QueryKey,
66
+ ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
67
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
68
+
69
+ query.queryKey = queryKey as TQueryKey
70
+
71
+ return query
53
72
  }
@@ -1,53 +1,72 @@
1
- import client from "axios";
2
- import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query";
3
- import type { RequestConfig } from "axios";
4
- import type { MaybeRef } from "vue";
5
- import { queryOptions, useQuery } from "@tanstack/react-query";
6
- import { unref } from "vue";
1
+ import client from 'axios'
2
+ import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
3
+ import type { RequestConfig } from 'axios'
4
+ import type { MaybeRef } from 'vue'
5
+ import { queryOptions, useQuery } from '@tanstack/react-query'
6
+ import { unref } from 'vue'
7
7
 
8
- export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
9
9
 
10
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
11
11
 
12
- /**
12
+ /**
13
13
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
14
  * @summary Finds Pets by tags
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
19
- return findPetsByTagsQueryResponse.parse(res.data);
18
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
19
+ method: 'GET',
20
+ url: `/pet/findByTags`,
21
+ params,
22
+ headers: { ...headers, ...config.headers },
23
+ ...config,
24
+ })
25
+ return findPetsByTagsQueryResponse.parse(res.data)
20
26
  }
21
27
 
22
- export function findPetsByTagsQueryOptions(headers: MaybeRef<FindPetsByTagsQueryParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, config: Partial<RequestConfig> = {}) {
23
- const queryKey = findPetsByTagsQueryKey(params);
24
- return queryOptions({
25
- queryKey,
26
- queryFn: async ({ signal }) => {
27
- config.signal = signal;
28
- return findPetsByTags(unref(headers), unref(params), unref(config));
29
- },
30
- });
28
+ export function findPetsByTagsQueryOptions(
29
+ headers: MaybeRef<FindPetsByTagsQueryParams>,
30
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
31
+ config: Partial<RequestConfig> = {},
32
+ ) {
33
+ const queryKey = findPetsByTagsQueryKey(params)
34
+ return queryOptions({
35
+ queryKey,
36
+ queryFn: async ({ signal }) => {
37
+ config.signal = signal
38
+ return findPetsByTags(unref(headers), unref(params), unref(config))
39
+ },
40
+ })
31
41
  }
32
42
 
33
- /**
43
+ /**
34
44
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
35
45
  * @summary Finds Pets by tags
36
46
  * {@link /pet/findByTags}
37
47
  */
38
- export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
39
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
40
- client?: Partial<RequestConfig>;
41
- } = {}) {
42
- const { query: queryOptions, client: config = {} } = options ?? {};
43
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
44
- const query = useQuery({
45
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
46
- queryKey: queryKey as QueryKey,
47
- ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
48
- }) as UseQueryReturnType<TData, FindPetsByTags400> & {
49
- queryKey: TQueryKey;
50
- };
51
- query.queryKey = queryKey as TQueryKey;
52
- return query;
48
+ export function useFindPetsByTags<
49
+ TData = FindPetsByTagsQueryResponse,
50
+ TQueryData = FindPetsByTagsQueryResponse,
51
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
52
+ >(
53
+ headers: MaybeRef<FindPetsByTagsHeaderParams>,
54
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
55
+ options: {
56
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
57
+ client?: Partial<RequestConfig>
58
+ } = {},
59
+ ) {
60
+ const { query: queryOptions, client: config = {} } = options ?? {}
61
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
62
+
63
+ const query = useQuery({
64
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
65
+ queryKey: queryKey as QueryKey,
66
+ ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
67
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
68
+
69
+ query.queryKey = queryKey as TQueryKey
70
+
71
+ return query
53
72
  }
@@ -1,45 +1,63 @@
1
- import client from "axios";
2
- import type { MutationObserverOptions } from "@tanstack/vue-query";
3
- import type { RequestConfig } from "axios";
4
- import type { MaybeRef } from "vue";
5
- import { useMutation } from "@tanstack/vue-query";
1
+ import client from 'axios'
2
+ import type { MutationObserverOptions } from '@tanstack/vue-query'
3
+ import type { RequestConfig } from 'axios'
4
+ import type { MaybeRef } from 'vue'
5
+ import { useMutation } from '@tanstack/vue-query'
6
6
 
7
- export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const;
7
+ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
8
8
 
9
- export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>;
9
+ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
10
10
 
11
- /**
11
+ /**
12
12
  * @summary Updates a pet in the store with form data
13
13
  * {@link /pet/:petId}
14
14
  */
15
- async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
16
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "POST", url: `/pet/${petId}`, params, data, ...config });
17
- return updatePetWithFormMutationResponse.parse(res.data);
15
+ async function updatePetWithForm(
16
+ petId: UpdatePetWithFormPathParams['petId'],
17
+ data?: UpdatePetWithFormMutationRequest,
18
+ params?: UpdatePetWithFormQueryParams,
19
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
20
+ ) {
21
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
22
+ method: 'POST',
23
+ url: `/pet/${petId}`,
24
+ params,
25
+ data,
26
+ ...config,
27
+ })
28
+ return updatePetWithFormMutationResponse.parse(res.data)
18
29
  }
19
30
 
20
- /**
31
+ /**
21
32
  * @summary Updates a pet in the store with form data
22
33
  * {@link /pet/:petId}
23
34
  */
24
- export function useUpdatePetWithForm(options: {
25
- mutation?: MutationObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
26
- petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>;
27
- data?: MaybeRef<UpdatePetWithFormMutationRequest>;
28
- params?: MaybeRef<UpdatePetWithFormQueryParams>;
29
- }>;
30
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
31
- } = {}) {
32
- const { mutation: mutationOptions, client: config = {} } = options ?? {};
33
- const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey();
34
- return useMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
35
- petId: UpdatePetWithFormPathParams["petId"];
36
- data?: UpdatePetWithFormMutationRequest;
37
- params?: UpdatePetWithFormQueryParams;
38
- }>({
39
- mutationFn: async ({ petId, data, params }) => {
40
- return updatePetWithForm(petId, data, params, config);
41
- },
42
- mutationKey,
43
- ...mutationOptions
44
- });
35
+ export function useUpdatePetWithForm(
36
+ options: {
37
+ mutation?: MutationObserverOptions<
38
+ UpdatePetWithFormMutationResponse,
39
+ UpdatePetWithForm405,
40
+ {
41
+ petId: MaybeRef<UpdatePetWithFormPathParams['petId']>
42
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>
43
+ params?: MaybeRef<UpdatePetWithFormQueryParams>
44
+ }
45
+ >
46
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
47
+ } = {},
48
+ ) {
49
+ const { mutation: mutationOptions, client: config = {} } = options ?? {}
50
+ const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
51
+
52
+ return useMutation<
53
+ UpdatePetWithFormMutationResponse,
54
+ UpdatePetWithForm405,
55
+ { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams }
56
+ >({
57
+ mutationFn: async ({ petId, data, params }) => {
58
+ return updatePetWithForm(petId, data, params, config)
59
+ },
60
+ mutationKey,
61
+ ...mutationOptions,
62
+ })
45
63
  }
@@ -1,53 +1,72 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query";
4
- import type { MaybeRef } from "vue";
5
- import { queryOptions, useQuery } from "@tanstack/react-query";
6
- import { unref } from "vue";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
+ import type { MaybeRef } from 'vue'
5
+ import { queryOptions, useQuery } from '@tanstack/react-query'
6
+ import { unref } from 'vue'
7
7
 
8
- export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
9
9
 
10
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
11
11
 
12
- /**
12
+ /**
13
13
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
14
  * @summary Finds Pets by tags
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
19
- return findPetsByTagsQueryResponse.parse(res.data);
18
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
19
+ method: 'GET',
20
+ url: `/pet/findByTags`,
21
+ params,
22
+ headers: { ...headers, ...config.headers },
23
+ ...config,
24
+ })
25
+ return findPetsByTagsQueryResponse.parse(res.data)
20
26
  }
21
27
 
22
- export function findPetsByTagsQueryOptions(headers: MaybeRef<FindPetsByTagsQueryParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, config: Partial<RequestConfig> = {}) {
23
- const queryKey = findPetsByTagsQueryKey(params);
24
- return queryOptions({
25
- queryKey,
26
- queryFn: async ({ signal }) => {
27
- config.signal = signal;
28
- return findPetsByTags(unref(headers), unref(params), unref(config));
29
- },
30
- });
28
+ export function findPetsByTagsQueryOptions(
29
+ headers: MaybeRef<FindPetsByTagsQueryParams>,
30
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
31
+ config: Partial<RequestConfig> = {},
32
+ ) {
33
+ const queryKey = findPetsByTagsQueryKey(params)
34
+ return queryOptions({
35
+ queryKey,
36
+ queryFn: async ({ signal }) => {
37
+ config.signal = signal
38
+ return findPetsByTags(unref(headers), unref(params), unref(config))
39
+ },
40
+ })
31
41
  }
32
42
 
33
- /**
43
+ /**
34
44
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
35
45
  * @summary Finds Pets by tags
36
46
  * {@link /pet/findByTags}
37
47
  */
38
- export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
39
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
40
- client?: Partial<RequestConfig>;
41
- } = {}) {
42
- const { query: queryOptions, client: config = {} } = options ?? {};
43
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
44
- const query = useQuery({
45
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
46
- queryKey: queryKey as QueryKey,
47
- ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
48
- }) as UseQueryReturnType<TData, FindPetsByTags400> & {
49
- queryKey: TQueryKey;
50
- };
51
- query.queryKey = queryKey as TQueryKey;
52
- return query;
48
+ export function useFindPetsByTags<
49
+ TData = FindPetsByTagsQueryResponse,
50
+ TQueryData = FindPetsByTagsQueryResponse,
51
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
52
+ >(
53
+ headers: MaybeRef<FindPetsByTagsHeaderParams>,
54
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
55
+ options: {
56
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
57
+ client?: Partial<RequestConfig>
58
+ } = {},
59
+ ) {
60
+ const { query: queryOptions, client: config = {} } = options ?? {}
61
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
62
+
63
+ const query = useQuery({
64
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
65
+ queryKey: queryKey as QueryKey,
66
+ ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
67
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
68
+
69
+ query.queryKey = queryKey as TQueryKey
70
+
71
+ return query
53
72
  }
@@ -1,62 +1,73 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query";
4
- import type { MaybeRef } from "vue";
5
- import { queryOptions, useQuery } from "@tanstack/react-query";
6
- import { unref } from "vue";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
+ import type { MaybeRef } from 'vue'
5
+ import { queryOptions, useQuery } from '@tanstack/react-query'
6
+ import { unref } from 'vue'
7
7
 
8
- export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
9
9
 
10
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
11
11
 
12
- /**
12
+ /**
13
13
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
14
  * @summary Finds Pets by tags
15
15
  * {@link /pet/findByTags}
16
16
  */
17
- async function findPetsByTags({ headers, params }: {
18
- headers: FindPetsByTagsHeaderParams;
19
- params?: FindPetsByTagsQueryParams;
20
- }, config: Partial<RequestConfig> = {}) {
21
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
22
- return findPetsByTagsQueryResponse.parse(res.data);
17
+ async function findPetsByTags(
18
+ { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
19
+ config: Partial<RequestConfig> = {},
20
+ ) {
21
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
22
+ method: 'GET',
23
+ url: `/pet/findByTags`,
24
+ params,
25
+ headers: { ...headers, ...config.headers },
26
+ ...config,
27
+ })
28
+ return findPetsByTagsQueryResponse.parse(res.data)
23
29
  }
24
30
 
25
- export function findPetsByTagsQueryOptions({ headers, params }: {
26
- headers: MaybeRef<FindPetsByTagsQueryParams>;
27
- params?: MaybeRef<FindPetsByTagsQueryParams>;
28
- }, config: Partial<RequestConfig> = {}) {
29
- const queryKey = findPetsByTagsQueryKey(params);
30
- return queryOptions({
31
- queryKey,
32
- queryFn: async ({ signal }) => {
33
- config.signal = signal;
34
- return findPetsByTags(unref({ headers: unref(headers), params: unref(params) }), unref(config));
35
- },
36
- });
31
+ export function findPetsByTagsQueryOptions(
32
+ { headers, params }: { headers: MaybeRef<FindPetsByTagsQueryParams>; params?: MaybeRef<FindPetsByTagsQueryParams> },
33
+ config: Partial<RequestConfig> = {},
34
+ ) {
35
+ const queryKey = findPetsByTagsQueryKey(params)
36
+ return queryOptions({
37
+ queryKey,
38
+ queryFn: async ({ signal }) => {
39
+ config.signal = signal
40
+ return findPetsByTags(unref({ headers: unref(headers), params: unref(params) }), unref(config))
41
+ },
42
+ })
37
43
  }
38
44
 
39
- /**
45
+ /**
40
46
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
41
47
  * @summary Finds Pets by tags
42
48
  * {@link /pet/findByTags}
43
49
  */
44
- export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>({ headers, params }: {
45
- headers: MaybeRef<FindPetsByTagsHeaderParams>;
46
- params?: MaybeRef<FindPetsByTagsQueryParams>;
47
- }, options: {
48
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
49
- client?: Partial<RequestConfig>;
50
- } = {}) {
51
- const { query: queryOptions, client: config = {} } = options ?? {};
52
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
53
- const query = useQuery({
54
- ...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions,
55
- queryKey: queryKey as QueryKey,
56
- ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
57
- }) as UseQueryReturnType<TData, FindPetsByTags400> & {
58
- queryKey: TQueryKey;
59
- };
60
- query.queryKey = queryKey as TQueryKey;
61
- return query;
50
+ export function useFindPetsByTags<
51
+ TData = FindPetsByTagsQueryResponse,
52
+ TQueryData = FindPetsByTagsQueryResponse,
53
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
54
+ >(
55
+ { headers, params }: { headers: MaybeRef<FindPetsByTagsHeaderParams>; params?: MaybeRef<FindPetsByTagsQueryParams> },
56
+ options: {
57
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
58
+ client?: Partial<RequestConfig>
59
+ } = {},
60
+ ) {
61
+ const { query: queryOptions, client: config = {} } = options ?? {}
62
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
63
+
64
+ const query = useQuery({
65
+ ...(findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions),
66
+ queryKey: queryKey as QueryKey,
67
+ ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
68
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
69
+
70
+ query.queryKey = queryKey as TQueryKey
71
+
72
+ return query
62
73
  }