@kubb/plugin-solid-query 4.29.1 → 4.31.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,74 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import fetch from 'axios'
6
- import type { UseMutationOptions, QueryClient } from '@tanstack/solid-query'
7
- import type { Client, RequestConfig, ResponseErrorConfig } from 'axios'
8
- import { useMutation } from '@tanstack/solid-query'
9
-
10
- export const updatePetWithFormMutationKey = () => [{ url: '/pet/:petId' }] as const
11
-
12
- export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
13
-
14
- /**
15
- * @summary Updates a pet in the store with form data
16
- * {@link /pet/:petId}
17
- */
18
- export async function updatePetWithForm(
19
- petId: UpdatePetWithFormPathParams['petId'],
20
- data?: UpdatePetWithFormMutationRequest,
21
- params?: UpdatePetWithFormQueryParams,
22
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const requestData = updatePetWithFormMutationRequest.parse(data)
27
-
28
- const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
29
- method: 'POST',
30
- url: `/pet/${petId}`,
31
- params,
32
- data: requestData,
33
- ...requestConfig,
34
- })
35
- return updatePetWithFormMutationResponse.parse(res.data)
36
- }
37
-
38
- /**
39
- * @summary Updates a pet in the store with form data
40
- * {@link /pet/:petId}
41
- */
42
- export function useUpdatePetWithForm<TContext>(
43
- options: {
44
- mutation?: ReturnType<
45
- UseMutationOptions<
46
- UpdatePetWithFormMutationResponse,
47
- ResponseErrorConfig<UpdatePetWithForm405>,
48
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
49
- TContext
50
- >
51
- > & { client?: QueryClient }
52
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
53
- } = {},
54
- ) {
55
- const { mutation = {}, client: config = {} } = options ?? {}
56
- const { client: queryClient, ...mutationOptions } = mutation
57
- const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
58
-
59
- return useMutation<
60
- UpdatePetWithFormMutationResponse,
61
- ResponseErrorConfig<UpdatePetWithForm405>,
62
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
63
- TContext
64
- >(
65
- () => ({
66
- mutationFn: async ({ petId, data, params }) => {
67
- return updatePetWithForm(petId, data, params, config)
68
- },
69
- mutationKey,
70
- ...mutationOptions,
71
- }),
72
- queryClient ? () => queryClient : undefined,
73
- )
74
- }
@@ -1,87 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import fetch from '@kubb/plugin-client/clients/axios'
6
- import type { Client, RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
- import type { QueryKey, QueryClient, UseBaseQueryOptions, UseQueryResult } from '@tanstack/svelte-query'
8
- import { queryOptions, useQuery } from '@tanstack/svelte-query'
9
-
10
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- params,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return findPetsByTagsQueryResponse.parse(res.data)
34
- }
35
-
36
- export function findPetsByTagsQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsQueryKey(params)
42
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
43
- queryKey,
44
- queryFn: async ({ signal }) => {
45
- if (!config.signal) {
46
- config.signal = signal
47
- }
48
- return findPetsByTags(headers, params, config)
49
- },
50
- })
51
- }
52
-
53
- /**
54
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
55
- * @summary Finds Pets by tags
56
- * {@link /pet/findByTags}
57
- */
58
- export function createFindPetsByTags<
59
- TData = FindPetsByTagsQueryResponse,
60
- TQueryData = FindPetsByTagsQueryResponse,
61
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
62
- >(
63
- headers: FindPetsByTagsHeaderParams,
64
- params?: FindPetsByTagsQueryParams,
65
- options: {
66
- query?: Partial<UseBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
67
- client?: QueryClient
68
- }
69
- client?: Partial<RequestConfig> & { client?: Client }
70
- } = {},
71
- ) {
72
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
73
- const { client: queryClient, ...queryOptions } = queryConfig
74
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
75
-
76
- const query = useQuery(
77
- () => ({
78
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as UseBaseQueryOptions),
79
- queryKey,
80
- initialData: null,
81
- ...(queryOptions as unknown as Omit<UseBaseQueryOptions, 'queryKey'>),
82
- }),
83
- queryClient ? () => queryClient : undefined,
84
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
85
-
86
- return query
87
- }
@@ -1,84 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import fetch from '@kubb/plugin-client/clients/axios'
6
- import type { Client, RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
- import type { QueryKey, QueryClient, UseBaseQueryOptions, UseQueryResult } from '@tanstack/svelte-query'
8
- import { queryOptions, useQuery } from '@tanstack/svelte-query'
9
-
10
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(
20
- { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
21
- config: Partial<RequestConfig> & { client?: Client } = {},
22
- ) {
23
- const { client: request = fetch, ...requestConfig } = config
24
-
25
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
26
- method: 'GET',
27
- url: `/pet/findByTags`,
28
- params,
29
- ...requestConfig,
30
- headers: { ...headers, ...requestConfig.headers },
31
- })
32
- return findPetsByTagsQueryResponse.parse(res.data)
33
- }
34
-
35
- export function findPetsByTagsQueryOptions(
36
- { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
37
- config: Partial<RequestConfig> & { client?: Client } = {},
38
- ) {
39
- const queryKey = findPetsByTagsQueryKey(params)
40
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
41
- queryKey,
42
- queryFn: async ({ signal }) => {
43
- if (!config.signal) {
44
- config.signal = signal
45
- }
46
- return findPetsByTags({ headers, params }, config)
47
- },
48
- })
49
- }
50
-
51
- /**
52
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
53
- * @summary Finds Pets by tags
54
- * {@link /pet/findByTags}
55
- */
56
- export function createFindPetsByTags<
57
- TData = FindPetsByTagsQueryResponse,
58
- TQueryData = FindPetsByTagsQueryResponse,
59
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
60
- >(
61
- { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
62
- options: {
63
- query?: Partial<UseBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
64
- client?: QueryClient
65
- }
66
- client?: Partial<RequestConfig> & { client?: Client }
67
- } = {},
68
- ) {
69
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
70
- const { client: queryClient, ...queryOptions } = queryConfig
71
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
72
-
73
- const query = useQuery(
74
- () => ({
75
- ...(findPetsByTagsQueryOptions({ headers, params }, config) as unknown as UseBaseQueryOptions),
76
- queryKey,
77
- initialData: null,
78
- ...(queryOptions as unknown as Omit<UseBaseQueryOptions, 'queryKey'>),
79
- }),
80
- queryClient ? () => queryClient : undefined,
81
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
82
-
83
- return query
84
- }
@@ -1,87 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import fetch from '@kubb/plugin-client/clients/axios'
6
- import type { Client, RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
- import type { QueryKey, QueryClient, UseBaseQueryOptions, UseQueryResult } from '@tanstack/svelte-query'
8
- import { queryOptions, useQuery } from '@tanstack/svelte-query'
9
-
10
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- params,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return findPetsByTagsQueryResponse.parse(res.data)
34
- }
35
-
36
- export function findPetsByTagsQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsQueryKey(params)
42
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
43
- queryKey,
44
- queryFn: async ({ signal }) => {
45
- if (!config.signal) {
46
- config.signal = signal
47
- }
48
- return findPetsByTags(headers, params, config)
49
- },
50
- })
51
- }
52
-
53
- /**
54
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
55
- * @summary Finds Pets by tags
56
- * {@link /pet/findByTags}
57
- */
58
- export function createFindPetsByTags<
59
- TData = FindPetsByTagsQueryResponse,
60
- TQueryData = FindPetsByTagsQueryResponse,
61
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
62
- >(
63
- headers: FindPetsByTagsHeaderParams,
64
- params?: FindPetsByTagsQueryParams,
65
- options: {
66
- query?: Partial<UseBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
67
- client?: QueryClient
68
- }
69
- client?: Partial<RequestConfig> & { client?: Client }
70
- } = {},
71
- ) {
72
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
73
- const { client: queryClient, ...queryOptions } = queryConfig
74
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
75
-
76
- const query = useQuery(
77
- () => ({
78
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as UseBaseQueryOptions),
79
- queryKey,
80
- initialData: null,
81
- ...(queryOptions as unknown as Omit<UseBaseQueryOptions, 'queryKey'>),
82
- }),
83
- queryClient ? () => queryClient : undefined,
84
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
85
-
86
- return query
87
- }
@@ -1,88 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
- import type { QueryKey, QueryClient, UseBaseQueryOptions, UseQueryResult } from '@tanstack/svelte-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { queryOptions, useQuery } from '@tanstack/svelte-query'
9
-
10
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- baseURL: `${123456}`,
30
- params,
31
- ...requestConfig,
32
- headers: { ...headers, ...requestConfig.headers },
33
- })
34
- return findPetsByTagsQueryResponse.parse(res.data)
35
- }
36
-
37
- export function findPetsByTagsQueryOptions(
38
- headers: FindPetsByTagsHeaderParams,
39
- params?: FindPetsByTagsQueryParams,
40
- config: Partial<RequestConfig> & { client?: Client } = {},
41
- ) {
42
- const queryKey = findPetsByTagsQueryKey(params)
43
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
44
- queryKey,
45
- queryFn: async ({ signal }) => {
46
- if (!config.signal) {
47
- config.signal = signal
48
- }
49
- return findPetsByTags(headers, params, config)
50
- },
51
- })
52
- }
53
-
54
- /**
55
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
56
- * @summary Finds Pets by tags
57
- * {@link /pet/findByTags}
58
- */
59
- export function createFindPetsByTags<
60
- TData = FindPetsByTagsQueryResponse,
61
- TQueryData = FindPetsByTagsQueryResponse,
62
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
63
- >(
64
- headers: FindPetsByTagsHeaderParams,
65
- params?: FindPetsByTagsQueryParams,
66
- options: {
67
- query?: Partial<UseBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
68
- client?: QueryClient
69
- }
70
- client?: Partial<RequestConfig> & { client?: Client }
71
- } = {},
72
- ) {
73
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
74
- const { client: queryClient, ...queryOptions } = queryConfig
75
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
76
-
77
- const query = useQuery(
78
- () => ({
79
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as UseBaseQueryOptions),
80
- queryKey,
81
- initialData: null,
82
- ...(queryOptions as unknown as Omit<UseBaseQueryOptions, 'queryKey'>),
83
- }),
84
- queryClient ? () => queryClient : undefined,
85
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
86
-
87
- return query
88
- }
@@ -1,87 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import fetch from '@kubb/plugin-client/clients/axios'
6
- import type { Client, RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
- import type { QueryKey, QueryClient, UseBaseQueryOptions, UseQueryResult } from '@tanstack/react-query'
8
- import { queryOptions, useQuery } from '@tanstack/react-query'
9
-
10
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => ['test', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- params,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return findPetsByTagsQueryResponse.parse(res.data)
34
- }
35
-
36
- export function findPetsByTagsQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsQueryKey(params)
42
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
43
- queryKey,
44
- queryFn: async ({ signal }) => {
45
- if (!config.signal) {
46
- config.signal = signal
47
- }
48
- return findPetsByTags(headers, params, config)
49
- },
50
- })
51
- }
52
-
53
- /**
54
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
55
- * @summary Finds Pets by tags
56
- * {@link /pet/findByTags}
57
- */
58
- export function createFindPetsByTags<
59
- TData = FindPetsByTagsQueryResponse,
60
- TQueryData = FindPetsByTagsQueryResponse,
61
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
62
- >(
63
- headers: FindPetsByTagsHeaderParams,
64
- params?: FindPetsByTagsQueryParams,
65
- options: {
66
- query?: Partial<UseBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
67
- client?: QueryClient
68
- }
69
- client?: Partial<RequestConfig> & { client?: Client }
70
- } = {},
71
- ) {
72
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
73
- const { client: queryClient, ...queryOptions } = queryConfig
74
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
75
-
76
- const query = useQuery(
77
- () => ({
78
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as UseBaseQueryOptions),
79
- queryKey,
80
- initialData: null,
81
- ...(queryOptions as unknown as Omit<UseBaseQueryOptions, 'queryKey'>),
82
- }),
83
- queryClient ? () => queryClient : undefined,
84
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
85
-
86
- return query
87
- }
@@ -1,87 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import fetch from '@kubb/plugin-client/clients/axios'
6
- import type { Client, RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
- import type { QueryKey, QueryClient, UseBaseQueryOptions, UseQueryResult } from '@tanstack/svelte-query'
8
- import { queryOptions, useQuery } from '@tanstack/svelte-query'
9
-
10
- export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
11
-
12
- export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(
20
- headers: FindPetsByTagsHeaderParams,
21
- params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
- method: 'GET',
28
- url: `/pet/findByTags`,
29
- params,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return findPetsByTagsQueryResponse.parse(res.data)
34
- }
35
-
36
- export function findPetsByTagsQueryOptions(
37
- headers: FindPetsByTagsHeaderParams,
38
- params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: Client } = {},
40
- ) {
41
- const queryKey = findPetsByTagsQueryKey(params)
42
- return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
43
- queryKey,
44
- queryFn: async ({ signal }) => {
45
- if (!config.signal) {
46
- config.signal = signal
47
- }
48
- return findPetsByTags(headers, params, config)
49
- },
50
- })
51
- }
52
-
53
- /**
54
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
55
- * @summary Finds Pets by tags
56
- * {@link /pet/findByTags}
57
- */
58
- export function createFindPetsByTags<
59
- TData = FindPetsByTagsQueryResponse,
60
- TQueryData = FindPetsByTagsQueryResponse,
61
- TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
62
- >(
63
- headers: FindPetsByTagsHeaderParams,
64
- params?: FindPetsByTagsQueryParams,
65
- options: {
66
- query?: Partial<UseBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
67
- client?: QueryClient
68
- }
69
- client?: Partial<RequestConfig> & { client?: Client }
70
- } = {},
71
- ) {
72
- const { query: queryConfig = {}, client: config = {} } = options ?? {}
73
- const { client: queryClient, ...queryOptions } = queryConfig
74
- const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
75
-
76
- const query = useQuery(
77
- () => ({
78
- ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as UseBaseQueryOptions),
79
- queryKey,
80
- initialData: null,
81
- ...(queryOptions as unknown as Omit<UseBaseQueryOptions, 'queryKey'>),
82
- }),
83
- queryClient ? () => queryClient : undefined,
84
- ) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
85
-
86
- return query
87
- }