@kubb/plugin-client 3.0.0-alpha.8 → 3.0.0-beta.1

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 (64) hide show
  1. package/README.md +14 -5
  2. package/client.ts +2 -2
  3. package/dist/chunk-6W3SC7JK.cjs +228 -0
  4. package/dist/chunk-6W3SC7JK.cjs.map +1 -0
  5. package/dist/chunk-LI44LDXH.js +218 -0
  6. package/dist/chunk-LI44LDXH.js.map +1 -0
  7. package/dist/chunk-X73EA6RA.cjs +133 -0
  8. package/dist/chunk-X73EA6RA.cjs.map +1 -0
  9. package/dist/chunk-YYBNZBCI.js +130 -0
  10. package/dist/chunk-YYBNZBCI.js.map +1 -0
  11. package/dist/client.cjs +16 -7
  12. package/dist/client.cjs.map +1 -1
  13. package/dist/client.d.cts +2 -2
  14. package/dist/client.d.ts +2 -2
  15. package/dist/client.js +5 -6
  16. package/dist/client.js.map +1 -1
  17. package/dist/components.cjs +11 -4
  18. package/dist/components.cjs.map +1 -1
  19. package/dist/components.d.cts +37 -7
  20. package/dist/components.d.ts +37 -7
  21. package/dist/components.js +2 -8
  22. package/dist/components.js.map +1 -1
  23. package/dist/generators.cjs +21 -0
  24. package/dist/generators.cjs.map +1 -0
  25. package/dist/generators.d.cts +11 -0
  26. package/dist/generators.d.ts +11 -0
  27. package/dist/generators.js +4 -0
  28. package/dist/generators.js.map +1 -0
  29. package/dist/index.cjs +10 -128
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +1 -6
  32. package/dist/index.d.ts +1 -6
  33. package/dist/index.js +3 -134
  34. package/dist/index.js.map +1 -1
  35. package/dist/types-Bk_NZurp.d.cts +86 -0
  36. package/dist/types-Bk_NZurp.d.ts +86 -0
  37. package/package.json +22 -17
  38. package/src/components/Client.tsx +109 -208
  39. package/src/components/Operations.tsx +5 -71
  40. package/src/generators/__snapshots__/deletePet.ts +13 -0
  41. package/src/generators/__snapshots__/deletePetObject.ts +15 -0
  42. package/src/generators/__snapshots__/findByTags.ts +13 -0
  43. package/src/generators/__snapshots__/findByTagsFull.ts +13 -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 +66 -0
  50. package/src/generators/groupedClientGenerator.tsx +70 -0
  51. package/src/generators/index.ts +3 -0
  52. package/src/generators/operationsGenerator.tsx +26 -0
  53. package/src/plugin.ts +34 -45
  54. package/src/types.ts +33 -75
  55. package/dist/chunk-E562RKCC.js +0 -199
  56. package/dist/chunk-E562RKCC.js.map +0 -1
  57. package/dist/chunk-PXA2JOEN.cjs +0 -199
  58. package/dist/chunk-PXA2JOEN.cjs.map +0 -1
  59. package/dist/types-C_-LImV-.d.cts +0 -233
  60. package/dist/types-C_-LImV-.d.ts +0 -233
  61. package/src/OperationGenerator.tsx +0 -29
  62. package/src/components/__snapshots__/Client/showPetById.ts +0 -8
  63. package/src/components/__snapshots__/Operations/showPetById.ts +0 -6
  64. package/src/components/__snapshots__/Query/showPetById.ts +0 -15
@@ -1,258 +1,159 @@
1
1
  import { URLPath } from '@kubb/core/utils'
2
- import { File, Function, useApp } from '@kubb/react'
3
- import { pluginTsName } from '@kubb/plugin-ts'
4
- import { useOperation, useOperationManager } from '@kubb/plugin-oas/hooks'
5
- import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
6
2
 
