@kubb/plugin-swr 3.0.0-alpha.17 → 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/README.md CHANGED
@@ -13,10 +13,6 @@
13
13
  [![Coverage][coverage-src]][coverage-href]
14
14
  [![License][license-src]][license-href]
15
15
 
16
- <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
17
- <!-- ALL-CONTRIBUTORS-BADGE:END -->
18
- </p>
19
-
20
16
  <h4>
21
17
  <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
22
18
  <span> · </span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-swr",
3
- "version": "3.0.0-alpha.17",
3
+ "version": "3.0.0-alpha.18",
4
4
  "description": "Generator plugin-swr",
5
5
  "keywords": [
6
6
  "typescript",
@@ -63,27 +63,25 @@
63
63
  "!/**/__tests__/**"
64
64
  ],
65
65
  "dependencies": {
66
- "@kubb/core": "3.0.0-alpha.17",
67
- "@kubb/fs": "3.0.0-alpha.17",
68
- "@kubb/oas": "3.0.0-alpha.17",
69
- "@kubb/parser-ts": "3.0.0-alpha.17",
70
- "@kubb/plugin-client": "3.0.0-alpha.17",
71
- "@kubb/plugin-oas": "3.0.0-alpha.17",
72
- "@kubb/plugin-ts": "3.0.0-alpha.17",
73
- "@kubb/plugin-zod": "3.0.0-alpha.17",
74
- "@kubb/react": "3.0.0-alpha.17"
66
+ "@kubb/core": "3.0.0-alpha.18",
67
+ "@kubb/fs": "3.0.0-alpha.18",
68
+ "@kubb/oas": "3.0.0-alpha.18",
69
+ "@kubb/plugin-client": "3.0.0-alpha.18",
70
+ "@kubb/plugin-oas": "3.0.0-alpha.18",
71
+ "@kubb/plugin-ts": "3.0.0-alpha.18",
72
+ "@kubb/plugin-zod": "3.0.0-alpha.18",
73
+ "@kubb/react": "3.0.0-alpha.18"
75
74
  },
76
75
  "devDependencies": {
77
76
  "@types/react": "^18.3.5",
78
77
  "react": "^18.3.1",
79
78
  "tsup": "^8.2.4",
80
79
  "typescript": "^5.6.2",
81
- "@kubb/config-biome": "3.0.0-alpha.17",
82
- "@kubb/config-ts": "3.0.0-alpha.17",
83
- "@kubb/config-tsup": "3.0.0-alpha.17"
80
+ "@kubb/config-ts": "3.0.0-alpha.18",
81
+ "@kubb/config-tsup": "3.0.0-alpha.18"
84
82
  },
85
83
  "peerDependencies": {
86
- "@kubb/react": "3.0.0-alpha.17"
84
+ "@kubb/react": "3.0.0-alpha.18"
87
85
  },
88
86
  "engines": {
89
87
  "node": ">=20"
@@ -1,43 +1,40 @@
1
- import client from '@kubb/plugin-client/client'
2
- import useSWR from 'swr'
3
- import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/client'
4
- import type { Key, SWRConfiguration } from 'swr'
1
+ import client from "@kubb/plugin-client/client";
2
+ import useSWR from "swr";
3
+ import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client";
4
+ import type { Key, SWRConfiguration } from "swr";
5
5
 
6
- /**
6
+ /**
7
7
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
8
8
  * @summary Finds Pets by tags
9
9
  * @link /pet/findByTags
10
10
  */
11
11
  async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
12
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'get', url: `/pet/findByTags`, params, ...config })
13
- return res
12
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, ...config });
13
+ return res;
14
14
  }
15
15
 
16
- export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
- return {
18
- fetcher: async () => {
19
- return findPetsByTags(params, config)
20
- },
21
- }
16
+ export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
+ return {
18
+ fetcher: async () => {
19
+ return findPetsByTags(params, config);
20
+ },
21
+ };
22
22
  }
23
23
 
24
- /**
24
+ /**
25
25
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
26
26
  * @summary Finds Pets by tags
27
27
  * @link /pet/findByTags
28
28
  */
