@kubb/plugin-react-query 3.0.0-alpha.2 → 3.0.0-alpha.21

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 (80) hide show
  1. package/README.md +13 -4
  2. package/dist/chunk-ESENIDWJ.js +608 -0
  3. package/dist/chunk-ESENIDWJ.js.map +1 -0
  4. package/dist/chunk-HAC4WPCC.js +608 -0
  5. package/dist/chunk-HAC4WPCC.js.map +1 -0
  6. package/dist/chunk-JQEH3UHY.cjs +618 -0
  7. package/dist/chunk-JQEH3UHY.cjs.map +1 -0
  8. package/dist/chunk-JYBGTT23.cjs +618 -0
  9. package/dist/chunk-JYBGTT23.cjs.map +1 -0
  10. package/dist/components.cjs +35 -14
  11. package/dist/components.cjs.map +1 -1
  12. package/dist/components.d.cts +143 -7
  13. package/dist/components.d.ts +143 -7
  14. package/dist/components.js +2 -14
  15. package/dist/components.js.map +1 -1
  16. package/dist/generators.cjs +25 -0
  17. package/dist/generators.cjs.map +1 -0
  18. package/dist/generators.d.cts +14 -0
  19. package/dist/generators.d.ts +14 -0
  20. package/dist/generators.js +4 -0
  21. package/dist/generators.js.map +1 -0
  22. package/dist/index.cjs +77 -154
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +1 -5
  25. package/dist/index.d.ts +1 -5
  26. package/dist/index.js +56 -140
  27. package/dist/index.js.map +1 -1
  28. package/dist/types-DFHc63S9.d.cts +179 -0
  29. package/dist/types-DFHc63S9.d.ts +179 -0
  30. package/package.json +22 -17
  31. package/src/components/InfiniteQuery.tsx +129 -0
  32. package/src/components/InfiniteQueryOptions.tsx +121 -0
  33. package/src/components/Mutation.tsx +113 -321
  34. package/src/components/Query.tsx +91 -598
  35. package/src/components/QueryKey.tsx +51 -178
  36. package/src/components/QueryOptions.tsx +65 -468
  37. package/src/components/SuspenseQuery.tsx +129 -0
  38. package/src/components/index.ts +3 -1
  39. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +50 -0
  40. package/src/generators/__snapshots__/clientGetImportPath.ts +50 -0
  41. package/src/generators/__snapshots__/clientPostImportPath.ts +38 -0
  42. package/src/generators/__snapshots__/findByTags.ts +50 -0
  43. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +50 -0
  44. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +50 -0
  45. package/src/generators/__snapshots__/findByTagsWithZod.ts +50 -0
  46. package/src/generators/__snapshots__/findInfiniteByTags.ts +56 -0
  47. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +56 -0
  48. package/src/generators/__snapshots__/getAsMutation.ts +31 -0
  49. package/src/generators/__snapshots__/postAsQuery.ts +48 -0
  50. package/src/generators/__snapshots__/updatePetById.ts +38 -0
  51. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +40 -0
  52. package/src/generators/index.ts +4 -0
  53. package/src/generators/infiniteQueryGenerator.tsx +125 -0
  54. package/src/generators/mutationGenerator.tsx +96 -0
  55. package/src/generators/queryGenerator.tsx +122 -0
  56. package/src/generators/suspenseQueryGenerator.tsx +121 -0
  57. package/src/plugin.ts +51 -73
  58. package/src/types.ts +43 -91
  59. package/dist/chunk-5IL6M74X.js +0 -1504
  60. package/dist/chunk-5IL6M74X.js.map +0 -1
  61. package/dist/chunk-JFX7DCS7.cjs +0 -1504
  62. package/dist/chunk-JFX7DCS7.cjs.map +0 -1
  63. package/dist/index-C9fwRDH7.d.cts +0 -579
  64. package/dist/index-C9fwRDH7.d.ts +0 -579
  65. package/src/OperationGenerator.tsx +0 -86
  66. package/src/__snapshots__/mutateAsQuery/updatePetWithForm.ts +0 -64
  67. package/src/__snapshots__/pathParamsTypeInline/getPetById.ts +0 -57
  68. package/src/__snapshots__/pathParamsTypeObject/getPetById.ts +0 -63
  69. package/src/__snapshots__/queryOptions/getPetById.ts +0 -37
  70. package/src/__snapshots__/queryWithoutQueryOptions/getPetById.ts +0 -47
  71. package/src/__snapshots__/upload/UploadFile.ts +0 -67
  72. package/src/__snapshots__/uploadMutation/UploadFile.ts +0 -44
  73. package/src/__snapshots__/variablesTypeMutate/deletePet.ts +0 -21
  74. package/src/components/Operations.tsx +0 -74
  75. package/src/components/QueryImports.tsx +0 -167
  76. package/src/components/SchemaType.tsx +0 -55
  77. package/src/components/__snapshots__/gen/showPetById.ts +0 -57
  78. package/src/components/__snapshots__/gen/useCreatePets.ts +0 -46
  79. package/src/components/__snapshots__/gen/useCreatePetsMutate.ts +0 -47
  80. package/src/utils.ts +0 -96