7
- import { isOptional } from '@kubb/oas'
8
- import type { HttpMethod } from '@kubb/oas'
9
- import type { KubbNode, Params } from '@kubb/react/types'
10
- import type { ComponentProps, ComponentType } from 'react'
11
- import type { FileMeta, PluginClient } from '../types.ts'
3
+ import { type Operation, isOptional } from '@kubb/oas'
4
+ import type { OperationSchemas } from '@kubb/plugin-oas'
5
+ import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
6
+ import { File, Function, FunctionParams } from '@kubb/react'
7
+ import type { KubbNode } from '@kubb/react/types'
8
+ import type { PluginClient } from '../types.ts'
12
9
 
13
- type TemplateProps = {
10
+ type Props = {
14
11
  /**
15
12
  * Name of the function
16
13
  */
17
14
  name: string
18
- /**
19
- * Parameters/options/props that need to be used
20
- */
21
- params: Params
22
- /**
23
- * Generics that needs to be added for TypeScript
24
- */
25
- generics?: string
26
- /**
27
- * ReturnType(see async for adding Promise type)
28
- */
29
- returnType?: string
30
- /**
31
- * Options for JSdocs
32
- */
33
- JSDoc?: {
34
- comments: string[]
35
- }
36
- client: {
37
- baseURL: string | undefined
38
- generics: string | string[]
39
- method: HttpMethod
40
- path: URLPath
41
- dataReturnType: PluginClient['options']['dataReturnType']
42
- withQueryParams: boolean
43
- withData: boolean
44
- withHeaders: boolean
45
- contentType: string
46
- }
15
+ isExportable?: boolean
16
+ isIndexable?: boolean
17
+
18
+ baseURL: string | undefined
19
+ dataReturnType: PluginClient['resolvedOptions']['dataReturnType']
20
+ pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
21
+ parser: PluginClient['resolvedOptions']['parser'] | undefined
22
+ typeSchemas: OperationSchemas
23
+ zodSchemas: OperationSchemas | undefined
24
+ operation: Operation
25
+ }
26
+
27
+ type GetParamsProps = {
28
+ pathParamsType: PluginClient['resolvedOptions']['pathParamsType']
29
+ typeSchemas: OperationSchemas
30
+ }
31
+
32
+ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
33
+ return FunctionParams.factory({
34
+ pathParams: {
35
+ mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
36
+ children: getPathParams(typeSchemas.pathParams, { typed: true }),
37
+ },
38
+ data: typeSchemas.request?.name
39
+ ? {
40
+ type: typeSchemas.request?.name,
41
+ optional: isOptional(typeSchemas.request?.schema),
42
+ }
43
+ : undefined,
44
+ params: typeSchemas.queryParams?.name
45
+ ? {
46
+ type: typeSchemas.queryParams?.name,
47
+ optional: isOptional(typeSchemas.queryParams?.schema),
48
+ }
49
+ : undefined,
50
+ headers: typeSchemas.headerParams?.name
51
+ ? {
52
+ type: typeSchemas.headerParams?.name,
53
+ optional: isOptional(typeSchemas.headerParams?.schema),
54
+ }
55
+ : undefined,
56
+ config: {
57
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',
58
+ default: '{}',
59
+ },
60
+ })
47
61
  }
48
62
 