29
- export function useFindPetsByTags(
30
- params?: FindPetsByTagsQueryParams,
31
- options: {
32
- query?: SWRConfiguration<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400>
33
- client?: Partial<RequestConfig>
34
- shouldFetch?: boolean
35
- } = {},
36
- ) {
37
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
38
- const swrKey = [`/pet/findByTags`, params] as const
39
- return useSWR<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
40
- ...findPetsByTagsQueryOptions(params, config),
41
- ...queryOptions,
42
- })
29
+ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: {
30
+ query?: SWRConfiguration<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400>;
31
+ client?: Partial<RequestConfig>;
32
+ shouldFetch?: boolean;
33
+ } = {}) {
34
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
35
+ const swrKey = [`/pet/findByTags`, params] as const;
36
+ return useSWR<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
37
+ ...findPetsByTagsQueryOptions(params, config),
38
+ ...queryOptions
39
+ });
43
40
  }
@@ -1,43 +1,40 @@
1
- import client from 'axios'
2
- import useSWR from 'swr'
3
- import type { RequestConfig } from 'axios'
4
- import type { Key, SWRConfiguration } from 'swr'
1
+ import client from "axios";
2
+ import useSWR from "swr";
3
+ import type { RequestConfig } from "axios";
4
+ import type { Key, SWRConfiguration } from "swr";
5
5
 
6
- /**
6
+ /**
7
7
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
8
8
  * @summary Finds Pets by tags
9
9
  * @link /pet/findByTags
10
10
  */
11
11
  async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
12
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'get', url: `/pet/findByTags`, params, ...config })
13
- return res.data
12
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, ...config });
13
+ return res.data;
14
14
  }
15
15
 
16
- export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
- return {
18
- fetcher: async () => {
19
- return findPetsByTags(params, config)
20
- },
21
- }
16
+ export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
+ return {
18
+ fetcher: async () => {
19
+ return findPetsByTags(params, config);
20
+ },
21
+ };
22
22
  }
23
23
 
24
- /**
24
+ /**
25
25
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
26
26
  * @summary Finds Pets by tags
27
27
  * @link /pet/findByTags
28
28
  */
29
- export function useFindPetsByTags(
30
- params?: FindPetsByTagsQueryParams,
31
- options: {
32
- query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>
33
- client?: Partial<RequestConfig>
34
- shouldFetch?: boolean
35
- } = {},
36
- ) {
37
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
38
- const swrKey = [`/pet/findByTags`, params] as const
39
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
40
- ...findPetsByTagsQueryOptions(params, config),
41
- ...queryOptions,
42
- })
29
+ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: {
30
+ query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>;
31
+ client?: Partial<RequestConfig>;
32
+ shouldFetch?: boolean;
33
+ } = {}) {
34
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
35
+ const swrKey = [`/pet/findByTags`, params] as const;
36
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
37
+ ...findPetsByTagsQueryOptions(params, config),
38
+ ...queryOptions
39
+ });
43
40
  }
@@ -1,38 +1,30 @@
1
- import client from 'axios'
2
- import useSWRMutation from 'swr/mutation'
3
- import type { RequestConfig } from 'axios'
4
- import type { Key } from 'swr'
5
- import type { SWRMutationConfiguration } from 'swr/mutation'
1
+ import client from "axios";
2
+ import useSWRMutation from "swr/mutation";
3
+ import type { RequestConfig } from "axios";
4
+ import type { Key } from "swr";
5
+ import type { SWRMutationConfiguration } from "swr/mutation";
6
6
 
7
- /**
7
+ /**
8
8
  * @summary Updates a pet in the store with form data
9
9
  * @link /pet/:petId
10
10
  */
11
- async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
12
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: 'post', url: `/pet/${petId}`, params, ...config })
13
- return res.data
11
+ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
12
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: "post", url: `/pet/${petId}`, params, ...config });
13
+ return res.data;
14
14
  }
15
15
 
16
- /**
16
+ /**
17
17
  * @summary Updates a pet in the store with form data
18
18
  * @link /pet/:petId
19
19
  */
20
- export function useUpdatePetWithForm(
21
- petId: UpdatePetWithFormPathParams['petId'],
22
- params?: UpdatePetWithFormQueryParams,
23
- options: {
24
- mutation?: SWRMutationConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>
25
- client?: Partial<RequestConfig>
26
- shouldFetch?: boolean
27
- } = {},
28
- ) {
29
- const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
30
- const swrKey = [`/pet/${petId}`, params] as const
31
- return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(
32
- shouldFetch ? swrKey : null,
33
- async (_url) => {
34
- return updatePetWithForm(petId, params, config)
35
- },
36
- mutationOptions,
37
- )
20
+ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, options: {
21
+ mutation?: SWRMutationConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>;
22
+ client?: Partial<RequestConfig>;
23
+ shouldFetch?: boolean;
24
+ } = {}) {
25
+ const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {};
26
+ const swrKey = [`/pet/${petId}`, params] as const;
27
+ return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(shouldFetch ? swrKey : null, async (_url) => {
28
+ return updatePetWithForm(petId, params, config);
29
+ }, mutationOptions);
38
30
  }
