user.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import { request } from '@umijs/max';
  4. /** Create user This can only be done by the logged in user. POST /user */
  5. export async function createUser(body: API.User, options?: { [key: string]: any }) {
  6. return request<any>('/user', {
  7. method: 'POST',
  8. data: body,
  9. ...(options || {}),
  10. });
  11. }
  12. /** Get user by user name GET /user/${param0} */
  13. export async function getUserByName(
  14. // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  15. params: API.getUserByNameParams,
  16. options?: { [key: string]: any },
  17. ) {
  18. const { username: param0, ...queryParams } = params;
  19. return request<API.User>(`/user/${param0}`, {
  20. method: 'GET',
  21. params: { ...queryParams },
  22. ...(options || {}),
  23. });
  24. }
  25. /** Updated user This can only be done by the logged in user. PUT /user/${param0} */
  26. export async function updateUser(
  27. // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  28. params: API.updateUserParams,
  29. body: API.User,
  30. options?: { [key: string]: any },
  31. ) {
  32. const { username: param0, ...queryParams } = params;
  33. return request<any>(`/user/${param0}`, {
  34. method: 'PUT',
  35. params: { ...queryParams },
  36. data: body,
  37. ...(options || {}),
  38. });
  39. }
  40. /** Delete user This can only be done by the logged in user. DELETE /user/${param0} */
  41. export async function deleteUser(
  42. // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  43. params: API.deleteUserParams,
  44. options?: { [key: string]: any },
  45. ) {
  46. const { username: param0, ...queryParams } = params;
  47. return request<any>(`/user/${param0}`, {
  48. method: 'DELETE',
  49. params: { ...queryParams },
  50. ...(options || {}),
  51. });
  52. }
  53. /** Creates list of users with given input array POST /user/createWithArray */
  54. export async function createUsersWithArrayInput(
  55. body: API.User[],
  56. options?: { [key: string]: any },
  57. ) {
  58. return request<any>('/user/createWithArray', {
  59. method: 'POST',
  60. data: body,
  61. ...(options || {}),
  62. });
  63. }
  64. /** Creates list of users with given input array POST /user/createWithList */
  65. export async function createUsersWithListInput(body: API.User[], options?: { [key: string]: any }) {
  66. return request<any>('/user/createWithList', {
  67. method: 'POST',
  68. data: body,
  69. ...(options || {}),
  70. });
  71. }
  72. /** Logs user into the system GET /user/login */
  73. export async function loginUser(
  74. // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  75. params: API.loginUserParams,
  76. options?: { [key: string]: any },
  77. ) {
  78. return request<string>('/user/login', {
  79. method: 'GET',
  80. params: {
  81. ...params,
  82. },
  83. ...(options || {}),
  84. });
  85. }
  86. /** Logs out current logged in user session GET /user/logout */
  87. export async function logoutUser(options?: { [key: string]: any }) {
  88. return request<any>('/user/logout', {
  89. method: 'GET',
  90. ...(options || {}),
  91. });
  92. }