@kubb/plugin-solid-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 (43) hide show
  1. package/dist/{chunk-MJ5KIMWZ.cjs → chunk-DVSYWSJI.cjs} +11 -7
  2. package/dist/chunk-DVSYWSJI.cjs.map +1 -0
  3. package/dist/{chunk-EUTZZKJ3.cjs → chunk-JJUVLRTD.cjs} +31 -23
  4. package/dist/chunk-JJUVLRTD.cjs.map +1 -0
  5. package/dist/{chunk-FDSKHS3A.js → chunk-Y4R4BN3G.js} +31 -23
  6. package/dist/chunk-Y4R4BN3G.js.map +1 -0
  7. package/dist/{chunk-46JQ7CUT.js → chunk-ZROTVRZS.js} +7 -3
  8. package/dist/chunk-ZROTVRZS.js.map +1 -0
  9. package/dist/components.cjs +4 -4
  10. package/dist/components.d.cts +13 -7
  11. package/dist/components.d.ts +13 -7
  12. package/dist/components.js +1 -1
  13. package/dist/generators.cjs +3 -3
  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 +9 -7
  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 +7 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-Udob4Cmd.d.cts → types-CkeKuWIN.d.cts} +29 -2
  24. package/dist/{types-Udob4Cmd.d.ts → types-CkeKuWIN.d.ts} +29 -2
  25. package/package.json +11 -11
  26. package/src/components/Query.tsx +9 -3
  27. package/src/components/QueryKey.tsx +9 -6
  28. package/src/components/QueryOptions.tsx +9 -5
  29. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +50 -35
  30. package/src/generators/__snapshots__/clientGetImportPath.ts +50 -35
  31. package/src/generators/__snapshots__/findByTags.ts +50 -35
  32. package/src/generators/__snapshots__/findByTagsObject.ts +56 -45
  33. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +50 -35
  34. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +50 -35
  35. package/src/generators/__snapshots__/findByTagsWithZod.ts +50 -35
  36. package/src/generators/__snapshots__/postAsQuery.ts +67 -37
  37. package/src/generators/queryGenerator.tsx +4 -0
  38. package/src/plugin.ts +3 -1
  39. package/src/types.ts +7 -0
  40. package/dist/chunk-46JQ7CUT.js.map +0 -1
  41. package/dist/chunk-EUTZZKJ3.cjs.map +0 -1
  42. package/dist/chunk-FDSKHS3A.js.map +0 -1
  43. package/dist/chunk-MJ5KIMWZ.cjs.map +0 -1
