token.api 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import "../base.api"
  2. import "./agent.api"
  3. type (
  4. // The data of token information | Token信息
  5. TokenInfo {
  6. BaseIDInfo
  7. // 过期时间
  8. ExpireAt *int64 `json:"expireAt,optional"`
  9. ExpireAtStr *string `json:"expireAtStr,optional"`
  10. // Token
  11. Token *string `json:"token,optional"`
  12. // Mac地址
  13. Mac *string `json:"mac,optional"`
  14. // 租户ID
  15. OrganizationId *uint64 `json:"organization_id,optional"`
  16. OrganizationName *string `json:"organizationName,optional"`
  17. AgentId *uint64 `json:"agent_id,optional"`
  18. AgentInfo *AgentInfo `json:"agent_info,optional"`
  19. CustomAgentBase *string `json:"custom_agent_base,optional"`
  20. CustomAgentKey *string `json:"custom_agent_key,optional"`
  21. OpenaiBase *string `json:"openai_base,optional"`
  22. OpenaiKey *string `json:"openai_key,optional"`
  23. }
  24. // The response data of token list | Token列表数据
  25. TokenListResp {
  26. BaseDataInfo
  27. // Token list data | Token列表数据
  28. Data TokenListInfo `json:"data"`
  29. }
  30. // Token list data | Token列表数据
  31. TokenListInfo {
  32. BaseListInfo
  33. // The API list data | Token列表数据
  34. Data []TokenInfo `json:"data"`
  35. }
  36. // Get token list request params | Token列表请求参数
  37. TokenListReq {
  38. PageInfo
  39. // Token
  40. Token *string `json:"token,optional"`
  41. // Mac地址
  42. Mac *string `json:"mac,optional"`
  43. OrganizationId *uint64 `json:"organization_id,optional"`
  44. OrganizationName *string `json:"organizationName,optional"`
  45. }
  46. // Token information response | Token信息返回体
  47. TokenInfoResp {
  48. BaseDataInfo
  49. // Token information | Token数据
  50. Data TokenInfo `json:"data"`
  51. }
  52. CheckTokenReq {
  53. // Token
  54. Token *string `json:"token"`
  55. // Mac地址
  56. Mac *string `json:"mac"`
  57. }
  58. CheckTokenResp {
  59. // 是否合法
  60. Valid *bool `json:"valid"`
  61. // Sign 签名内容
  62. Sign *string `json:"sign"`
  63. // Timestamp 时间戳
  64. Timestamp *int64 `json:"timestamp"`
  65. AgentInfo *AgentInfo `json:"agent_info"`
  66. CustomAgentBase *string `json:"custom_agent_base"`
  67. CustomAgentKey *string `json:"custom_agent_key"`
  68. OpenaiBase *string `json:"openai_base"`
  69. OpenaiKey *string `json:"openai_key"`
  70. DatasetBase *string `json:"dataset_base"`
  71. DatasetKey *string `json:"dataset_key"`
  72. }
  73. )
  74. @server(
  75. group: token
  76. )
  77. service Wechat {
  78. // Check if token and mac are valid | 检查token和mac的合法性
  79. @handler checkToken
  80. post /token/check (CheckTokenReq) returns (CheckTokenResp)
  81. }
  82. @server(
  83. group: token
  84. jwt: Auth
  85. middleware: Authority
  86. )
  87. service Wechat {
  88. // Create token information | 创建Token
  89. @handler createToken
  90. post /token/third/create (TokenInfo) returns (BaseMsgResp)
  91. // Update token information | 更新Token
  92. @handler updateToken
  93. post /token/third/update (TokenInfo) returns (BaseMsgResp)
  94. // Delete token information | 删除Token信息
  95. @handler deleteToken
  96. post /token/third/delete (IDsReq) returns (BaseMsgResp)
  97. // Get token list | 获取Token列表
  98. @handler getTokenList
  99. post /token/third/list (TokenListReq) returns (TokenListResp)
  100. // Get token list | 获取Token列表
  101. @handler getApiTokenList
  102. post /token/api/list (TokenListReq) returns (TokenListResp)
  103. // Get token by ID | 通过ID获取Token
  104. @handler getTokenById
  105. post /token/third/detail (IDReq) returns (TokenInfoResp)
  106. // Clear token by ID | 通过ID清空Token
  107. @handler clearTokenById
  108. post /token/third/clear (IDReq) returns (BaseMsgResp)
  109. }