@kubb/plugin-vue-query 3.2.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.
@@ -1,58 +1,79 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from "@tanstack/react-query";
4
- import type { MaybeRef } from "vue";
5
- import { infiniteQueryOptions, useInfiniteQuery } 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 { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query'
4
+ import type { MaybeRef } from 'vue'
5
+ import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
6
6
 
7
- export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+ export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) =>
8
+ [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
8
9
 
9
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>;
10
+ export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
10
11
 
11
- /**
12
+ /**
12
13
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
13
14
  * @summary Finds Pets by tags
14
15
  * {@link /pet/findByTags}
15
16
  */
16
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
18
- return findPetsByTagsQueryResponse.parse(res.data);
18
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
19
+ method: 'GET',
20
+ url: `/pet/findByTags`,
21
+ params,
22
+ headers: { ...headers, ...config.headers },
23
+ ...config,
24
+ })
25
+ return findPetsByTagsQueryResponse.parse(res.data)
19
26
  }
20
27
 
21
- export function findPetsByTagsInfiniteQueryOptions(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, config: Partial<RequestConfig> = {}) {
22
- const queryKey = findPetsByTagsInfiniteQueryKey(params);
23
- return infiniteQueryOptions({
24
- queryKey,
25
- queryFn: async ({ signal, pageParam }) => {
26
- config.signal = signal;
27
- if (params) {
28
- params["pageSize"] = pageParam as unknown as FindPetsByTagsQueryParams["pageSize"];
29
- }
30
- return findPetsByTags(headers, params, config);
31
- },
32
- initialPageParam: 0,
33
- getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1,
34
- getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1
35
- });
28
+ export function findPetsByTagsInfiniteQueryOptions(
29
+ headers: MaybeRef<FindPetsByTagsHeaderParams>,
30
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
31
+ config: Partial<RequestConfig> = {},
32
+ ) {
33
+ const queryKey = findPetsByTagsInfiniteQueryKey(params)
34
+ return infiniteQueryOptions({
35
+ queryKey,
36
+ queryFn: async ({ signal, pageParam }) => {
37
+ config.signal = signal
38
+
39
+ if (params) {
40
+ params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize']
41
+ }
42
+ return findPetsByTags(headers, params, config)
43
+ },
44
+ initialPageParam: 0,
45
+ getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1),
46
+ getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1),
47
+ })
36
48
  }
37
49
 
38
- /**
50
+ /**
39
51
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
40
52
  * @summary Finds Pets by tags
41
53
  * {@link /pet/findByTags}
42
54
  */
43
- export function useFindPetsByTagsInfinite<TData = InfiniteData<FindPetsByTagsQueryResponse>, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
44
- query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
45
- client?: Partial<RequestConfig>;
46
- } = {}) {
47
- const { query: queryOptions, client: config = {} } = options ?? {};
48
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params);
49
- const query = useInfiniteQuery({
50
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions,
51
- queryKey: queryKey as QueryKey,
52
- ...queryOptions as unknown as Omit<InfiniteQueryObserverOptions, "queryKey">
53
- }) as UseInfiniteQueryReturnType<TData, FindPetsByTags400> & {
54
- queryKey: TQueryKey;
55
- };
56
- query.queryKey = queryKey as TQueryKey;
57
- return query;
55
+ export function useFindPetsByTagsInfinite<
56
+ TData = InfiniteData<FindPetsByTagsQueryResponse>,
57
+ TQueryData = FindPetsByTagsQueryResponse,
58
+ TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
59
+ >(
60
+ headers: MaybeRef<FindPetsByTagsHeaderParams>,
61
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
62
+ options: {
63
+ query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
64
+ client?: Partial<RequestConfig>
65
+ } = {},
66
+ ) {
67
+ const { query: queryOptions, client: config = {} } = options ?? {}
68
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
69
+
70
+ const query = useInfiniteQuery({
71
+ ...(findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions),
72
+ queryKey: queryKey as QueryKey,
73
+ ...(queryOptions as unknown as Omit<InfiniteQueryObserverOptions, 'queryKey'>),
74
+ }) as UseInfiniteQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
75
+
76
+ query.queryKey = queryKey as TQueryKey
77
+
78
+ return query
58
79
  }
