GitLabBotIdentityResolver
public final class GitLabBotIdentityResolver
源码Source
io/agentscope/extensions/channel/gitlab/GitLabBotIdentityResolver.java:32–89GitLab Bot 身份解析器,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.gitlab 包。核心成员包括 refresh、botUserId、botUsername、GitLabBotIdentityResolver。
Resolves the bot's GitLab user id (and username) for the configured token by calling
GET /user. Used for bot-loop self-detection — when a Note Hook is fired by the bot
itself, the channel must drop it to avoid infinite loops.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public GitLabBotIdentityResolver(String apiBase, String token) | 初始化 `GitLabBotIdentityResolver` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public void refresh() | 执行刷新相关操作。 Synchronously attempts to resolve `GET /user` and cache the response. |
public long botUserId() | 返回 `botUserId` 结果。 Returns the bot's numeric user id, or `-1` if unresolved. |
public String botUsername() | 返回 `botUsername` 结果。 Returns the bot's username, or null if unresolved. |
构造器详情Constructor Detail
GitLabBotIdentityResolver
public GitLabBotIdentityResolver(String apiBase, String token)
初始化 GitLabBotIdentityResolver 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
apiBase | String | API 基类(类型 `String`)。The api base. |
token | String | 令牌(类型 `String`)。The token. |
源码Source
io/agentscope/extensions/channel/gitlab/GitLabBotIdentityResolver.java:41–44方法详情Method Detail
refresh
public void refresh()
执行刷新相关操作。
Synchronously attempts to resolve GET /user and cache the response.
源码Source
io/agentscope/extensions/channel/gitlab/GitLabBotIdentityResolver.java:50–74botUserId
public long botUserId()
返回 botUserId 结果。
Returns the bot's numeric user id, or -1 if unresolved.
long返回数值结果。Returns a numeric result.
源码Source
io/agentscope/extensions/channel/gitlab/GitLabBotIdentityResolver.java:77–79botUsername
public String botUsername()
返回 botUsername 结果。
Returns the bot's username, or null if unresolved.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/extensions/channel/gitlab/GitLabBotIdentityResolver.java:82–84