@kubb/plugin-vue-query 3.0.0-alpha.20

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 (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -0
  3. package/dist/chunk-3HD4DCDR.js +505 -0
  4. package/dist/chunk-3HD4DCDR.js.map +1 -0
  5. package/dist/chunk-4YY5DUPV.cjs +514 -0
  6. package/dist/chunk-4YY5DUPV.cjs.map +1 -0
  7. package/dist/chunk-BKYBSBUA.js +567 -0
  8. package/dist/chunk-BKYBSBUA.js.map +1 -0
  9. package/dist/chunk-FRKJLBA5.cjs +576 -0
  10. package/dist/chunk-FRKJLBA5.cjs.map +1 -0
  11. package/dist/components.cjs +32 -0
  12. package/dist/components.cjs.map +1 -0
  13. package/dist/components.d.cts +121 -0
  14. package/dist/components.d.ts +121 -0
  15. package/dist/components.js +3 -0
  16. package/dist/components.js.map +1 -0
  17. package/dist/generators.cjs +21 -0
  18. package/dist/generators.cjs.map +1 -0
  19. package/dist/generators.d.cts +12 -0
  20. package/dist/generators.d.ts +12 -0
  21. package/dist/generators.js +4 -0
  22. package/dist/generators.js.map +1 -0
  23. package/dist/index.cjs +138 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +9 -0
  26. package/dist/index.d.ts +9 -0
  27. package/dist/index.js +131 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/types-CmetQDTc.d.cts +173 -0
  30. package/dist/types-CmetQDTc.d.ts +173 -0
  31. package/package.json +102 -0
  32. package/src/components/InfiniteQuery.tsx +137 -0
  33. package/src/components/InfiniteQueryOptions.tsx +129 -0
  34. package/src/components/Mutation.tsx +141 -0
  35. package/src/components/Query.tsx +128 -0
  36. package/src/components/QueryKey.tsx +81 -0
  37. package/src/components/QueryOptions.tsx +88 -0
  38. package/src/components/index.ts +6 -0
  39. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +52 -0
  40. package/src/generators/__snapshots__/clientGetImportPath.ts +52 -0
  41. package/src/generators/__snapshots__/clientPostImportPath.ts +38 -0
  42. package/src/generators/__snapshots__/findByTags.ts +52 -0
  43. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +52 -0
  44. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +52 -0
  45. package/src/generators/__snapshots__/findByTagsWithZod.ts +52 -0
  46. package/src/generators/__snapshots__/findInfiniteByTags.ts +57 -0
  47. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +57 -0
  48. package/src/generators/__snapshots__/postAsQuery.ts +50 -0
  49. package/src/generators/__snapshots__/updatePetById.ts +38 -0
  50. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +40 -0
  51. package/src/generators/index.ts +3 -0
  52. package/src/generators/infiniteQueryGenerator.tsx +131 -0
  53. package/src/generators/mutationGenerator.tsx +96 -0
  54. package/src/generators/queryGenerator.tsx +124 -0
  55. package/src/index.ts +2 -0
  56. package/src/plugin.ts +152 -0
  57. package/src/types.ts +179 -0
@@ -0,0 +1,6 @@
1
+ export { Mutation } from './Mutation.tsx'
2
+ export { Query } from './Query.tsx'
3
+ export { QueryKey } from './QueryKey.tsx'
4
+ export { QueryOptions } from './QueryOptions.tsx'
5
+ export { InfiniteQueryOptions } from './InfiniteQueryOptions.tsx'
6
+ export { InfiniteQuery } from './InfiniteQuery.tsx'
@@ -0,0 +1,52 @@
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 { useQuery, queryOptions } from "@tanstack/react-query";
6
+ import { unref } from "vue";
7
+
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
9
+
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
11
+
12
+ /**
13
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
+ * @summary Finds Pets by tags
15
+ * @link /pet/findByTags
16
+ */
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) };
20
+ }
21
+
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 () => {
27
+ return findPetsByTags(unref(headers), unref(params), unref(config));
28
+ },
29
+ });
30
+ }
31
+
32
+ /**
33
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
34
+ * @summary Finds Pets by tags
35
+ * @link /pet/findByTags
36
+ */
37
+ export function useFindPetsByTags<TData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
38
+ query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
39
+ client?: Partial<RequestConfig>;
40
+ } = {}) {
41
+ const { query: queryOptions, client: config = {} } = options ?? {};
42
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
43
+ const query = useQuery({
44
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
45
+ queryKey,
46
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
47
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & {
48
+ queryKey: TQueryKey;
49
+ };
50
+ query.queryKey = queryKey as TQueryKey;
51
+ return query;
52
+ }
@@ -0,0 +1,52 @@
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 { useQuery, queryOptions } from "@tanstack/react-query";
6
+ import { unref } from "vue";
7
+
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
9
+
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
11
+
12
+ /**
13
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
+ * @summary Finds Pets by tags
15
+ * @link /pet/findByTags
16
+ */
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);
20
+ }
21
+
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 () => {
27
+ return findPetsByTags(unref(headers), unref(params), unref(config));
28
+ },
29
+ });
30
+ }
31
+
32
+ /**
33
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
34
+ * @summary Finds Pets by tags
35
+ * @link /pet/findByTags
36
+ */
37
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
38
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
39
+ client?: Partial<RequestConfig>;
40
+ } = {}) {
41
+ const { query: queryOptions, client: config = {} } = options ?? {};
42
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
43
+ const query = useQuery({
44
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
45
+ queryKey,
46
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
47
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & {
48
+ queryKey: TQueryKey;
49
+ };
50
+ query.queryKey = queryKey as TQueryKey;
51
+ return query;
52
+ }
@@ -0,0 +1,38 @@
1
+ import client from "axios";
2
+ import type { UseMutationOptions } from "@tanstack/react-query";
3
+ import type { RequestConfig } from "axios";
4
+ import { useMutation } from "@tanstack/react-query";
5
+
6
+ /**
7
+ * @summary Updates a pet in the store with form data
8
+ * @link /pet/:petId
9
+ */
10
+ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
11
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "post", url: `/pet/${petId}`, params, data, ...config });
12
+ return updatePetWithFormMutationResponse.parse(res.data);
13
+ }
14
+
15
+ /**
16
+ * @summary Updates a pet in the store with form data
17
+ * @link /pet/:petId
18
+ */
19
+ export function useUpdatePetWithForm(options: {
20
+ mutation?: UseMutationOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
21
+ petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>;
22
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>;
23
+ params?: MaybeRef<UpdatePetWithFormQueryParams>;
24
+ }>;
25
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
26
+ } = {}) {
27
+ const { mutation: mutationOptions, client: config = {} } = options ?? {};
28
+ return useMutation({
29
+ mutationFn: async ({ petId, data, params }: {
30
+ petId: UpdatePetWithFormPathParams["petId"];
31
+ data?: UpdatePetWithFormMutationRequest;
32
+ params?: UpdatePetWithFormQueryParams;
33
+ }) => {
34
+ return updatePetWithForm(petId, data, params, config);
35
+ },
36
+ ...mutationOptions
37
+ });
38
+ }
@@ -0,0 +1,52 @@
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 { useQuery, queryOptions } from "@tanstack/react-query";
6
+ import { unref } from "vue";
7
+
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
9
+
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
11
+
12
+ /**
13
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
+ * @summary Finds Pets by tags
15
+ * @link /pet/findByTags
16
+ */
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);
20
+ }
21
+
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 () => {
27
+ return findPetsByTags(unref(headers), unref(params), unref(config));
28
+ },
29
+ });
30
+ }
31
+
32
+ /**
33
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
34
+ * @summary Finds Pets by tags
35
+ * @link /pet/findByTags
36
+ */
37
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
38
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
39
+ client?: Partial<RequestConfig>;
40
+ } = {}) {
41
+ const { query: queryOptions, client: config = {} } = options ?? {};
42
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
43
+ const query = useQuery({
44
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
45
+ queryKey,
46
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
47
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & {
48
+ queryKey: TQueryKey;
49
+ };
50
+ query.queryKey = queryKey as TQueryKey;
51
+ return query;
52
+ }
@@ -0,0 +1,52 @@
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 { useQuery, queryOptions } from "@tanstack/react-query";
6
+ import { unref } from "vue";
7
+
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
9
+
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
11
+
12
+ /**
13
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
+ * @summary Finds Pets by tags
15
+ * @link /pet/findByTags
16
+ */
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);
20
+ }
21
+
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 () => {
27
+ return findPetsByTags(unref(headers), unref(params), unref(config));
28
+ },
29
+ });
30
+ }
31
+
32
+ /**
33
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
34
+ * @summary Finds Pets by tags
35
+ * @link /pet/findByTags
36
+ */
37
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
38
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
39
+ client?: Partial<RequestConfig>;
40
+ } = {}) {
41
+ const { query: queryOptions, client: config = {} } = options ?? {};
42
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
43
+ const query = useQuery({
44
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
45
+ queryKey,
46
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
47
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & {
48
+ queryKey: TQueryKey;
49
+ };
50
+ query.queryKey = queryKey as TQueryKey;
51
+ return query;
52
+ }
@@ -0,0 +1,52 @@
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 { useQuery, queryOptions } from "@tanstack/react-query";
6
+ import { unref } from "vue";
7
+
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [test, { url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
9
+
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
11
+
12
+ /**
13
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
+ * @summary Finds Pets by tags
15
+ * @link /pet/findByTags
16
+ */
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);
20
+ }
21
+
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 () => {
27
+ return findPetsByTags(unref(headers), unref(params), unref(config));
28
+ },
29
+ });
30
+ }
31
+
32
+ /**
33
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
34
+ * @summary Finds Pets by tags
35
+ * @link /pet/findByTags
36
+ */
37
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
38
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
39
+ client?: Partial<RequestConfig>;
40
+ } = {}) {
41
+ const { query: queryOptions, client: config = {} } = options ?? {};
42
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
43
+ const query = useQuery({
44
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
45
+ queryKey,
46
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
47
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & {
48
+ queryKey: TQueryKey;
49
+ };
50
+ query.queryKey = queryKey as TQueryKey;
51
+ return query;
52
+ }
@@ -0,0 +1,52 @@
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 { useQuery, queryOptions } from "@tanstack/react-query";
6
+ import { unref } from "vue";
7
+
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
9
+
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
11
+
12
+ /**
13
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
+ * @summary Finds Pets by tags
15
+ * @link /pet/findByTags
16
+ */
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);
20
+ }
21
+
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 () => {
27
+ return findPetsByTags(unref(headers), unref(params), unref(config));
28
+ },
29
+ });
30
+ }
31
+
32
+ /**
33
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
34
+ * @summary Finds Pets by tags
35
+ * @link /pet/findByTags
36
+ */
37
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
38
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
39
+ client?: Partial<RequestConfig>;
40
+ } = {}) {
41
+ const { query: queryOptions, client: config = {} } = options ?? {};
42
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
43
+ const query = useQuery({
44
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
45
+ queryKey,
46
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
47
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & {
48
+ queryKey: TQueryKey;
49
+ };
50
+ query.queryKey = queryKey as TQueryKey;
51
+ return query;
52
+ }
@@ -0,0 +1,57 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from "@tanstack/react-query";
4
+ import type { MaybeRef } from "vue";
5
+ import { useInfiniteQuery, infiniteQueryOptions } from "@tanstack/react-query";
6
+
7
+ export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
8
+
9
+ export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>;
10
+
11
+ /**
12
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
13
+ * @summary Finds Pets by tags
14
+ * @link /pet/findByTags
15
+ */
16
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
18
+ return findPetsByTagsQueryResponse.parse(res.data);
19
+ }
20
+
21
+ export function findPetsByTagsInfiniteQueryOptions(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, config: Partial<RequestConfig> = {}) {
22
+ const queryKey = findPetsByTagsInfiniteQueryKey(params);
23
+ return infiniteQueryOptions({
24
+ queryKey,
25
+ queryFn: async ({ pageParam }) => {
26
+ if (params) {
27
+ params["pageSize"] = pageParam as unknown as FindPetsByTagsQueryParams["pageSize"];
28
+ }
29
+ return findPetsByTags(headers, params, config);
30
+ },
31
+ initialPageParam: 0,
32
+ getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1,
33
+ getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1
34
+ });
35
+ }
36
+
37
+ /**
38
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
39
+ * @summary Finds Pets by tags
40
+ * @link /pet/findByTags
41
+ */
42
+ export function useFindPetsByTagsInfinite<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
43
+ query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
44
+ client?: Partial<RequestConfig>;
45
+ } = {}) {
46
+ const { query: queryOptions, client: config = {} } = options ?? {};
47
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params);
48
+ const query = useInfiniteQuery({
49
+ ...findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions,
50
+ queryKey,
51
+ ...queryOptions as unknown as Omit<InfiniteQueryObserverOptions, "queryKey">
52
+ }) as UseInfiniteQueryReturnType<TData, FindPetsByTags400> & {
53
+ queryKey: TQueryKey;
54
+ };
55
+ query.queryKey = queryKey as TQueryKey;
56
+ return query;
57
+ }
@@ -0,0 +1,57 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from "@tanstack/react-query";
4
+ import type { MaybeRef } from "vue";
5
+ import { useInfiniteQuery, infiniteQueryOptions } from "@tanstack/react-query";
6
+
7
+ export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
8
+
9
+ export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>;
10
+
11
+ /**
12
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
13
+ * @summary Finds Pets by tags
14
+ * @link /pet/findByTags
15
+ */
16
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
18
+ return findPetsByTagsQueryResponse.parse(res.data);
19
+ }
20
+
21
+ export function findPetsByTagsInfiniteQueryOptions(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, config: Partial<RequestConfig> = {}) {
22
+ const queryKey = findPetsByTagsInfiniteQueryKey(params);
23
+ return infiniteQueryOptions({
24
+ queryKey,
25
+ queryFn: async ({ pageParam }) => {
26
+ if (params) {
27
+ params["pageSize"] = pageParam as unknown as FindPetsByTagsQueryParams["pageSize"];
28
+ }
29
+ return findPetsByTags(headers, params, config);
30
+ },
31
+ initialPageParam: 0,
32
+ getNextPageParam: (lastPage) => lastPage["cursor"],
33
+ getPreviousPageParam: (firstPage) => firstPage["cursor"]
34
+ });
35
+ }
36
+
37
+ /**
38
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
39
+ * @summary Finds Pets by tags
40
+ * @link /pet/findByTags
41
+ */
42
+ export function useFindPetsByTagsInfinite<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
43
+ query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
44
+ client?: Partial<RequestConfig>;
45
+ } = {}) {
46
+ const { query: queryOptions, client: config = {} } = options ?? {};
47
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params);
48
+ const query = useInfiniteQuery({
49
+ ...findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions,
50
+ queryKey,
51
+ ...queryOptions as unknown as Omit<InfiniteQueryObserverOptions, "queryKey">
52
+ }) as UseInfiniteQueryReturnType<TData, FindPetsByTags400> & {
53
+ queryKey: TQueryKey;
54
+ };
55
+ query.queryKey = queryKey as TQueryKey;
56
+ return query;
57
+ }
@@ -0,0 +1,50 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "custom-query";
4
+ import type { MaybeRef } from "vue";
5
+ import { useQuery, queryOptions } from "custom-query";
6
+ import { unref } from "vue";
7
+
8
+ export const updatePetWithFormQueryKey = (petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>, data?: MaybeRef<UpdatePetWithFormMutationRequest>, params?: MaybeRef<UpdatePetWithFormQueryParams>) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const;
9
+
10
+ export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>;
11
+
12
+ /**
13
+ * @summary Updates a pet in the store with form data
14
+ * @link /pet/:petId
15
+ */
16
+ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
17
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "post", url: `/pet/${petId}`, params, data, ...config });
18
+ return updatePetWithFormMutationResponse.parse(res.data);
19
+ }
20
+
21
+ export function updatePetWithFormQueryOptions(petId: UpdatePetWithFormPathParams["petId"], data?: MaybeRef<UpdatePetWithFormMutationRequest>, params?: MaybeRef<UpdatePetWithFormQueryParams>, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
22
+ const queryKey = updatePetWithFormQueryKey(petId, data, params);
23
+ return queryOptions({
24
+ queryKey,
25
+ queryFn: async () => {
26
+ return updatePetWithForm(unref(petId), unref(data), unref(params), unref(config));
27
+ },
28
+ });
29
+ }
30
+
31
+ /**
32
+ * @summary Updates a pet in the store with form data
33
+ * @link /pet/:petId
34
+ */
35
+ export function useUpdatePetWithForm<TData = UpdatePetWithFormMutationResponse, TQueryData = UpdatePetWithFormMutationResponse, TQueryKey extends QueryKey = UpdatePetWithFormQueryKey>(petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>, data?: MaybeRef<UpdatePetWithFormMutationRequest>, params?: MaybeRef<UpdatePetWithFormQueryParams>, options: {
36
+ query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, TData, TQueryData, TQueryKey>>;
37
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
38
+ } = {}) {
39
+ const { query: queryOptions, client: config = {} } = options ?? {};
40
+ const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params);
41
+ const query = useQuery({
42
+ ...updatePetWithFormQueryOptions(petId, data, params, config) as unknown as QueryObserverOptions,
43
+ queryKey,
44
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
45
+ }) as UseQueryReturnType<TData, UpdatePetWithForm405> & {
46
+ queryKey: TQueryKey;
47
+ };
48
+ query.queryKey = queryKey as TQueryKey;
49
+ return query;
50
+ }
@@ -0,0 +1,38 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { UseMutationOptions } from "@tanstack/react-query";
4
+ import { useMutation } from "@tanstack/react-query";
5
+
6
+ /**
7
+ * @summary Updates a pet in the store with form data
8
+ * @link /pet/:petId
9
+ */
10
+ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
11
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "post", url: `/pet/${petId}`, params, data, ...config });
12
+ return updatePetWithFormMutationResponse.parse(res.data);
13
+ }
14
+
15
+ /**
16
+ * @summary Updates a pet in the store with form data
17
+ * @link /pet/:petId
18
+ */
19
+ export function useUpdatePetWithForm(options: {
20
+ mutation?: UseMutationOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
21
+ petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>;
22
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>;
23
+ params?: MaybeRef<UpdatePetWithFormQueryParams>;
24
+ }>;
25
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
26
+ } = {}) {
27
+ const { mutation: mutationOptions, client: config = {} } = options ?? {};
28
+ return useMutation({
29
+ mutationFn: async ({ petId, data, params }: {
30
+ petId: UpdatePetWithFormPathParams["petId"];
31
+ data?: UpdatePetWithFormMutationRequest;
32
+ params?: UpdatePetWithFormQueryParams;
33
+ }) => {
34
+ return updatePetWithForm(petId, data, params, config);
35
+ },
36
+ ...mutationOptions
37
+ });
38
+ }
@@ -0,0 +1,40 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { UseMutationOptions } from "@tanstack/react-query";
4
+ import { useMutation } from "@tanstack/react-query";
5
+
6
+ /**
7
+ * @summary Updates a pet in the store with form data
8
+ * @link /pet/:petId
9
+ */
10
+ async function updatePetWithForm({ petId }: {
11
+ petId: UpdatePetWithFormPathParams["petId"];
12
+ }, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
13
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "post", url: `/pet/${petId}`, params, data, ...config });
14
+ return updatePetWithFormMutationResponse.parse(res.data);
15
+ }
16
+
17
+ /**
18
+ * @summary Updates a pet in the store with form data
19
+ * @link /pet/:petId
20
+ */
21
+ export function useUpdatePetWithForm(options: {
22
+ mutation?: UseMutationOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
23
+ petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>;
24
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>;
25
+ params?: MaybeRef<UpdatePetWithFormQueryParams>;
26
+ }>;
27
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
28
+ } = {}) {
29
+ const { mutation: mutationOptions, client: config = {} } = options ?? {};
30
+ return useMutation({
31
+ mutationFn: async ({ petId, data, params }: {
32
+ petId: UpdatePetWithFormPathParams["petId"];
33
+ data?: UpdatePetWithFormMutationRequest;
34
+ params?: UpdatePetWithFormQueryParams;
35
+ }) => {
36
+ return updatePetWithForm({ petId }, data, params, config);
37
+ },
38
+ ...mutationOptions
39
+ });
40
+ }
@@ -0,0 +1,3 @@
1
+ export { queryGenerator } from './queryGenerator.tsx'
2
+ export { mutationGenerator } from './mutationGenerator.tsx'
3
+ export { infiniteQueryGenerator } from './infiniteQueryGenerator.tsx'