@kubb/plugin-client 4.29.1 → 4.31.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 (25) hide show
  1. package/package.json +11 -10
  2. package/dist/types-DGWXyUI0.d.ts +0 -159
  3. package/src/generators/__snapshots__/Pet.ts +0 -186
  4. package/src/generators/__snapshots__/Store.ts +0 -106
  5. package/src/generators/__snapshots__/User.ts +0 -147
  6. package/src/generators/__snapshots__/deletePet.ts +0 -33
  7. package/src/generators/__snapshots__/deletePetObject.ts +0 -33
  8. package/src/generators/__snapshots__/findByStatusAllOptional.ts +0 -29
  9. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +0 -29
  10. package/src/generators/__snapshots__/findByTags.ts +0 -29
  11. package/src/generators/__snapshots__/findByTagsFull.ts +0 -29
  12. package/src/generators/__snapshots__/findByTagsObject.ts +0 -29
  13. package/src/generators/__snapshots__/findByTagsWithBaseURL.ts +0 -29
  14. package/src/generators/__snapshots__/findByTagsWithTemplateString.ts +0 -29
  15. package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -29
  16. package/src/generators/__snapshots__/findByTagsWithZodFull.ts +0 -29
  17. package/src/generators/__snapshots__/importPath.ts +0 -29
  18. package/src/generators/__snapshots__/operations.ts +0 -87
  19. package/src/generators/__snapshots__/requiredOneOfRequestBody.ts +0 -34
  20. package/src/generators/__snapshots__/static/Pet.ts +0 -182
  21. package/src/generators/__snapshots__/static/Store.ts +0 -105
  22. package/src/generators/__snapshots__/static/User.ts +0 -143
  23. package/src/generators/__snapshots__/updatePetById.ts +0 -32
  24. package/src/generators/__snapshots__/updatePetByIdClean.ts +0 -32
  25. package/src/generators/__snapshots__/uploadFile.ts +0 -37
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "4.29.1",
3
+ "version": "4.31.1",
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",
@@ -97,7 +97,8 @@
97
97
  "*.d.ts",
98
98
  "*.d.cts",
99
99
  "!/**/**.test.**",
100
- "!/**/__tests__/**"
100
+ "!/**/__tests__/**",
101
+ "!/**/__snapshots__/**"
101
102
  ],
102
103
  "size-limit": [
103
104
  {
@@ -107,18 +108,18 @@
107
108
  }
108
109
  ],
109
110
  "dependencies": {
110
- "@kubb/react-fabric": "0.13.1",
111
- "@kubb/core": "4.29.1",
112
- "@kubb/oas": "4.29.1",
113
- "@kubb/plugin-oas": "4.29.1",
114
- "@kubb/plugin-ts": "4.29.1",
115
- "@kubb/plugin-zod": "4.29.1"
111
+ "@kubb/react-fabric": "0.13.3",
112
+ "@kubb/core": "4.31.1",
113
+ "@kubb/oas": "4.31.1",
114
+ "@kubb/plugin-oas": "4.31.1",
115
+ "@kubb/plugin-ts": "4.31.1",
116
+ "@kubb/plugin-zod": "4.31.1"
116
117
  },
117
118
  "devDependencies": {
118
- "axios": "^1.13.5"
119
+ "axios": "^1.13.6"
119
120
  },
120
121
  "peerDependencies": {
121
- "@kubb/react-fabric": "0.13.0",
122
+ "@kubb/react-fabric": "0.13.3",
122
123
  "axios": "^1.7.2"
123
124
  },