@@ -0,0 +1,50 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
4
+ import { useQuery, queryOptions } from "@tanstack/react-query";
5
+
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
+
10
+ /**
11
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
+ * @summary Finds Pets by tags
13
+ * @link /pet/findByTags
14
+ */
15
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
+ return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) };
18
+ }
19
+
20
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
+ const queryKey = findPetsByTagsQueryKey(params);
22
+ return queryOptions({
23
+ queryKey,
24
+ queryFn: async () => {
25
+ return findPetsByTags(headers, params, config);
26
+ },
27
+ });
28
+ }
29
+
30
+ /**
31
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
32
+ * @summary Finds Pets by tags
33
+ * @link /pet/findByTags
34
+ */
35
+ export function useFindPetsByTags<TData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
36
+ query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
37
+ client?: Partial<RequestConfig>;
38
+ } = {}) {
39
+ const { query: queryOptions, client: config = {} } = options ?? {};
40
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
41
+ const query = useQuery({
42
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
43
+ queryKey,
44
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
45
+ }) as UseQueryResult<TData, FindPetsByTags400> & {
46
+ queryKey: TQueryKey;
47
+ };
48
+ query.queryKey = queryKey as TQueryKey;
49
+ return query;
50
+ }
@@ -0,0 +1,50 @@
1
+ import client from "axios";
2
+ import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
3
+ import type { RequestConfig } from "axios";
4
+ import { useQuery, queryOptions } from "@tanstack/react-query";
5
+
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
+
10
+ /**
11
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
+ * @summary Finds Pets by tags
13
+ * @link /pet/findByTags
14
+ */
15
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
+ return findPetsByTagsQueryResponse.parse(res.data);
18
+ }
19
+
20
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
+ const queryKey = findPetsByTagsQueryKey(params);
22
+ return queryOptions({
23
+ queryKey,
24
+ queryFn: async () => {
25
+ return findPetsByTags(headers, params, config);
26
+ },
27
+ });
28
+ }
29
+
30
+ /**
31
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
32
+ * @summary Finds Pets by tags
33
+ * @link /pet/findByTags
34
+ */
35
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
36
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
37
+ client?: Partial<RequestConfig>;
38
+ } = {}) {
39
+ const { query: queryOptions, client: config = {} } = options ?? {};
40
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
41
+ const query = useQuery({
42
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
43
+ queryKey,
44
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
45
+ }) as UseQueryResult<TData, FindPetsByTags400> & {
46
+ queryKey: TQueryKey;
47
+ };
48
+ query.queryKey = queryKey as TQueryKey;
49
+ return query;
50
+ }
@@ -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: UpdatePetWithFormPathParams["petId"];
22
+ data?: UpdatePetWithFormMutationRequest;
23
+ params?: 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,50 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query";
4
+ import { useQuery, queryOptions } from "@tanstack/react-query";
5
+
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
+
10
+ /**
11
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
+ * @summary Finds Pets by tags
13
+ * @link /pet/findByTags
14
+ */
15
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
+ return findPetsByTagsQueryResponse.parse(res.data);
18
+ }
19
+
20
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
+ const queryKey = findPetsByTagsQueryKey(params);
22
+ return queryOptions({
23
+ queryKey,
24
+ queryFn: async () => {
25
+ return findPetsByTags(headers, params, config);
26
+ },
27
+ });
28
+ }
29
+
30
+ /**
31
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
32
+ * @summary Finds Pets by tags
33
+ * @link /pet/findByTags
34
+ */
35
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
36
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
37
+ client?: Partial<RequestConfig>;
38
+ } = {}) {
39
+ const { query: queryOptions, client: config = {} } = options ?? {};
40
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
41
+ const query = useQuery({
42
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
43
+ queryKey,
44
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
45
+ }) as UseQueryResult<TData, FindPetsByTags400> & {
46
+ queryKey: TQueryKey;
47
+ };
48
+ query.queryKey = queryKey as TQueryKey;
49
+ return query;
50
+ }
@@ -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, UseQueryResult } from "@tanstack/react-query";
4
+ import { useQuery, queryOptions } from "@tanstack/react-query";
5
+
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
+
10
+ /**
11
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
+ * @summary Finds Pets by tags
13
+ * @link /pet/findByTags
14
+ */
15
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
+ return findPetsByTagsQueryResponse.parse(res.data);
18
+ }
19
+
20
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
+ const queryKey = findPetsByTagsQueryKey(params);
22
+ return queryOptions({
23
+ queryKey,
24
+ queryFn: async () => {
25
+ return findPetsByTags(headers, params, config);
26
+ },
27
+ });
28
+ }
29
+
30
+ /**
31
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
32
+ * @summary Finds Pets by tags
33
+ * @link /pet/findByTags
34
+ */
35
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
36
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
37
+ client?: Partial<RequestConfig>;
38
+ } = {}) {
39
+ const { query: queryOptions, client: config = {} } = options ?? {};
40
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
41
+ const query = useQuery({
42
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
43
+ queryKey,
44
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
45
+ }) as UseQueryResult<TData, FindPetsByTags400> & {
46
+ queryKey: TQueryKey;
47
+ };
48
+ query.queryKey = queryKey as TQueryKey;
49
+ return query;
50
+ }
@@ -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, UseQueryResult } from "@tanstack/react-query";
4
+ import { useQuery, queryOptions } from "@tanstack/react-query";
5
+
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [test, { url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
+
10
+ /**
11
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
+ * @summary Finds Pets by tags
13
+ * @link /pet/findByTags
14
+ */
15
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
+ return findPetsByTagsQueryResponse.parse(res.data);
18
+ }
19
+
20
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
+ const queryKey = findPetsByTagsQueryKey(params);
22
+ return queryOptions({
23
+ queryKey,
24
+ queryFn: async () => {
25
+ return findPetsByTags(headers, params, config);
26
+ },
27
+ });
28
+ }
29
+
30
+ /**
31
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
32
+ * @summary Finds Pets by tags
33
+ * @link /pet/findByTags
34
+ */
35
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
36
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
37
+ client?: Partial<RequestConfig>;
38
+ } = {}) {
39
+ const { query: queryOptions, client: config = {} } = options ?? {};
40
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
41
+ const query = useQuery({
42
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
43
+ queryKey,
44
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
45
+ }) as UseQueryResult<TData, FindPetsByTags400> & {
46
+ queryKey: TQueryKey;
47
+ };
48
+ query.queryKey = queryKey as TQueryKey;
49
+ return query;
50
+ }
@@ -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, UseQueryResult } from "@tanstack/react-query";
4
+ import { useQuery, queryOptions } from "@tanstack/react-query";
5
+
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
+
10
+ /**
11
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
+ * @summary Finds Pets by tags
13
+ * @link /pet/findByTags
14
+ */
15
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
+ return findPetsByTagsQueryResponse.parse(res.data);
18
+ }
19
+
20
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
+ const queryKey = findPetsByTagsQueryKey(params);
22
+ return queryOptions({
23
+ queryKey,
24
+ queryFn: async () => {
25
+ return findPetsByTags(headers, params, config);
26
+ },
27
+ });
28
+ }
29
+
30
+ /**
31
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
32
+ * @summary Finds Pets by tags
33
+ * @link /pet/findByTags
34
+ */
35
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
36
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
37
+ client?: Partial<RequestConfig>;
38
+ } = {}) {
39
+ const { query: queryOptions, client: config = {} } = options ?? {};
40
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
41
+ const query = useQuery({
42
+ ...findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions,
43
+ queryKey,
44
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
45
+ }) as UseQueryResult<TData, FindPetsByTags400> & {
46
+ queryKey: TQueryKey;
47
+ };
48
+ query.queryKey = queryKey as TQueryKey;
49
+ return query;
50
+ }
@@ -0,0 +1,56 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from "@tanstack/react-query";
4
+ import { useInfiniteQuery, infiniteQueryOptions } from "@tanstack/react-query";
5
+
6
+ export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+
8
+ export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>;
9
+
10
+ /**
11
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
+ * @summary Finds Pets by tags
13
+ * @link /pet/findByTags
14
+ */
15
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
+ return findPetsByTagsQueryResponse.parse(res.data);
18
+ }
19
+
20
+ export function findPetsByTagsInfiniteQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
+ const queryKey = findPetsByTagsInfiniteQueryKey(params);
22
+ return infiniteQueryOptions({
23
+ queryKey,
24
+ queryFn: async ({ pageParam }) => {
25
+ if (params) {
26
+ params["pageSize"] = pageParam as unknown as FindPetsByTagsQueryParams["pageSize"];
27
+ }
28
+ return findPetsByTags(headers, params, config);
29
+ },
30
+ initialPageParam: 0,
31
+ getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1,
32
+ getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1
33
+ });
34
+ }
35
+
36
+ /**
37
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
38
+ * @summary Finds Pets by tags
39
+ * @link /pet/findByTags
40
+ */
41
+ export function useFindPetsByTagsInfinite<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
42
+ query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
43
+ client?: Partial<RequestConfig>;
44
+ } = {}) {
45
+ const { query: queryOptions, client: config = {} } = options ?? {};
46
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params);
47
+ const query = useInfiniteQuery({
48
+ ...findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions,
49
+ queryKey,
50
+ ...queryOptions as unknown as Omit<InfiniteQueryObserverOptions, "queryKey">
51
+ }) as UseInfiniteQueryResult<TData, FindPetsByTags400> & {
52
+ queryKey: TQueryKey;
53
+ };
54
+ query.queryKey = queryKey as TQueryKey;
55
+ return query;
56
+ }
@@ -0,0 +1,56 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from "@tanstack/react-query";
4
+ import { useInfiniteQuery, infiniteQueryOptions } from "@tanstack/react-query";
5
+
6
+ export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+
8
+ export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>;
9
+
10
+ /**
11
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
+ * @summary Finds Pets by tags
13
+ * @link /pet/findByTags
14
+ */
15
+ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
+ return findPetsByTagsQueryResponse.parse(res.data);
18
+ }
19
+
20
+ export function findPetsByTagsInfiniteQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
+ const queryKey = findPetsByTagsInfiniteQueryKey(params);
22
+ return infiniteQueryOptions({
23
+ queryKey,
24
+ queryFn: async ({ pageParam }) => {
25
+ if (params) {
26
+ params["pageSize"] = pageParam as unknown as FindPetsByTagsQueryParams["pageSize"];
27
+ }
28
+ return findPetsByTags(headers, params, config);
29
+ },
30
+ initialPageParam: 0,
31
+ getNextPageParam: (lastPage) => lastPage["cursor"],
32
+ getPreviousPageParam: (firstPage) => firstPage["cursor"]
33
+ });
34
+ }
35
+
36
+ /**
37
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
38
+ * @summary Finds Pets by tags
39
+ * @link /pet/findByTags
40
+ */
41
+ export function useFindPetsByTagsInfinite<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
42
+ query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
43
+ client?: Partial<RequestConfig>;
44
+ } = {}) {
45
+ const { query: queryOptions, client: config = {} } = options ?? {};
46
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params);
47
+ const query = useInfiniteQuery({
48
+ ...findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions,
49
+ queryKey,
50
+ ...queryOptions as unknown as Omit<InfiniteQueryObserverOptions, "queryKey">
51
+ }) as UseInfiniteQueryResult<TData, FindPetsByTags400> & {
52
+ queryKey: TQueryKey;
53
+ };
54
+ query.queryKey = queryKey as TQueryKey;
55
+ return query;
56
+ }
@@ -0,0 +1,31 @@
1
+ import client from '@kubb/plugin-client/client'
2
+ import type { RequestConfig } from '@kubb/plugin-client/client'
3
+ import type { UseMutationOptions } from 'custom-swr/mutation'
4
+ import { useMutation } from 'custom-swr/mutation'
5
+
6
+ /**
7
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
8
+ * @summary Finds Pets by tags
9
+ * @link /pet/findByTags
10
+ */
11
+ export function findPetsByTags(
12
+ options: {
13
+ mutation?: UseMutationOptions<
14
+ FindPetsByTagsQueryResponse,
15
+ FindPetsByTags400,
16
+ {
17
+ headers: FindPetsByTagsHeaderParams
18
+ params?: FindPetsByTagsQueryParams
19
+ }
20
+ >
21
+ client?: Partial<RequestConfig>
22
+ } = {},
23
+ ) {
24
+ const { mutation: mutationOptions, client: config = {} } = options ?? {}
25
+ return useMutation({
26
+ mutationFn: async ({ headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams }) => {
27
+ return findPetsByTags(headers, params, config)
28
+ },
29
+ ...mutationOptions,
30
+ })
31
+ }
@@ -0,0 +1,48 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, QueryObserverOptions, UseQueryResult } from "custom-query";
4
+ import { useQuery, queryOptions } from "custom-query";
5
+
6
+ export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const;
7
+
8
+ export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>;
9
+
10
+ /**
11
+ * @summary Updates a pet in the store with form data
12
+ * @link /pet/:petId
13
+ */
14
+ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
15
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "post", url: `/pet/${petId}`, params, data, ...config });
16
+ return updatePetWithFormMutationResponse.parse(res.data);
17
+ }
18
+
19
+ export function updatePetWithFormQueryOptions(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
20
+ const queryKey = updatePetWithFormQueryKey(petId, data, params);
21
+ return queryOptions({
22
+ queryKey,
23
+ queryFn: async () => {
24
+ return updatePetWithForm(petId, data, params, config);
25
+ },
26
+ });
27
+ }
28
+
29
+ /**
30
+ * @summary Updates a pet in the store with form data
31
+ * @link /pet/:petId
32
+ */
33
+ export function useUpdatePetWithForm<TData = UpdatePetWithFormMutationResponse, TQueryData = UpdatePetWithFormMutationResponse, TQueryKey extends QueryKey = UpdatePetWithFormQueryKey>(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, options: {
34
+ query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, TData, TQueryData, TQueryKey>>;
35
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
36
+ } = {}) {
37
+ const { query: queryOptions, client: config = {} } = options ?? {};
38
+ const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params);
39
+ const query = useQuery({
40
+ ...updatePetWithFormQueryOptions(petId, data, params, config) as unknown as QueryObserverOptions,
41
+ queryKey,
42
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
43
+ }) as UseQueryResult<TData, UpdatePetWithForm405> & {
44
+ queryKey: TQueryKey;
45
+ };
46
+ query.queryKey = queryKey as TQueryKey;
47
+ return query;
48
+ }
@@ -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: UpdatePetWithFormPathParams["petId"];
22
+ data?: UpdatePetWithFormMutationRequest;
23
+ params?: 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: UpdatePetWithFormPathParams["petId"];
24
+ data?: UpdatePetWithFormMutationRequest;
25
+ params?: 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,4 @@
1
+ export { queryGenerator } from './queryGenerator.tsx'
2
+ export { mutationGenerator } from './mutationGenerator.tsx'
3
+ export { infiniteQueryGenerator } from './infiniteQueryGenerator.tsx'
4
+ export { suspenseQueryGenerator } from './suspenseQueryGenerator.tsx'