@kubb/plugin-svelte-query 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-TOBORUCM.js → chunk-BB5SCJJT.js} +10 -3
  2. package/dist/chunk-BB5SCJJT.js.map +1 -0
  3. package/dist/{chunk-F6TRULM6.cjs → chunk-DJNDGHXY.cjs} +17 -10
  4. package/dist/chunk-DJNDGHXY.cjs.map +1 -0
  5. package/dist/{chunk-SP3FM442.js → chunk-EZRBBWGF.js} +50 -30
  6. package/dist/chunk-EZRBBWGF.js.map +1 -0
  7. package/dist/{chunk-PHEQCKJY.cjs → chunk-YSVAGB5Y.cjs} +50 -30
  8. package/dist/chunk-YSVAGB5Y.cjs.map +1 -0
  9. package/dist/components.cjs +6 -6
  10. package/dist/components.d.cts +17 -9
  11. package/dist/components.d.ts +17 -9
  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 +5 -3
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-BxGtUnah.d.ts → types-CdgT4Eeh.d.cts} +29 -2
  24. package/dist/{types-BxGtUnah.d.cts → types-CdgT4Eeh.d.ts} +29 -2
  25. package/package.json +11 -11
  26. package/src/components/Mutation.tsx +18 -4
  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 +9 -5
  31. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +49 -34
  32. package/src/generators/__snapshots__/clientGetImportPath.ts +49 -34
  33. package/src/generators/__snapshots__/clientPostImportPath.ts +46 -32
  34. package/src/generators/__snapshots__/findByTags.ts +49 -34
  35. package/src/generators/__snapshots__/findByTagsObject.ts +55 -44
  36. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +49 -34
  37. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +49 -34
  38. package/src/generators/__snapshots__/findByTagsWithZod.ts +49 -34
  39. package/src/generators/__snapshots__/postAsQuery.ts +66 -36
  40. package/src/generators/__snapshots__/updatePetById.ts +46 -32
  41. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +46 -34
  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-F6TRULM6.cjs.map +0 -1
  47. package/dist/chunk-PHEQCKJY.cjs.map +0 -1
  48. package/dist/chunk-SP3FM442.js.map +0 -1
  49. package/dist/chunk-TOBORUCM.js.map +0 -1
@@ -1,51 +1,66 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-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>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
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)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
46
- }) as CreateQueryResult<TData, FindPetsByTags400> & {
47
- queryKey: TQueryKey;
48
- };
49
- query.queryKey = queryKey as TQueryKey;
50
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
61
+ }) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
62
+
63
+ query.queryKey = queryKey as TQueryKey
64
+
65
+ return query
51
66
  }
@@ -1,60 +1,71 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-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
- async function findPetsByTags({ headers, params }: {
16
- headers: FindPetsByTagsHeaderParams;
17
- params?: FindPetsByTagsQueryParams;
18
- }, config: Partial<RequestConfig> = {}) {
19
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
20
- return findPetsByTagsQueryResponse.parse(res.data);
15
+ async function findPetsByTags(
16
+ { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
17
+ config: Partial<RequestConfig> = {},
18
+ ) {
19
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
20
+ method: 'GET',
21
+ url: `/pet/findByTags`,
22
+ params,
23
+ headers: { ...headers, ...config.headers },
24
+ ...config,
25
+ })
26
+ return findPetsByTagsQueryResponse.parse(res.data)
21
27
  }
22
28
 