49
- function Template({ name, generics, returnType, params, JSDoc, client }: TemplateProps): KubbNode {
50
- const isFormData = client.contentType === 'multipart/form-data'
63
+ export function Client({
64
+ name,
65
+ isExportable = true,
66
+ isIndexable = true,
67
+ typeSchemas,
68
+ baseURL,
69
+ dataReturnType,
70
+ parser,
71
+ zodSchemas,
72
+ pathParamsType,
73
+ operation,
74
+ }: Props): KubbNode {
75
+ const path = new URLPath(operation.path)
76
+ const contentType = operation.getContentType()
77
+ const isFormData = contentType === 'multipart/form-data'
51
78
  const headers = [
52
- client.contentType !== 'application/json' ? `'Content-Type': '${client.contentType}'` : undefined,
53
- client.withHeaders ? '...headers' : undefined,
54
- ]
55
- .filter(Boolean)
56
- .join(', ')
57
- const clientParams: Params = {
58
- data: {
79
+ contentType !== 'application/json' ? `'Content-Type': '${contentType}'` : undefined,
80
+ typeSchemas.headerParams?.name ? '...headers' : undefined,
81
+ ].filter(Boolean)
82
+
83
+ const generics = [
84
+ typeSchemas.response.name,
85
+ typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error',
86
+ typeSchemas.request?.name || 'unknown',
87
+ ].filter(Boolean)
88
+ const params = getParams({ pathParamsType, typeSchemas })
89
+ const clientParams = FunctionParams.factory({
90
+ config: {
59
91
  mode: 'object',
60
92
  children: {
61
93
  method: {
62
- type: 'string',
63
- value: JSON.stringify(client.method),
94
+ value: JSON.stringify(operation.method.toUpperCase()),
64
95
  },
65
96
  url: {
66
- type: 'string',
67
- value: client.path.template,
97
+ value: path.template,
68
98
  },
69
- baseURL: client.baseURL
99
+ baseURL: baseURL
70
100
  ? {
71
- type: 'string',
72
- value: JSON.stringify(client.baseURL),
101
+ value: JSON.stringify(baseURL),
73
102
  }
74
103
  : undefined,
75
- params: client.withQueryParams
104
+ params: typeSchemas.queryParams?.name ? {} : undefined,
105
+ data: typeSchemas.request?.name
76
106
  ? {
77
- type: 'any',
78
- }
79
- : undefined,
80
- data: client.withData
81
- ? {
82
- type: 'any',
83
107
  value: isFormData ? 'formData' : undefined,
84
108
  }
85
109
  : undefined,
86
110
  headers: headers.length
87
111
  ? {
88
- type: 'any',
89
- value: headers.length ? `{ ${headers}, ...options.headers }` : undefined,
112
+ value: headers.length ? `{ ${headers.join(', ')}, ...config.headers }` : undefined,
90
113
  }
91
114
  : undefined,
92
- options: {
93
- type: 'any',
115
+ config: {
94
116
  mode: 'inlineSpread',
95
117
  },
96
118
  },
97
119
  },
98
- }
120
+ })
99
121
 
100
122
  const formData = isFormData
101
123
  ? `
102
124
  const formData = new FormData()
103
125
  if(data) {
104
126
  Object.keys(data).forEach((key) => {
105
- const value = data[key];
127
+ const value = data[key as keyof typeof data];
106
128
  if (typeof key === "string" && (typeof value === "string" || value instanceof Blob)) {
107
129
  formData.append(key, value);
108
130
  }
109
131
  })
110
132
  }
111
133
  `
112
- : undefined
134
+ : ''
113
135
 
114
136
  return (
115
- <File.Source name={name} isExportable isIndexable>
116
- <Function name={name} async export generics={generics} returnType={returnType} params={params} JSDoc={JSDoc}>
117
- {formData || ''}
118
- <Function.Call name="res" to={<Function name="client" async generics={client.generics} params={clientParams} />} />
119
- <Function.Return>{client.dataReturnType === 'data' ? 'res.data' : 'res'}</Function.Return>
137
+ <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>
138
+ <Function
139
+ name={name}
140
+ async
141
+ export={isExportable}
142
+ params={params.toConstructor()}
143
+ JSDoc={{
144
+ comments: getComments(operation),
145
+ }}
146
+ >
147
+ {formData}
148
+ {`const res = await client<${generics.join(', ')}>(${clientParams.toCall()})`}
149
+ <br />
150
+ {dataReturnType === 'full' && parser === 'zod' && zodSchemas && `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`}
151
+ {dataReturnType === 'data' && parser === 'zod' && zodSchemas && `return ${zodSchemas.response.name}.parse(res.data)`}
152
+ {dataReturnType === 'full' && parser === 'client' && 'return res'}
153
+ {dataReturnType === 'data' && parser === 'client' && 'return res.data'}
120
154
  </Function>
121
155
  </File.Source>
122
156
  )
123
157
  }
124
158
 
125
- type RootTemplateProps = {
126
- children?: React.ReactNode
127
- }
128
-
129
- function RootTemplate({ children }: RootTemplateProps) {
130
- const {
131
- plugin: {
132
- options: {
133
- client: { importPath },
134
- },
135
- },
136
- } = useApp<PluginClient>()
137
-
138
- const { getSchemas, getFile } = useOperationManager()
139
- const operation = useOperation()
140
-
141
- const file = getFile(operation)
142
- const fileType = getFile(operation, { pluginKey: [pluginTsName] })
143
- const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })
144
-
145
- return (
146
- <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>
147
- <File.Import name={'client'} path={importPath} />
148
- <File.Import name={['ResponseConfig']} path={importPath} isTypeOnly />
149
- <File.Import
150
- name={[schemas.request?.name, schemas.response.name, schemas.pathParams?.name, schemas.queryParams?.name, schemas.headerParams?.name].filter(Boolean)}
151
- root={file.path}
152
- path={fileType.path}
153
- isTypeOnly
154
- />
155
- {children}
156
- </File>
157
- )
158
- }
159
-
160
- const defaultTemplates = { default: Template, root: RootTemplate } as const
161
-
162
- type Templates = Partial<typeof defaultTemplates>
163
-
164
- type ClientProps = {
165
- baseURL: string | undefined
166
- /**
167
- * This will make it possible to override the default behaviour.
168
- */
169
- Template?: ComponentType<ComponentProps<typeof Template>>
170
- }
171
-
172
- export function Client({ baseURL, Template = defaultTemplates.default }: ClientProps): KubbNode {
173
- const {
174
- plugin: {
175
- options: { client, dataReturnType, pathParamsType },
176
- },
177
- } = useApp<PluginClient>()
178
-
179
- const { getSchemas, getName } = useOperationManager()
180
- const operation = useOperation()
181
-
182
- const contentType = operation.getContentType()
183
- const name = getName(operation, { type: 'function' })
184
- const schemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })
185
-
186
- return (
187
- <Template
188
- name={name}
189
- params={{
190
- pathParams: {
191
- mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
192
- children: getPathParams(schemas.pathParams, { typed: true }),
193
- },
194
- data: schemas.request?.name
195
- ? {
196
- type: schemas.request?.name,
197
- optional: isOptional(schemas.request?.schema),
198
- }
199
- : undefined,
200
- params: schemas.queryParams?.name
201
- ? {
202
- type: schemas.queryParams?.name,
203
- optional: isOptional(schemas.queryParams?.schema),
204
- }
205
- : undefined,
206
- headers: schemas.headerParams?.name
207
- ? {
208
- type: schemas.headerParams?.name,
209
- optional: isOptional(schemas.headerParams?.schema),
210
- }
211
- : undefined,
212
- options: {
213
- type: 'Partial<Parameters<typeof client>[0]>',
214
- default: '{}',
215
- },
216
- }}
217
- returnType={dataReturnType === 'data' ? `ResponseConfig<${schemas.response.name}>["data"]` : `ResponseConfig<${schemas.response.name}>`}
218
- JSDoc={{
219
- comments: getComments(operation),
220
- }}
221
- client={{
222
- // only set baseURL from serverIndex(swagger) when no custom client(default) is used
223
- baseURL: client.importPath === '@kubb/plugin-client/client' ? baseURL : undefined,
224
- generics: [schemas.response.name, schemas.request?.name].filter(Boolean),
225
- dataReturnType,
226
- withQueryParams: !!schemas.queryParams?.name,
227
- withData: !!schemas.request?.name,
228
- withHeaders: !!schemas.headerParams?.name,
229
- method: operation.method,
230
- path: new URLPath(operation.path),
231
- contentType,
232
- }}
233
- />
234
- )
235
- }
236
-
237
- type FileProps = {
238
- baseURL: string | undefined
239
- /**
240
- * This will make it possible to override the default behaviour.
241
- */
242
- templates?: Templates
243
- }
244
-
245
- Client.File = function ({ baseURL, ...props }: FileProps): KubbNode {
246
- const templates = { ...defaultTemplates, ...props.templates }
247
-
248
- const Template = templates.default
249
- const RootTemplate = templates.root
250
-
251
- return (
252
- <RootTemplate>
253
- <Client baseURL={baseURL} Template={Template} />
254
- </RootTemplate>
255
- )
256
- }
257
-
258
- Client.templates = defaultTemplates
159
+ Client.getParams = getParams
@@ -1,22 +1,14 @@
1
1
  import { URLPath } from '@kubb/core/utils'
