blob: b887475a19c20c13b416d2402e3611e77edbb869 [file] [log] [blame]
86133aaa3f5d2025-04-20 21:33:29 +08001// @ts-ignore
2/* eslint-disable */
3import { request } from '@umijs/max';
4
5/** Update an existing pet PUT /pet */
6export async function updatePet(body: API.Pet, options?: { [key: string]: any }) {
7 return request<any>('/pet', {
8 method: 'PUT',
9 headers: {
10 'Content-Type': 'application/json',
11 },
12 data: body,
13 ...(options || {}),
14 });
15}
16
17/** Add a new pet to the store POST /pet */
18export async function addPet(body: API.Pet, options?: { [key: string]: any }) {
19 return request<any>('/pet', {
20 method: 'POST',
21 headers: {
22 'Content-Type': 'application/json',
23 },
24 data: body,
25 ...(options || {}),
26 });
27}
28
29/** Find pet by ID Returns a single pet GET /pet/${param0} */
30export async function getPetById(
31 // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
32 params: API.getPetByIdParams,
33 options?: { [key: string]: any },
34) {
35 const { petId: param0, ...queryParams } = params;
36 return request<API.Pet>(`/pet/${param0}`, {
37 method: 'GET',
38 params: { ...queryParams },
39 ...(options || {}),
40 });
41}
42
43/** Updates a pet in the store with form data POST /pet/${param0} */
44export async function updatePetWithForm(
45 // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
46 params: API.updatePetWithFormParams,
47 body: { name?: string; status?: string },
48 options?: { [key: string]: any },
49) {
50 const { petId: param0, ...queryParams } = params;
51 const formData = new FormData();
52
53 Object.keys(body).forEach((ele) => {
54 const item = (body as any)[ele];
55
56 if (item !== undefined && item !== null) {
57 formData.append(
58 ele,
59 typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item,
60 );
61 }
62 });
63
64 return request<any>(`/pet/${param0}`, {
65 method: 'POST',
66 params: { ...queryParams },
67 data: formData,
68 ...(options || {}),
69 });
70}
71
72/** Deletes a pet DELETE /pet/${param0} */
73export async function deletePet(
74 // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
75 params: API.deletePetParams & {
76 // header
77 api_key?: string;
78 },
79 options?: { [key: string]: any },
80) {
81 const { petId: param0, ...queryParams } = params;
82 return request<any>(`/pet/${param0}`, {
83 method: 'DELETE',
84 headers: {},
85 params: { ...queryParams },
86 ...(options || {}),
87 });
88}
89
90/** uploads an image POST /pet/${param0}/uploadImage */
91export async function uploadFile(
92 // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
93 params: API.uploadFileParams,
94 body: { additionalMetadata?: string; file?: string },
95 file?: File,
96 options?: { [key: string]: any },
97) {
98 const { petId: param0, ...queryParams } = params;
99 const formData = new FormData();
100
101 if (file) {
102 formData.append('file', file);
103 }
104
105 Object.keys(body).forEach((ele) => {
106 const item = (body as any)[ele];
107
108 if (item !== undefined && item !== null) {
109 formData.append(
110 ele,
111 typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item,
112 );
113 }
114 });
115
116 return request<API.ApiResponse>(`/pet/${param0}/uploadImage`, {
117 method: 'POST',
118 params: { ...queryParams },
119 data: formData,
120 requestType: 'form',
121 ...(options || {}),
122 });
123}
124
125/** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */
126export async function findPetsByStatus(
127 // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
128 params: API.findPetsByStatusParams,
129 options?: { [key: string]: any },
130) {
131 return request<API.Pet[]>('/pet/findByStatus', {
132 method: 'GET',
133 params: {
134 ...params,
135 },
136 ...(options || {}),
137 });
138}
139
140/** Finds Pets by tags Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */
141export async function findPetsByTags(
142 // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
143 params: API.findPetsByTagsParams,
144 options?: { [key: string]: any },
145) {
146 return request<API.Pet[]>('/pet/findByTags', {
147 method: 'GET',
148 params: {
149 ...params,
150 },
151 ...(options || {}),
152 });
153}