@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
@@ -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 }: { 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 }: { 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
- }
@@ -1,29 +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 getFindPetsByStatusUrl() {
10
- const res = { method: 'GET', url: `/pet/findByStatus` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple status values can be provided with comma separated strings
16
- * @summary Finds Pets by status
17
- * {@link /pet/findByStatus}
18
- */
19
- export async function findPetsByStatus({ params }: { params?: FindPetsByStatusQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByStatusUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return res.data
29
- }
@@ -1,29 +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 getFindPetsByStatusUrl() {
10
- const res = { method: 'GET', url: `/pet/findByStatus` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple status values can be provided with comma separated strings
16
- * @summary Finds Pets by status
17
- * {@link /pet/findByStatus}
18
- */
19
- export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByStatusUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return res.data
29
- }
@@ -1,29 +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 getFindPetsByTagsUrl() {
10
- const res = { method: 'GET', url: `/pet/findByTags` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByTagsUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return res.data
29
- }
@@ -1,29 +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 getFindPetsByTagsUrl() {
10
- const res = { method: 'GET', url: `/pet/findByTags` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByTagsUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return res
29
- }
@@ -1,29 +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 getFindPetsByTagsUrl() {
10
- const res = { method: 'GET', url: `/pet/findByTags` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByTagsUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return res.data
29
- }
@@ -1,29 +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 getFindPetsByTagsUrl() {
10
- const res = { method: 'GET', url: `https://petstore3.swagger.io/api/v3/pet/findByTags` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByTagsUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return res.data
29
- }
@@ -1,29 +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 getFindPetsByTagsUrl() {
10
- const res = { method: 'GET', url: `${123456}/pet/findByTags` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByTagsUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return res.data
29
- }
@@ -1,29 +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 getFindPetsByTagsUrl() {
10
- const res = { method: 'GET', url: `/pet/findByTags` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByTagsUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return findPetsByTagsQueryResponse.parse(res.data)
29
- }
@@ -1,29 +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 getFindPetsByTagsUrl() {
10
- const res = { method: 'GET', url: `/pet/findByTags` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByTagsUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return { ...res, data: findPetsByTagsQueryResponse.parse(res.data) }
29
- }
@@ -1,29 +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 fetch from 'axios'
7
- import type { Client, RequestConfig, ResponseErrorConfig } from 'axios'
8
-
9
- export function getFindPetsByTagsUrl() {
10
- const res = { method: 'GET', url: `/pet/findByTags` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
16
- * @summary Finds Pets by tags
17
- * {@link /pet/findByTags}
18
- */
19
- export async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
20
- const { client: request = fetch, ...requestConfig } = config
21
-
22
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
23
- method: 'GET',
24
- url: getFindPetsByTagsUrl().url.toString(),
25
- params,
26
- ...requestConfig,
27
- })
28
- return res.data
29
- }
@@ -1,87 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
-
6
- export const operations = {
7
- updatePet: {
8
- path: '/pet',
9
- method: 'put',
10
- },
11
- addPet: {
12
- path: '/pet',
13
- method: 'post',
14
- },
15
- findPetsByStatus: {
16
- path: '/pet/findByStatus',
17
- method: 'get',
18
- },
19
- findPetsByTags: {
20
- path: '/pet/findByTags',
21
- method: 'get',
22
- },
23
- getPetById: {
24
- path: '/pet/:petId',
25
- method: 'get',
26
- },
27
- updatePetWithForm: {
28
- path: '/pet/:petId',
29
- method: 'post',
30
- },
31
- deletePet: {
32
- path: '/pet/:petId',
33
- method: 'delete',
34
- },
35
- uploadFile: {
36
- path: '/pet/:petId/uploadImage',
37
- method: 'post',
38
- },
39
- getInventory: {
40
- path: '/store/inventory',
41
- method: 'get',
42
- },
43
- placeOrder: {
44
- path: '/store/order',
45
- method: 'post',
46
- },
47
- placeOrderPatch: {
48
- path: '/store/order',
49
- method: 'patch',
50
- },
51
- getOrderById: {
52
- path: '/store/order/:orderId',
53
- method: 'get',
54
- },
55
- deleteOrder: {
56
- path: '/store/order/:orderId',
57
- method: 'delete',
58
- },
59
- createUser: {
60
- path: '/user',
61
- method: 'post',
62
- },
63
- createUsersWithListInput: {
64
- path: '/user/createWithList',
65
- method: 'post',
66
- },
67
- loginUser: {
68
- path: '/user/login',
69
- method: 'get',
70
- },
71
- logoutUser: {
72
- path: '/user/logout',
73
- method: 'get',
74
- },
75
- getUserByName: {
76
- path: '/user/:username',
77
- method: 'get',
78
- },
79
- updateUser: {
80
- path: '/user/:username',
81
- method: 'put',
82
- },
83
- deleteUser: {
84
- path: '/user/:username',
85
- method: 'delete',
86
- },
87
- }
@@ -1,34 +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 getCreateOrderUrl() {
10
- const res = { method: 'POST', url: `/orders` as const }
11
- return res
12
- }
13
-
14
- /**
15
- * {@link /orders}
16
- */
17
- export async function createOrder(
18
- data: CreateOrderMutationRequest,
19
- headers?: CreateOrderHeaderParams,
20
- config: Partial<RequestConfig<CreateOrderMutationRequest>> & { client?: Client } = {},
21
- ) {
22
- const { client: request = fetch, ...requestConfig } = config
23
-
24
- const requestData = data
25
-
26
- const res = await request<CreateOrderMutationResponse, ResponseErrorConfig<Error>, CreateOrderMutationRequest>({
27
- method: 'POST',
28
- url: getCreateOrderUrl().url.toString(),
29
- data: requestData,
30
- ...requestConfig,
31
- headers: { ...headers, ...requestConfig.headers },
32
- })
33
- return res.data
34
- }
@@ -1,182 +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
- static #config: Partial<RequestConfig> & { client?: Client } = {}
43
-
44
- /**
45
- * @description Update an existing pet by Id
46
- * @summary Update an existing pet
47
- * {@link /pet}
48
- */
49
- static async updatePet(data: UpdatePetMutationRequest, config: Partial<RequestConfig<UpdatePetMutationRequest>> & { client?: Client } = {}) {
50
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
51
- const requestData = data
52
- const res = await request<UpdatePetMutationResponse, ResponseErrorConfig<UpdatePet400 | UpdatePet404 | UpdatePet405>, UpdatePetMutationRequest>({
53
- ...requestConfig,
54
- method: 'PUT',
55
- url: `/pet`,
56
- data: requestData,
57
- })
58
- return res.data
59
- }
60
-
61
- /**
62
- * @description Add a new pet to the store
63
- * @summary Add a new pet to the store
64
- * {@link /pet}
65
- */
66
- static async addPet(data: AddPetMutationRequest, config: Partial<RequestConfig<AddPetMutationRequest>> & { client?: Client } = {}) {
67
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
68
- const requestData = data
69
- const res = await request<AddPetMutationResponse, ResponseErrorConfig<AddPet405>, AddPetMutationRequest>({
70
- ...requestConfig,
71
- method: 'POST',
72
- url: `/pet`,
73
- data: requestData,
74
- })
75
- return res.data
76
- }
77
-
78
- /**
79
- * @description Multiple status values can be provided with comma separated strings
80
- * @summary Finds Pets by status
81
- * {@link /pet/findByStatus}
82
- */
83
- static async findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
84
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
85
- const res = await request<FindPetsByStatusQueryResponse, ResponseErrorConfig<FindPetsByStatus400>, unknown>({
86
- ...requestConfig,
87
- method: 'GET',
88
- url: `/pet/findByStatus`,
89
- params,
90
- })
91
- return res.data
92
- }
93
-
94
- /**
95
- * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
96
- * @summary Finds Pets by tags
97
- * {@link /pet/findByTags}
98
- */
99
- static async findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
100
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
101
- const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
102
- ...requestConfig,
103
- method: 'GET',
104
- url: `/pet/findByTags`,
105
- params,
106
- })
107
- return res.data
108
- }
109
-
110
- /**
111
- * @description Returns a single pet
112
- * @summary Find pet by ID
113
- * {@link /pet/:petId}
114
- */
115
- static async getPetById(petId: GetPetByIdPathParams['petId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
116
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
117
- const res = await request<GetPetByIdQueryResponse, ResponseErrorConfig<GetPetById400 | GetPetById404>, unknown>({
118
- ...requestConfig,
119
- method: 'GET',
120
- url: `/pet/${petId}`,
121
- })
122
- return res.data
123
- }
124
-
125
- /**
126
- * @summary Updates a pet in the store with form data
127
- * {@link /pet/:petId}
128
- */
129
- static async updatePetWithForm(
130
- petId: UpdatePetWithFormPathParams['petId'],
131
- params?: UpdatePetWithFormQueryParams,
132
- config: Partial<RequestConfig> & { client?: Client } = {},
133
- ) {
134
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
135
- const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
136
- ...requestConfig,
137
- method: 'POST',
138
- url: `/pet/${petId}`,
139
- params,
140
- })
141
- return res.data
142
- }
143
-
144
- /**
145
- * @description delete a pet
146
- * @summary Deletes a pet
147
- * {@link /pet/:petId}
148
- */
149
- static async deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial<RequestConfig> & { client?: Client } = {}) {
150
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
151
- const res = await request<DeletePetMutationResponse, ResponseErrorConfig<DeletePet400>, unknown>({
152
- ...requestConfig,
153
- method: 'DELETE',
154
- url: `/pet/${petId}`,
155
- headers: { ...headers, ...requestConfig.headers },
156
- })
157
- return res.data
158
- }
159
-
160
- /**
161
- * @summary uploads an image
162
- * {@link /pet/:petId/uploadImage}
163
- */
164
- static async uploadFile(
165
- petId: UploadFilePathParams['petId'],
166
- data: UploadFileMutationRequest,
167
- params?: UploadFileQueryParams,
168
- config: Partial<RequestConfig<UploadFileMutationRequest>> & { client?: Client } = {},
169
- ) {
170
- const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
171
- const requestData = data
172
- const formData = buildFormData(requestData)
173
- const res = await request<UploadFileMutationResponse, ResponseErrorConfig<Error>, UploadFileMutationRequest>({
174
- ...requestConfig,
175
- method: 'POST',
176
- url: `/pet/${petId}/uploadImage`,
177
- params,
178
- data: formData as FormData,
179
- })
180
- return res.data
181
- }
182
- }