user.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // @ts-ignore
  2. /* eslint-disable */
  3. import { request } from 'umi';
  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. /** Creates list of users with given input array POST /user/createWithArray */
  13. export async function createUsersWithArrayInput(
  14. body: API.User[],
  15. options?: { [key: string]: any },
  16. ) {
  17. return request<any>('/user/createWithArray', {
  18. method: 'POST',
  19. data: body,
  20. ...(options || {}),
  21. });
  22. }
  23. /** Creates list of users with given input array POST /user/createWithList */
  24. export async function createUsersWithListInput(body: API.User[], options?: { [key: string]: any }) {
  25. return request<any>('/user/createWithList', {
  26. method: 'POST',
  27. data: body,
  28. ...(options || {}),
  29. });
  30. }
  31. /** Logs user into the system GET /user/login */
  32. export async function loginUser(
  33. params: {
  34. // query
  35. /** The user name for login */
  36. username: string;
  37. /** The password for login in clear text */
  38. password: string;
  39. },
  40. options?: { [key: string]: any },
  41. ) {
  42. return request<string>('/user/login', {
  43. method: 'GET',
  44. params: {
  45. ...params,
  46. },
  47. ...(options || {}),
  48. });
  49. }
  50. /** Logs out current logged in user session GET /user/logout */
  51. export async function logoutUser(options?: { [key: string]: any }) {
  52. return request<any>('/user/logout', {
  53. method: 'GET',
  54. ...(options || {}),
  55. });
  56. }
  57. /** Get user by user name GET /user/${param0} */
  58. export async function getUserByName(
  59. params: {
  60. // path
  61. /** The name that needs to be fetched. Use user1 for testing. */
  62. username: string;
  63. },
  64. options?: { [key: string]: any },
  65. ) {
  66. const { username: param0 } = params;
  67. return request<API.User>(`/user/${param0}`, {
  68. method: 'GET',
  69. params: { ...params },
  70. ...(options || {}),
  71. });
  72. }
  73. /** Updated user This can only be done by the logged in user. PUT /user/${param0} */
  74. export async function updateUser(
  75. params: {
  76. // path
  77. /** name that need to be updated */
  78. username: string;
  79. },
  80. body: API.User,
  81. options?: { [key: string]: any },
  82. ) {
  83. const { username: param0 } = params;
  84. return request<any>(`/user/${param0}`, {
  85. method: 'PUT',
  86. params: { ...params },
  87. data: body,
  88. ...(options || {}),
  89. });
  90. }
  91. /** Delete user This can only be done by the logged in user. DELETE /user/${param0} */
  92. export async function deleteUser(
  93. params: {
  94. // path
  95. /** The name that needs to be deleted */
  96. username: string;
  97. },
  98. options?: { [key: string]: any },
  99. ) {
  100. const { username: param0 } = params;
  101. return request<any>(`/user/${param0}`, {
  102. method: 'DELETE',
  103. params: { ...params },
  104. ...(options || {}),
  105. });
  106. }