@kubb/plugin-swr 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{chunk-23A6KPTG.js → chunk-4EFF327C.js} +10 -3
  2. package/dist/chunk-4EFF327C.js.map +1 -0
  3. package/dist/{chunk-ZO4CRCE6.cjs → chunk-4ZIGOWYH.cjs} +15 -8
  4. package/dist/chunk-4ZIGOWYH.cjs.map +1 -0
  5. package/dist/{chunk-HOCARL2F.js → chunk-7ELDJ4IB.js} +33 -24
  6. package/dist/chunk-7ELDJ4IB.js.map +1 -0
  7. package/dist/{chunk-442Q5BKM.cjs → chunk-DJ57MWSH.cjs} +33 -24
  8. package/dist/chunk-DJ57MWSH.cjs.map +1 -0
  9. package/dist/components.cjs +6 -6
  10. package/dist/components.d.cts +15 -8
  11. package/dist/components.d.ts +15 -8
  12. package/dist/components.js +1 -1
  13. package/dist/generators.cjs +4 -4
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +2 -2
  17. package/dist/index.cjs +8 -6
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +6 -4
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-C68y96t2.d.cts → types-CwvU4w1t.d.cts} +14 -0
  24. package/dist/{types-C68y96t2.d.ts → types-CwvU4w1t.d.ts} +14 -0
  25. package/package.json +12 -12
  26. package/src/components/Mutation.tsx +7 -2
  27. package/src/components/MutationKey.tsx +5 -4
  28. package/src/components/Query.tsx +9 -3
  29. package/src/components/QueryKey.tsx +9 -6
  30. package/src/components/QueryOptions.tsx +8 -5
  31. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +32 -33
  32. package/src/generators/__snapshots__/clientGetImportPath.ts +32 -33
  33. package/src/generators/__snapshots__/clientPostImportPath.ts +29 -20
  34. package/src/generators/__snapshots__/findByTags.ts +32 -33
  35. package/src/generators/__snapshots__/findByTagsObject.ts +32 -33
  36. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +32 -33
  37. package/src/generators/__snapshots__/findByTagsWithZod.ts +32 -33
  38. package/src/generators/__snapshots__/getAsMutation.ts +2 -2
  39. package/src/generators/__snapshots__/postAsQuery.ts +39 -36
  40. package/src/generators/__snapshots__/updatePetById.ts +29 -20
  41. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +33 -24
  42. package/src/generators/mutationGenerator.tsx +3 -0
  43. package/src/generators/queryGenerator.tsx +4 -0
  44. package/src/plugin.ts +3 -1
  45. package/src/types.ts +7 -0
  46. package/dist/chunk-23A6KPTG.js.map +0 -1
  47. package/dist/chunk-442Q5BKM.cjs.map +0 -1
  48. package/dist/chunk-HOCARL2F.js.map +0 -1
  49. package/dist/chunk-ZO4CRCE6.cjs.map +0 -1
@@ -1,49 +1,48 @@
1
- import client from "axios";
2
- import useSWR from "swr";
3
- import type { RequestConfig } from "axios";
1
+ import client from 'axios'
2
+ import useSWR from 'swr'
3
+ import type { RequestConfig } from 'axios'
4
4
 
5
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
5
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
6
 
7
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
7
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
8
 
9
- /**
9
+ /**
10
10
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
11
11
  * @summary Finds Pets by tags
12
12
  * {@link /pet/findByTags}
13
13
  */
14
- async function findPetsByTags({ params }: {
15
- params?: FindPetsByTagsQueryParams;
16
- }, config: Partial<RequestConfig> = {}) {
17
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
18
- return res.data;
14
+ async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
15
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'GET', url: `/pet/findByTags`, params, ...config })
16
+ return res.data
19
17
  }
20
18
 
21
- export function findPetsByTagsQueryOptions({ params }: {
22
- params?: FindPetsByTagsQueryParams;
23
- }, config: Partial<RequestConfig> = {}) {
24
- return {
25
- fetcher: async () => {
26
- return findPetsByTags({ params }, config);
27
- },
28
- };
19
+ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
20
+ return {
21
+ fetcher: async () => {
22
+ return findPetsByTags({ params }, config)
23
+ },
24
+ }
29
25
  }
30
26
 
