@kubb/plugin-react-query 3.0.0-alpha.16 → 3.0.0-alpha.18

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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator } from './chunk-ME7ZFS5H.js';
1
+ import { queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator } from './chunk-G6I2OU3A.js';
2
2
  import './chunk-ESENIDWJ.js';
3
3
  import path from 'node:path';
4
4
  import { createPlugin, FileManager, PluginManager } from '@kubb/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-react-query",
3
- "version": "3.0.0-alpha.16",
3
+ "version": "3.0.0-alpha.18",
4
4
  "description": "Generator react-query hooks",
5
5
  "keywords": [
6
6
  "faker",
@@ -62,27 +62,24 @@
62
62
  "!/**/__tests__/**"
63
63
  ],
64
64
  "dependencies": {
65
- "@kubb/core": "3.0.0-alpha.16",
66
- "@kubb/fs": "3.0.0-alpha.16",
67
- "@kubb/oas": "3.0.0-alpha.16",
68
- "@kubb/parser-ts": "3.0.0-alpha.16",
69
- "@kubb/plugin-faker": "3.0.0-alpha.16",
70
- "@kubb/plugin-oas": "3.0.0-alpha.16",
71
- "@kubb/plugin-ts": "3.0.0-alpha.16",
72
- "@kubb/plugin-zod": "3.0.0-alpha.16",
73
- "@kubb/react": "3.0.0-alpha.16"
65
+ "@kubb/core": "3.0.0-alpha.18",
66
+ "@kubb/fs": "3.0.0-alpha.18",
67
+ "@kubb/oas": "3.0.0-alpha.18",
68
+ "@kubb/plugin-oas": "3.0.0-alpha.18",
69
+ "@kubb/plugin-ts": "3.0.0-alpha.18",
70
+ "@kubb/plugin-zod": "3.0.0-alpha.18",
71
+ "@kubb/react": "3.0.0-alpha.18"
74
72
  },
75
73
  "devDependencies": {
76
74
  "@types/react": "^18.3.5",
77
75
  "react": "^18.3.1",
78
76
  "tsup": "^8.2.4",
79
77
  "typescript": "^5.6.2",
80
- "@kubb/config-biome": "3.0.0-alpha.16",
81
- "@kubb/config-ts": "3.0.0-alpha.16",
82
- "@kubb/config-tsup": "3.0.0-alpha.16"
78
+ "@kubb/config-ts": "3.0.0-alpha.18",
79
+ "@kubb/config-tsup": "3.0.0-alpha.18"
83
80
  },
84
81
  "peerDependencies": {
85
- "@kubb/react": "3.0.0-alpha.16"
82
+ "@kubb/react": "3.0.0-alpha.18"
86
83
  },
87
84
  "engines": {
88
85
  "node": ">=20"
@@ -1,64 +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'
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
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * @link /pet/findByTags
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
- method: 'get',
18
- url: `/pet/findByTags`,
19
- params,
20
- headers: { ...headers, ...config.headers },
21
- ...config,
22
- })
23
- return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) }
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) };
24
18
  }
25
19
 
26
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
- const queryKey = findPetsByTagsQueryKey(params)
28
- return queryOptions({
29
- queryKey,
30
- queryFn: async () => {
31
- return findPetsByTags(headers, params, config)
32
- },
33
- })
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
+ });
34
28
  }
35
29
 
36
- /**
30
+ /**
37
31
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
38
32
  * @summary Finds Pets by tags
39
33
  * @link /pet/findByTags
40
34
  */
41
- export function useFindPetsByTags<
42
- TData = ResponseConfig<FindPetsByTagsQueryResponse>,
43
- TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>,
44
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
45
- >(
46
- headers: FindPetsByTagsHeaderParams,
47
- params?: FindPetsByTagsQueryParams,
48
- options: {
49
- query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>
50
- client?: Partial<RequestConfig>
51
- } = {},
52
- ) {
53
- const { query: queryOptions, client: config = {} } = options ?? {}
54
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
55
- const query = useQuery({
56
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
57
- queryKey,
58
- ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
59
- }) as UseQueryResult<TData, FindPetsByTags400> & {
60
- queryKey: TQueryKey
61
- }
62
- query.queryKey = queryKey as TQueryKey
63
- return query
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;
64
50
  }
