pet-controller.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /**
  2. * Generated by orval v7.0.1 🍺
  3. * Do not edit manually.
  4. * OpenAPI definition
  5. * OpenAPI spec version: v0
  6. */
  7. import type {
  8. DewormingDto,
  9. PetDto,
  10. RBoolean,
  11. RDewormingVo,
  12. RListDewormingVo,
  13. RListPetVo,
  14. RListVaccinationVo,
  15. RPetVo,
  16. RVaccinationVo,
  17. VaccinationDto,
  18. } from "./models";
  19. import { customAxiosInstance } from "../util/axios-instance";
  20. export const getPetController = () => {
  21. /**
  22. * @summary 获取宠物详情
  23. */
  24. const getById = (id: number) => {
  25. return customAxiosInstance<RPetVo>({ url: `/pets/${id}`, method: "GET" });
  26. };
  27. /**
  28. * @summary 修改宠物信息
  29. */
  30. const update = (id: number, petDto: PetDto) => {
  31. return customAxiosInstance<RBoolean>({
  32. url: `/pets/${id}`,
  33. method: "PUT",
  34. headers: { "Content-Type": "application/json" },
  35. data: petDto,
  36. });
  37. };
  38. /**
  39. * @summary 删除宠物
  40. */
  41. const _delete = (id: number) => {
  42. return customAxiosInstance<RBoolean>({
  43. url: `/pets/${id}`,
  44. method: "DELETE",
  45. });
  46. };
  47. /**
  48. * @summary 获取当前用户宠物列表
  49. */
  50. const list = () => {
  51. return customAxiosInstance<RListPetVo>({ url: `/pets`, method: "GET" });
  52. };
  53. /**
  54. * @summary 新增宠物
  55. */
  56. const add1 = (petDto: PetDto) => {
  57. return customAxiosInstance<RPetVo>({
  58. url: `/pets`,
  59. method: "POST",
  60. headers: { "Content-Type": "application/json" },
  61. data: petDto,
  62. });
  63. };
  64. /**
  65. * @summary 获取疫苗记录
  66. */
  67. const getVaccinations = (id: number) => {
  68. return customAxiosInstance<RListVaccinationVo>({
  69. url: `/pets/${id}/vaccinations`,
  70. method: "GET",
  71. });
  72. };
  73. /**
  74. * @summary 新增疫苗记录
  75. */
  76. const addVaccination = (id: number, vaccinationDto: VaccinationDto) => {
  77. return customAxiosInstance<RVaccinationVo>({
  78. url: `/pets/${id}/vaccinations`,
  79. method: "POST",
  80. headers: { "Content-Type": "application/json" },
  81. data: vaccinationDto,
  82. });
  83. };
  84. /**
  85. * @summary 获取驱虫记录
  86. */
  87. const getDeworming = (id: number) => {
  88. return customAxiosInstance<RListDewormingVo>({
  89. url: `/pets/${id}/deworming`,
  90. method: "GET",
  91. });
  92. };
  93. /**
  94. * @summary 新增驱虫记录
  95. */
  96. const addDeworming = (id: number, dewormingDto: DewormingDto) => {
  97. return customAxiosInstance<RDewormingVo>({
  98. url: `/pets/${id}/deworming`,
  99. method: "POST",
  100. headers: { "Content-Type": "application/json" },
  101. data: dewormingDto,
  102. });
  103. };
  104. return {
  105. getById,
  106. update,
  107. _delete,
  108. list,
  109. add1,
  110. getVaccinations,
  111. addVaccination,
  112. getDeworming,
  113. addDeworming,
  114. };
  115. };
  116. export type GetByIdResult = NonNullable<
  117. Awaited<ReturnType<ReturnType<typeof getPetController>["getById"]>>
  118. >;
  119. export type UpdateResult = NonNullable<
  120. Awaited<ReturnType<ReturnType<typeof getPetController>["update"]>>
  121. >;
  122. export type _DeleteResult = NonNullable<
  123. Awaited<ReturnType<ReturnType<typeof getPetController>["_delete"]>>
  124. >;
  125. export type ListResult = NonNullable<
  126. Awaited<ReturnType<ReturnType<typeof getPetController>["list"]>>
  127. >;
  128. export type Add1Result = NonNullable<
  129. Awaited<ReturnType<ReturnType<typeof getPetController>["add1"]>>
  130. >;
  131. export type GetVaccinationsResult = NonNullable<
  132. Awaited<ReturnType<ReturnType<typeof getPetController>["getVaccinations"]>>
  133. >;
  134. export type AddVaccinationResult = NonNullable<
  135. Awaited<ReturnType<ReturnType<typeof getPetController>["addVaccination"]>>
  136. >;
  137. export type GetDewormingResult = NonNullable<
  138. Awaited<ReturnType<ReturnType<typeof getPetController>["getDeworming"]>>
  139. >;
  140. export type AddDewormingResult = NonNullable<
  141. Awaited<ReturnType<ReturnType<typeof getPetController>["addDeworming"]>>
  142. >;