31
- /**
27
+ /**
32
28
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
29
  * @summary Finds Pets by tags
34
30
  * {@link /pet/findByTags}
35
31
  */
36
- export function useFindPetsByTags({ params }: {
37
- params?: FindPetsByTagsQueryParams;
38
- }, options: {
39
- query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2];
40
- client?: Partial<RequestConfig>;
41
- shouldFetch?: boolean;
42
- } = {}) {
43
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
44
- const queryKey = findPetsByTagsQueryKey(params);
45
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
46
- ...findPetsByTagsQueryOptions({ params }, config),
47
- ...queryOptions
48
- });
32
+ export function useFindPetsByTags(
33
+ { params }: { params?: FindPetsByTagsQueryParams },
34
+ options: {
35
+ query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2]
36
+ client?: Partial<RequestConfig>
37
+ shouldFetch?: boolean
38
+ } = {},
39
+ ) {
40
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
41
+
42
+ const queryKey = findPetsByTagsQueryKey(params)
43
+
44
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
45
+ ...findPetsByTagsQueryOptions({ params }, config),
46
+ ...queryOptions,
47
+ })
49
48
  }
@@ -1,32 +1,41 @@
1
- import client from "axios";
2
- import useSWRMutation from "swr/mutation";
3
- import type { RequestConfig } from "axios";
1
+ import client from 'axios'
2
+ import useSWRMutation from 'swr/mutation'
3
+ import type { RequestConfig } from 'axios'
4
4
 
5
- export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const;
5
+ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
6
6
 
7
- export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>;
7
+ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
8
8
 
9
- /**
9
+ /**
10
10
  * @summary Updates a pet in the store with form data
11
11
  * {@link /pet/:petId}
12
12
  */
13
- async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
14
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: "POST", url: `/pet/${petId}`, params, ...config });
15
- return res.data;
13
+ async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
14
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: 'POST', url: `/pet/${petId}`, params, ...config })
15
+ return res.data
16
16
  }
17
17
 
18
- /**
18
+ /**
19
19
  * @summary Updates a pet in the store with form data
20
20
  * {@link /pet/:petId}
21
21
  */
22
- export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, options: {
23
- mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationKey>>[2];
24
- client?: Partial<RequestConfig>;
25
- shouldFetch?: boolean;
26
- } = {}) {
27
- const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {};
28
- const mutationKey = updatePetWithFormMutationKey();
29
- return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationKey | null>(shouldFetch ? mutationKey : null, async (_url) => {
30
- return updatePetWithForm(petId, params, config);
31
- }, mutationOptions);
22
+ export function useUpdatePetWithForm(
23
+ petId: UpdatePetWithFormPathParams['petId'],
24
+ params?: UpdatePetWithFormQueryParams,
25
+ options: {
26
+ mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationKey>>[2]
27
+ client?: Partial<RequestConfig>
28
+ shouldFetch?: boolean
29
+ } = {},
30
+ ) {
31
+ const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
32
+ const mutationKey = updatePetWithFormMutationKey()
33
+
34
+ return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationKey | null>(
35
+ shouldFetch ? mutationKey : null,
36
+ async (_url) => {
37
+ return updatePetWithForm(petId, params, config)
38
+ },
39
+ mutationOptions,
40
+ )
32
41
  }
@@ -1,49 +1,48 @@
1
- import client from "@kubb/plugin-client/client";
2
- import useSWR from "swr";
3
- import type { RequestConfig } from "@kubb/plugin-client/client";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import useSWR from 'swr'
3
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
4
4
 
5
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
5
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
6
 
7
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
7
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
8
 
9
- /**
9
+ /**
10
10
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
11
11
  * @summary Finds Pets by tags
12
12
  * {@link /pet/findByTags}
13
13
  */
14
- async function findPetsByTags({ params }: {
15
- params?: FindPetsByTagsQueryParams;
16
- }, config: Partial<RequestConfig> = {}) {
17
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
18
- return res.data;
14
+ async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
15
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'GET', url: `/pet/findByTags`, params, ...config })
16
+ return res.data
19
17
  }
20
18
 