@@ -1,43 +1,40 @@
1
- import client from '@kubb/plugin-client/client'
2
- import useSWR from 'swr'
3
- import type { RequestConfig } from '@kubb/plugin-client/client'
4
- import type { Key, SWRConfiguration } from 'swr'
1
+ import client from "@kubb/plugin-client/client";
2
+ import useSWR from "swr";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+ import type { Key, SWRConfiguration } from "swr";
5
5
 
6
- /**
6
+ /**
7
7
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
8
8
  * @summary Finds Pets by tags
9
9
  * @link /pet/findByTags
10
10
  */
11
11
  async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
12
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'get', url: `/pet/findByTags`, params, ...config })
13
- return res.data
12
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, ...config });
13
+ return res.data;
14
14
  }
15
15
 
16
- export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
- return {
18
- fetcher: async () => {
19
- return findPetsByTags(params, config)
20
- },
21
- }
16
+ export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
+ return {
18
+ fetcher: async () => {
19
+ return findPetsByTags(params, config);
20
+ },
21
+ };
22
22
  }
23
23
 
24
- /**
24
+ /**
25
25
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
26
26
  * @summary Finds Pets by tags
27
27
  * @link /pet/findByTags
28
28
  */
29
- export function useFindPetsByTags(
30
- params?: FindPetsByTagsQueryParams,
31
- options: {
32
- query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>
33
- client?: Partial<RequestConfig>
34
- shouldFetch?: boolean
35
- } = {},
36
- ) {
37
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
38
- const swrKey = [`/pet/findByTags`, params] as const
39
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
40
- ...findPetsByTagsQueryOptions(params, config),
41
- ...queryOptions,
42
- })
29
+ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: {
30
+ query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>;
31
+ client?: Partial<RequestConfig>;
32
+ shouldFetch?: boolean;
33
+ } = {}) {
34
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
35
+ const swrKey = [`/pet/findByTags`, params] as const;
36
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
37
+ ...findPetsByTagsQueryOptions(params, config),
38
+ ...queryOptions
39
+ });
43
40
  }
@@ -1,43 +1,40 @@
1
- import client from '@kubb/plugin-client/client'
2
- import useSWR from 'swr'
3
- import type { RequestConfig } from '@kubb/plugin-client/client'
4
- import type { Key, SWRConfiguration } from 'swr'
1
+ import client from "@kubb/plugin-client/client";
2
+ import useSWR from "swr";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+ import type { Key, SWRConfiguration } from "swr";
5
5
 
6
- /**
6
+ /**
7
7
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
8
8
  * @summary Finds Pets by tags
9
9
  * @link /pet/findByTags
10
10
  */
11
11
  async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
12
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'get', url: `/pet/findByTags`, params, ...config })
13
- return res.data
12
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, ...config });
13
+ return res.data;
14
14
  }
15
15
 
16
- export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
- return {
18
- fetcher: async () => {
19
- return findPetsByTags(params, config)
20
- },
21
- }
16
+ export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
+ return {
18
+ fetcher: async () => {
19
+ return findPetsByTags(params, config);
20
+ },
21
+ };
22
22
  }
23
23
 
24
- /**
24
+ /**
25
25
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
26
26
  * @summary Finds Pets by tags
27
27
  * @link /pet/findByTags
28
28
  */
29
- export function useFindPetsByTags(
30
- params?: FindPetsByTagsQueryParams,
31
- options: {
32
- query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>
33
- client?: Partial<RequestConfig>
34
- shouldFetch?: boolean
35
- } = {},
36
- ) {
37
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
38
- const swrKey = [`/pet/findByTags`, params] as const
39
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
40
- ...findPetsByTagsQueryOptions(params, config),
41
- ...queryOptions,
42
- })
29
+ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: {
30
+ query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>;
31
+ client?: Partial<RequestConfig>;
32
+ shouldFetch?: boolean;
33
+ } = {}) {
34
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
35
+ const swrKey = [`/pet/findByTags`, params] as const;
36
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
37
+ ...findPetsByTagsQueryOptions(params, config),
38
+ ...queryOptions
39
+ });
43
40
  }
