@kubb/plugin-client 3.0.0-alpha.9 → 3.0.0-beta.10

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 (72) hide show
  1. package/README.md +14 -5
  2. package/client.ts +29 -8
  3. package/dist/chunk-ILOAIN3U.cjs +231 -0
  4. package/dist/chunk-ILOAIN3U.cjs.map +1 -0
  5. package/dist/chunk-PHUXTZZT.js +159 -0
  6. package/dist/chunk-PHUXTZZT.js.map +1 -0
  7. package/dist/chunk-UBMTYBLG.cjs +162 -0
  8. package/dist/chunk-UBMTYBLG.cjs.map +1 -0
  9. package/dist/chunk-UOML26IJ.js +221 -0
  10. package/dist/chunk-UOML26IJ.js.map +1 -0
  11. package/dist/client.cjs +36 -10
  12. package/dist/client.cjs.map +1 -1
  13. package/dist/client.d.cts +10 -4
  14. package/dist/client.d.ts +10 -4
  15. package/dist/client.js +24 -10
  16. package/dist/client.js.map +1 -1
  17. package/dist/components.cjs +11 -5
  18. package/dist/components.cjs.map +1 -1
  19. package/dist/components.d.cts +39 -5
  20. package/dist/components.d.ts +39 -5
  21. package/dist/components.js +2 -9
  22. package/dist/components.js.map +1 -1
  23. package/dist/generators.cjs +17 -4
  24. package/dist/generators.cjs.map +1 -1
  25. package/dist/generators.d.cts +7 -6
  26. package/dist/generators.d.ts +7 -6
  27. package/dist/generators.js +3 -7
  28. package/dist/generators.js.map +1 -1
  29. package/dist/index.cjs +11 -109
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +1 -4
  32. package/dist/index.d.ts +1 -4
  33. package/dist/index.js +3 -114
  34. package/dist/index.js.map +1 -1
  35. package/dist/types-DMMK2qi5.d.cts +88 -0
  36. package/dist/types-DMMK2qi5.d.ts +88 -0
  37. package/package.json +14 -17
  38. package/src/components/Client.tsx +120 -60
  39. package/src/generators/__snapshots__/deletePet.ts +13 -0
  40. package/src/generators/__snapshots__/deletePetObject.ts +13 -0
  41. package/src/generators/__snapshots__/findByTags.ts +13 -0
  42. package/src/generators/__snapshots__/findByTagsFull.ts +13 -0
  43. package/src/generators/__snapshots__/findByTagsObject.ts +15 -0
  44. package/src/generators/__snapshots__/findByTagsWithZod.ts +13 -0
  45. package/src/generators/__snapshots__/findByTagsWithZodFull.ts +13 -0
  46. package/src/generators/__snapshots__/importPath.ts +13 -0
  47. package/src/generators/__snapshots__/operations.ts +82 -0
  48. package/src/generators/__snapshots__/updatePetById.ts +12 -0
  49. package/src/generators/clientGenerator.tsx +67 -0
  50. package/src/generators/groupedClientGenerator.tsx +70 -0
  51. package/src/generators/index.ts +3 -1
  52. package/src/generators/operationsGenerator.tsx +26 -0
  53. package/src/plugin.ts +37 -46
  54. package/src/types.ts +47 -87
  55. package/dist/chunk-AZDWYBLW.cjs +0 -1
  56. package/dist/chunk-AZDWYBLW.cjs.map +0 -1
  57. package/dist/chunk-GHHJWXKQ.cjs +0 -61
  58. package/dist/chunk-GHHJWXKQ.cjs.map +0 -1
  59. package/dist/chunk-OODSLPAP.js +0 -61
  60. package/dist/chunk-OODSLPAP.js.map +0 -1
  61. package/dist/chunk-W256NILH.js +0 -128
  62. package/dist/chunk-W256NILH.js.map +0 -1
  63. package/dist/chunk-YGRM4AA5.cjs +0 -128
  64. package/dist/chunk-YGRM4AA5.cjs.map +0 -1
  65. package/dist/chunk-YJOVLRSC.js +0 -1
  66. package/dist/chunk-YJOVLRSC.js.map +0 -1
  67. package/dist/types-DETYKDFZ.d.cts +0 -139
  68. package/dist/types-DETYKDFZ.d.ts +0 -139
  69. package/src/components/__snapshots__/Client/showPetById.ts +0 -8
  70. package/src/components/__snapshots__/Operations/showPetById.ts +0 -6
  71. package/src/components/__snapshots__/Query/showPetById.ts +0 -15
  72. package/src/generators/axiosGenerator.tsx +0 -63
