@kubb/plugin-client 4.29.1 → 4.31.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.
- package/package.json +11 -10
- package/src/generators/__snapshots__/Pet.ts +0 -186
- package/src/generators/__snapshots__/Store.ts +0 -106
- package/src/generators/__snapshots__/User.ts +0 -147
- package/src/generators/__snapshots__/deletePet.ts +0 -33
- package/src/generators/__snapshots__/deletePetObject.ts +0 -33
- package/src/generators/__snapshots__/findByStatusAllOptional.ts +0 -29
- package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +0 -29
- package/src/generators/__snapshots__/findByTags.ts +0 -29
- package/src/generators/__snapshots__/findByTagsFull.ts +0 -29
- package/src/generators/__snapshots__/findByTagsObject.ts +0 -29
- package/src/generators/__snapshots__/findByTagsWithBaseURL.ts +0 -29
- package/src/generators/__snapshots__/findByTagsWithTemplateString.ts +0 -29
- package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -29
- package/src/generators/__snapshots__/findByTagsWithZodFull.ts +0 -29
- package/src/generators/__snapshots__/importPath.ts +0 -29
- package/src/generators/__snapshots__/operations.ts +0 -87
- package/src/generators/__snapshots__/requiredOneOfRequestBody.ts +0 -34
- package/src/generators/__snapshots__/static/Pet.ts +0 -182
- package/src/generators/__snapshots__/static/Store.ts +0 -105
- package/src/generators/__snapshots__/static/User.ts +0 -143
- package/src/generators/__snapshots__/updatePetById.ts +0 -32
- package/src/generators/__snapshots__/updatePetByIdClean.ts +0 -32
- package/src/generators/__snapshots__/uploadFile.ts +0 -37
|
@@ -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
|
-
}
|
|
@@ -1,105 +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
|
-
static #config: Partial<RequestConfig> & { client?: Client } = {}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @description Returns a map of status codes to quantities
|
|
30
|
-
* @summary Returns pet inventories by status
|
|
31
|
-
* {@link /store/inventory}
|
|
32
|
-
*/
|
|
33
|
-
static async getInventory(config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
34
|
-
const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
|
|
35
|
-
const res = await request<GetInventoryQueryResponse, ResponseErrorConfig<Error>, unknown>({ ...requestConfig, method: 'GET', url: `/store/inventory` })
|
|
36
|
-
return res.data
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @description Place a new order in the store
|
|
41
|
-
* @summary Place an order for a pet
|
|
42
|
-
* {@link /store/order}
|
|
43
|
-
*/
|
|
44
|
-
static async placeOrder(data?: PlaceOrderMutationRequest, config: Partial<RequestConfig<PlaceOrderMutationRequest>> & { client?: Client } = {}) {
|
|
45
|
-
const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
|
|
46
|
-
const requestData = data
|
|
47
|
-
const res = await request<PlaceOrderMutationResponse, ResponseErrorConfig<PlaceOrder405>, PlaceOrderMutationRequest>({
|
|
48
|
-
...requestConfig,
|
|
49
|
-
method: 'POST',
|
|
50
|
-
url: `/store/order`,
|
|
51
|
-
data: requestData,
|
|
52
|
-
})
|
|
53
|
-
return res.data
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @description Place a new order in the store with patch
|
|
58
|
-
* @summary Place an order for a pet with patch
|
|
59
|
-
* {@link /store/order}
|
|
60
|
-
*/
|
|
61
|
-
static async placeOrderPatch(
|
|
62
|
-
data?: PlaceOrderPatchMutationRequest,
|
|
63
|
-
config: Partial<RequestConfig<PlaceOrderPatchMutationRequest>> & { client?: Client } = {},
|
|
64
|
-
) {
|
|
65
|
-
const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
|
|
66
|
-
const requestData = data
|
|
67
|
-
const res = await request<PlaceOrderPatchMutationResponse, ResponseErrorConfig<PlaceOrderPatch405>, PlaceOrderPatchMutationRequest>({
|
|
68
|
-
...requestConfig,
|
|
69
|
-
method: 'PATCH',
|
|
70
|
-
url: `/store/order`,
|
|
71
|
-
data: requestData,
|
|
72
|
-
})
|
|
73
|
-
return res.data
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
|
|
78
|
-
* @summary Find purchase order by ID
|
|
79
|
-
* {@link /store/order/:orderId}
|
|
80
|
-
*/
|
|
81
|
-
static async getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
82
|
-
const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
|
|
83
|
-
const res = await request<GetOrderByIdQueryResponse, ResponseErrorConfig<GetOrderById400 | GetOrderById404>, unknown>({
|
|
84
|
-
...requestConfig,
|
|
85
|
-
method: 'GET',
|
|
86
|
-
url: `/store/order/${orderId}`,
|
|
87
|
-
})
|
|
88
|
-
return res.data
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
93
|
-
* @summary Delete purchase order by ID
|
|
94
|
-
* {@link /store/order/:orderId}
|
|
95
|
-
*/
|
|
96
|
-
static async deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
97
|
-
const { client: request = fetch, ...requestConfig } = mergeConfig(this.#config, config)
|
|
98
|
-
const res = await request<DeleteOrderMutationResponse, ResponseErrorConfig<DeleteOrder400 | DeleteOrder404>, unknown>({
|
|
99
|
-
...requestConfig,
|
|
100
|
-
method: 'DELETE',
|
|
101
|
-
url: `/store/order/${orderId}`,
|
|
102
|
-
})
|
|
103
|
-
return res.data
|
|
104
|
-
}
|
|
105
|
-
}
|