@@ -1,43 +1,40 @@
1
- import client from '@kubb/plugin-client/client'
2
- import useSWR from 'swr'
3
- import type { RequestConfig } from '@kubb/plugin-client/client'
4
- import type { Key, SWRConfiguration } from 'swr'
1
+ import client from "@kubb/plugin-client/client";
2
+ import useSWR from "swr";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+ import type { Key, SWRConfiguration } from "swr";
5
5
 
6
- /**
6
+ /**
7
7
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
8
8
  * @summary Finds Pets by tags
9
9
  * @link /pet/findByTags
10
10
  */
11
11
  async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
12
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'get', url: `/pet/findByTags`, params, ...config })
13
- return findPetsByTagsQueryResponse.parse(res.data)
12
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, ...config });
13
+ return findPetsByTagsQueryResponse.parse(res.data);
14
14
  }
15
15
 
16
- export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
- return {
18
- fetcher: async () => {
19
- return findPetsByTags(params, config)
20
- },
21
- }
16
+ export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
+ return {
18
+ fetcher: async () => {
19
+ return findPetsByTags(params, config);
20
+ },
21
+ };
22
22
  }
23
23
 
24
- /**
24
+ /**
25
25
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
26
26
  * @summary Finds Pets by tags
27
27
  * @link /pet/findByTags
28
28
  */
29
- export function useFindPetsByTags(
30
- params?: FindPetsByTagsQueryParams,
31
- options: {
32
- query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>
33
- client?: Partial<RequestConfig>
34
- shouldFetch?: boolean
35
- } = {},
36
- ) {
37
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
38
- const swrKey = [`/pet/findByTags`, params] as const
39
- return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
40
- ...findPetsByTagsQueryOptions(params, config),
41
- ...queryOptions,
42
- })
29
+ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: {
30
+ query?: SWRConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>;
31
+ client?: Partial<RequestConfig>;
32
+ shouldFetch?: boolean;
33
+ } = {}) {
34
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
35
+ const swrKey = [`/pet/findByTags`, params] as const;
36
+ return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, {
37
+ ...findPetsByTagsQueryOptions(params, config),
38
+ ...queryOptions
39
+ });
43
40
  }
@@ -1,39 +1,32 @@
1
- import client from '@kubb/plugin-client/client'
2
- import useSWRMutation from 'custom-swr/mutation'
3
- import type { RequestConfig } from '@kubb/plugin-client/client'
4
- import type { SWRMutationConfiguration } from 'custom-swr/mutation'
5
- import type { Key } from 'swr'
1
+ import client from "@kubb/plugin-client/client";
2
+ import useSWRMutation from "custom-swr/mutation";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+ import type { SWRMutationConfiguration } from "custom-swr/mutation";
5
+ import type { Key } from "swr";
6
6
 
7
- /**
7
+ /**
8
8
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
9
9
  * @summary Finds Pets by tags
10
10
  * @link /pet/findByTags
11
11
  */
12
12
  async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
13
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: 'get', url: `/pet/findByTags`, params, ...config })
14
- return res.data
13
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "get", url: `/pet/findByTags`, params, ...config });
14
+ return res.data;
15
15
  }
16
16
 
17
- /**
17
+ /**
18
18
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
19
19
  * @summary Finds Pets by tags
20
20
  * @link /pet/findByTags
21
21
  */
22
- export function useFindPetsByTags(
23
- params?: FindPetsByTagsQueryParams,
24
- options: {
25
- mutation?: SWRMutationConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>
26
- client?: Partial<RequestConfig>
27
- shouldFetch?: boolean
28
- } = {},
29
- ) {
30
- const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
31
- const swrKey = [`/pet/findByTags`, params] as const
32
- return useSWRMutation<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(
33
- shouldFetch ? swrKey : null,
34
- async (_url) => {
35
- return findPetsByTags(params, config)
36
- },
37
- mutationOptions,
38
- )
22
+ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: {
23
+ mutation?: SWRMutationConfiguration<FindPetsByTagsQueryResponse, FindPetsByTags400>;
24
+ client?: Partial<RequestConfig>;
25
+ shouldFetch?: boolean;
26
+ } = {}) {
27
+ const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {};
28
+ const swrKey = [`/pet/findByTags`, params] as const;
29
+ return useSWRMutation<FindPetsByTagsQueryResponse, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, async (_url) => {
30
+ return findPetsByTags(params, config);
31
+ }, mutationOptions);
39
32
  }