23
- export function findPetsByTagsQueryOptions({ headers, params }: {
24
- headers: FindPetsByTagsHeaderParams;
25
- params?: FindPetsByTagsQueryParams;
26
- }, config: Partial<RequestConfig> = {}) {
27
- const queryKey = findPetsByTagsQueryKey(params);
28
- return queryOptions({
29
- queryKey,
30
- queryFn: async ({ signal }) => {
31
- config.signal = signal;
32
- return findPetsByTags({ headers, params }, config);
33
- },
34
- });
29
+ export function findPetsByTagsQueryOptions(
30
+ { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
31
+ config: Partial<RequestConfig> = {},
32
+ ) {
33
+ const queryKey = findPetsByTagsQueryKey(params)
34
+ return queryOptions({
35
+ queryKey,
36
+ queryFn: async ({ signal }) => {
37
+ config.signal = signal
38
+ return findPetsByTags({ headers, params }, config)
39
+ },
40
+ })
35
41
  }
36
42
 
37
- /**
43
+ /**
38
44
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
39
45
  * @summary Finds Pets by tags
40
46
  * {@link /pet/findByTags}
41
47
  */
42
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>({ headers, params }: {
43
- headers: FindPetsByTagsHeaderParams;
44
- params?: FindPetsByTagsQueryParams;
45
- }, options: {
46
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
47
- client?: Partial<RequestConfig>;
48
- } = {}) {
49
- const { query: queryOptions, client: config = {} } = options ?? {};
50
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
51
- const query = createQuery({
52
- ...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as CreateBaseQueryOptions,
53
- queryKey,
54
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
55
- }) as CreateQueryResult<TData, FindPetsByTags400> & {
56
- queryKey: TQueryKey;
57
- };
58
- query.queryKey = queryKey as TQueryKey;
59
- return query;
48
+ export function createFindPetsByTags<
49
+ TData = FindPetsByTagsQueryResponse,
50
+ TQueryData = FindPetsByTagsQueryResponse,
51
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
52
+ >(
53
+ { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
54
+ options: {
55
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
56
+ client?: Partial<RequestConfig>
57
+ } = {},
58
+ ) {
59
+ const { query: queryOptions, client: config = {} } = options ?? {}
60
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
61
+
62
+ const query = createQuery({
63
+ ...(findPetsByTagsQueryOptions({ headers, params }, config) as unknown as CreateBaseQueryOptions),
64
+ queryKey,
65
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
66
+ }) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
67
+
68
+ query.queryKey = queryKey as TQueryKey
69
+
70
+ return query
60
71
  }
@@ -1,51 +1,66 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-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>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
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)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
46
- }) as CreateQueryResult<TData, FindPetsByTags400> & {
47
- queryKey: TQueryKey;
48
- };
49
- query.queryKey = queryKey as TQueryKey;
50
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
61
+ }) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
62
+
63
+ query.queryKey = queryKey as TQueryKey
64
+
65
+ return query
51
66
  }
@@ -1,51 +1,66 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/react-query";
4
- import { queryOptions, createQuery } from "@tanstack/react-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/react-query'
4
+ import { queryOptions, createQuery } 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>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
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)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
46
- }) as CreateQueryResult<TData, FindPetsByTags400> & {
47
- queryKey: TQueryKey;
48
- };
49
- query.queryKey = queryKey as TQueryKey;
50
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
61
+ }) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
62
+
63
+ query.queryKey = queryKey as TQueryKey
64
+
65
+ return query
51
66
  }
@@ -1,51 +1,66 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
4
+ import { queryOptions, createQuery } from '@tanstack/svelte-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>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
17
- return findPetsByTagsQueryResponse.parse(res.data);
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)
18
24
  }
19
25
 
20
- export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
21
- const queryKey = findPetsByTagsQueryKey(params);
22
- return queryOptions({
23
- queryKey,
24
- queryFn: async ({ signal }) => {
25
- config.signal = signal;
26
- return findPetsByTags(headers, params, config);
27
- },
28
- });
26
+ export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
27
+ const queryKey = findPetsByTagsQueryKey(params)
28
+ return queryOptions({
29
+ queryKey,
30
+ queryFn: async ({ signal }) => {
31
+ config.signal = signal
32
+ return findPetsByTags(headers, params, config)
33
+ },
34
+ })
29
35
  }
30
36
 
31
- /**
37
+ /**
32
38
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
33
39
  * @summary Finds Pets by tags
34
40
  * {@link /pet/findByTags}
35
41
  */
36
- export function createFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
38
- client?: Partial<RequestConfig>;
39
- } = {}) {
40
- const { query: queryOptions, client: config = {} } = options ?? {};
41
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
42
- const query = createQuery({
43
- ...findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions,
44
- queryKey,
45
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
46
- }) as CreateQueryResult<TData, FindPetsByTags400> & {
47
- queryKey: TQueryKey;
48
- };
49
- query.queryKey = queryKey as TQueryKey;
50
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = FindPetsByTagsQueryResponse,
44
+ TQueryData = FindPetsByTagsQueryResponse,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
51
+ client?: Partial<RequestConfig>
52
+ } = {},
53
+ ) {
54
+ const { query: queryOptions, client: config = {} } = options ?? {}
55
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
56
+
57
+ const query = createQuery({
58
+ ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as CreateBaseQueryOptions),
59
+ queryKey,
60
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
61
+ }) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
62
+
63
+ query.queryKey = queryKey as TQueryKey
64
+
65
+ return query
51
66
  }