@@ -1,64 +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'
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
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * @link /pet/findByTags
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
- method: 'get',
18
- url: `/pet/findByTags`,
19
- params,
20
- headers: { ...headers, ...config.headers },
21
- ...config,
22
- })
23
- return findPetsByTagsQueryResponse.parse(res.data)
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);
24
18
  }
25
19
 
26
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
- const queryKey = findPetsByTagsQueryKey(params)
28
- return queryOptions({
29
- queryKey,
30
- queryFn: async () => {
31
- return findPetsByTags(headers, params, config)
32
- },
33
- })
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
+ });
34
28
  }
35
29
 
36
- /**
30
+ /**
37
31
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
38
32
  * @summary Finds Pets by tags
39
33
  * @link /pet/findByTags
40
34
  */
41
- export function useFindPetsByTags<
42
- TData = FindPetsByTagsQueryResponse,
43
- TQueryData = FindPetsByTagsQueryResponse,
44
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
45
- >(
46
- headers: FindPetsByTagsHeaderParams,
47
- params?: FindPetsByTagsQueryParams,
48
- options: {
49
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
50
- client?: Partial<RequestConfig>
51
- } = {},
52
- ) {
53
- const { query: queryOptions, client: config = {} } = options ?? {}
54
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
55
- const query = useQuery({
56
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
57
- queryKey,
58
- ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
59
- }) as UseQueryResult<TData, FindPetsByTags400> & {
60
- queryKey: TQueryKey
61
- }
62
- query.queryKey = queryKey as TQueryKey
63
- return query
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;
64
50
  }
@@ -1,59 +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'
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
5
 
6
- /**
6
+ /**
7
7
  * @summary Updates a pet in the store with form data
8
8
  * @link /pet/:petId
9
9
  */
10
- async function updatePetWithForm(
11
- petId: UpdatePetWithFormPathParams['petId'],
12
- data?: UpdatePetWithFormMutationRequest,
13
- params?: UpdatePetWithFormQueryParams,
14
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
15
- ) {
16
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
17
- method: 'post',
18
- url: `/pet/${petId}`,
19
- params,
20
- data,
21
- ...config,
22
- })
23
- return updatePetWithFormMutationResponse.parse(res.data)
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);
24
13
  }
25
14
 
26
- /**
15
+ /**
27
16
  * @summary Updates a pet in the store with form data
28
17
  * @link /pet/:petId
29
18
  */
30
- export function useUpdatePetWithForm(
31
- options: {
32
- mutation?: UseMutationOptions<
33
- UpdatePetWithFormMutationResponse,
34
- UpdatePetWithForm405,
35
- {
36
- petId: UpdatePetWithFormPathParams['petId']
37
- data?: UpdatePetWithFormMutationRequest
38
- params?: UpdatePetWithFormQueryParams
39
- }
40
- >
41
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
42
- } = {},
43
- ) {
44
- const { mutation: mutationOptions, client: config = {} } = options ?? {}
45
- return useMutation({
46
- mutationFn: async ({
47
- petId,
48
- data,
49
- params,
50
- }: {
51
- petId: UpdatePetWithFormPathParams['petId']
52
- data?: UpdatePetWithFormMutationRequest
53
- params?: UpdatePetWithFormQueryParams
54
- }) => {
55
- return updatePetWithForm(petId, data, params, config)
56
- },
57
- ...mutationOptions,
58
- })
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
+ });
59
38
  }
@@ -1,64 +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'
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
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * @link /pet/findByTags
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
- method: 'get',
18
- url: `/pet/findByTags`,
19
- params,
20
- headers: { ...headers, ...config.headers },
21
- ...config,
22
- })
23
- return findPetsByTagsQueryResponse.parse(res.data)
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);
24
18
  }
25
19
 
26
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
- const queryKey = findPetsByTagsQueryKey(params)
28
- return queryOptions({
29
- queryKey,
30
- queryFn: async () => {
31
- return findPetsByTags(headers, params, config)
32
- },
33
- })
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
+ });
34
28
  }
35
29
 
36
- /**
30
+ /**
37
31
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
38
32
  * @summary Finds Pets by tags
39
33
  * @link /pet/findByTags
40
34
  */
