@kubb/plugin-client 4.21.1 → 4.22.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 (68) hide show
  1. package/dist/{StaticClassClient-DKYiW3Uw.cjs → StaticClassClient-DEcg6Vjq.cjs} +6 -6
  2. package/dist/StaticClassClient-DEcg6Vjq.cjs.map +1 -0
  3. package/dist/{StaticClassClient-BFzMsStZ.js → StaticClassClient-mL_MpTJQ.js} +19 -19
  4. package/dist/StaticClassClient-mL_MpTJQ.js.map +1 -0
  5. package/dist/clients/axios.cjs.map +1 -1
  6. package/dist/clients/axios.d.cts +2 -1
  7. package/dist/clients/axios.d.ts +2 -1
  8. package/dist/clients/axios.js.map +1 -1
  9. package/dist/clients/fetch.cjs.map +1 -1
  10. package/dist/clients/fetch.d.cts +2 -1
  11. package/dist/clients/fetch.d.ts +2 -1
  12. package/dist/clients/fetch.js.map +1 -1
  13. package/dist/components.cjs +1 -1
  14. package/dist/components.d.cts +3 -1
  15. package/dist/components.d.ts +3 -1
  16. package/dist/components.js +1 -1
  17. package/dist/{generators-Bw4z5w4I.cjs → generators-D_u4tfoM.cjs} +32 -8
  18. package/dist/generators-D_u4tfoM.cjs.map +1 -0
  19. package/dist/{generators-ByPFBaDk.js → generators-tEaQeAYN.js} +32 -8
  20. package/dist/generators-tEaQeAYN.js.map +1 -0
  21. package/dist/generators.cjs +1 -1
  22. package/dist/generators.d.cts +457 -1
  23. package/dist/generators.d.ts +457 -1
  24. package/dist/generators.js +1 -1
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.cts +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/types-8onFUFxU.d.ts +143 -0
  30. package/dist/types-B72OcxWD.d.cts +143 -0
  31. package/package.json +7 -7
  32. package/src/clients/axios.ts +2 -0
  33. package/src/clients/fetch.ts +2 -0
  34. package/src/components/ClassClient.tsx +2 -2
  35. package/src/components/Client.tsx +4 -4
  36. package/src/components/StaticClassClient.tsx +1 -1
  37. package/src/generators/__snapshots__/Pet.ts +11 -11
  38. package/src/generators/__snapshots__/Store.ts +8 -11
  39. package/src/generators/__snapshots__/User.ts +10 -10
  40. package/src/generators/__snapshots__/deletePet.ts +2 -2
  41. package/src/generators/__snapshots__/deletePetObject.ts +2 -2
  42. package/src/generators/__snapshots__/findByStatusAllOptional.ts +2 -5
  43. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +2 -2
  44. package/src/generators/__snapshots__/findByTags.ts +2 -2
  45. package/src/generators/__snapshots__/findByTagsFull.ts +2 -2
  46. package/src/generators/__snapshots__/findByTagsObject.ts +2 -2
  47. package/src/generators/__snapshots__/findByTagsWithBaseURL.ts +2 -2
  48. package/src/generators/__snapshots__/findByTagsWithTemplateString.ts +2 -2
  49. package/src/generators/__snapshots__/findByTagsWithZod.ts +2 -2
  50. package/src/generators/__snapshots__/findByTagsWithZodFull.ts +2 -2
  51. package/src/generators/__snapshots__/importPath.ts +2 -2
  52. package/src/generators/__snapshots__/static/Pet.ts +10 -14
  53. package/src/generators/__snapshots__/static/Store.ts +7 -7
  54. package/src/generators/__snapshots__/static/User.ts +9 -9
  55. package/src/generators/__snapshots__/updatePetById.ts +2 -2
  56. package/src/generators/__snapshots__/updatePetByIdClean.ts +2 -2
  57. package/src/generators/__snapshots__/uploadFile.ts +2 -2
  58. package/src/generators/classClientGenerator.tsx +2 -2
  59. package/src/generators/clientGenerator.tsx +2 -2
  60. package/src/generators/staticClassClientGenerator.tsx +2 -2
  61. package/templates/clients/axios.ts +2 -0
  62. package/templates/clients/fetch.ts +2 -0
  63. package/dist/StaticClassClient-BFzMsStZ.js.map +0 -1
  64. package/dist/StaticClassClient-DKYiW3Uw.cjs.map +0 -1
  65. package/dist/generators-Bw4z5w4I.cjs.map +0 -1
  66. package/dist/generators-ByPFBaDk.js.map +0 -1
  67. package/dist/types-BmD1XBku.d.ts +0 -683
  68. package/dist/types-CB0x0LTs.d.cts +0 -683