@@ -1,58 +1,79 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from "@tanstack/react-query";
4
- import type { MaybeRef } from "vue";
5
- import { infiniteQueryOptions, useInfiniteQuery } 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 { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query'
4
+ import type { MaybeRef } from 'vue'
5
+ import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
6
6
 
7
- export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
7
+ export const findPetsByTagsInfiniteQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) =>
8
+ [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
8
9
 
9
- export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>;
10
+ export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInfiniteQueryKey>
10
11
 
11
- /**
12
+ /**
12
13
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
13
14
  * @summary Finds Pets by tags
14
15
  * {@link /pet/findByTags}
15
16
  */
16
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
17
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
18
- return findPetsByTagsQueryResponse.parse(res.data);
18
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
19
+ method: 'GET',
20
+ url: `/pet/findByTags`,
21
+ params,
22
+ headers: { ...headers, ...config.headers },
23
+ ...config,
24
+ })
25
+ return findPetsByTagsQueryResponse.parse(res.data)
19
26
  }
20
27
 
21
- export function findPetsByTagsInfiniteQueryOptions(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, config: Partial<RequestConfig> = {}) {
22
- const queryKey = findPetsByTagsInfiniteQueryKey(params);
23
- return infiniteQueryOptions({
24
- queryKey,
25
- queryFn: async ({ signal, pageParam }) => {
26
- config.signal = signal;
27
- if (params) {
28
- params["pageSize"] = pageParam as unknown as FindPetsByTagsQueryParams["pageSize"];
29
- }
30
- return findPetsByTags(headers, params, config);
31
- },
32
- initialPageParam: 0,
33
- getNextPageParam: (lastPage) => lastPage["cursor"],
34
- getPreviousPageParam: (firstPage) => firstPage["cursor"]
35
- });
28
+ export function findPetsByTagsInfiniteQueryOptions(
29
+ headers: MaybeRef<FindPetsByTagsHeaderParams>,
30
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
31
+ config: Partial<RequestConfig> = {},
32
+ ) {
33
+ const queryKey = findPetsByTagsInfiniteQueryKey(params)
34
+ return infiniteQueryOptions({
35
+ queryKey,
36
+ queryFn: async ({ signal, pageParam }) => {
37
+ config.signal = signal
38
+
39
+ if (params) {
40
+ params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize']
41
+ }
42
+ return findPetsByTags(headers, params, config)
43
+ },
44
+ initialPageParam: 0,
45
+ getNextPageParam: (lastPage) => lastPage['cursor'],
46
+ getPreviousPageParam: (firstPage) => firstPage['cursor'],
47
+ })
36
48
  }
37
49
 
38
- /**
50
+ /**
39
51
  * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
40
52
  * @summary Finds Pets by tags
41
53
  * {@link /pet/findByTags}
42
54
  */
43
- export function useFindPetsByTagsInfinite<TData = InfiniteData<FindPetsByTagsQueryResponse>, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey>(headers: MaybeRef<FindPetsByTagsHeaderParams>, params?: MaybeRef<FindPetsByTagsQueryParams>, options: {
44
- query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
45
- client?: Partial<RequestConfig>;
46
- } = {}) {
47
- const { query: queryOptions, client: config = {} } = options ?? {};
48
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params);
49
- const query = useInfiniteQuery({
50
- ...findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions,
51
- queryKey: queryKey as QueryKey,
52
- ...queryOptions as unknown as Omit<InfiniteQueryObserverOptions, "queryKey">
53
- }) as UseInfiniteQueryReturnType<TData, FindPetsByTags400> & {
54
- queryKey: TQueryKey;
55
- };
56
- query.queryKey = queryKey as TQueryKey;
57
- return query;
55
+ export function useFindPetsByTagsInfinite<
56
+ TData = InfiniteData<FindPetsByTagsQueryResponse>,
57
+ TQueryData = FindPetsByTagsQueryResponse,
58
+ TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey,
59
+ >(
60
+ headers: MaybeRef<FindPetsByTagsHeaderParams>,
61
+ params?: MaybeRef<FindPetsByTagsQueryParams>,
62
+ options: {
63
+ query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
64
+ client?: Partial<RequestConfig>
65
+ } = {},
66
+ ) {
67
+ const { query: queryOptions, client: config = {} } = options ?? {}
68
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
69
+
70
+ const query = useInfiniteQuery({
71
+ ...(findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions),
72
+ queryKey: queryKey as QueryKey,
73
+ ...(queryOptions as unknown as Omit<InfiniteQueryObserverOptions, 'queryKey'>),
74
+ }) as UseInfiniteQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
75
+
76
+ query.queryKey = queryKey as TQueryKey
77
+
78
+ return query
58
79
  }
@@ -1,52 +1,82 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "custom-query";
4
- import type { MaybeRef } from "vue";
5
- import { queryOptions, useQuery } from "custom-query";
6
- import { unref } from "vue";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from 'custom-query'
4
+ import type { MaybeRef } from 'vue'
5
+ import { queryOptions, useQuery } from 'custom-query'
6
+ import { unref } from 'vue'
7
7
 
8
- export const updatePetWithFormQueryKey = (petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>, data?: MaybeRef<UpdatePetWithFormMutationRequest>, params?: MaybeRef<UpdatePetWithFormQueryParams>) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const;
8
+ export const updatePetWithFormQueryKey = (
9
+ petId: MaybeRef<UpdatePetWithFormPathParams['petId']>,
10
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>,
11
+ params?: MaybeRef<UpdatePetWithFormQueryParams>,
12
+ ) => [{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const
9
13
 
10
- export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>;
14
+ export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>
11
15
 
12
- /**
16
+ /**
13
17
  * @summary Updates a pet in the store with form data
14
18
  * {@link /pet/:petId}
15
19
  */
16
- async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
17
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "POST", url: `/pet/${petId}`, params, data, ...config });
18
- return updatePetWithFormMutationResponse.parse(res.data);
20
+ async function updatePetWithForm(
21
+ petId: UpdatePetWithFormPathParams['petId'],
22
+ data?: UpdatePetWithFormMutationRequest,
23
+ params?: UpdatePetWithFormQueryParams,
24
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
25
+ ) {
26
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
27
+ method: 'POST',
28
+ url: `/pet/${petId}`,
29
+ params,
30
+ data,
31
+ ...config,
32
+ })
33
+ return updatePetWithFormMutationResponse.parse(res.data)
19
34
  }
