chat_session.api 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import "../base.api"
  2. type (
  3. // The data of chat session information | ChatSession信息
  4. ChatSessionInfo {
  5. BaseIDInfo
  6. // 名称
  7. Name *string `json:"name,optional"`
  8. // 用户ID
  9. UserId *uint64 `json:"userId,optional"`
  10. // 聊天ID
  11. BotId *uint64 `json:"botId,optional"`
  12. // 类型:1-微信 2-小程序card 3-智能体
  13. BotType *uint8 `json:"botType,optional"`
  14. }
  15. // The response data of chat session list | ChatSession列表数据
  16. ChatSessionListResp {
  17. BaseDataInfo
  18. // ChatSession list data | ChatSession列表数据
  19. Data ChatSessionListInfo `json:"data"`
  20. }
  21. // ChatSession list data | ChatSession列表数据
  22. ChatSessionListInfo {
  23. BaseListInfo
  24. // The API list data | ChatSession列表数据
  25. Data []ChatSessionInfo `json:"data"`
  26. }
  27. // Get chat session list request params | ChatSession列表请求参数
  28. ChatSessionListReq {
  29. PageInfo
  30. BotId *uint64 `json:"botId,optional"`
  31. BotType *uint8 `json:"botType,optional"`
  32. }
  33. // ChatSession information response | ChatSession信息返回体
  34. ChatSessionInfoResp {
  35. BaseDataInfo
  36. // ChatSession information | ChatSession数据
  37. Data ChatSessionInfo `json:"data"`
  38. }
  39. )
  40. @server(
  41. jwt: Auth
  42. group: chatsession
  43. middleware: Miniprogram
  44. )
  45. service Wechat {
  46. // Get chat session list | 获取ChatSession列表
  47. @handler getApiSessionList
  48. post /api/session/list (ChatSessionListReq) returns (ChatSessionListResp)
  49. // Update chat session information | 更新ChatSession
  50. @handler updateApiSession
  51. post /api/session/update (ChatSessionInfo) returns (BaseMsgResp)
  52. // Delete chat session information | 删除ChatSession信息
  53. @handler deleteApiSession
  54. post /api/session/delete (IDsReq) returns (BaseMsgResp)
  55. }
  56. @server(
  57. jwt: Auth
  58. group: chatsession
  59. middleware: Authority
  60. )
  61. service Wechat {
  62. // Create chat session information | 创建ChatSession
  63. @handler createChatSession
  64. post /chat_session/create (ChatSessionInfo) returns (BaseMsgResp)
  65. // Update chat session information | 更新ChatSession
  66. @handler updateChatSession
  67. post /chat_session/update (ChatSessionInfo) returns (BaseMsgResp)
  68. // Delete chat session information | 删除ChatSession信息
  69. @handler deleteChatSession
  70. post /chat_session/delete (IDsReq) returns (BaseMsgResp)
  71. // Get chat session list | 获取ChatSession列表
  72. @handler getChatSessionList
  73. post /chat_session/list (ChatSessionListReq) returns (ChatSessionListResp)
  74. // Get chat session by ID | 通过ID获取ChatSession
  75. @handler getChatSessionById
  76. post /chat_session (IDReq) returns (ChatSessionInfoResp)
  77. }