21
- export function findPetsByTagsQueryOptions({ params }: {
22
- params?: FindPetsByTagsQueryParams;
23
- }, config: Partial<RequestConfig> = {}) {
24
- return {
25
- fetcher: async () => {
26
- return findPetsByTags({ params }, config);
27
- },
28
- };
19
+ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
20
+ return {
21
+ fetcher: async () => {
22
+ return findPetsByTags({ params }, config)
23
+ },
24
+ }
29
25
  }
30
26
 
31
- /**
27
+ /**
32
28
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
29
  * @summary Finds Pets by tags
34
30
  * {@link /pet/findByTags}
35
31
  */
36
- export function useFindPetsByTags({ params }: {
37
- params?: FindPetsByTagsQueryParams;
38
- }, options: {
39
- query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2];
40
- client?: Partial<RequestConfig>;
41
- shouldFetch?: boolean;
42
- } = {}) {
43
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
44
- const queryKey = findPetsByTagsQueryKey(params);
45
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
46
- ...findPetsByTagsQueryOptions({ params }, config),
47
- ...queryOptions
48
- });
32
+ export function useFindPetsByTags(
33
+ { params }: { params?: FindPetsByTagsQueryParams },
34
+ options: {
35
+ query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2]
36
+ client?: Partial<RequestConfig>
37
+ shouldFetch?: boolean
38
+ } = {},
39
+ ) {
40
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
41
+
42
+ const queryKey = findPetsByTagsQueryKey(params)
43
+
44
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
45
+ ...findPetsByTagsQueryOptions({ params }, config),
46
+ ...queryOptions,
47
+ })
49
48
  }
@@ -1,49 +1,48 @@
1
- import client from "@kubb/plugin-client/client";
2
- import useSWR from "swr";
3
- import type { RequestConfig } from "@kubb/plugin-client/client";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import useSWR from 'swr'
3
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
4
4
 
5
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
5
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
6
 
7
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
7
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
8
 
9
- /**
9
+ /**
10
10
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
11
11
  * @summary Finds Pets by tags
12
12
  * {@link /pet/findByTags}
13
13
  */
14
- async function findPetsByTags({ params }: {
15
- params?: FindPetsByTagsQueryParams;
16
- }, config: Partial<RequestConfig> = {}) {
17
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
18
- return res.data;
14
+ async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
15
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'GET', url: `/pet/findByTags`, params, ...config })
16
+ return res.data
19
17
  }
20
18
 
21
- export function findPetsByTagsQueryOptions({ params }: {
22
- params?: FindPetsByTagsQueryParams;
23
- }, config: Partial<RequestConfig> = {}) {
24
- return {
25
- fetcher: async () => {
26
- return findPetsByTags({ params }, config);
27
- },
28
- };
19
+ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
20
+ return {
21
+ fetcher: async () => {
22
+ return findPetsByTags({ params }, config)
23
+ },
24
+ }
29
25
  }
30
26
 
31
- /**
27
+ /**
32
28
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
29
  * @summary Finds Pets by tags
34
30
  * {@link /pet/findByTags}
35
31
  */
36
- export function useFindPetsByTags({ params }: {
37
- params?: FindPetsByTagsQueryParams;
38
- }, options: {
39
- query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2];
40
- client?: Partial<RequestConfig>;
41
- shouldFetch?: boolean;
42
- } = {}) {
43
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
44
- const queryKey = findPetsByTagsQueryKey(params);
45
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
46
- ...findPetsByTagsQueryOptions({ params }, config),
47
- ...queryOptions
48
- });
32
+ export function useFindPetsByTags(
33
+ { params }: { params?: FindPetsByTagsQueryParams },
34
+ options: {
35
+ query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2]
36
+ client?: Partial<RequestConfig>
37
+ shouldFetch?: boolean
38
+ } = {},
39
+ ) {
40
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
41
+
42
+ const queryKey = findPetsByTagsQueryKey(params)
43
+
44
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
45
+ ...findPetsByTagsQueryOptions({ params }, config),
46
+ ...queryOptions,
47
+ })
49
48
  }
@@ -1,49 +1,48 @@
1
- import client from "@kubb/plugin-client/client";
2
- import useSWR from "swr";
3
- import type { RequestConfig } from "@kubb/plugin-client/client";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import useSWR from 'swr'
3
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
4
4
 
5
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
5
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
6
 
7
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
7
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
8
 