@@ -1,47 +1,39 @@
1
- import client from '@kubb/plugin-client/client'
2
- import useSWR from 'custom-swr'
3
- import type { RequestConfig } from '@kubb/plugin-client/client'
4
- import type { SWRConfiguration } from 'custom-swr'
5
- import type { Key } from 'swr'
1
+ import client from "@kubb/plugin-client/client";
2
+ import useSWR from "custom-swr";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+ import type { SWRConfiguration } from "custom-swr";
5
+ import type { Key } from "swr";
6
6
 
7
- /**
7
+ /**
8
8
  * @summary Updates a pet in the store with form data
9
9
  * @link /pet/:petId
10
10
  */
11
- async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
12
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: 'post', url: `/pet/${petId}`, params, ...config })
13
- return res.data
11
+ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
12
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: "post", url: `/pet/${petId}`, params, ...config });
13
+ return res.data;
14
14
  }
15
15
 
16
- export function updatePetWithFormQueryOptions(
17
- petId: UpdatePetWithFormPathParams['petId'],
18
- params?: UpdatePetWithFormQueryParams,
19
- config: Partial<RequestConfig> = {},
20
- ) {
21
- return {
22
- fetcher: async () => {
23
- return updatePetWithForm(petId, params, config)
24
- },
25
- }
16
+ export function updatePetWithFormQueryOptions(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
17
+ return {
18
+ fetcher: async () => {
19
+ return updatePetWithForm(petId, params, config);
20
+ },
21
+ };
26
22
  }
27
23
 
28
- /**
24
+ /**
29
25
  * @summary Updates a pet in the store with form data
30
26
  * @link /pet/:petId
31
27
  */
32
- export function useUpdatePetWithForm(
33
- petId: UpdatePetWithFormPathParams['petId'],
34
- params?: UpdatePetWithFormQueryParams,
35
- options: {
36
- query?: SWRConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>
37
- client?: Partial<RequestConfig>
38
- shouldFetch?: boolean
39
- } = {},
40
- ) {
41
- const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}
42
- const swrKey = [`/pet/${petId}`, params] as const
43
- return useSWR<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(shouldFetch ? swrKey : null, {
44
- ...updatePetWithFormQueryOptions(petId, params, config),
45
- ...queryOptions,
46
- })
28
+ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, options: {
29
+ query?: SWRConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>;
30
+ client?: Partial<RequestConfig>;
31
+ shouldFetch?: boolean;
32
+ } = {}) {
33
+ const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {};
34
+ const swrKey = [`/pet/${petId}`, params] as const;
35
+ return useSWR<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(shouldFetch ? swrKey : null, {
36
+ ...updatePetWithFormQueryOptions(petId, params, config),
37
+ ...queryOptions
38
+ });
47
39
  }
@@ -1,38 +1,30 @@
1
- import client from '@kubb/plugin-client/client'
2
- import useSWRMutation from 'swr/mutation'
3
- import type { RequestConfig } from '@kubb/plugin-client/client'
4
- import type { Key } from 'swr'
5
- import type { SWRMutationConfiguration } from 'swr/mutation'
1
+ import client from "@kubb/plugin-client/client";
2
+ import useSWRMutation from "swr/mutation";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+ import type { Key } from "swr";
5
+ import type { SWRMutationConfiguration } from "swr/mutation";
6
6
 
7
- /**
7
+ /**
8
8
  * @summary Updates a pet in the store with form data
9
9
  * @link /pet/:petId
10
10
  */
11
- async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
12
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: 'post', url: `/pet/${petId}`, params, ...config })
13
- return res.data
11
+ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
12
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: "post", url: `/pet/${petId}`, params, ...config });
13
+ return res.data;
14
14
  }
15
15
 
16
- /**
16
+ /**
17
17
  * @summary Updates a pet in the store with form data
18
18
  * @link /pet/:petId
19
19
  */