@@ -0,0 +1,143 @@
1
+ import { t as __name } from "./chunk-DlpkT3g-.cjs";
2
+ import { Oas, contentType } from "@kubb/oas";
3
+ import { Exclude, Include, Override, ResolvePathOptions } from "@kubb/plugin-oas";
4
+ import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
5
+ import { Generator } from "@kubb/plugin-oas/generators";
6
+
7
+ //#region src/types.d.ts
8
+ type Options = {
9
+ /**
10
+ * Specify the export location for the files and define the behavior of the output
11
+ * @default { path: 'clients', barrelType: 'named' }
12
+ */
13
+ output?: Output<Oas>;
14
+ /**
15
+ * Define which contentType should be used.
16
+ * By default, the first JSON valid mediaType is used
17
+ */
18
+ contentType?: contentType;
19
+ /**
20
+ * Group the clients based on the provided name.
21
+ */
22
+ group?: Group;
23
+ /**
24
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
25
+ */
26
+ exclude?: Array<Exclude>;
27
+ /**
28
+ * Array containing include parameters to include tags/operations/methods/paths.
29
+ */
30
+ include?: Array<Include>;
31
+ /**
32
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
33
+ */
34
+ override?: Array<Override<ResolvedOptions>>;
35
+ /**
36
+ * Create `operations.ts` file with all operations grouped by methods.
37
+ * @default false
38
+ */
39
+ operations?: boolean;
40
+ /**
41
+ * Export urls that are used by operation x.
42
+ * - 'export' makes them part of your barrel file.
43
+ * - false does not make them exportable.
44
+ * @default false
45
+ * @example getGetPetByIdUrl
46
+ */
47
+ urlType?: 'export' | false;
48
+ /**
49
+ * Client import path for API calls.
50
+ * Used as `import client from '${client.importPath}'`.
51
+ * Accepts relative and absolute paths; path changes are not performed.
52
+ */
53
+ importPath?: string;
54
+ /**
55
+ * Allows you to set a custom base url for all generated calls.
56
+ */
57
+ baseURL?: string;
58
+ /**
59
+ * ReturnType that is used when calling the client.
60
+ * - 'data' returns ResponseConfig[data].
61
+ * - 'full' returns ResponseConfig.
62
+ * @default 'data'
63
+ */
64
+ dataReturnType?: 'data' | 'full';
65
+ /**
66
+ * How to style your params, by default no casing is applied
67
+ * - 'camelcase' uses camelCase for pathParams, queryParams and headerParams names
68
+ * @note response types (data/body) are not affected by this option
69
+ */
70
+ paramsCasing?: 'camelcase';
71
+ /**
72
+ * How to pass your params.
73
+ * - 'object' returns the params and pathParams as an object.
74
+ * - 'inline' returns the params as comma separated params.
75
+ * @default 'inline'
76
+ */
77
+ paramsType?: 'object' | 'inline';
78
+ /**
79
+ * How to pass your pathParams.
80
+ * - 'object' returns the pathParams as an object.
81
+ * - 'inline' returns the pathParams as comma separated params.
82
+ * @default 'inline'
83
+ */
84
+ pathParamsType?: 'object' | 'inline';
85
+ /**
86
+ * Which parser can be used before returning the data.
87
+ * - 'client' returns the data as-is from the client.
88
+ * - 'zod' uses @kubb/plugin-zod to parse the data.
89
+ * @default 'client'
90
+ */
91
+ parser?: 'client' | 'zod';
92
+ /**
93
+ * Which client should be used to do the HTTP calls.
94
+ * - 'axios' uses axios client for HTTP requests.
95
+ * - 'fetch' uses native fetch API for HTTP requests.
96
+ * @default 'axios'
97
+ */
98
+ client?: 'axios' | 'fetch';
99
+ /**
100
+ * How to generate the client code.
101
+ * - 'function' generates standalone functions for each operation.
102
+ * - 'class' generates a class with methods for each operation.
103
+ * - 'staticClass' generates a class with static methods for each operation.
104
+ * @default 'function'
105
+ */
106
+ clientType?: 'function' | 'class' | 'staticClass';
107
+ /**
108
+ * Bundle the selected client into the generated `.kubb` directory.
109
+ * When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
110
+ * @default false
111
+ * In version 5 of Kubb this is by default true
112
+ */
113
+ bundle?: boolean;
114
+ transformers?: {
115
+ /**
116
+ * Customize the names based on the type that is provided by the plugin.
117
+ */
118
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
119
+ };
120
+ /**
121
+ * Define some generators next to the client generators
122
+ */
123
+ generators?: Array<Generator<PluginClient>>;
124
+ };
125
+ type ResolvedOptions = {
126
+ output: Output<Oas>;
127
+ group?: Options['group'];
128
+ baseURL: string | undefined;
129
+ client: Options['client'];
130
+ clientType: NonNullable<Options['clientType']>;
131
+ bundle: NonNullable<Options['bundle']>;
132
+ parser: NonNullable<Options['parser']>;
133
+ urlType: NonNullable<Options['urlType']>;
134
+ importPath: Options['importPath'];
135
+ dataReturnType: NonNullable<Options['dataReturnType']>;
136
+ pathParamsType: NonNullable<Options['pathParamsType']>;
137
+ paramsType: NonNullable<Options['paramsType']>;
138
+ paramsCasing: Options['paramsCasing'];
139
+ };
140
+ type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
141
+ //#endregion
142
+ export { PluginClient as n, Options as t };
143
+ //# sourceMappingURL=types-B72OcxWD.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "4.21.1",
3
+ "version": "4.22.0",
4
4
  "description": "API client generator plugin for Kubb, creating type-safe HTTP clients (Axios, Fetch) from OpenAPI specifications for making API requests.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -90,14 +90,14 @@
