chat_session.api 3.0 KB

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