20
- export function useUpdatePetWithForm(
21
- petId: UpdatePetWithFormPathParams['petId'],
22
- params?: UpdatePetWithFormQueryParams,
23
- options: {
24
- mutation?: SWRMutationConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>
25
- client?: Partial<RequestConfig>
26
- shouldFetch?: boolean
27
- } = {},
28
- ) {
29
- const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
30
- const swrKey = [`/pet/${petId}`, params] as const
31
- return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(
32
- shouldFetch ? swrKey : null,
33
- async (_url) => {
34
- return updatePetWithForm(petId, params, config)
35
- },
36
- mutationOptions,
37
- )
20
+ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, options: {
21
+ mutation?: SWRMutationConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>;
22
+ client?: Partial<RequestConfig>;
23
+ shouldFetch?: boolean;
24
+ } = {}) {
25
+ const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {};
26
+ const swrKey = [`/pet/${petId}`, params] as const;
27
+ return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(shouldFetch ? swrKey : null, async (_url) => {
28
+ return updatePetWithForm(petId, params, config);
29
+ }, mutationOptions);
38
30
  }
@@ -1,50 +1,34 @@
1
- import client from '@kubb/plugin-client/client'
2
- import useSWRMutation from 'swr/mutation'
3
- import type { RequestConfig } from '@kubb/plugin-client/client'
4
- import type { Key } from 'swr'
5
- import type { SWRMutationConfiguration } from 'swr/mutation'
1
+ import client from "@kubb/plugin-client/client";
2
+ import useSWRMutation from "swr/mutation";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+ import type { Key } from "swr";
5
+ import type { SWRMutationConfiguration } from "swr/mutation";
6
6
 
7
- /**
7
+ /**
8
8
  * @summary Updates a pet in the store with form data
9
9
  * @link /pet/:petId
10
10
  */
11
- async function updatePetWithForm(
12
- {
13
- petId,
14
- }: {
15
- petId: UpdatePetWithFormPathParams['petId']
16
- },
17
- params?: UpdatePetWithFormQueryParams,
18
- config: Partial<RequestConfig> = {},
19
- ) {
20
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: 'post', url: `/pet/${petId}`, params, ...config })
21
- return res.data
11
+ async function updatePetWithForm({ petId }: {
12
+ petId: UpdatePetWithFormPathParams["petId"];
13
+ }, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
14
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: "post", url: `/pet/${petId}`, params, ...config });
15
+ return res.data;
22
16
  }
23
17
 
24
- /**
18
+ /**
25
19
  * @summary Updates a pet in the store with form data
26
20
  * @link /pet/:petId
27
21
  */
28
- export function useUpdatePetWithForm(
29
- {
30
- petId,
31
- }: {
32
- petId: UpdatePetWithFormPathParams['petId']
33
- },
34
- params?: UpdatePetWithFormQueryParams,
35
- options: {
36
- mutation?: SWRMutationConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>
37
- client?: Partial<RequestConfig>
38
- shouldFetch?: boolean
39
- } = {},
40
- ) {
41
- const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
42
- const swrKey = [`/pet/${petId}`, params] as const
43
- return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(
44
- shouldFetch ? swrKey : null,
45
- async (_url) => {
46
- return updatePetWithForm({ petId }, params, config)
47
- },
48
- mutationOptions,
49
- )
22
+ export function useUpdatePetWithForm({ petId }: {
23
+ petId: UpdatePetWithFormPathParams["petId"];
24
+ }, params?: UpdatePetWithFormQueryParams, options: {
25
+ mutation?: SWRMutationConfiguration<UpdatePetWithFormMutationResponse, UpdatePetWithForm405>;
26
+ client?: Partial<RequestConfig>;
27
+ shouldFetch?: boolean;
28
+ } = {}) {
29
+ const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {};
30
+ const swrKey = [`/pet/${petId}`, params] as const;
31
+ return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, Key>(shouldFetch ? swrKey : null, async (_url) => {
32
+ return updatePetWithForm({ petId }, params, config);
33
+ }, mutationOptions);
50
34
  }
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Plugin, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
1
+ import type { PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
2
  import type * as KubbFile from '@kubb/fs/types'
3
3
  import type { HttpMethod } from '@kubb/oas'
4
4
  import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
@@ -140,9 +140,4 @@ type ResolvedOptions = {
140
140
  pathParamsType: NonNullable<Options['pathParamsType']>
141
141
  }
142
142
 
143
- export type FileMeta = {
144
- pluginKey?: Plugin['key']
145
- tag?: string
146
- }
147
-
148
143
  export type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, never, ResolvePathOptions>