2
- import { useOperations } from '@kubb/plugin-oas/hooks'
3
- import { Const, File, useApp } from '@kubb/react'
2
+ import { Const, File } from '@kubb/react'
4
3
 
5
4
  import type { HttpMethod, Operation } from '@kubb/oas'
6
- import type { KubbNode } from '@kubb/react/types'
7
- import type { ComponentProps, ComponentType } from 'react'
8
- import type { FileMeta, PluginClient } from '../types.ts'
9
5
 
10
- type TemplateProps = {
11
- /**
12
- * Name of the function
13
- */
6
+ type OperationsProps = {
14
7
  name: string
15
- operations: Operation[]
16
- baseURL: string | undefined
8
+ operations: Array<Operation>
17
9
  }
18
10
 
19
- function Template({ name, operations }: TemplateProps): KubbNode {
11
+ export function Operations({ name, operations }: OperationsProps) {
20
12
  const operationsObject: Record<string, { path: string; method: HttpMethod }> = {}
21
13
 
22
14
  operations.forEach((operation) => {
@@ -25,6 +17,7 @@ function Template({ name, operations }: TemplateProps): KubbNode {
25
17
  method: operation.method,
26
18
  }
27
19
  })
20
+
28
21
  return (
29
22
  <File.Source name={name} isExportable isIndexable>
30
23
  <Const name={name} export asConst>
@@ -33,62 +26,3 @@ function Template({ name, operations }: TemplateProps): KubbNode {
33
26
  </File.Source>
34
27
  )
35
28
  }
36
-
37
- type RootTemplateProps = {
38
- children?: React.ReactNode
39
- }
40
-
41
- function RootTemplate({ children }: RootTemplateProps) {
42
- const {
43
- pluginManager,
44
- plugin: { key: pluginKey },
45
- } = useApp<PluginClient>()
46
- const file = pluginManager.getFile({ name: 'operations', extName: '.ts', pluginKey })
47
-
48
- return (
49
- <File<FileMeta> baseName={file.baseName} path={file.path} meta={file.meta}>
50
- {children}
51
- </File>
52
- )
53
- }
54
-
55
- const defaultTemplates = { default: Template, root: RootTemplate } as const
56
-
57
- type Templates = Partial<typeof defaultTemplates>
58
-
59
- type Props = {
60
- baseURL: string | undefined
61
- /**
62
- * This will make it possible to override the default behaviour.
63
- */
64
- Template?: ComponentType<ComponentProps<typeof Template>>
65
- }
66
-
67
- export function Operations({ baseURL, Template = defaultTemplates.default }: Props): KubbNode {
68
- const operations = useOperations()
69
-
70
- return <Template baseURL={baseURL} name="operations" operations={operations} />
71
- }
72
-
73
- type FileProps = {
74
- baseURL: string | undefined
75
- /**
76
- * This will make it possible to override the default behaviour.
77
- */
78
- templates?: Templates
79
- }
80
-
81
- Operations.File = function ({ baseURL, ...props }: FileProps): KubbNode {
82
- const templates = { ...defaultTemplates, ...props.templates }
83
-
84
- const Template = templates.default
85
- const RootTemplate = templates.root
86
-
87
- return (
88
- <RootTemplate>
89
- <Operations baseURL={baseURL} Template={Template} />
90
- </RootTemplate>
91
- )
92
- }
93
-
94
- Operations.templates = defaultTemplates
@@ -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,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 delete a pet
7
+ * @summary Deletes a pet
8
+ * @link /pet/:petId
9
+ */
10
+ export async function deletePet({ petId }: {
11
+ petId: DeletePetPathParams["petId"];
12
+ }, headers?: DeletePetHeaderParams, config: Partial<RequestConfig> = {}) {
13
+ const res = await client<DeletePetMutationResponse, DeletePet400, unknown>({ method: "DELETE", url: `/pet/${petId}`, headers: { ...headers, ...config.headers }, ...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 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,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
+ }