20
35
 
21
- export function updatePetWithFormQueryOptions(petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>, data?: MaybeRef<UpdatePetWithFormMutationRequest>, params?: MaybeRef<UpdatePetWithFormQueryParams>, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
22
- const queryKey = updatePetWithFormQueryKey(petId, data, params);
23
- return queryOptions({
24
- enabled: !!(petId),
25
- queryKey,
26
- queryFn: async ({ signal }) => {
27
- config.signal = signal;
28
- return updatePetWithForm(unref(petId), unref(data), unref(params), unref(config));
29
- },
30
- });
36
+ export function updatePetWithFormQueryOptions(
37
+ petId: MaybeRef<UpdatePetWithFormPathParams['petId']>,
38
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>,
39
+ params?: MaybeRef<UpdatePetWithFormQueryParams>,
40
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
41
+ ) {
42
+ const queryKey = updatePetWithFormQueryKey(petId, data, params)
43
+ return queryOptions({
44
+ enabled: !!petId,
45
+ queryKey,
46
+ queryFn: async ({ signal }) => {
47
+ config.signal = signal
48
+ return updatePetWithForm(unref(petId), unref(data), unref(params), unref(config))
49
+ },
50
+ })
31
51
  }
32
52
 
33
- /**
53
+ /**
34
54
  * @summary Updates a pet in the store with form data
35
55
  * {@link /pet/:petId}
36
56
  */
37
- export function useUpdatePetWithForm<TData = UpdatePetWithFormMutationResponse, TQueryData = UpdatePetWithFormMutationResponse, TQueryKey extends QueryKey = UpdatePetWithFormQueryKey>(petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>, data?: MaybeRef<UpdatePetWithFormMutationRequest>, params?: MaybeRef<UpdatePetWithFormQueryParams>, options: {
38
- query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, TData, TQueryData, TQueryKey>>;
39
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
40
- } = {}) {
41
- const { query: queryOptions, client: config = {} } = options ?? {};
42
- const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params);
43
- const query = useQuery({
44
- ...updatePetWithFormQueryOptions(petId, data, params, config) as unknown as QueryObserverOptions,
45
- queryKey: queryKey as QueryKey,
46
- ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
47
- }) as UseQueryReturnType<TData, UpdatePetWithForm405> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- return query;
57
+ export function useUpdatePetWithForm<
58
+ TData = UpdatePetWithFormMutationResponse,
59
+ TQueryData = UpdatePetWithFormMutationResponse,
60
+ TQueryKey extends QueryKey = UpdatePetWithFormQueryKey,
61
+ >(
62
+ petId: MaybeRef<UpdatePetWithFormPathParams['petId']>,
63
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>,
64
+ params?: MaybeRef<UpdatePetWithFormQueryParams>,
65
+ options: {
66
+ query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, TData, TQueryData, TQueryKey>>
67
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
68
+ } = {},
69
+ ) {
70
+ const { query: queryOptions, client: config = {} } = options ?? {}
71
+ const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params)
72
+
73
+ const query = useQuery({
74
+ ...(updatePetWithFormQueryOptions(petId, data, params, config) as unknown as QueryObserverOptions),
75
+ queryKey: queryKey as QueryKey,
76
+ ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
77
+ }) as UseQueryReturnType<TData, UpdatePetWithForm405> & { queryKey: TQueryKey }
78
+
79
+ query.queryKey = queryKey as TQueryKey
80
+
81
+ return query
52
82
  }