9
- /**
9
+ /**
10
10
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
11
11
  * @summary Finds Pets by tags
12
12
  * {@link /pet/findByTags}
13
13
  */
14
- async function findPetsByTags({ params }: {
15
- params?: FindPetsByTagsQueryParams;
16
- }, config: Partial<RequestConfig> = {}) {
17
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
18
- return res.data;
14
+ async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
15
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'GET', url: `/pet/findByTags`, params, ...config })
16
+ return res.data
19
17
  }
20
18
 
21
- export function findPetsByTagsQueryOptions({ params }: {
22
- params?: FindPetsByTagsQueryParams;
23
- }, config: Partial<RequestConfig> = {}) {
24
- return {
25
- fetcher: async () => {
26
- return findPetsByTags({ params }, config);
27
- },
28
- };
19
+ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
20
+ return {
21
+ fetcher: async () => {
22
+ return findPetsByTags({ params }, config)
23
+ },
24
+ }
29
25
  }
30
26
 
31
- /**
27
+ /**
32
28
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
29
  * @summary Finds Pets by tags
34
30
  * {@link /pet/findByTags}
35
31
  */
36
- export function useFindPetsByTags({ params }: {
37
- params?: FindPetsByTagsQueryParams;
38
- }, options: {
39
- query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2];
40
- client?: Partial<RequestConfig>;
41
- shouldFetch?: boolean;
42
- } = {}) {
43
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
44
- const queryKey = findPetsByTagsQueryKey(params);
45
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
46
- ...findPetsByTagsQueryOptions({ params }, config),
47
- ...queryOptions
48
- });
32
+ export function useFindPetsByTags(
33
+ { params }: { params?: FindPetsByTagsQueryParams },
34
+ options: {
35
+ query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2]
36
+ client?: Partial<RequestConfig>
37
+ shouldFetch?: boolean
38
+ } = {},
39
+ ) {
40
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
41
+
42
+ const queryKey = findPetsByTagsQueryKey(params)
43
+
44
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
45
+ ...findPetsByTagsQueryOptions({ params }, config),
46
+ ...queryOptions,
47
+ })
49
48
  }
@@ -1,49 +1,48 @@
1
- import client from "@kubb/plugin-client/client";
2
- import useSWR from "swr";
3
- import type { RequestConfig } from "@kubb/plugin-client/client";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import useSWR from 'swr'
3
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
4
4
 
5
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
5
+ export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
6
6
 
7
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
7
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
8
8
 
9
- /**
9
+ /**
10
10
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
11
11
  * @summary Finds Pets by tags
12
12
  * {@link /pet/findByTags}
13
13
  */
14
- async function findPetsByTags({ params }: {
15
- params?: FindPetsByTagsQueryParams;
16
- }, config: Partial<RequestConfig> = {}) {
17
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
18
- return findPetsByTagsQueryResponse.parse(res.data);
14
+ async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
15
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'GET', url: `/pet/findByTags`, params, ...config })
16
+ return findPetsByTagsQueryResponse.parse(res.data)
19
17
  }
20
18
 
21
- export function findPetsByTagsQueryOptions({ params }: {
22
- params?: FindPetsByTagsQueryParams;
23
- }, config: Partial<RequestConfig> = {}) {
24
- return {
25
- fetcher: async () => {
26
- return findPetsByTags({ params }, config);
27
- },
28
- };
19
+ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
20
+ return {
21
+ fetcher: async () => {
22
+ return findPetsByTags({ params }, config)
23
+ },
24
+ }
29
25
  }
30
26
 
31
- /**
27
+ /**
32
28
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
29
  * @summary Finds Pets by tags
34
30
  * {@link /pet/findByTags}
35
31
  */
36
- export function useFindPetsByTags({ params }: {
37
- params?: FindPetsByTagsQueryParams;
38
- }, options: {
39
- query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2];
40
- client?: Partial<RequestConfig>;
41
- shouldFetch?: boolean;
42
- } = {}) {
43
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
44
- const queryKey = findPetsByTagsQueryKey(params);
45
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
46
- ...findPetsByTagsQueryOptions({ params }, config),
47
- ...queryOptions
48
- });
32
+ export function useFindPetsByTags(
33
+ { params }: { params?: FindPetsByTagsQueryParams },
34
+ options: {
35
+ query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2]
36
+ client?: Partial<RequestConfig>
37
+ shouldFetch?: boolean
38
+ } = {},
39
+ ) {
40
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
41
+
42
+ const queryKey = findPetsByTagsQueryKey(params)
43
+
44
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
45
+ ...findPetsByTagsQueryOptions({ params }, config),
46
+ ...queryOptions,
47
+ })
49
48
  }
