whatsapp.api 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import "../base.api"
  2. import "./agent.api"
  3. import "./label_relationship.api"
  4. type (
  5. // The data of whatsapp information | Whatsapp信息
  6. WhatsappInfo {
  7. BaseIDInfo
  8. // Status 1: normal 2: ban | 状态 1 正常 2 禁用
  9. Status *uint8 `json:"status,optional"`
  10. WaId *string `json:"waId,optional"`
  11. // 回调地址
  12. Callback *string `json:"callback,optional"`
  13. // 模式ID
  14. AgentId *uint64 `json:"agentId,optional"`
  15. AgentInfo *AgentInfo `json:"agentInfo,optional"`
  16. // 微信账号
  17. Account *string `json:"account,optional"`
  18. // 手机号
  19. Phone *string `json:"phone,optional"`
  20. Cc *string `json:"cc,optional"`
  21. // 号码名称
  22. PhoneName *string `json:"phoneName,optional"`
  23. // 号码状态
  24. PhoneStatus *int8 `json:"phoneStatus,optional"`
  25. Tokens *uint64 `json:"tokens,optional"`
  26. Frequency *uint64 `json:"frequency,optional"`
  27. // 机构 ID
  28. OrganizationId *uint64 `json:"organizationId,optional"`
  29. OrganizationName *string `json:"organizationName,optional"`
  30. // 大模型服务地址
  31. ApiBase *string `json:"apiBase,optional"`
  32. // 大模型服务密钥
  33. ApiKey *string `json:"apiKey,optional"`
  34. // 白名单
  35. AllowList []ContactInfo `json:"allowList,optional"`
  36. // 群白名单
  37. GroupAllowList []ContactInfo `json:"groupAllowList,optional"`
  38. // 黑名单
  39. BlockList []ContactInfo `json:"blockList,optional"`
  40. // 群黑名单
  41. GroupBlockList []ContactInfo `json:"groupBlockList,optional"`
  42. }
  43. // The response data of whatsapp list | Whatsapp列表数据
  44. WhatsappListResp {
  45. BaseDataInfo
  46. // Whatsapp list data | Whatsapp列表数据
  47. Data WhatsappListInfo `json:"data"`
  48. }
  49. // Whatsapp list data | Whatsapp列表数据
  50. WhatsappListInfo {
  51. BaseListInfo
  52. // The API list data | Whatsapp列表数据
  53. Data []WhatsappInfo `json:"data"`
  54. }
  55. // Get whatsapp list request params | Whatsapp列表请求参数
  56. WhatsappListReq {
  57. PageInfo
  58. // ak
  59. Ak *string `json:"ak,optional"`
  60. // 端口号
  61. Sk *string `json:"sk,optional"`
  62. // 回调地址
  63. Callback *string `json:"callback,optional"`
  64. }
  65. // Whatsapp information response | Whatsapp信息返回体
  66. WhatsappInfoResp {
  67. BaseDataInfo
  68. // Whatsapp information | Whatsapp数据
  69. Data WhatsappInfo `json:"data"`
  70. }
  71. )
  72. @server(
  73. jwt: Auth
  74. group: whatsapp
  75. middleware: Authority
  76. )
  77. service Wechat {
  78. // Create whatsapp information | 创建Whatsapp
  79. @handler createWhatsapp
  80. post /whatsapp/create (WhatsappInfo) returns (BaseMsgResp)
  81. // Update whatsapp information | 更新Whatsapp
  82. @handler updateWhatsapp
  83. post /whatsapp/update (WhatsappInfo) returns (BaseMsgResp)
  84. // Delete whatsapp information | 删除Whatsapp信息
  85. @handler deleteWhatsapp
  86. post /whatsapp/delete (IDsReq) returns (BaseMsgResp)
  87. // Get whatsapp list | 获取Whatsapp列表
  88. @handler getWhatsappList
  89. post /whatsapp/list (WhatsappListReq) returns (WhatsappListResp)
  90. // Get whatsapp by ID | 通过ID获取Whatsapp
  91. @handler getWhatsappById
  92. post /whatsapp (IDReq) returns (WhatsappInfoResp)
  93. }