@@ -1,45 +1,63 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { MutationObserverOptions } from "@tanstack/vue-query";
4
- import type { MaybeRef } from "vue";
5
- import { useMutation } from "@tanstack/vue-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { MutationObserverOptions } from '@tanstack/vue-query'
4
+ import type { MaybeRef } from 'vue'
5
+ import { useMutation } from '@tanstack/vue-query'
6
6
 
7
- export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const;
7
+ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
8
8
 
9
- export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>;
9
+ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
10
10
 
11
- /**
11
+ /**
12
12
  * @summary Updates a pet in the store with form data
13
13
  * {@link /pet/:petId}
14
14
  */
15
- async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
16
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "POST", url: `/pet/${petId}`, params, data, ...config });
17
- return updatePetWithFormMutationResponse.parse(res.data);
15
+ async function updatePetWithForm(
16
+ petId: UpdatePetWithFormPathParams['petId'],
17
+ data?: UpdatePetWithFormMutationRequest,
18
+ params?: UpdatePetWithFormQueryParams,
19
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
20
+ ) {
21
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
22
+ method: 'POST',
23
+ url: `/pet/${petId}`,
24
+ params,
25
+ data,
26
+ ...config,
27
+ })
28
+ return updatePetWithFormMutationResponse.parse(res.data)
18
29
  }
19
30
 
20
- /**
31
+ /**
21
32
  * @summary Updates a pet in the store with form data
22
33
  * {@link /pet/:petId}
23
34
  */
24
- export function useUpdatePetWithForm(options: {
25
- mutation?: MutationObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
26
- petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>;
27
- data?: MaybeRef<UpdatePetWithFormMutationRequest>;
28
- params?: MaybeRef<UpdatePetWithFormQueryParams>;
29
- }>;
30
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
31
- } = {}) {
32
- const { mutation: mutationOptions, client: config = {} } = options ?? {};
33
- const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey();
34
- return useMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
35
- petId: UpdatePetWithFormPathParams["petId"];
36
- data?: UpdatePetWithFormMutationRequest;
37
- params?: UpdatePetWithFormQueryParams;
38
- }>({
39
- mutationFn: async ({ petId, data, params }) => {
40
- return updatePetWithForm(petId, data, params, config);
41
- },
42
- mutationKey,
43
- ...mutationOptions
44
- });
35
+ export function useUpdatePetWithForm(
36
+ options: {
37
+ mutation?: MutationObserverOptions<
38
+ UpdatePetWithFormMutationResponse,
39
+ UpdatePetWithForm405,
40
+ {
41
+ petId: MaybeRef<UpdatePetWithFormPathParams['petId']>
42
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>
43
+ params?: MaybeRef<UpdatePetWithFormQueryParams>
44
+ }
45
+ >
46
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
47
+ } = {},
48
+ ) {
49
+ const { mutation: mutationOptions, client: config = {} } = options ?? {}
50
+ const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
51
+
52
+ return useMutation<
53
+ UpdatePetWithFormMutationResponse,
54
+ UpdatePetWithForm405,
55
+ { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams }
56
+ >({
57
+ mutationFn: async ({ petId, data, params }) => {
58
+ return updatePetWithForm(petId, data, params, config)
59
+ },
60
+ mutationKey,
61
+ ...mutationOptions,
62
+ })
45
63
  }