@@ -33,7 +33,7 @@ type Options$2 = {
33
33
  * Path to the client import path that will be used to do the API calls.
34
34
  * It will be used as `import client from '${client.importPath}'`.
35
35
  * It allows both relative and absolute path but be aware that we will not change the path.
36
- * @default '@kubb/plugin-client/client'
36
+ * @default '@kubb/plugin-client/clients/axios'
37
37
  */
38
38
  importPath?: string;
39
39
  /**
@@ -47,6 +47,11 @@ type Options$2 = {
47
47
  * @default 'data'
48
48
  */
49
49
  dataReturnType?: 'data' | 'full';
50
+ /**
51
+ * How to style your params, by default no casing is applied
52
+ * - 'camelcase' will use camelcase for the params names
53
+ */
54
+ paramsCasing?: 'camelcase';
50
55
  /**
51
56
  * How to pass your params
52
57
  * - 'object' will return the params and pathParams as an object.
@@ -63,10 +68,17 @@ type Options$2 = {
63
68
  pathParamsType?: 'object' | 'inline';
64
69
  /**
65
70
  * Which parser can be used before returning the data
66
- * - 'zod' will use `@kubb/plugin-zod` to parse the data.
71
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
67
72
  * @default 'client'
68
73
  */
69
74
  parser?: 'client' | 'zod';
75
+ /**
76
+ * Which client should be used to do the HTTP calls
77
+ * - 'axios' will use `@kubb/plugin-client/clients/axios` to fetch data.
78
+ * - 'fetch' will use `@kubb/plugin-client/clients/fetch` to fetch data.
79
+ * @default 'axios'
80
+ */
81
+ client?: 'axios' | 'fetch';
70
82
  transformers?: {
71
83
  /**
72
84
  * Customize the names based on the type that is provided by the plugin.
@@ -87,12 +99,14 @@ type ResolvedOptions$2 = {
87
99
  dataReturnType: NonNullable<Options$2['dataReturnType']>;
88
100
  pathParamsType: NonNullable<Options$2['pathParamsType']>;
89
101
  paramsType: NonNullable<Options$2['paramsType']>;
102
+ paramsCasing: Options$2['paramsCasing'];
90
103
  };
91
104
  type PluginClient = PluginFactoryOptions<'plugin-client', Options$2, ResolvedOptions$2, never, ResolvePathOptions>;
92
105
 
93
106
  type TransformerProps$1 = {
94
107
  operation: Operation;
95
108
  schemas: OperationSchemas;
109
+ casing: 'camelcase' | undefined;
96
110
  };
97
111
  type Transformer$1 = (props: TransformerProps$1) => unknown[];
98
112
  type Suspense = object;
@@ -173,6 +187,11 @@ type Options$1 = {
173
187
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
174
188
  */
175
189
  override?: Array<Override<ResolvedOptions$1>>;
190
+ /**
191
+ * How to style your params, by default no casing is applied
192
+ * - 'camelcase' will use camelcase for the params names
193
+ */
194
+ paramsCasing?: 'camelcase';
176
195
  /**
177
196
  * How to pass your params
178
197
  * - 'object' will return the params and pathParams as an object.
@@ -229,6 +248,7 @@ type ResolvedOptions$1 = {
229
248
  };
230
249
  parser: Required<NonNullable<Options$1['parser']>>;
231
250
  pathParamsType: NonNullable<Options$1['pathParamsType']>;
251
+ paramsCasing: Options$1['paramsCasing'];
232
252
  paramsType: NonNullable<Options$1['paramsType']>;
233
253
  /**
234
254
  * Only used of infinite
@@ -245,6 +265,7 @@ type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options$1, Re
245
265
  type TransformerProps = {
246
266
  operation: Operation;
247
267
  schemas: OperationSchemas;
268
+ casing: 'camelcase' | undefined;
248
269
  };
249
270
  type Transformer = (props: TransformerProps) => unknown[];
250
271
  /**
@@ -289,6 +310,11 @@ type Options = {
289
310
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
290
311
  */
291
312
  override?: Array<Override<ResolvedOptions>>;
313
+ /**
314
+ * How to style your params, by default no casing is applied
315
+ * - 'camelcase' will use camelcase for the params names
316
+ */
317
+ paramsCasing?: 'camelcase';
292
318
  /**
293
319
  * How to pass your params
294
320
  * - 'object' will return the params and pathParams as an object.
@@ -331,6 +357,7 @@ type ResolvedOptions = {
331
357
  baseURL?: string;
332
358
  };
333
359
  parser: Required<NonNullable<Options['parser']>>;
360
+ paramsCasing: Options['paramsCasing'];
334
361
  paramsType: NonNullable<Options['paramsType']>;
335
362
  pathParamsType: NonNullable<Options['pathParamsType']>;
336
363
  queryKey: QueryKey | undefined;
@@ -33,7 +33,7 @@ type Options$2 = {
33
33
  * Path to the client import path that will be used to do the API calls.
34
34
  * It will be used as `import client from '${client.importPath}'`.
35
35
  * It allows both relative and absolute path but be aware that we will not change the path.
36
- * @default '@kubb/plugin-client/client'
36
+ * @default '@kubb/plugin-client/clients/axios'
37
37
  */
38
38
  importPath?: string;
39
39
  /**
@@ -47,6 +47,11 @@ type Options$2 = {
47
47
  * @default 'data'
48
48
  */
49
49
  dataReturnType?: 'data' | 'full';
50
+ /**
51
+ * How to style your params, by default no casing is applied
52
+ * - 'camelcase' will use camelcase for the params names
53
+ */
54
+ paramsCasing?: 'camelcase';
50
55
  /**
51
56
  * How to pass your params
52
57
  * - 'object' will return the params and pathParams as an object.
@@ -63,10 +68,17 @@ type Options$2 = {
63
68
  pathParamsType?: 'object' | 'inline';
64
69
  /**
65
70
  * Which parser can be used before returning the data
66
- * - 'zod' will use `@kubb/plugin-zod` to parse the data.
71
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
67
72
  * @default 'client'
68
73
  */
69
74
  parser?: 'client' | 'zod';
75
+ /**
76
+ * Which client should be used to do the HTTP calls
77
+ * - 'axios' will use `@kubb/plugin-client/clients/axios` to fetch data.
78
+ * - 'fetch' will use `@kubb/plugin-client/clients/fetch` to fetch data.
79
+ * @default 'axios'
80
+ */
81
+ client?: 'axios' | 'fetch';
70
82
  transformers?: {
71
83
  /**
72
84
  * Customize the names based on the type that is provided by the plugin.
@@ -87,12 +99,14 @@ type ResolvedOptions$2 = {
87
99
  dataReturnType: NonNullable<Options$2['dataReturnType']>;
88
100
  pathParamsType: NonNullable<Options$2['pathParamsType']>;
89
101
  paramsType: NonNullable<Options$2['paramsType']>;
102
+ paramsCasing: Options$2['paramsCasing'];
90
103
  };
91
104
  type PluginClient = PluginFactoryOptions<'plugin-client', Options$2, ResolvedOptions$2, never, ResolvePathOptions>;
92
105
 
93
106
  type TransformerProps$1 = {
94
107
  operation: Operation;
95
108
  schemas: OperationSchemas;
109
+ casing: 'camelcase' | undefined;
96
110
  };
97
111
  type Transformer$1 = (props: TransformerProps$1) => unknown[];
98
112
  type Suspense = object;
@@ -173,6 +187,11 @@ type Options$1 = {
173
187
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
174
188
  */
175
189
  override?: Array<Override<ResolvedOptions$1>>;
190
+ /**
191
+ * How to style your params, by default no casing is applied
192
+ * - 'camelcase' will use camelcase for the params names
193
+ */
194
+ paramsCasing?: 'camelcase';
176
195
  /**
177
196
  * How to pass your params
178
197
  * - 'object' will return the params and pathParams as an object.
@@ -229,6 +248,7 @@ type ResolvedOptions$1 = {
229
248
  };
230
249
  parser: Required<NonNullable<Options$1['parser']>>;
231
250
  pathParamsType: NonNullable<Options$1['pathParamsType']>;
251
+ paramsCasing: Options$1['paramsCasing'];
232
252
  paramsType: NonNullable<Options$1['paramsType']>;
233
253
  /**
234
254
  * Only used of infinite
@@ -245,6 +265,7 @@ type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options$1, Re
245
265
  type TransformerProps = {
246
266
  operation: Operation;
247
267
  schemas: OperationSchemas;
268
+ casing: 'camelcase' | undefined;
248
269
  };
249
270
  type Transformer = (props: TransformerProps) => unknown[];
250
271
  /**
@@ -289,6 +310,11 @@ type Options = {
289
310
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
290
311
  */
291
312
  override?: Array<Override<ResolvedOptions>>;
313
+ /**
314
+ * How to style your params, by default no casing is applied
315
+ * - 'camelcase' will use camelcase for the params names
316
+ */
317
+ paramsCasing?: 'camelcase';
292
318
  /**
293
319
  * How to pass your params
294
320
  * - 'object' will return the params and pathParams as an object.
@@ -331,6 +357,7 @@ type ResolvedOptions = {
331
357
  baseURL?: string;
332
358
  };
333
359
  parser: Required<NonNullable<Options['parser']>>;
360
+ paramsCasing: Options['paramsCasing'];
334
361
  paramsType: NonNullable<Options['paramsType']>;
335
362
  pathParamsType: NonNullable<Options['pathParamsType']>;
336
363
  queryKey: QueryKey | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-solid-query",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "Generator solid-query hooks",
5
5
  "keywords": [
6
6
  "faker",
@@ -63,21 +63,21 @@
63
63
  ],
64
64
  "dependencies": {
65
65
  "remeda": "^2.17.4",
66
- "@kubb/core": "3.1.0",
67
- "@kubb/fs": "3.1.0",
68
- "@kubb/oas": "3.1.0",
69
- "@kubb/plugin-oas": "3.1.0",
70
- "@kubb/plugin-ts": "3.1.0",
71
- "@kubb/plugin-zod": "3.1.0",
72
- "@kubb/react": "3.1.0"
66
+ "@kubb/core": "3.3.0",
67
+ "@kubb/fs": "3.3.0",
68
+ "@kubb/oas": "3.3.0",
69
+ "@kubb/plugin-oas": "3.3.0",
70
+ "@kubb/plugin-ts": "3.3.0",
71
+ "@kubb/plugin-zod": "3.3.0",
72
+ "@kubb/react": "3.3.0"
73
73
  },
74
74
  "devDependencies": {
75
- "@types/react": "^18.3.13",
75
+ "@types/react": "^18.3.16",
76
76
  "react": "^18.3.1",
77
77
  "tsup": "^8.3.5",
78
78
  "typescript": "^5.7.2",
79
- "@kubb/config-ts": "3.1.0",
80
- "@kubb/config-tsup": "3.1.0"
79
+ "@kubb/config-ts": "3.3.0",
80
+ "@kubb/config-tsup": "3.3.0"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@kubb/react": "^3.0.0"
@@ -18,19 +18,21 @@ type Props = {
18
18
  queryKeyTypeName: string
19
19
  typeSchemas: OperationSchemas
20
20
  operation: Operation
21
+ paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']
21
22
  paramsType: PluginSolidQuery['resolvedOptions']['paramsType']
22
23
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
23
24
  dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']
24
25
  }
25
26
 
26
27
  type GetParamsProps = {
28
+ paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']
27
29
  paramsType: PluginSolidQuery['resolvedOptions']['paramsType']
28
30
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
29
31
  dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']
30
32
  typeSchemas: OperationSchemas
31
33
  }
32
34
 
33
- function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
35
+ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
34
36
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
35
37
 
36
38
  if (paramsType === 'object') {
@@ -38,7 +40,7 @@ function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }:
38
40
  data: {
39
41
  mode: 'object',
40
42
  children: {
41
- ...getPathParams(typeSchemas.pathParams, { typed: true }),
43
+ ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
42
44
  data: typeSchemas.request?.name
43
45
  ? {
44
46
  type: typeSchemas.request?.name,
@@ -75,7 +77,7 @@ function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }:
75
77
  pathParams: typeSchemas.pathParams?.name
76
78
  ? {
77
79
  mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
78
- children: getPathParams(typeSchemas.pathParams, { typed: true }),
80
+ children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
79
81
  optional: isOptional(typeSchemas.pathParams?.schema),
80
82
  }
81
83
  : undefined,
@@ -114,6 +116,7 @@ export function Query({
114
116
  queryKeyTypeName,
115
117
  queryOptionsName,
116
118
  queryKeyName,
119
+ paramsCasing,
117
120
  paramsType,
118
121
  pathParamsType,
119
122
  dataReturnType,
@@ -127,13 +130,16 @@ export function Query({
127
130
  const queryKeyParams = QueryKey.getParams({
128
131
  pathParamsType,
129
132
  typeSchemas,
133
+ paramsCasing,
130
134
  })
131
135
  const queryOptionsParams = QueryOptions.getParams({
132
136
  paramsType,
137
+ paramsCasing,
133
138
  pathParamsType,
134
139
  typeSchemas,
135
140
  })
136
141
  const params = getParams({
142
+ paramsCasing,
137
143
  paramsType,
138
144
  pathParamsType,
139
145
  dataReturnType,
@@ -12,20 +12,22 @@ type Props = {
12
12
  typeName: string
13
13
  typeSchemas: OperationSchemas
14
14
  operation: Operation
15
+ paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']
15
16
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
16
17
  transformer: Transformer | undefined
17
18
  }
18
19
 
19
20
  type GetParamsProps = {
21
+ paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']
20
22
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
21
23
  typeSchemas: OperationSchemas
22
24
  }
23
25
 
24
- function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
26
+ function getParams({ pathParamsType, paramsCasing, typeSchemas }: GetParamsProps) {
25
27
  return FunctionParams.factory({
26
28
  pathParams: {
27
29
  mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
28
- children: getPathParams(typeSchemas.pathParams, { typed: true }),
30
+ children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
29
31
  },
30
32
  data: typeSchemas.request?.name
31
33
  ? {
@@ -42,8 +44,8 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
42
44
  })
43
45
  }
44
46
 
45
- const getTransformer: Transformer = ({ operation, schemas }) => {
46
- const path = new URLPath(operation.path)
47
+ const getTransformer: Transformer = ({ operation, schemas, casing }) => {
48
+ const path = new URLPath(operation.path, { casing })
47
49
  const keys = [
48
50
  path.toObject({
49
51
  type: 'path',
@@ -56,11 +58,12 @@ const getTransformer: Transformer = ({ operation, schemas }) => {
56
58
  return keys
57
59
  }
58
60
 
59
- export function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {
60
- const params = getParams({ pathParamsType, typeSchemas })
61
+ export function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {
62
+ const params = getParams({ pathParamsType, paramsCasing, typeSchemas })
61
63
  const keys = transformer({
62
64
  operation,
63
65
  schemas: typeSchemas,
66
+ casing: paramsCasing,
64
67
  })
65
68
 
66
69
  return (
@@ -14,23 +14,25 @@ type Props = {
14
14
  clientName: string
15
15
  queryKeyName: string
16
16
  typeSchemas: OperationSchemas
17
+ paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']
17
18
  paramsType: PluginSolidQuery['resolvedOptions']['paramsType']
18
19
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
19
20
  }
20
21
 
21
22
  type GetParamsProps = {
23
+ paramsCasing: PluginSolidQuery['resolvedOptions']['paramsCasing']
22
24
  paramsType: PluginSolidQuery['resolvedOptions']['paramsType']
23
25
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
24
26
  typeSchemas: OperationSchemas
25
27
  }
26
28
 
27
- function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) {
29
+ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {
28
30
  if (paramsType === 'object') {
29
31
  return FunctionParams.factory({
30
32
  data: {
31
33
  mode: 'object',
32
34
  children: {
33
- ...getPathParams(typeSchemas.pathParams, { typed: true }),
35
+ ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
34
36
  data: typeSchemas.request?.name
35
37
  ? {
36
38
  type: typeSchemas.request?.name,
@@ -62,7 +64,7 @@ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps)
62
64
  pathParams: typeSchemas.pathParams?.name
63
65
  ? {
64
66
  mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
65
- children: getPathParams(typeSchemas.pathParams, { typed: true }),
67
+ children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
66
68
  optional: isOptional(typeSchemas.pathParams?.schema),
67
69
  }
68
70
  : undefined,
@@ -91,15 +93,17 @@ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps)
91
93
  })
92
94
  }
93
95
 
94
- export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props): ReactNode {
95
- const params = getParams({ paramsType, pathParamsType, typeSchemas })
96
+ export function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }: Props): ReactNode {
97
+ const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })
96
98
  const clientParams = Client.getParams({
99
+ paramsCasing,
97
100
  typeSchemas,
98
101
  paramsType,
99
102
  pathParamsType,
100
103
  })
101
104
  const queryKeyParams = QueryKey.getParams({
102
105
  pathParamsType,
106
+ paramsCasing,
103
107
  typeSchemas,
104
108
  })
105
109
 
@@ -1,52 +1,67 @@
1
- import client from "@kubb/plugin-client/client";
2
- import type { RequestConfig, ResponseConfig } 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, ResponseConfig } 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 { ...res, data: 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 { ...res, data: 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 = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, options: {
37
- query?: Partial<CreateBaseQueryOptions<ResponseConfig<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
- initialData: null,
46
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
47
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- return query;
42
+ export function createFindPetsByTags<
43
+ TData = ResponseConfig<FindPetsByTagsQueryResponse>,
44
+ TQueryData = ResponseConfig<FindPetsByTagsQueryResponse>,
45
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
46
+ >(
47
+ headers: FindPetsByTagsHeaderParams,
48
+ params?: FindPetsByTagsQueryParams,
49
+ options: {
50
+ query?: Partial<CreateBaseQueryOptions<ResponseConfig<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
+ initialData: null,
61
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
62
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
63
+
64
+ query.queryKey = queryKey as TQueryKey
65
+
66
+ return query
52
67
  }
@@ -1,52 +1,67 @@
1
- import client from "axios";
2
- import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query";
3
- import type { RequestConfig } from "axios";
4
- import { queryOptions, createQuery } from "@tanstack/svelte-query";
1
+ import client from 'axios'
2
+ import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
3
+ import type { RequestConfig } from 'axios'
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
- initialData: null,
46
- ...queryOptions as unknown as Omit<CreateBaseQueryOptions, "queryKey">
47
- })) as CreateQueryResult<TData, FindPetsByTags400> & {
48
- queryKey: TQueryKey;
49
- };
50
- query.queryKey = queryKey as TQueryKey;
51
- 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
+ initialData: null,
61
+ ...(queryOptions as unknown as Omit<CreateBaseQueryOptions, 'queryKey'>),
62
+ })) as CreateQueryResult<TData, FindPetsByTags400> & { queryKey: TQueryKey }
63
+
64
+ query.queryKey = queryKey as TQueryKey
65
+
66
+ return query
52
67
  }