user.ts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /* eslint-disable */
  2. // @ts-ignore
  3. import request from '@/utils/request';
  4. import { CustomRequestOptions } from '@/interceptors/request';
  5. import * as API from './types';
  6. /** Create user This can only be done by the logged in user. 返回值: successful operation POST /user */
  7. export async function createUser({
  8. body,
  9. options,
  10. }: {
  11. body: API.User;
  12. options?: CustomRequestOptions;
  13. }) {
  14. return request<unknown>('/user', {
  15. method: 'POST',
  16. headers: {
  17. 'Content-Type': 'application/json',
  18. },
  19. data: body,
  20. ...(options || {}),
  21. });
  22. }
  23. /** Get user by user name GET /user/${param0} */
  24. export async function getUserByName({
  25. params,
  26. options,
  27. }: {
  28. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  29. params: API.getUserByNameParams;
  30. options?: CustomRequestOptions;
  31. }) {
  32. const { username: param0, ...queryParams } = params;
  33. return request<API.User>(`/user/${param0}`, {
  34. method: 'GET',
  35. params: { ...queryParams },
  36. ...(options || {}),
  37. });
  38. }
  39. /** Updated user This can only be done by the logged in user. PUT /user/${param0} */
  40. export async function updateUser({
  41. params,
  42. body,
  43. options,
  44. }: {
  45. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  46. params: API.updateUserParams;
  47. body: API.User;
  48. options?: CustomRequestOptions;
  49. }) {
  50. const { username: param0, ...queryParams } = params;
  51. return request<unknown>(`/user/${param0}`, {
  52. method: 'PUT',
  53. headers: {
  54. 'Content-Type': 'application/json',
  55. },
  56. params: { ...queryParams },
  57. data: body,
  58. ...(options || {}),
  59. });
  60. }
  61. /** Delete user This can only be done by the logged in user. DELETE /user/${param0} */
  62. export async function deleteUser({
  63. params,
  64. options,
  65. }: {
  66. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  67. params: API.deleteUserParams;
  68. options?: CustomRequestOptions;
  69. }) {
  70. const { username: param0, ...queryParams } = params;
  71. return request<unknown>(`/user/${param0}`, {
  72. method: 'DELETE',
  73. params: { ...queryParams },
  74. ...(options || {}),
  75. });
  76. }
  77. /** Creates list of users with given input array 返回值: successful operation POST /user/createWithArray */
  78. export async function createUsersWithArrayInput({
  79. body,
  80. options,
  81. }: {
  82. body: API.User[];
  83. options?: CustomRequestOptions;
  84. }) {
  85. return request<unknown>('/user/createWithArray', {
  86. method: 'POST',
  87. headers: {
  88. 'Content-Type': 'application/json',
  89. },
  90. data: body,
  91. ...(options || {}),
  92. });
  93. }
  94. /** Creates list of users with given input array 返回值: successful operation POST /user/createWithList */
  95. export async function createUsersWithListInput({
  96. body,
  97. options,
  98. }: {
  99. body: API.User[];
  100. options?: CustomRequestOptions;
  101. }) {
  102. return request<unknown>('/user/createWithList', {
  103. method: 'POST',
  104. headers: {
  105. 'Content-Type': 'application/json',
  106. },
  107. data: body,
  108. ...(options || {}),
  109. });
  110. }
  111. /** Logs user into the system GET /user/login */
  112. export async function loginUser({
  113. params,
  114. options,
  115. }: {
  116. // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  117. params: API.loginUserParams;
  118. options?: CustomRequestOptions;
  119. }) {
  120. return request<string>('/user/login', {
  121. method: 'GET',
  122. params: {
  123. ...params,
  124. },
  125. ...(options || {}),
  126. });
  127. }
  128. /** Logs out current logged in user session 返回值: successful operation GET /user/logout */
  129. export async function logoutUser({
  130. options,
  131. }: {
  132. options?: CustomRequestOptions;
  133. }) {
  134. return request<unknown>('/user/logout', {
  135. method: 'GET',
  136. ...(options || {}),
  137. });
  138. }