@@ -1,6 +1,6 @@
1
- import client from "@kubb/plugin-client/client";
1
+ import client from "@kubb/plugin-client/clients/axios";
2
2
  import useSWRMutation from "custom-swr/mutation";
3
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/clients/axios";
4
4
 
5
5
  export const findPetsByTagsMutationKey = () => [{ "url": "/pet/findByTags" }] as const;
6
6
 
@@ -1,50 +1,53 @@
1
- import client from "@kubb/plugin-client/client";
2
- import useSWR from "custom-swr";
3
- import type { RequestConfig } from "@kubb/plugin-client/client";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import useSWR from 'custom-swr'
3
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
4
4
 
5
- export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : [])] as const;
5
+ export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams) =>
6
+ [{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : [])] as const
6
7
 
7
- export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>;
8
+ export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>
8
9
 
9
- /**
10
+ /**
10
11
  * @summary Updates a pet in the store with form data
11
12
  * {@link /pet/:petId}
12
13
  */
13
- async function updatePetWithForm({ petId, params }: {
14
- petId: UpdatePetWithFormPathParams["petId"];
15
- params?: UpdatePetWithFormQueryParams;
16
- }, config: Partial<RequestConfig> = {}) {
17
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: "POST", url: `/pet/${petId}`, params, ...config });
18
- return res.data;
14
+ async function updatePetWithForm(
15
+ { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
16
+ config: Partial<RequestConfig> = {},
17
+ ) {
18
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: 'POST', url: `/pet/${petId}`, params, ...config })
19
+ return res.data
19
20
  }
20
21
 
21
- export function updatePetWithFormQueryOptions({ petId, params }: {
22
- petId: UpdatePetWithFormPathParams["petId"];
23
- params?: UpdatePetWithFormQueryParams;
24
- }, config: Partial<RequestConfig> = {}) {
25
- return {
26
- fetcher: async () => {
27
- return updatePetWithForm({ petId, params }, config);
28
- },
29
- };
22
+ export function updatePetWithFormQueryOptions(
23
+ { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
24
+ config: Partial<RequestConfig> = {},
25
+ ) {
26
+ return {
27
+ fetcher: async () => {
28
+ return updatePetWithForm({ petId, params }, config)
29
+ },
30
+ }
30
31
  }
31
32
 
32
- /**
33
+ /**
33
34
  * @summary Updates a pet in the store with form data
34
35
  * {@link /pet/:petId}
35
36
  */
36
- export function useUpdatePetWithForm({ petId, params }: {
37
- petId: UpdatePetWithFormPathParams["petId"];
38
- params?: UpdatePetWithFormQueryParams;
39
- }, options: {
40
- query?: Parameters<typeof useSWR<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormQueryKey | null, any>>[2];
41
- client?: Partial<RequestConfig>;
42
- shouldFetch?: boolean;
43
- } = {}) {
44
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
45
- const queryKey = updatePetWithFormQueryKey(petId, params);
46
- return useSWR<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormQueryKey | null>(shouldFetch ? queryKey : null, {
47
- ...updatePetWithFormQueryOptions({ petId, params }, config),
48
- ...queryOptions
49
- });
37
+ export function useUpdatePetWithForm(
38
+ { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
39
+ options: {
40
+ query?: Parameters<typeof useSWR<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormQueryKey | null, any>>[2]
41
+ client?: Partial<RequestConfig>
42
+ shouldFetch?: boolean
43
+ } = {},
44
+ ) {
45
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
46
+
47
+ const queryKey = updatePetWithFormQueryKey(petId, params)
48
+
49
+ return useSWR<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormQueryKey | null>(shouldFetch ? queryKey : null, {
50
+ ...updatePetWithFormQueryOptions({ petId, params }, config),
51
+ ...queryOptions,
52
+ })
50
53
  }