123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- import "../base.api"
- import "./agent.api"
- type (
- // The data of token information | Token信息
- TokenInfo {
- BaseIDInfo
- // 过期时间
- ExpireAt *int64 `json:"expireAt,optional"`
- ExpireAtStr *string `json:"expireAtStr,optional"`
- // Token
- Token *string `json:"token,optional"`
- // Mac地址
- Mac *string `json:"mac,optional"`
- // 租户ID
- OrganizationId *uint64 `json:"organization_id,optional"`
- OrganizationName *string `json:"organizationName,optional"`
- AgentId *uint64 `json:"agent_id,optional"`
- AgentInfo *AgentInfo `json:"agent_info,optional"`
- CustomAgentBase *string `json:"custom_agent_base,optional"`
- CustomAgentKey *string `json:"custom_agent_key,optional"`
- OpenaiBase *string `json:"openai_base,optional"`
- OpenaiKey *string `json:"openai_key,optional"`
- }
- // The response data of token list | Token列表数据
- TokenListResp {
- BaseDataInfo
- // Token list data | Token列表数据
- Data TokenListInfo `json:"data"`
- }
- // Token list data | Token列表数据
- TokenListInfo {
- BaseListInfo
- // The API list data | Token列表数据
- Data []TokenInfo `json:"data"`
- }
- // Get token list request params | Token列表请求参数
- TokenListReq {
- PageInfo
- // Token
- Token *string `json:"token,optional"`
- // Mac地址
- Mac *string `json:"mac,optional"`
- OrganizationId *uint64 `json:"organization_id,optional"`
- OrganizationName *string `json:"organizationName,optional"`
- }
- // Token information response | Token信息返回体
- TokenInfoResp {
- BaseDataInfo
- // Token information | Token数据
- Data TokenInfo `json:"data"`
- }
- CheckTokenReq {
- // Token
- Token *string `json:"token"`
- // Mac地址
- Mac *string `json:"mac"`
- }
- CheckTokenResp {
- // 是否合法
- Valid *bool `json:"valid"`
- // Sign 签名内容
- Sign *string `json:"sign"`
- // Timestamp 时间戳
- Timestamp *int64 `json:"timestamp"`
- AgentInfo *AgentInfo `json:"agent_info"`
- CustomAgentBase *string `json:"custom_agent_base"`
- CustomAgentKey *string `json:"custom_agent_key"`
- OpenaiBase *string `json:"openai_base"`
- OpenaiKey *string `json:"openai_key"`
- DatasetBase *string `json:"dataset_base"`
- DatasetKey *string `json:"dataset_key"`
- }
- )
- @server(
- group: token
- )
- service Wechat {
- // Check if token and mac are valid | 检查token和mac的合法性
- @handler checkToken
- post /token/check (CheckTokenReq) returns (CheckTokenResp)
- }
- @server(
- group: token
- jwt: Auth
- middleware: Authority
- )
- service Wechat {
- // Create token information | 创建Token
- @handler createToken
- post /token/third/create (TokenInfo) returns (BaseMsgResp)
- // Update token information | 更新Token
- @handler updateToken
- post /token/third/update (TokenInfo) returns (BaseMsgResp)
- // Delete token information | 删除Token信息
- @handler deleteToken
- post /token/third/delete (IDsReq) returns (BaseMsgResp)
- // Get token list | 获取Token列表
- @handler getTokenList
- post /token/third/list (TokenListReq) returns (TokenListResp)
- // Get token list | 获取Token列表
- @handler getApiTokenList
- post /token/api/list (TokenListReq) returns (TokenListResp)
- // Get token by ID | 通过ID获取Token
- @handler getTokenById
- post /token/third/detail (IDReq) returns (TokenInfoResp)
- }
|