chat_session.api 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. BotType *uint8 `json:"botType,optional"`
  31. }
  32. // ChatSession information response | ChatSession信息返回体
  33. ChatSessionInfoResp {
  34. BaseDataInfo
  35. // ChatSession information | ChatSession数据
  36. Data ChatSessionInfo `json:"data"`
  37. }
  38. )
  39. @server(
  40. // jwt: Auth
  41. group: chatsession
  42. // middleware: Miniprogram
  43. )
  44. service Wechat {
  45. // Get chat session list | 获取ChatSession列表
  46. @handler getApiSessionList
  47. post /api/session/list (ChatSessionListReq) returns (ChatSessionListResp)
  48. // Update chat session information | 更新ChatSession
  49. @handler updateApiSession
  50. post /api/session/update (ChatSessionInfo) returns (BaseMsgResp)
  51. // Delete chat session information | 删除ChatSession信息
  52. @handler deleteApiSession
  53. post /api/session/delete (IDsReq) returns (BaseMsgResp)
  54. }
  55. @server(
  56. jwt: Auth
  57. group: chatsession
  58. middleware: Authority
  59. )
  60. service Wechat {
  61. // Create chat session information | 创建ChatSession
  62. @handler createChatSession
  63. post /chat_session/create (ChatSessionInfo) returns (BaseMsgResp)
  64. // Update chat session information | 更新ChatSession
  65. @handler updateChatSession
  66. post /chat_session/update (ChatSessionInfo) returns (BaseMsgResp)
  67. // Delete chat session information | 删除ChatSession信息
  68. @handler deleteChatSession
  69. post /chat_session/delete (IDsReq) returns (BaseMsgResp)
  70. // Get chat session list | 获取ChatSession列表
  71. @handler getChatSessionList
  72. post /chat_session/list (ChatSessionListReq) returns (ChatSessionListResp)
  73. // Get chat session by ID | 通过ID获取ChatSession
  74. @handler getChatSessionById
  75. post /chat_session (IDReq) returns (ChatSessionInfoResp)
  76. }