@@ -1,47 +1,63 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig } from "@kubb/plugin-client/client";
3
- import type { MutationObserverOptions } from "@tanstack/vue-query";
4
- import type { MaybeRef } from "vue";
5
- import { useMutation } from "@tanstack/vue-query";
1
+ import client from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
3
+ import type { MutationObserverOptions } from '@tanstack/vue-query'
4
+ import type { MaybeRef } from 'vue'
5
+ import { useMutation } from '@tanstack/vue-query'
6
6
 
7
- export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const;
7
+ export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
8
8
 
9
- export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>;
9
+ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
10
10
 
11
- /**
11
+ /**
12
12
  * @summary Updates a pet in the store with form data
13
13
  * {@link /pet/:petId}
14
14
  */
15
- async function updatePetWithForm({ petId }: {
16
- petId: UpdatePetWithFormPathParams["petId"];
17
- }, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
18
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "POST", url: `/pet/${petId}`, params, data, ...config });
19
- return updatePetWithFormMutationResponse.parse(res.data);
15
+ async function updatePetWithForm(
16
+ { petId }: { petId: UpdatePetWithFormPathParams['petId'] },
17
+ data?: UpdatePetWithFormMutationRequest,
18
+ params?: UpdatePetWithFormQueryParams,
19
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
20
+ ) {
21
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
22
+ method: 'POST',
23
+ url: `/pet/${petId}`,
24
+ params,
25
+ data,
26
+ ...config,
27
+ })
28
+ return updatePetWithFormMutationResponse.parse(res.data)
20
29
  }
21
30
 
22
- /**
31
+ /**
23
32
  * @summary Updates a pet in the store with form data
24
33
  * {@link /pet/:petId}
25
34
  */
26
- export function useUpdatePetWithForm(options: {
27
- mutation?: MutationObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
28
- petId: MaybeRef<UpdatePetWithFormPathParams["petId"]>;
29
- data?: MaybeRef<UpdatePetWithFormMutationRequest>;
30
- params?: MaybeRef<UpdatePetWithFormQueryParams>;
31
- }>;
32
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>;
33
- } = {}) {
34
- const { mutation: mutationOptions, client: config = {} } = options ?? {};
35
- const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey();
36
- return useMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, {
37
- petId: UpdatePetWithFormPathParams["petId"];
38
- data?: UpdatePetWithFormMutationRequest;
39
- params?: UpdatePetWithFormQueryParams;
40
- }>({
41
- mutationFn: async ({ petId, data, params }) => {
42
- return updatePetWithForm({ petId }, data, params, config);
43
- },
44
- mutationKey,
45
- ...mutationOptions
46
- });
35
+ export function useUpdatePetWithForm(
36
+ options: {
37
+ mutation?: MutationObserverOptions<
38
+ UpdatePetWithFormMutationResponse,
39
+ UpdatePetWithForm405,
40
+ {
41
+ petId: MaybeRef<UpdatePetWithFormPathParams['petId']>
42
+ data?: MaybeRef<UpdatePetWithFormMutationRequest>
43
+ params?: MaybeRef<UpdatePetWithFormQueryParams>
44
+ }
45
+ >
46
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
47
+ } = {},
48
+ ) {
49
+ const { mutation: mutationOptions, client: config = {} } = options ?? {}
50
+ const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
51
+
52
+ return useMutation<
53
+ UpdatePetWithFormMutationResponse,
54
+ UpdatePetWithForm405,
55
+ { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams }
56
+ >({
57
+ mutationFn: async ({ petId, data, params }) => {
58
+ return updatePetWithForm({ petId }, data, params, config)
59
+ },
60
+ mutationKey,
61
+ ...mutationOptions,
62
+ })
47
63
  }
package/src/plugin.ts CHANGED
@@ -40,7 +40,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
40
40
  options: {
41
41
  output,
42
42
  client: {
43
- importPath: '@kubb/plugin-client/client',
43
+ importPath: '@kubb/plugin-client/clients/axios',
44
44
  dataReturnType: 'data',
45
45
  pathParamsType: 'inline',
46
46
  ...options.client,