41
- export function useFindPetsByTags<
42
- TData = FindPetsByTagsQueryResponse,
43
- TQueryData = FindPetsByTagsQueryResponse,
44
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
45
- >(
46
- headers: FindPetsByTagsHeaderParams,
47
- params?: FindPetsByTagsQueryParams,
48
- options: {
49
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
50
- client?: Partial<RequestConfig>
51
- } = {},
52
- ) {
53
- const { query: queryOptions, client: config = {} } = options ?? {}
54
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
55
- const query = useQuery({
56
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
57
- queryKey,
58
- ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
59
- }) as UseQueryResult<TData, FindPetsByTags400> & {
60
- queryKey: TQueryKey
61
- }
62
- query.queryKey = queryKey as TQueryKey
63
- return query
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;
64
50
  }
@@ -1,64 +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'
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
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * @link /pet/findByTags
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
- method: 'get',
18
- url: `/pet/findByTags`,
19
- params,
20
- headers: { ...headers, ...config.headers },
21
- ...config,
22
- })
23
- return findPetsByTagsQueryResponse.parse(res.data)
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);
24
18
  }
25
19
 
26
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
- const queryKey = findPetsByTagsQueryKey(params)
28
- return queryOptions({
29
- queryKey,
30
- queryFn: async () => {
31
- return findPetsByTags(headers, params, config)
32
- },
33
- })
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
+ });
34
28
  }
35
29
 
36
- /**
30
+ /**
37
31
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
38
32
  * @summary Finds Pets by tags
39
33
  * @link /pet/findByTags
40
34
  */
41
- export function useFindPetsByTags<
42
- TData = FindPetsByTagsQueryResponse,
43
- TQueryData = FindPetsByTagsQueryResponse,
44
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
45
- >(
46
- headers: FindPetsByTagsHeaderParams,
47
- params?: FindPetsByTagsQueryParams,
48
- options: {
49
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
50
- client?: Partial<RequestConfig>
51
- } = {},
52
- ) {
53
- const { query: queryOptions, client: config = {} } = options ?? {}
54
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
55
- const query = useQuery({
56
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
57
- queryKey,
58
- ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
59
- }) as UseQueryResult<TData, FindPetsByTags400> & {
60
- queryKey: TQueryKey
61
- }
62
- query.queryKey = queryKey as TQueryKey
63
- return query
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;
64
50
  }
@@ -1,64 +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'
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
5
 
6
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [test, { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [test, { url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
7
 
8
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
9
9
 
10
- /**
10
+ /**
11
11
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
12
12
  * @summary Finds Pets by tags
13
13
  * @link /pet/findByTags
14
14
  */
15
15
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
16
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
17
- method: 'get',
18
- url: `/pet/findByTags`,
19
- params,
20
- headers: { ...headers, ...config.headers },
21
- ...config,
22
- })
23
- return findPetsByTagsQueryResponse.parse(res.data)
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);
24
18
  }
25
19
 
26
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
- const queryKey = findPetsByTagsQueryKey(params)
28
- return queryOptions({
29
- queryKey,
30
- queryFn: async () => {
31
- return findPetsByTags(headers, params, config)
32
- },
33
- })
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
+ });
34
28
  }
35
29
 
36
- /**
30
+ /**
37
31
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
38
32
  * @summary Finds Pets by tags
39
33
  * @link /pet/findByTags
40
34
  */
41
- export function useFindPetsByTags<
42
- TData = FindPetsByTagsQueryResponse,
43
- TQueryData = FindPetsByTagsQueryResponse,
44
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
45
- >(
46
- headers: FindPetsByTagsHeaderParams,
47
- params?: FindPetsByTagsQueryParams,
48
- options: {
49
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
50
- client?: Partial<RequestConfig>
51
- } = {},
52
- ) {
53
- const { query: queryOptions, client: config = {} } = options ?? {}
54
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
55
- const query = useQuery({
56
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
57
- queryKey,
58
- ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
59
- }) as UseQueryResult<TData, FindPetsByTags400> & {
60
- queryKey: TQueryKey
61
- }
62
- query.queryKey = queryKey as TQueryKey
63
- return query
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;
64
50
  }