90
90
  ],
91
91
  "dependencies": {
92
92
  "@kubb/react-fabric": "0.12.11",
93
- "@kubb/core": "4.21.1",
94
- "@kubb/oas": "4.21.1",
95
- "@kubb/plugin-oas": "4.21.1",
96
- "@kubb/plugin-ts": "4.21.1",
97
- "@kubb/plugin-zod": "4.21.1"
93
+ "@kubb/core": "4.22.0",
94
+ "@kubb/oas": "4.22.0",
95
+ "@kubb/plugin-oas": "4.22.0",
96
+ "@kubb/plugin-ts": "4.22.0",
97
+ "@kubb/plugin-zod": "4.22.0"
98
98
  },
99
99
  "devDependencies": {
100
- "axios": "^1.13.4"
100
+ "axios": "^1.13.5"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "@kubb/react-fabric": "0.12.11",
@@ -32,6 +32,8 @@ export type ResponseConfig<TData = unknown> = {
32
32
 
33
33
  export type ResponseErrorConfig<TError = unknown> = AxiosError<TError>
34
34
 
35
+ export type Client = <TResponseData, _TError = unknown, TRequestData = unknown>(config: RequestConfig<TRequestData>) => Promise<ResponseConfig<TResponseData>>
36
+
35
37
  let _config: Partial<RequestConfig> = {
36
38
  baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,
37
39
  headers: typeof AXIOS_HEADERS !== 'undefined' ? (JSON.parse(AXIOS_HEADERS) as AxiosHeaders) : undefined,
@@ -39,6 +39,8 @@ export const setConfig = (config: Partial<RequestConfig>) => {
39
39
 
40
40
  export type ResponseErrorConfig<TError = unknown> = TError
41
41
 
42
+ export type Client = <TResponseData, _TError = unknown, TRequestData = unknown>(config: RequestConfig<TRequestData>) => Promise<ResponseConfig<TResponseData>>
43
+
42
44
  export const client = async <TResponseData, _TError = unknown, RequestData = unknown>(
43
45
  paramsConfig: RequestConfig<RequestData>,
44
46
  ): Promise<ResponseConfig<TResponseData>> => {
@@ -216,9 +216,9 @@ export function ClassClient({
216
216
  )
217
217
 
218
218
  const classCode = `export class ${name} {
219
- #client: typeof fetch
219
+ #client: Client
220
220
 
221
- constructor(config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
221
+ constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
222
222
  this.#client = config.client || fetch
223
223
  }
224
224
 
@@ -80,8 +80,8 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isCo
80
80
  config: isConfigurable
81
81
  ? {
82
82
  type: typeSchemas.request?.name
83
- ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`
84
- : 'Partial<RequestConfig> & { client?: typeof fetch }',
83
+ ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: Client }`
84
+ : 'Partial<RequestConfig> & { client?: Client }',
85
85
  default: '{}',
86
86
  }
87
87
  : undefined,
@@ -120,8 +120,8 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isCo
120
120
  config: isConfigurable
121
121
  ? {
122
122
  type: typeSchemas.request?.name
123
- ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`
124
- : 'Partial<RequestConfig> & { client?: typeof fetch }',
123
+ ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: Client }`
124
+ : 'Partial<RequestConfig> & { client?: Client }',
125
125
  default: '{}',
126
126
  }
127
127
  : undefined,
@@ -212,7 +212,7 @@ export function StaticClassClient({
212
212
  }),
213
213
  )
214
214
 
215
- const classCode = `export class ${name} {\n static #client: typeof fetch = fetch\n\n${methods.join('\n\n')}\n}`
215
+ const classCode = `export class ${name} {\n static #client: Client = fetch\n\n${methods.join('\n\n')}\n}`
216
216
 
217
217
  return (
218
218
  <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>
@@ -2,7 +2,7 @@
2
2
  * Generated by Kubb (https://kubb.dev/).
3
3
  * Do not edit manually.
4
4
  */
5
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
5
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
6
  import type {
7
7
  UpdatePetMutationRequest,
8
8
  UpdatePetMutationResponse,
@@ -39,9 +39,9 @@ import { buildFormData } from './test/.kubb/config'
39
39
  import { fetch } from './test/.kubb/fetch'
40
40
 
41
41
  export class Pet {
42
- #client: typeof fetch
42
+ #client: Client
43
43
 
44
- constructor(config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
44
+ constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
45
45
  this.#client = config.client || fetch
46
46
  }
47
47
 
@@ -50,7 +50,7 @@ export class Pet {
50
50
  * @summary Update an existing pet
51
51
  * {@link /pet}
52
52
  */
53
- async updatePet(data: UpdatePetMutationRequest, config: Partial<RequestConfig<UpdatePetMutationRequest>> & { client?: typeof fetch } = {}) {
53
+ async updatePet(data: UpdatePetMutationRequest, config: Partial<RequestConfig<UpdatePetMutationRequest>> & { client?: Client } = {}) {
54
54
  const { client: request = this.#client, ...requestConfig } = config
55
55
  const requestData = data
56
56
  const res = await request<UpdatePetMutationResponse, ResponseErrorConfig<UpdatePet400 | UpdatePet404 | UpdatePet405>, UpdatePetMutationRequest>({
@@ -67,7 +67,7 @@ export class Pet {
67
67
  * @summary Add a new pet to the store
68
68
  * {@link /pet}
69
69
  */
70
- async addPet(data: AddPetMutationRequest, config: Partial<RequestConfig<AddPetMutationRequest>> & { client?: typeof fetch } = {}) {
70
+ async addPet(data: AddPetMutationRequest, config: Partial<RequestConfig<AddPetMutationRequest>> & { client?: Client } = {}) {
71
71
  const { client: request = this.#client, ...requestConfig } = config
72
72
  const requestData = data
73
73
  const res = await request<AddPetMutationResponse, ResponseErrorConfig<AddPet405>, AddPetMutationRequest>({
@@ -84,7 +84,7 @@ export class Pet {
84
84
  * @summary Finds Pets by status
85
85
  * {@link /pet/findByStatus}
86
86
  */
87
- async findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
87
+ async findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
88
88
  const { client: request = this.#client, ...requestConfig } = config
89
89
  const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
90
90
  method: 'GET',
@@ -100,7 +100,7 @@ export class Pet {
100
100
  * @summary Finds Pets by tags
101
101
  * {@link /pet/findByTags}
102
102
  */
103
- async findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
103
+ async findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
104
104
  const { client: request = this.#client, ...requestConfig } = config
105
105
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
106
106
  method: 'GET',
@@ -116,7 +116,7 @@ export class Pet {
116
116
  * @summary Find pet by ID
117
117
  * {@link /pet/:petId}
118
118
  */
119
- async getPetById(petId: GetPetByIdPathParams['petId'], config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
119
+ async getPetById(petId: GetPetByIdPathParams['petId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
120
120
  const { client: request = this.#client, ...requestConfig } = config
121
121
  const res = await request<GetPetByIdQueryResponse, ResponseErrorConfig<GetPetById400 | GetPetById404>, unknown>({
122
122
  method: 'GET',
@@ -133,7 +133,7 @@ export class Pet {
133
133
  async updatePetWithForm(
134
134
  petId: UpdatePetWithFormPathParams['petId'],
135
135
  params?: UpdatePetWithFormQueryParams,
136
- config: Partial<RequestConfig> & { client?: typeof fetch } = {},
136
+ config: Partial<RequestConfig> & { client?: Client } = {},
137
137
  ) {
138
138
  const { client: request = this.#client, ...requestConfig } = config
139
139
  const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
@@ -150,7 +150,7 @@ export class Pet {
150
150
  * @summary Deletes a pet
151
151
  * {@link /pet/:petId}
152
152
  */
153
- async deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
153
+ async deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
154
154
  const { client: request = this.#client, ...requestConfig } = config
155
155
  const res = await request<DeletePetMutationResponse, ResponseErrorConfig<DeletePet400>, unknown>({
156
156
  method: 'DELETE',
@@ -169,7 +169,7 @@ export class Pet {
169
169
  petId: UploadFilePathParams['petId'],
170
170
  data: UploadFileMutationRequest,
171
171
  params?: UploadFileQueryParams,
172
- config: Partial<RequestConfig<UploadFileMutationRequest>> & { client?: typeof fetch } = {},
172
+ config: Partial<RequestConfig<UploadFileMutationRequest>> & { client?: Client } = {},
173
173
  ) {
174
174
  const { client: request = this.#client, ...requestConfig } = config
175
175
  const requestData = data
@@ -2,7 +2,7 @@
2
2
  * Generated by Kubb (https://kubb.dev/).
3
3
  * Do not edit manually.
4
4
  */
5
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
5
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
6
  import type {
7
7
  GetInventoryQueryResponse,
8
8
  PlaceOrderMutationRequest,
@@ -23,9 +23,9 @@ import type {
23
23
  import { fetch } from './test/.kubb/fetch'
24
24
 
25
25
  export class Store {
26
- #client: typeof fetch
26
+ #client: Client
27
27
 
28
- constructor(config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
28
+ constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
29
29
  this.#client = config.client || fetch
30
30
  }
31
31
 
@@ -34,7 +34,7 @@ export class Store {
34
34
  * @summary Returns pet inventories by status
35
35
  * {@link /store/inventory}
36
36
  */
37
- async getInventory(config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
37
+ async getInventory(config: Partial<RequestConfig> & { client?: Client } = {}) {
38
38
  const { client: request = this.#client, ...requestConfig } = config
39
39
  const res = await request<GetInventoryQueryResponse, ResponseErrorConfig<Error>, unknown>({ method: 'GET', url: `/store/inventory`, ...requestConfig })
40
40
  return res.data
@@ -45,7 +45,7 @@ export class Store {
45
45
  * @summary Place an order for a pet
46
46
  * {@link /store/order}
47
47
  */
48
- async placeOrder(data?: PlaceOrderMutationRequest, config: Partial<RequestConfig<PlaceOrderMutationRequest>> & { client?: typeof fetch } = {}) {
48
+ async placeOrder(data?: PlaceOrderMutationRequest, config: Partial<RequestConfig<PlaceOrderMutationRequest>> & { client?: Client } = {}) {
49
49
  const { client: request = this.#client, ...requestConfig } = config
50
50
  const requestData = data
51
51
  const res = await request<PlaceOrderMutationResponse, ResponseErrorConfig<PlaceOrder405>, PlaceOrderMutationRequest>({
@@ -62,10 +62,7 @@ export class Store {
62
62
  * @summary Place an order for a pet with patch
63
63
  * {@link /store/order}
64
64
  */
65
- async placeOrderPatch(
66
- data?: PlaceOrderPatchMutationRequest,
67
- config: Partial<RequestConfig<PlaceOrderPatchMutationRequest>> & { client?: typeof fetch } = {},
68
- ) {
65
+ async placeOrderPatch(data?: PlaceOrderPatchMutationRequest, config: Partial<RequestConfig<PlaceOrderPatchMutationRequest>> & { client?: Client } = {}) {
69
66
  const { client: request = this.#client, ...requestConfig } = config
70
67
  const requestData = data
71
68
  const res = await request<PlaceOrderPatchMutationResponse, ResponseErrorConfig<PlaceOrderPatch405>, PlaceOrderPatchMutationRequest>({
@@ -82,7 +79,7 @@ export class Store {
82
79
  * @summary Find purchase order by ID
83
80
  * {@link /store/order/:orderId}
84
81
  */
85
- async getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
82
+ async getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
86
83
  const { client: request = this.#client, ...requestConfig } = config
87
84
  const res = await request<GetOrderByIdQueryResponse, ResponseErrorConfig<GetOrderById400 | GetOrderById404>, unknown>({
88
85
  method: 'GET',
@@ -97,7 +94,7 @@ export class Store {
97
94
  * @summary Delete purchase order by ID
98
95
  * {@link /store/order/:orderId}
99
96
  */
100
- async deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
97
+ async deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
101
98
  const { client: request = this.#client, ...requestConfig } = config
102
99
  const res = await request<DeleteOrderMutationResponse, ResponseErrorConfig<DeleteOrder400 | DeleteOrder404>, unknown>({
103
100
  method: 'DELETE',
@@ -2,7 +2,7 @@
2
2
  * Generated by Kubb (https://kubb.dev/).
3
3
  * Do not edit manually.
4
4
  */
5
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
5
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
6
  import type {
7
7
  CreateUserMutationRequest,
8
8
  CreateUserMutationResponse,
@@ -27,9 +27,9 @@ import type {
27
27
  import { fetch } from './test/.kubb/fetch'
28
28
 
29
29
  export class User {
30
- #client: typeof fetch
30
+ #client: Client
31
31
 
32
- constructor(config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
32
+ constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
33
33
  this.#client = config.client || fetch
34
34
  }
35
35
 
@@ -38,7 +38,7 @@ export class User {
38
38
  * @summary Create user
39
39
  * {@link /user}
40
40
  */
41
- async createUser(data?: CreateUserMutationRequest, config: Partial<RequestConfig<CreateUserMutationRequest>> & { client?: typeof fetch } = {}) {
41
+ async createUser(data?: CreateUserMutationRequest, config: Partial<RequestConfig<CreateUserMutationRequest>> & { client?: Client } = {}) {
42
42
  const { client: request = this.#client, ...requestConfig } = config
43
43
  const requestData = data
44
44
  const res = await request<CreateUserMutationResponse, ResponseErrorConfig<Error>, CreateUserMutationRequest>({
@@ -57,7 +57,7 @@ export class User {
57
57
  */
58
58
  async createUsersWithListInput(
59
59
  data?: CreateUsersWithListInputMutationRequest,
60
- config: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: typeof fetch } = {},
60
+ config: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: Client } = {},
61
61
  ) {
62
62
  const { client: request = this.#client, ...requestConfig } = config
63
63
  const requestData = data
@@ -74,7 +74,7 @@ export class User {
74
74
  * @summary Logs user into the system
75
75
  * {@link /user/login}
76
76
  */
77
- async loginUser(params?: LoginUserQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
77
+ async loginUser(params?: LoginUserQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
78
78
  const { client: request = this.#client, ...requestConfig } = config
79
79
  const res = await request<LoginUserQueryResponse, ResponseErrorConfig<LoginUser400>, unknown>({
80
80
  method: 'GET',
@@ -89,7 +89,7 @@ export class User {
89
89
  * @summary Logs out current logged in user session
90
90
  * {@link /user/logout}
91
91
  */
92
- async logoutUser(config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
92
+ async logoutUser(config: Partial<RequestConfig> & { client?: Client } = {}) {
93
93
  const { client: request = this.#client, ...requestConfig } = config
94
94
  const res = await request<LogoutUserQueryResponse, ResponseErrorConfig<Error>, unknown>({ method: 'GET', url: `/user/logout`, ...requestConfig })
95
95
  return res.data
@@ -99,7 +99,7 @@ export class User {
99
99
  * @summary Get user by user name
100
100
  * {@link /user/:username}
101
101
  */
102
- async getUserByName(username: GetUserByNamePathParams['username'], config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
102
+ async getUserByName(username: GetUserByNamePathParams['username'], config: Partial<RequestConfig> & { client?: Client } = {}) {
103
103
  const { client: request = this.#client, ...requestConfig } = config
104
104
  const res = await request<GetUserByNameQueryResponse, ResponseErrorConfig<GetUserByName400 | GetUserByName404>, unknown>({
105
105
  method: 'GET',
@@ -117,7 +117,7 @@ export class User {
117
117
  async updateUser(
118
118
  username: UpdateUserPathParams['username'],
119
119
  data?: UpdateUserMutationRequest,
120
- config: Partial<RequestConfig<UpdateUserMutationRequest>> & { client?: typeof fetch } = {},
120
+ config: Partial<RequestConfig<UpdateUserMutationRequest>> & { client?: Client } = {},
121
121
  ) {
122
122
  const { client: request = this.#client, ...requestConfig } = config
123
123
  const requestData = data
@@ -135,7 +135,7 @@ export class User {
135
135
  * @summary Delete user
136
136
  * {@link /user/:username}
137
137
  */
138
- async deleteUser(username: DeleteUserPathParams['username'], config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
138
+ async deleteUser(username: DeleteUserPathParams['username'], config: Partial<RequestConfig> & { client?: Client } = {}) {
139
139
  const { client: request = this.#client, ...requestConfig } = config
140
140
  const res = await request<DeleteUserMutationResponse, ResponseErrorConfig<DeleteUser400 | DeleteUser404>, unknown>({
141
141
  method: 'DELETE',
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getDeletePetUrl(petId: DeletePetPathParams['petId']) {
@@ -19,7 +19,7 @@ export function getDeletePetUrl(petId: DeletePetPathParams['petId']) {
19
19
  export async function deletePet(
20
20
  petId: DeletePetPathParams['petId'],
21
21
  headers?: DeletePetHeaderParams,
22
- config: Partial<RequestConfig> & { client?: typeof fetch } = {},
22
+ config: Partial<RequestConfig> & { client?: Client } = {},
23
23
  ) {
24
24
  const { client: request = fetch, ...requestConfig } = config
25
25
 
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getDeletePetUrl({ petId }: { petId: DeletePetPathParams['petId'] }) {
@@ -19,7 +19,7 @@ export function getDeletePetUrl({ petId }: { petId: DeletePetPathParams['petId']
19
19
  export async function deletePet(
20
20
  { petId }: { petId: DeletePetPathParams['petId'] },
21
21
  headers?: DeletePetHeaderParams,
22
- config: Partial<RequestConfig> & { client?: typeof fetch } = {},
22
+ config: Partial<RequestConfig> & { client?: Client } = {},
23
23
  ) {
24
24
  const { client: request = fetch, ...requestConfig } = config
25
25
 
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getFindPetsByStatusUrl() {
@@ -16,10 +16,7 @@ export function getFindPetsByStatusUrl() {
16
16
  * @summary Finds Pets by status
17
17
  * {@link /pet/findByStatus}
18
18
  */
19
- export async function findPetsByStatus(
20
- { params }: { params?: FindPetsByStatusQueryParams } = {},
21
- config: Partial<RequestConfig> & { client?: typeof fetch } = {},
22
- ) {
19
+ export async function findPetsByStatus({ params }: { params?: FindPetsByStatusQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
23
20
  const { client: request = fetch, ...requestConfig } = config
24
21
 
25
22
  const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getFindPetsByStatusUrl() {
@@ -16,7 +16,7 @@ export function getFindPetsByStatusUrl() {
16
16
  * @summary Finds Pets by status
17
17
  * {@link /pet/findByStatus}
18
18
  */
19
- export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
19
+ export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
20
  const { client: request = fetch, ...requestConfig } = config
21
21
 
22
22
  const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getFindPetsByTagsUrl() {
@@ -16,7 +16,7 @@ export function getFindPetsByTagsUrl() {
16
16
  * @summary Finds Pets by tags
17
17
  * {@link /pet/findByTags}
18
18
  */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
19
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
20
  const { client: request = fetch, ...requestConfig } = config
21
21
 
22
22
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getFindPetsByTagsUrl() {
@@ -16,7 +16,7 @@ export function getFindPetsByTagsUrl() {
16
16
  * @summary Finds Pets by tags
17
17
  * {@link /pet/findByTags}
18
18
  */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
19
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
20
  const { client: request = fetch, ...requestConfig } = config
21
21
 
22
22
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getFindPetsByTagsUrl() {
@@ -16,7 +16,7 @@ export function getFindPetsByTagsUrl() {
16
16
  * @summary Finds Pets by tags
17
17
  * {@link /pet/findByTags}
18
18
  */
19
- export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
19
+ export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
20
  const { client: request = fetch, ...requestConfig } = config
21
21
 
22
22
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getFindPetsByTagsUrl() {
@@ -16,7 +16,7 @@ export function getFindPetsByTagsUrl() {
16
16
  * @summary Finds Pets by tags
17
17
  * {@link /pet/findByTags}
18
18
  */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
19
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
20
  const { client: request = fetch, ...requestConfig } = config
21
21
 
22
22
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
@@ -3,7 +3,7 @@
3
3
  * Generated by Kubb (https://kubb.dev/).
4
4
  * Do not edit manually.
5
5
  */
6
- import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
7
  import { fetch } from './test/.kubb/fetch'
8
8
 
9
9
  export function getFindPetsByTagsUrl() {
@@ -16,7 +16,7 @@ export function getFindPetsByTagsUrl() {
16
16
  * @summary Finds Pets by tags
17
17
  * {@link /pet/findByTags}
18
18
  */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
19
+ export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
20
  const { client: request = fetch, ...requestConfig } = config
21
21
 
22
22
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({