124
125
  "peerDependenciesMeta": {
@@ -1,159 +0,0 @@
1
- import { t as __name } from "./chunk-cy2TeOE5.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
- /**
9
- * Use either a preset `client` type OR a custom `importPath`, not both.
10
- * `importPath` will override the default `client` preset when both are provided.
11
- * These options are mutually exclusive. `bundle` and `importPath` are also
12
- * mutually exclusive since `bundle` only has effect when `importPath` is not set.
13
- */
14
- type ClientImportPath = {
15
- /**
16
- * Which client should be used to do the HTTP calls.
17
- * - 'axios' uses axios client for HTTP requests.
18
- * - 'fetch' uses native fetch API for HTTP requests.
19
- * @default 'axios'
20
- */
21
- client?: 'axios' | 'fetch';
22
- importPath?: never;
23
- } | {
24
- client?: never;
25
- /**
26
- * Client import path for API calls.
27
- * Used as `import client from '${importPath}'`.
28
- * Accepts relative and absolute paths; path changes are not performed.
29
- */
30
- importPath: string;
31
- /**
32
- * `bundle` has no effect when `importPath` is set.
33
- * Use either `bundle` (with `client`) or `importPath`, not both.
34
- */
35
- bundle?: never;
36
- };
37
- type Options = {
38
- /**
39
- * Specify the export location for the files and define the behavior of the output
40
- * @default { path: 'clients', barrelType: 'named' }
41
- */
42
- output?: Output<Oas>;
43
- /**
44
- * Define which contentType should be used.
45
- * By default, the first JSON valid mediaType is used
46
- */
47
- contentType?: contentType;
48
- /**
49
- * Group the clients based on the provided name.
50
- */
51
- group?: Group;
52
- /**
53
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
54
- */
55
- exclude?: Array<Exclude>;
56
- /**
57
- * Array containing include parameters to include tags/operations/methods/paths.
58
- */
59
- include?: Array<Include>;
60
- /**
61
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
62
- */
63
- override?: Array<Override<ResolvedOptions>>;
64
- /**
65
- * Create `operations.ts` file with all operations grouped by methods.
66
- * @default false
67
- */
68
- operations?: boolean;
69
- /**
70
- * Export urls that are used by operation x.
71
- * - 'export' makes them part of your barrel file.
72
- * - false does not make them exportable.
73
- * @default false
74
- * @example getGetPetByIdUrl
75
- */
76
- urlType?: 'export' | false;
77
- /**
78
- * Allows you to set a custom base url for all generated calls.
79
- */
80
- baseURL?: string;
81
- /**
82
- * ReturnType that is used when calling the client.
83
- * - 'data' returns ResponseConfig[data].
84
- * - 'full' returns ResponseConfig.
85
- * @default 'data'
86
- */
87
- dataReturnType?: 'data' | 'full';
88
- /**
89
- * How to style your params, by default no casing is applied
90
- * - 'camelcase' uses camelCase for pathParams, queryParams and headerParams names
91
- * @note response types (data/body) are not affected by this option
92
- */
93
- paramsCasing?: 'camelcase';
94
- /**
95
- * How to pass your params.
96
- * - 'object' returns the params and pathParams as an object.
97
- * - 'inline' returns the params as comma separated params.
98
- * @default 'inline'
99
- */
100
- paramsType?: 'object' | 'inline';
101
- /**
102
- * How to pass your pathParams.
103
- * - 'object' returns the pathParams as an object.
104
- * - 'inline' returns the pathParams as comma separated params.
105
- * @default 'inline'
106
- */
107
- pathParamsType?: 'object' | 'inline';
108
- /**
109
- * Which parser can be used before returning the data.
110
- * - 'client' returns the data as-is from the client.
111
- * - 'zod' uses @kubb/plugin-zod to parse the data.
112
- * @default 'client'
113
- */
114
- parser?: 'client' | 'zod';
115
- /**
116
- * How to generate the client code.
117
- * - 'function' generates standalone functions for each operation.
118
- * - 'class' generates a class with methods for each operation.
119
- * - 'staticClass' generates a class with static methods for each operation.
120
- * @default 'function'
121
- */
122
- clientType?: 'function' | 'class' | 'staticClass';
123
- /**
124
- * Bundle the selected client into the generated `.kubb` directory.
125
- * When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
126
- * @default false
127
- * In version 5 of Kubb this is by default true
128
- */
129
- bundle?: boolean;
130
- transformers?: {
131
- /**
132
- * Customize the names based on the type that is provided by the plugin.
133
- */
134
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
135
- };
136
- /**
137
- * Define some generators next to the client generators
138
- */
139
- generators?: Array<Generator<PluginClient>>;
140
- } & ClientImportPath;
141
- type ResolvedOptions = {
142
- output: Output<Oas>;
143
- group?: Options['group'];
144
- baseURL: string | undefined;
145
- client: Options['client'];
146
- clientType: NonNullable<Options['clientType']>;
147
- bundle: NonNullable<Options['bundle']>;
148
- parser: NonNullable<Options['parser']>;
149
- urlType: NonNullable<Options['urlType']>;
150
- importPath: Options['importPath'];
151
- dataReturnType: NonNullable<Options['dataReturnType']>;
152
- pathParamsType: NonNullable<Options['pathParamsType']>;
153
- paramsType: NonNullable<Options['paramsType']>;
154
- paramsCasing: Options['paramsCasing'];
155
- };
156
- type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
157
- //#endregion
158
- export { Options as n, PluginClient as r, ClientImportPath as t };
159
- //# sourceMappingURL=types-DGWXyUI0.d.ts.map
@@ -1,186 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
- import type {
7
- UpdatePetMutationRequest,
8
- UpdatePetMutationResponse,
9
- UpdatePet400,
10
- UpdatePet404,
11
- UpdatePet405,
12
- AddPetMutationRequest,
13
- AddPetMutationResponse,
14
- AddPet405,
15
- FindPetsByStatusQueryResponse,
16
- FindPetsByStatusQueryParams,
17
- FindPetsByStatus400,
18
- FindPetsByTagsQueryResponse,
19
- FindPetsByTagsQueryParams,
20
- FindPetsByTags400,
21
- GetPetByIdQueryResponse,
22
- GetPetByIdPathParams,
23
- GetPetById400,
24
- GetPetById404,
25
- UpdatePetWithFormMutationResponse,
26
- UpdatePetWithFormPathParams,
27
- UpdatePetWithFormQueryParams,
28
- UpdatePetWithForm405,
29
- DeletePetMutationResponse,
30
- DeletePetPathParams,
31
- DeletePetHeaderParams,
32
- DeletePet400,
33
- UploadFileMutationRequest,
34
- UploadFileMutationResponse,
35
- UploadFilePathParams,
36
- UploadFileQueryParams,
37
- } from './findByTags'
38
- import { buildFormData } from './test/.kubb/config'
39
- import { fetch, mergeConfig } from './test/.kubb/fetch'
40
-
41
- export class Pet {
42
- #config: Partial<RequestConfig> & { client?: Client }
43
-
44
- constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
45
- this.#config = config
46
- }
47
-
48
- /**
49
- * @description Update an existing pet by Id
50
- * @summary Update an existing pet
51
- * {@link /pet}
52
- */
53
- async updatePet(data: UpdatePetMutationRequest, config: Partial<RequestConfig<UpdatePetMutationRequest>> & { client?: Client } = {}) {
54
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
55
- const requestData = data
56
- const res = await request<UpdatePetMutationResponse, ResponseErrorConfig<UpdatePet400 | UpdatePet404 | UpdatePet405>, UpdatePetMutationRequest>({
57
- ...requestConfig,
58
- method: 'PUT',
59
- url: `/pet`,
60
- data: requestData,
61
- })
62
- return res.data
63
- }
64
-
65
- /**
66
- * @description Add a new pet to the store
67
- * @summary Add a new pet to the store
68
- * {@link /pet}
69
- */
70
- async addPet(data: AddPetMutationRequest, config: Partial<RequestConfig<AddPetMutationRequest>> & { client?: Client } = {}) {
71
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
72
- const requestData = data
73
- const res = await request<AddPetMutationResponse, ResponseErrorConfig<AddPet405>, AddPetMutationRequest>({
74
- ...requestConfig,
75
- method: 'POST',
76
- url: `/pet`,
77
- data: requestData,
78
- })
79
- return res.data
80
- }
81
-
82
- /**
83
- * @description Multiple status values can be provided with comma separated strings
84
- * @summary Finds Pets by status
85
- * {@link /pet/findByStatus}
86
- */
87
- async findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
88
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
89
- const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
90
- ...requestConfig,
91
- method: 'GET',
92
- url: `/pet/findByStatus`,
93
- params,
94
- })
95
- return res.data
96
- }
97
-
98
- /**
99
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
100
- * @summary Finds Pets by tags
101
- * {@link /pet/findByTags}
102
- */
103
- async findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
104
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
105
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
106
- ...requestConfig,
107
- method: 'GET',
108
- url: `/pet/findByTags`,
109
- params,
110
- })
111
- return res.data
112
- }
113
-
114
- /**
115
- * @description Returns a single pet
116
- * @summary Find pet by ID
117
- * {@link /pet/:petId}
118
- */
119
- async getPetById(petId: GetPetByIdPathParams['petId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
120
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
121
- const res = await request<GetPetByIdQueryResponse, ResponseErrorConfig<GetPetById400 | GetPetById404>, unknown>({
122
- ...requestConfig,
123
- method: 'GET',
124
- url: `/pet/${petId}`,
125
- })
126
- return res.data
127
- }
128
-
129
- /**
130
- * @summary Updates a pet in the store with form data
131
- * {@link /pet/:petId}
132
- */
133
- async updatePetWithForm(
134
- petId: UpdatePetWithFormPathParams['petId'],
135
- params?: UpdatePetWithFormQueryParams,
136
- config: Partial<RequestConfig> & { client?: Client } = {},
137
- ) {
138
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
139
- const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
140
- ...requestConfig,
141
- method: 'POST',
142
- url: `/pet/${petId}`,
143
- params,
144
- })
145
- return res.data
146
- }
147
-
148
- /**
149
- * @description delete a pet
150
- * @summary Deletes a pet
151
- * {@link /pet/:petId}
152
- */
153
- async deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
154
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
155
- const res = await request<DeletePetMutationResponse, ResponseErrorConfig<DeletePet400>, unknown>({
156
- ...requestConfig,
157
- method: 'DELETE',
158
- url: `/pet/${petId}`,
159
- headers: { ...headers, ...requestConfig.headers },
160
- })
161
- return res.data
162
- }
163
-
164
- /**
165
- * @summary uploads an image
166
- * {@link /pet/:petId/uploadImage}
167
- */
168
- async uploadFile(
169
- petId: UploadFilePathParams['petId'],
170
- data: UploadFileMutationRequest,
171
- params?: UploadFileQueryParams,
172
- config: Partial<RequestConfig<UploadFileMutationRequest>> & { client?: Client } = {},
173
- ) {
174
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
175
- const requestData = data
176
- const formData = buildFormData(requestData)
177
- const res = await request<UploadFileMutationResponse, ResponseErrorConfig<Error>, UploadFileMutationRequest>({
178
- ...requestConfig,
179
- method: 'POST',
180
- url: `/pet/${petId}/uploadImage`,
181
- params,
182
- data: formData as FormData,
183
- })
184
- return res.data
185
- }
186
- }
@@ -1,106 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
- import type {
7
- GetInventoryQueryResponse,
8
- PlaceOrderMutationRequest,
9
- PlaceOrderMutationResponse,
10
- PlaceOrder405,
11
- PlaceOrderPatchMutationRequest,
12
- PlaceOrderPatchMutationResponse,
13
- PlaceOrderPatch405,
14
- GetOrderByIdQueryResponse,
15
- GetOrderByIdPathParams,
16
- GetOrderById400,
17
- GetOrderById404,
18
- DeleteOrderMutationResponse,
19
- DeleteOrderPathParams,
20
- DeleteOrder400,
21
- DeleteOrder404,
22
- } from './findByTags'
23
- import { fetch, mergeConfig } from './test/.kubb/fetch'
24
-
25
- export class Store {
26
- #config: Partial<RequestConfig> & { client?: Client }
27
-
28
- constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
29
- this.#config = config
30
- }
31
-
32
- /**
33
- * @description Returns a map of status codes to quantities
34
- * @summary Returns pet inventories by status
35
- * {@link /store/inventory}
36
- */
37
- async getInventory(config: Partial<RequestConfig> & { client?: Client } = {}) {
38
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
39
- const res = await request<GetInventoryQueryResponse, ResponseErrorConfig<Error>, unknown>({ ...requestConfig, method: 'GET', url: `/store/inventory` })
40
- return res.data
41
- }
42
-
43
- /**
44
- * @description Place a new order in the store
45
- * @summary Place an order for a pet
46
- * {@link /store/order}
47
- */
48
- async placeOrder(data?: PlaceOrderMutationRequest, config: Partial<RequestConfig<PlaceOrderMutationRequest>> & { client?: Client } = {}) {
49
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
50
- const requestData = data
51
- const res = await request<PlaceOrderMutationResponse, ResponseErrorConfig<PlaceOrder405>, PlaceOrderMutationRequest>({
52
- ...requestConfig,
53
- method: 'POST',
54
- url: `/store/order`,
55
- data: requestData,
56
- })
57
- return res.data
58
- }
59
-
60
- /**
61
- * @description Place a new order in the store with patch
62
- * @summary Place an order for a pet with patch
63
- * {@link /store/order}
64
- */
65
- async placeOrderPatch(data?: PlaceOrderPatchMutationRequest, config: Partial<RequestConfig<PlaceOrderPatchMutationRequest>> & { client?: Client } = {}) {
66
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
67
- const requestData = data
68
- const res = await request<PlaceOrderPatchMutationResponse, ResponseErrorConfig<PlaceOrderPatch405>, PlaceOrderPatchMutationRequest>({
69
- ...requestConfig,
70
- method: 'PATCH',
71
- url: `/store/order`,
72
- data: requestData,
73
- })
74
- return res.data
75
- }
76
-
77
- /**
78
- * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
79
- * @summary Find purchase order by ID
80
- * {@link /store/order/:orderId}
81
- */
82
- async getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
83
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
84
- const res = await request<GetOrderByIdQueryResponse, ResponseErrorConfig<GetOrderById400 | GetOrderById404>, unknown>({
85
- ...requestConfig,
86
- method: 'GET',
87
- url: `/store/order/${orderId}`,
88
- })
89
- return res.data
90
- }
91
-
92
- /**
93
- * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
94
- * @summary Delete purchase order by ID
95
- * {@link /store/order/:orderId}
96
- */
97
- async deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
98
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
99
- const res = await request<DeleteOrderMutationResponse, ResponseErrorConfig<DeleteOrder400 | DeleteOrder404>, unknown>({
100
- ...requestConfig,
101
- method: 'DELETE',
102
- url: `/store/order/${orderId}`,
103
- })
104
- return res.data
105
- }
106
- }
@@ -1,147 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
- import type {
7
- CreateUserMutationRequest,
8
- CreateUserMutationResponse,
9
- CreateUsersWithListInputMutationRequest,
10
- CreateUsersWithListInputMutationResponse,
11
- LoginUserQueryResponse,
12
- LoginUserQueryParams,
13
- LoginUser400,
14
- LogoutUserQueryResponse,
15
- GetUserByNameQueryResponse,
16
- GetUserByNamePathParams,
17
- GetUserByName400,
18
- GetUserByName404,
19
- UpdateUserMutationRequest,
20
- UpdateUserMutationResponse,
21
- UpdateUserPathParams,
22
- DeleteUserMutationResponse,
23
- DeleteUserPathParams,
24
- DeleteUser400,
25
- DeleteUser404,
26
- } from './findByTags'
27
- import { fetch, mergeConfig } from './test/.kubb/fetch'
28
-
29
- export class User {
30
- #config: Partial<RequestConfig> & { client?: Client }
31
-
32
- constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
33
- this.#config = config
34
- }
35
-
36
- /**
37
- * @description This can only be done by the logged in user.
38
- * @summary Create user
39
- * {@link /user}
40
- */
41
- async createUser(data?: CreateUserMutationRequest, config: Partial<RequestConfig<CreateUserMutationRequest>> & { client?: Client } = {}) {
42
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
43
- const requestData = data
44
- const res = await request<CreateUserMutationResponse, ResponseErrorConfig<Error>, CreateUserMutationRequest>({
45
- ...requestConfig,
46
- method: 'POST',
47
- url: `/user`,
48
- data: requestData,
49
- })
50
- return res.data
51
- }
52
-
53
- /**
54
- * @description Creates list of users with given input array
55
- * @summary Creates list of users with given input array
56
- * {@link /user/createWithList}
57
- */
58
- async createUsersWithListInput(
59
- data?: CreateUsersWithListInputMutationRequest,
60
- config: Partial<RequestConfig<CreateUsersWithListInputMutationRequest>> & { client?: Client } = {},
61
- ) {
62
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
63
- const requestData = data
64
- const res = await request<CreateUsersWithListInputMutationResponse, ResponseErrorConfig<Error>, CreateUsersWithListInputMutationRequest>({
65
- ...requestConfig,
66
- method: 'POST',
67
- url: `/user/createWithList`,
68
- data: requestData,
69
- })
70
- return res.data
71
- }
72
-
73
- /**
74
- * @summary Logs user into the system
75
- * {@link /user/login}
76
- */
77
- async loginUser(params?: LoginUserQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
78
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
79
- const res = await request<LoginUserQueryResponse, ResponseErrorConfig<LoginUser400>, unknown>({
80
- ...requestConfig,
81
- method: 'GET',
82
- url: `/user/login`,
83
- params,
84
- })
85
- return res.data
86
- }
87
-
88
- /**
89
- * @summary Logs out current logged in user session
90
- * {@link /user/logout}
91
- */
92
- async logoutUser(config: Partial<RequestConfig> & { client?: Client } = {}) {
93
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
94
- const res = await request<LogoutUserQueryResponse, ResponseErrorConfig<Error>, unknown>({ ...requestConfig, method: 'GET', url: `/user/logout` })
95
- return res.data
96
- }
97
-
98
- /**
99
- * @summary Get user by user name
100
- * {@link /user/:username}
101
- */
102
- async getUserByName(username: GetUserByNamePathParams['username'], config: Partial<RequestConfig> & { client?: Client } = {}) {
103
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
104
- const res = await request<GetUserByNameQueryResponse, ResponseErrorConfig<GetUserByName400 | GetUserByName404>, unknown>({
105
- ...requestConfig,
106
- method: 'GET',
107
- url: `/user/${username}`,
108
- })
109
- return res.data
110
- }
111
-
112
- /**
113
- * @description This can only be done by the logged in user.
114
- * @summary Update user
115
- * {@link /user/:username}
116
- */
117
- async updateUser(
118
- username: UpdateUserPathParams['username'],
119
- data?: UpdateUserMutationRequest,
120
- config: Partial<RequestConfig<UpdateUserMutationRequest>> & { client?: Client } = {},
121
- ) {
122
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
123
- const requestData = data
124
- const res = await request<UpdateUserMutationResponse, ResponseErrorConfig<Error>, UpdateUserMutationRequest>({
125
- ...requestConfig,
126
- method: 'PUT',
127
- url: `/user/${username}`,
128
- data: requestData,
129
- })
130
- return res.data
131
- }
132
-
133
- /**
134
- * @description This can only be done by the logged in user.
135
- * @summary Delete user
136
- * {@link /user/:username}
137
- */
138
- async deleteUser(username: DeleteUserPathParams['username'], config: Partial<RequestConfig> & { client?: Client } = {}) {
139
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
140
- const res = await request<DeleteUserMutationResponse, ResponseErrorConfig<DeleteUser400 | DeleteUser404>, unknown>({
141
- ...requestConfig,
142
- method: 'DELETE',
143
- url: `/user/${username}`,
144
- })
145
- return res.data
146
- }
147
- }
@@ -1,33 +0,0 @@
1
- /* eslint-disable no-alert, no-console */
2
- /**
3
- * Generated by Kubb (https://kubb.dev/).
4
- * Do not edit manually.
5
- */
6
- import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
7
- import { fetch } from './test/.kubb/fetch'
8
-
9
- export function getDeletePetUrl(petId: DeletePetPathParams['petId']) {
10
- const res = { method: 'DELETE', url: `/pet/${petId}` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description delete a pet
16
- * @summary Deletes a pet
17
- * {@link /pet/:petId}
18
- */
19
- export async function deletePet(
20
- petId: DeletePetPathParams['petId'],
21
- headers?: DeletePetHeaderParams,
22
- config: Partial<RequestConfig> & { client?: Client } = {},
23
- ) {
24
- const { client: request = fetch, ...requestConfig } = config
25
-
26
- const res = await request<DeletePetMutationResponse, ResponseErrorConfig<DeletePet400>, unknown>({
27
- method: 'DELETE',
28
- url: getDeletePetUrl(petId).url.toString(),
29
- ...requestConfig,
30
- headers: { ...headers, ...requestConfig.headers },
31
- })
32
- return res.data
33
- }