@@ -0,0 +1,88 @@
1
+ import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
+ import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
3
+
4
+ type Options = {
5
+ /**
6
+ * Specify the export location for the files and define the behavior of the output
7
+ * @default { path: 'clients', barrelType: 'named' }
8
+ */
9
+ output?: Output;
10
+ /**
11
+ * Group the clients based on the provided name.
12
+ */
13
+ group?: Group;
14
+ /**
15
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
16
+ */
17
+ exclude?: Array<Exclude>;
18
+ /**
19
+ * Array containing include parameters to include tags/operations/methods/paths.
20
+ */
21
+ include?: Array<Include>;
22
+ /**
23
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
24
+ */
25
+ override?: Array<Override<ResolvedOptions>>;
26
+ /**
27
+ * Create `operations.ts` file with all operations grouped by methods.
28
+ * @default false
29
+ */
30
+ operations?: boolean;
31
+ /**
32
+ * Path to the client import path that will be used to do the API calls.
33
+ * It will be used as `import client from '${client.importPath}'`.
34
+ * It allows both relative and absolute path but be aware that we will not change the path.
35
+ * @default '@kubb/plugin-client/client'
36
+ */
37
+ importPath?: string;
38
+ /**
39
+ * ReturnType that will be used when calling the client.
40
+ * - 'data' will return ResponseConfig[data].
41
+ * - 'full' will return ResponseConfig.
42
+ * @default 'data'
43
+ */
44
+ dataReturnType?: 'data' | 'full';
45
+ /**
46
+ * How to pass your params
47
+ * - 'object' will return the params and pathParams as an object.
48
+ * - 'inline' will return the params as comma separated params.
49
+ * @default 'inline'
50
+ */
51
+ paramsType?: 'object' | 'inline';
52
+ /**
53
+ * How to pass your pathParams.
54
+ * - 'object' will return the pathParams as an object.
55
+ * - 'inline' will return the pathParams as comma separated params.
56
+ * @default 'inline'
57
+ */
58
+ pathParamsType?: 'object' | 'inline';
59
+ /**
60
+ * Which parser can be used before returning the data
61
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
62
+ * @default 'client'
63
+ */
64
+ parser?: 'client' | 'zod';
65
+ transformers?: {
66
+ /**
67
+ * Customize the names based on the type that is provided by the plugin.
68
+ */
69
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
70
+ };
71
+ /**
72
+ * Define some generators next to the client generators
73
+ */
74
+ generators?: Array<Generator<PluginClient>>;
75
+ };
76
+ type ResolvedOptions = {
77
+ output: Output;
78
+ group?: Options['group'];
79
+ baseURL: string | undefined;
80
+ parser: NonNullable<Options['parser']>;
81
+ importPath: NonNullable<Options['importPath']>;
82
+ dataReturnType: NonNullable<Options['dataReturnType']>;
83
+ pathParamsType: NonNullable<Options['pathParamsType']>;
84
+ paramsType: NonNullable<Options['paramsType']>;
85
+ };
86
+ type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
87
+
88
+ export type { Options as O, PluginClient as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "3.0.0-alpha.9",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "Generator plugin-client",
5
5
  "keywords": [
6
6
  "typescript",
@@ -72,27 +72,24 @@
72
72
  "!/**/__tests__/**"
73
73
  ],
74
74
  "dependencies": {
75
- "@kubb/core": "3.0.0-alpha.9",
76
- "@kubb/fs": "3.0.0-alpha.9",
77
- "@kubb/oas": "3.0.0-alpha.9",
78
- "@kubb/parser-ts": "3.0.0-alpha.9",
79
- "@kubb/plugin-oas": "3.0.0-alpha.9",
80
- "@kubb/plugin-ts": "3.0.0-alpha.9",
81
- "@kubb/react": "3.0.0-alpha.9"
75
+ "@kubb/core": "3.0.0-beta.10",
76
+ "@kubb/fs": "3.0.0-beta.10",
77
+ "@kubb/oas": "3.0.0-beta.10",
78
+ "@kubb/plugin-oas": "3.0.0-beta.10",
79
+ "@kubb/plugin-ts": "3.0.0-beta.10",
80
+ "@kubb/plugin-zod": "3.0.0-beta.10",
81
+ "@kubb/react": "3.0.0-beta.10"
82
82
  },
83
83
  "devDependencies": {
84
- "@types/react": "^18.3.4",
85
- "axios": "^1.7.5",
86
- "react": "^18.3.1",
87
- "tsup": "^8.2.4",
88
- "typescript": "^5.5.4",
89
- "@kubb/config-biome": "3.0.0-alpha.9",
90
- "@kubb/config-ts": "3.0.0-alpha.9",
91
- "@kubb/config-tsup": "3.0.0-alpha.9"
84
+ "axios": "^1.7.7",
85
+ "tsup": "^8.3.5",
86
+ "typescript": "^5.6.3",
87
+ "@kubb/config-ts": "3.0.0-beta.10",
88
+ "@kubb/config-tsup": "3.0.0-beta.10"
92
89
  },
93
90
  "peerDependencies": {
94
91
  "axios": "^1.7.2",
95
- "@kubb/react": "3.0.0-alpha.9"
92
+ "@kubb/react": "3.0.0-beta.10"
96
93
  },
97
94
  "peerDependenciesMeta": {
98
95
  "axios": {
@@ -3,8 +3,8 @@ import { URLPath } from '@kubb/core/utils'
3
3
  import { type Operation, isOptional } from '@kubb/oas'
4
4
  import type { OperationSchemas } from '@kubb/plugin-oas'
5
5
  import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
6
- import { File, Function, createParams } from '@kubb/react'
7
- import type { KubbNode, Params } from '@kubb/react/types'
6
+ import { File, Function, FunctionParams } from '@kubb/react'
7
+ import type { KubbNode } from '@kubb/react/types'
8
8
  import type { PluginClient } from '../types.ts'
9
9
 
10
10
  type Props = {
@@ -12,87 +12,147 @@ type Props = {
12
12
  * Name of the function
13
13
  */
14
14
  name: string
15
- options: PluginClient['resolvedOptions']
16
- typedSchemas: OperationSchemas
15
+ isExportable?: boolean
16
+ isIndexable?: boolean
17
+
18
+ baseURL: string | undefined
19
+ dataReturnType: PluginClient['resolvedOptions']['dataReturnType']
20
+ paramsType: PluginClient['resolvedOptions']['pathParamsType']
21
+ pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
22
+ parser: PluginClient['resolvedOptions']['parser'] | undefined
23
+ typeSchemas: OperationSchemas
24
+ zodSchemas: OperationSchemas | undefined
17
25
  operation: Operation
18
26
  }
19
27
 
20
- export function Client({ name, options, typedSchemas, operation }: Props): KubbNode {
21
- const contentType = operation.getContentType()
22
- const baseURL = options.client.importPath === '@kubb/plugin-client/client' ? options.baseURL : undefined
23
- const path = new URLPath(operation.path)
24
- const isFormData = contentType === 'multipart/form-data'
25
- const headers = [
26
- contentType !== 'application/json' ? `'Content-Type': '${contentType}'` : undefined,
27
- typedSchemas.headerParams?.name ? '...headers' : undefined,
28
- ].filter(Boolean)
28
+ type GetParamsProps = {
29
+ paramsType: PluginClient['resolvedOptions']['paramsType']
30
+ pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
31
+ typeSchemas: OperationSchemas
32
+ }
29
33
 
30
- const params = createParams({
31
- pathParams: {
32
- mode: options.pathParamsType === 'object' ? 'object' : 'inlineSpread',
33
- children: getPathParams(typedSchemas.pathParams, { typed: true }),
34
- },
35
- data: typedSchemas.request?.name
34
+ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) {
35
+ if (paramsType === 'object') {
36
+ return FunctionParams.factory({
37
+ data: {
38
+ mode: 'object',
39
+ children: {
40
+ ...getPathParams(typeSchemas.pathParams, { typed: true }),
41
+ data: typeSchemas.request?.name
42
+ ? {
43
+ type: typeSchemas.request?.name,
44
+ optional: isOptional(typeSchemas.request?.schema),
45
+ }
46
+ : undefined,
47
+ params: typeSchemas.queryParams?.name
48
+ ? {
49
+ type: typeSchemas.queryParams?.name,
50
+ optional: isOptional(typeSchemas.queryParams?.schema),
51
+ }
52
+ : undefined,
53
+ headers: typeSchemas.headerParams?.name
54
+ ? {
55
+ type: typeSchemas.headerParams?.name,
56
+ optional: isOptional(typeSchemas.headerParams?.schema),
57
+ }
58
+ : undefined,
59
+ },
60
+ },
61
+ config: {
62
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',
63
+ default: '{}',
64
+ },
65
+ })
66
+ }
67
+
68
+ return FunctionParams.factory({
69
+ pathParams: typeSchemas.pathParams?.name
36
70
  ? {
37
- type: typedSchemas.request?.name,
38
- optional: isOptional(typedSchemas.request?.schema),
71
+ mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
72
+ children: getPathParams(typeSchemas.pathParams, { typed: true }),
73
+ type: typeSchemas.pathParams?.name,
74
+ optional: isOptional(typeSchemas.pathParams?.schema),
39
75
  }
40
76
  : undefined,
41
- params: typedSchemas.queryParams?.name
77
+ data: typeSchemas.request?.name
42
78
  ? {
43
- type: typedSchemas.queryParams?.name,
44
- optional: isOptional(typedSchemas.queryParams?.schema),
79
+ type: typeSchemas.request?.name,
80
+ optional: isOptional(typeSchemas.request?.schema),
45
81
  }
46
82
  : undefined,
47
- headers: typedSchemas.headerParams?.name
83
+ params: typeSchemas.queryParams?.name
48
84
  ? {
49
- type: typedSchemas.headerParams?.name,
50
- optional: isOptional(typedSchemas.headerParams?.schema),
85
+ type: typeSchemas.queryParams?.name,
86
+ optional: isOptional(typeSchemas.queryParams?.schema),
51
87
  }
52
88
  : undefined,
53
- options: {
54
- type: 'Partial<Parameters<typeof client>[0]>',
89
+ headers: typeSchemas.headerParams?.name
90
+ ? {
91
+ type: typeSchemas.headerParams?.name,
92
+ optional: isOptional(typeSchemas.headerParams?.schema),
93
+ }
94
+ : undefined,
95
+ config: {
96
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',
55
97
  default: '{}',
56
98
  },
57
99
  })
100
+ }
58
101
 
59
- const clientParams = createParams({
60
- data: {
102
+ export function Client({
103
+ name,
104
+ isExportable = true,
105
+ isIndexable = true,
106
+ typeSchemas,
107
+ baseURL,
108
+ dataReturnType,
109
+ parser,
110
+ zodSchemas,
111
+ paramsType,
112
+ pathParamsType,
113
+ operation,
114
+ }: Props): KubbNode {
115
+ const path = new URLPath(operation.path)
116
+ const contentType = operation.getContentType()
117
+ const isFormData = contentType === 'multipart/form-data'
118
+ const headers = [
119
+ contentType !== 'application/json' ? `'Content-Type': '${contentType}'` : undefined,
120
+ typeSchemas.headerParams?.name ? '...headers' : undefined,
121
+ ].filter(Boolean)
122
+
123
+ const generics = [
124
+ typeSchemas.response.name,
125
+ typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error',
126
+ typeSchemas.request?.name || 'unknown',
127
+ ].filter(Boolean)
128
+ const params = getParams({ paramsType, pathParamsType, typeSchemas })
129
+ const clientParams = FunctionParams.factory({
130
+ config: {
61
131
  mode: 'object',
62
132
  children: {
63
133
  method: {
64
- type: 'string',
65
- value: JSON.stringify(operation.method),
134
+ value: JSON.stringify(operation.method.toUpperCase()),
66
135
  },
67
136
  url: {
68
- type: 'string',
69
137
  value: path.template,
70
138
  },
71
139
  baseURL: baseURL
72
140
  ? {
73
- type: 'string',
74
141
  value: JSON.stringify(baseURL),
75
142
  }
76
143
  : undefined,
77
- params: typedSchemas.queryParams?.name
144
+ params: typeSchemas.queryParams?.name ? {} : undefined,
145
+ data: typeSchemas.request?.name
78
146
  ? {
79
- type: 'any',
80
- }
81
- : undefined,
82
- data: typedSchemas.request?.name
83
- ? {
84
- type: 'any',
85
147
  value: isFormData ? 'formData' : undefined,
86
148
  }
87
149
  : undefined,
88
150
  headers: headers.length
89
151
  ? {
90
- type: 'any',
91
- value: headers.length ? `{ ${headers.join(', ')}, ...options.headers }` : undefined,
152
+ value: headers.length ? `{ ${headers.join(', ')}, ...config.headers }` : undefined,
92
153
  }
93
154
  : undefined,
94
- options: {
95
- type: 'any',
155
+ config: {
96
156
  mode: 'inlineSpread',
97
157
  },
98
158
  },
@@ -104,36 +164,36 @@ export function Client({ name, options, typedSchemas, operation }: Props): KubbN
104
164
  const formData = new FormData()
105
165
  if(data) {
106
166
  Object.keys(data).forEach((key) => {
107
- const value = data[key];
167
+ const value = data[key as keyof typeof data];
108
168
  if (typeof key === "string" && (typeof value === "string" || value instanceof Blob)) {
109
169
  formData.append(key, value);
110
170
  }
111
171
  })
112
172
  }
113
173
  `
114
- : undefined
174
+ : ''
115
175
 
116
176
  return (
117
- <File.Source name={name} isExportable isIndexable>
177
+ <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>
118
178
  <Function
119
179
  name={name}
120
180
  async
121
- export
122
- returnType={
123
- options.dataReturnType === 'data' ? `ResponseConfig<${typedSchemas.response.name}>["data"]` : `ResponseConfig<${typedSchemas.response.name}>`
124
- }
125
- params={params}
181
+ export={isExportable}
182
+ params={params.toConstructor()}
126
183
  JSDoc={{
127
184
  comments: getComments(operation),
128
185
  }}
129
186
  >
130
- {formData || ''}
131
- <Function.Call
132
- name="res"
133
- to={<Function name="client" async generics={[typedSchemas.response.name, typedSchemas.request?.name].filter(Boolean)} params={clientParams} />}
134
- />
135
- <Function.Return>{options.dataReturnType === 'data' ? 'res.data' : 'res'}</Function.Return>
187
+ {formData}
188
+ {`const res = await client<${generics.join(', ')}>(${clientParams.toCall()})`}
189
+ <br />
190
+ {dataReturnType === 'full' && parser === 'zod' && zodSchemas && `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`}
191
+ {dataReturnType === 'data' && parser === 'zod' && zodSchemas && `return ${zodSchemas.response.name}.parse(res.data)`}
192
+ {dataReturnType === 'full' && parser === 'client' && 'return res'}
193
+ {dataReturnType === 'data' && parser === 'client' && 'return res.data'}
136
194
  </Function>
137
195
  </File.Source>
138
196
  )
139
197
  }
198
+
199
+ Client.getParams = getParams
@@ -0,0 +1,13 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+
5
+ /**
6
+ * @description delete a pet
7
+ * @summary Deletes a pet
8
+ * @link /pet/:petId
9
+ */
10
+ export async function deletePet(petId: DeletePetPathParams["petId"], headers?: DeletePetHeaderParams, config: Partial<RequestConfig> = {}) {
11
+ const res = await client<DeletePetMutationResponse, DeletePet400, unknown>({ method: "DELETE", url: `/pet/${petId}`, headers: { ...headers, ...config.headers }, ...config });
12
+ return res.data;
13
+ }
@@ -0,0 +1,13 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+
5
+ /**
6
+ * @description delete a pet
7
+ * @summary Deletes a pet
8
+ * @link /pet/:petId
9
+ */
10
+ export async function deletePet({ petId }: DeletePetPathParams, headers?: DeletePetHeaderParams, config: Partial<RequestConfig> = {}) {
11
+ const res = await client<DeletePetMutationResponse, DeletePet400, unknown>({ method: "DELETE", url: `/pet/${petId}`, headers: { ...headers, ...config.headers }, ...config });
12
+ return res.data;
13
+ }
@@ -0,0 +1,13 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+
5
+ /**
6
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
7
+ * @summary Finds Pets by tags
8
+ * @link /pet/findByTags
9
+ */
10
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
11
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
12
+ return res.data;
13
+ }
@@ -0,0 +1,13 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+
5
+ /**
6
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
7
+ * @summary Finds Pets by tags
8
+ * @link /pet/findByTags
9
+ */
10
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
11
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
12
+ return res;
13
+ }
@@ -0,0 +1,15 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+
5
+ /**
6
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
7
+ * @summary Finds Pets by tags
8
+ * @link /pet/findByTags
9
+ */
10
+ export async function findPetsByTags({ params }: {
11
+ params?: FindPetsByTagsQueryParams;
12
+ }, config: Partial<RequestConfig> = {}) {
13
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
14
+ return res.data;
15
+ }
@@ -0,0 +1,13 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+
5
+ /**
6
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
7
+ * @summary Finds Pets by tags
8
+ * @link /pet/findByTags
9
+ */
10
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
11
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
12
+ return findPetsByTagsQueryResponse.parse(res.data);
13
+ }
@@ -0,0 +1,13 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+
5
+ /**
6
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
7
+ * @summary Finds Pets by tags
8
+ * @link /pet/findByTags
9
+ */
10
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
11
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
12
+ return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) };
13
+ }
@@ -0,0 +1,13 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "axios";
3
+ import type { RequestConfig } from "axios";
4
+
5
+ /**
6
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
7
+ * @summary Finds Pets by tags
8
+ * @link /pet/findByTags
9
+ */
10
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
11
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, ...config });
12
+ return res.data;
13
+ }
@@ -0,0 +1,82 @@
1
+ export const operations = {
2
+ "updatePet": {
3
+ "path": "/pet",
4
+ "method": "put"
5
+ },
6
+ "addPet": {
7
+ "path": "/pet",
8
+ "method": "post"
9
+ },
10
+ "findPetsByStatus": {
11
+ "path": "/pet/findByStatus",
12
+ "method": "get"
13
+ },
14
+ "findPetsByTags": {
15
+ "path": "/pet/findByTags",
16
+ "method": "get"
17
+ },
18
+ "getPetById": {
19
+ "path": "/pet/:petId",
20
+ "method": "get"
21
+ },
22
+ "updatePetWithForm": {
23
+ "path": "/pet/:petId",
24
+ "method": "post"
25
+ },
26
+ "deletePet": {
27
+ "path": "/pet/:petId",
28
+ "method": "delete"
29
+ },
30
+ "uploadFile": {
31
+ "path": "/pet/:petId/uploadImage",
32
+ "method": "post"
33
+ },
34
+ "getInventory": {
35
+ "path": "/store/inventory",
36
+ "method": "get"
37
+ },
38
+ "placeOrder": {
39
+ "path": "/store/order",
40
+ "method": "post"
41
+ },
42
+ "placeOrderPatch": {
43
+ "path": "/store/order",
44
+ "method": "patch"
45
+ },
46
+ "getOrderById": {
47
+ "path": "/store/order/:orderId",
48
+ "method": "get"
49
+ },
50
+ "deleteOrder": {
51
+ "path": "/store/order/:orderId",
52
+ "method": "delete"
53
+ },
54
+ "createUser": {
55
+ "path": "/user",
56
+ "method": "post"
57
+ },
58
+ "createUsersWithListInput": {
59
+ "path": "/user/createWithList",
60
+ "method": "post"
61
+ },
62
+ "loginUser": {
63
+ "path": "/user/login",
64
+ "method": "get"
65
+ },
66
+ "logoutUser": {
67
+ "path": "/user/logout",
68
+ "method": "get"
69
+ },
70
+ "getUserByName": {
71
+ "path": "/user/:username",
72
+ "method": "get"
73
+ },
74
+ "updateUser": {
75
+ "path": "/user/:username",
76
+ "method": "put"
77
+ },
78
+ "deleteUser": {
79
+ "path": "/user/:username",
80
+ "method": "delete"
81
+ }
82
+ } as const;
@@ -0,0 +1,12 @@
1
+ /* eslint-disable no-alert, no-console */
2
+ import client from "@kubb/plugin-client/client";
3
+ import type { RequestConfig } from "@kubb/plugin-client/client";
4
+
5
+ /**
6
+ * @summary Updates a pet in the store with form data
7
+ * @link /pet/:petId
8
+ */
9
+ export async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
10
+ const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, unknown>({ method: "POST", url: `/pet/${petId}`, params, ...config });
11
+ return res.data;
12
+ }