GitHubInboundMapper
public final class GitHubInboundMapper
io/agentscope/extensions/channel/github/GitHubInboundMapper.java:46–127GitHub 入站 Mapper,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.github 包。核心成员包括 extractCommentId、extractCommenterId、map、GitHubInboundMapper。
Maps a GitHub webhook delivery into an InboundMessage.
MVP handles two event types:
-
issue_comment— comments on issues OR PRs (GitHub firesissue_commentfor both; theissueobject has apull_requestsubobject when it's a PR) -
pull_request_review_comment— line-anchored review comments on PR diffs
The peer model:
-
peerKind=PeerKind#THREAD -
peerId="<owner>/<repo>#<number>"— stable identifier the outbound client parses to build the comment URL.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public GitHubInboundMapper(String channelId) | 初始化 `GitHubInboundMapper` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static Optional<Long> extractCommentId(JsonNode payload)static | 设置该参数。 Returns the `comment.id` used as the idempotency key. |
public static Optional<Long> extractCommenterId(JsonNode payload)static | 设置该参数。 Returns the numeric id of the comment author. |
public Optional<InboundMessage> map(String eventType, JsonNode payload) | 执行映射相关操作。 Maps an `issue_comment` or `pull_request_review_comment` payload into an
`InboundMessage`. |
构造器详情Constructor Detail
GitHubInboundMapper
public GitHubInboundMapper(String channelId)
初始化 GitHubInboundMapper 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
io/agentscope/extensions/channel/github/GitHubInboundMapper.java:50–52方法详情Method Detail
extractCommentId
public static Optional<Long> extractCommentId(JsonNode payload)
设置该参数。
Returns the comment.id used as the idempotency key.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payload | JsonNode | 负载(类型 `JsonNode`)。The payload. |
Optional<Long>io/agentscope/extensions/channel/github/GitHubInboundMapper.java:58–64extractCommenterId
public static Optional<Long> extractCommenterId(JsonNode payload)
设置该参数。
Returns the numeric id of the comment author.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payload | JsonNode | 负载(类型 `JsonNode`)。The payload. |
Optional<Long>io/agentscope/extensions/channel/github/GitHubInboundMapper.java:69–75map
public Optional<InboundMessage> map(String eventType, JsonNode payload)
执行映射相关操作。
Maps an issue_comment or pull_request_review_comment payload into an InboundMessage.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
eventType | String | 事件类型(类型 `String`)。The event type. |
payload | JsonNode | 负载(类型 `JsonNode`)。The payload. |
Optional<InboundMessage>io/agentscope/extensions/channel/github/GitHubInboundMapper.java:82–126