@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.
- package/dist/{chunk-TOBORUCM.js → chunk-BB5SCJJT.js} +10 -3
- package/dist/chunk-BB5SCJJT.js.map +1 -0
- package/dist/{chunk-F6TRULM6.cjs → chunk-DJNDGHXY.cjs} +17 -10
- package/dist/chunk-DJNDGHXY.cjs.map +1 -0
- package/dist/{chunk-SP3FM442.js → chunk-EZRBBWGF.js} +50 -30
- package/dist/chunk-EZRBBWGF.js.map +1 -0
- package/dist/{chunk-PHEQCKJY.cjs → chunk-YSVAGB5Y.cjs} +50 -30
- package/dist/chunk-YSVAGB5Y.cjs.map +1 -0
- package/dist/components.cjs +6 -6
- package/dist/components.d.cts +17 -9
- package/dist/components.d.ts +17 -9
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +8 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-BxGtUnah.d.ts → types-CdgT4Eeh.d.cts} +29 -2
- package/dist/{types-BxGtUnah.d.cts → types-CdgT4Eeh.d.ts} +29 -2
- package/package.json +11 -11
- package/src/components/Mutation.tsx +18 -4
- package/src/components/MutationKey.tsx +5 -4
- package/src/components/Query.tsx +9 -3
- package/src/components/QueryKey.tsx +9 -6
- package/src/components/QueryOptions.tsx +9 -5
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +49 -34
- package/src/generators/__snapshots__/clientGetImportPath.ts +49 -34
- package/src/generators/__snapshots__/clientPostImportPath.ts +46 -32
- package/src/generators/__snapshots__/findByTags.ts +49 -34
- package/src/generators/__snapshots__/findByTagsObject.ts +55 -44
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +49 -34
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +49 -34
- package/src/generators/__snapshots__/findByTagsWithZod.ts +49 -34
- package/src/generators/__snapshots__/postAsQuery.ts +66 -36
- package/src/generators/__snapshots__/updatePetById.ts +46 -32
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +46 -34
- package/src/generators/mutationGenerator.tsx +3 -0
- package/src/generators/queryGenerator.tsx +4 -0
- package/src/plugin.ts +3 -1
- package/src/types.ts +7 -0
- package/dist/chunk-F6TRULM6.cjs.map +0 -1
- package/dist/chunk-PHEQCKJY.cjs.map +0 -1
- package/dist/chunk-SP3FM442.js.map +0 -1
- package/dist/chunk-TOBORUCM.js.map +0 -1
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
import client from
|
|
2
|
-
import type { RequestConfig } from
|
|
3
|
-
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from
|
|
4
|
-
import { queryOptions, createQuery } from
|
|
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
|
-
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
7
7
|
|
|
8
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
2
|
-
import type { RequestConfig } from
|
|
3
|
-
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from
|
|
4
|
-
import { queryOptions, createQuery } from
|
|
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
|
-
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
7
7
|
|
|
8
|
-
|
|
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(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
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
|
|
2
|
-
import type { RequestConfig } from
|
|
3
|
-
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from
|
|
4
|
-
import { queryOptions, createQuery } from
|
|
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
|
-
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
7
7
|
|
|
8
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
2
|
-
import type { RequestConfig } from
|
|
3
|
-
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from
|
|
4
|
-
import { queryOptions, createQuery } from
|
|
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
|
-
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => ['test', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
7
7
|
|
|
8
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
2
|
-
import type { RequestConfig } from
|
|
3
|
-
import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from
|
|
4
|
-
import { queryOptions, createQuery } from
|
|
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
|
-
|
|
6
|
+
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
7
7
|
|
|
8
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
}
|