pet.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /* eslint-disable */
  2. // @ts-ignore
  3. import request from '@/http/vue-query';
  4. import { CustomRequestOptions } from '@/http/types';
  5. import * as API from './types';
  6. /** Update an existing pet PUT /pet */
  7. export async function petUsingPut({
  8. body,
  9. options,
  10. }: {
  11. body: API.Pet;
  12. options?: CustomRequestOptions;
  13. }) {
  14. return request<unknown>('/pet', {
  15. method: 'PUT',
  16. headers: {
  17. 'Content-Type': 'application/json',
  18. },
  19. data: body,
  20. ...(options || {}),
  21. });
  22. }
  23. /** Add a new pet to the store POST /pet */
  24. export async function petUsingPost({
  25. body,
  26. options,
  27. }: {
  28. body: API.Pet;
  29. options?: CustomRequestOptions;
  30. }) {
  31. return request<unknown>('/pet', {
  32. method: 'POST',
  33. headers: {
  34. 'Content-Type': 'application/json',
  35. },
  36. data: body,
  37. ...(options || {}),
  38. });
  39. }
  40. /** Find pet by ID Returns a single pet GET /pet/${param0} */
  41. export async function petPetIdUsingGet({
  42. params,
  43. options,
  44. }: {
  45. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  46. params: API.PetPetIdUsingGetParams;
  47. options?: CustomRequestOptions;
  48. }) {
  49. const { petId: param0, ...queryParams } = params;
  50. return request<API.Pet>(`/pet/${param0}`, {
  51. method: 'GET',
  52. params: { ...queryParams },
  53. ...(options || {}),
  54. });
  55. }
  56. /** Updates a pet in the store with form data POST /pet/${param0} */
  57. export async function petPetIdUsingPost({
  58. params,
  59. body,
  60. options,
  61. }: {
  62. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  63. params: API.PetPetIdUsingPostParams;
  64. body: API.PetPetIdUsingPostBody;
  65. options?: CustomRequestOptions;
  66. }) {
  67. const { petId: param0, ...queryParams } = params;
  68. return request<unknown>(`/pet/${param0}`, {
  69. method: 'POST',
  70. headers: {
  71. 'Content-Type': 'application/x-www-form-urlencoded',
  72. },
  73. params: { ...queryParams },
  74. data: body,
  75. ...(options || {}),
  76. });
  77. }
  78. /** Deletes a pet DELETE /pet/${param0} */
  79. export async function petPetIdUsingDelete({
  80. params,
  81. options,
  82. }: {
  83. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  84. params: API.PetPetIdUsingDeleteParams;
  85. options?: CustomRequestOptions;
  86. }) {
  87. const { petId: param0, ...queryParams } = params;
  88. return request<unknown>(`/pet/${param0}`, {
  89. method: 'DELETE',
  90. params: { ...queryParams },
  91. ...(options || {}),
  92. });
  93. }
  94. /** uploads an image POST /pet/${param0}/uploadImage */
  95. export async function petPetIdUploadImageUsingPost({
  96. params,
  97. body,
  98. file,
  99. options,
  100. }: {
  101. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  102. params: API.PetPetIdUploadImageUsingPostParams;
  103. body: API.PetPetIdUploadImageUsingPostBody;
  104. file?: File;
  105. options?: CustomRequestOptions;
  106. }) {
  107. const { petId: param0, ...queryParams } = params;
  108. const formData = new FormData();
  109. if (file) {
  110. formData.append('file', file);
  111. }
  112. Object.keys(body).forEach((ele) => {
  113. const item = (body as { [key: string]: any })[ele];
  114. if (item !== undefined && item !== null) {
  115. if (typeof item === 'object' && !(item instanceof File)) {
  116. if (item instanceof Array) {
  117. item.forEach((f) => formData.append(ele, f || ''));
  118. } else {
  119. formData.append(ele, JSON.stringify(item));
  120. }
  121. } else {
  122. formData.append(ele, item);
  123. }
  124. }
  125. });
  126. return request<API.ApiResponse>(`/pet/${param0}/uploadImage`, {
  127. method: 'POST',
  128. headers: {
  129. 'Content-Type': 'multipart/form-data',
  130. },
  131. params: { ...queryParams },
  132. data: formData,
  133. ...(options || {}),
  134. });
  135. }
  136. /** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */
  137. export async function petFindByStatusUsingGet({
  138. params,
  139. options,
  140. }: {
  141. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  142. params: API.PetFindByStatusUsingGetParams;
  143. options?: CustomRequestOptions;
  144. }) {
  145. return request<API.Pet[]>('/pet/findByStatus', {
  146. method: 'GET',
  147. params: {
  148. ...params,
  149. },
  150. ...(options || {}),
  151. });
  152. }
  153. /** Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */
  154. export async function petFindByTagsUsingGet({
  155. params,
  156. options,
  157. }: {
  158. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  159. params: API.PetFindByTagsUsingGetParams;
  160. options?: CustomRequestOptions;
  161. }) {
  162. return request<API.Pet[]>('/pet/findByTags', {
  163. method: 'GET',
  164. params: {
  165. ...params,
  166. },
  167. ...(options || {}),
  168. });
  169. }