endpoints.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /**
  2. * REST API v1,以端点的形式提供。
  3. */
  4. const APIv1 = {
  5. Application: {
  6. Base: '/api/v1/application',
  7. BadgeNo: '/badge_no'
  8. },
  9. Chats: {
  10. Base: "/api/v1/chats",
  11. List: "/list",
  12. ListWithPatient: "/list/patient",
  13. ListWithDoctor: "/list/doctor",
  14. MsgAmount: "/msg/amount",
  15. Recent: '/recent',
  16. SearchAboutPatient: '/search/patient',
  17. SearchAboutPatientList: '/search/patient/list',
  18. SearchAbountPatientMore: '/search/patient/all',
  19. SearchAboutDoctor: '/search/doctor',
  20. SearchAboutDoctorList: '/search/doctor/list',
  21. SearchAbountDoctorContentDetail: '/search/doctor/content/list',
  22. // 所有未读消息数
  23. UnreadMsgCount: '/unread_count',
  24. Message: '/message', // 单条消息
  25. // 私信
  26. PM: '/pm',
  27. PMUnread: '/pm/unread',
  28. PMUnreadCount: '/pm/unread/count',
  29. PMStats: '/pm/statistic',
  30. PMFinished: '/pm/finished', // 当前会话是否已经结束
  31. // 组信
  32. GM: '/gm',
  33. GMUnread: '/gm/unread',
  34. GMUnreadCount: '/gm/unread/count',
  35. GMStats: '/gm/statistic',
  36. //系统消息
  37. SM: '/sm',
  38. TEST: '/test'
  39. },
  40. Users: {
  41. Base: '/api/v1/users',
  42. Login: '/login',
  43. Logout: '/logout',
  44. User: '/:user_id',
  45. UserStatus: '/:user_id/status'
  46. },
  47. Groups: {
  48. Base: '/api/v1/groups',
  49. Members: '/:group_id/members',
  50. MembersAvatar: '/member/avatars'
  51. },
  52. Management: {
  53. Base: '/api/v1/management',
  54. Health: '/health',
  55. DbStatus: '/db'
  56. }
  57. };
  58. /**
  59. * REST API v2,以端点的形式提供。
  60. */
  61. const APIv2 = {
  62. Application: {
  63. Base: '/api/v2/application',
  64. BadgeNo: '/badge_no'
  65. },
  66. Management: {
  67. Base: '/api/v2/management',
  68. Health: '/health',
  69. DbStatus: '/db'
  70. },
  71. Users: {
  72. Base: '/api/v2/users',
  73. Login: '/login',
  74. Logout: '/logout',
  75. User: '/:user_id',
  76. UserStatus: '/:user_id/status'
  77. },
  78. Sessions: {
  79. Base: '/api/v2/sessions',
  80. Session: '/:session_id',
  81. SessionSticky: '/:session_id/sticky', // 会话置顶,置顶使用PUT,取消置顶使用DELETE
  82. RecentSessions: '/recent', // 最近会话,使用类型过滤出'患者'或'医生'会话
  83. Topics: '/:session_id/topics',
  84. Topic: '/:session_id/topics/:topic_id', // 议题,指定ID的议题将返回其信息
  85. TopicEnded: '/:session_id/topics/:topic_id/ended', // 议题是否已结束,若top_id为current,则检查最后一个议题的状态
  86. Messages: '/:session_id/messages', // 会话消息
  87. MessagesByTopic: '/:session_id/topics/:topic_id/messages', // 议题消息
  88. Message: '/:session_id/messages/:message_id', // 单条消息
  89. SessionsUnreadMessageCount: '/unread_message_count', // 所有会话的未读消息数
  90. SessionUnreadMessageCount: '/:session_id/unread_message_count', // 指定会话的未读消息数
  91. SessionUnreadMessage: '/:session_id/messages/unread', // 会话未读消息
  92. Participants: '/:session_id/participants', // 会话所有成员
  93. ParticipantsAvatar: '/:session_id/participants/avatars', // 会话所有成员头像
  94. Participant: '/:session_id/participants/:participant_id', // 会话单个成员
  95. ParticipantAvatar: '/:session_id/participants/:participant_id/avatars' // 会话单个成员头像
  96. //SendMsg: '/send', //发送消息,使用POST
  97. //CreateSession: '/create',//创建会话, 使用POST
  98. //PushSessionUser: '/push',//往Session里面push人员,使用POST
  99. //RemoveSessionUser: '/remove'//将人员从session中移除,使用DELETE
  100. },
  101. Search: {
  102. Base: '/api/v2/search' // 搜索,语法借鉴ElasticSearch
  103. }
  104. };
  105. const pages = {
  106. Home: {
  107. Index: '/'
  108. },
  109. Socket: {
  110. Index: '/socket',
  111. Test: '/test'
  112. }
  113. };
  114. module.exports.PAGES = pages;
  115. module.exports.APIv1 = APIv1;
  116. module.exports.APIv2 = APIv2;