AS AgentScopeAPI 手册 / API Reference

GitHubInboundMapper

public final class GitHubInboundMapper
源码Source io/agentscope/extensions/channel/github/GitHubInboundMapper.java:46–127

GitHub 入站 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 fires issue_comment for both; the issue object has a pull_request subobject 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.

参数Parameters
名称Name类型Type说明Description
channelIdString渠道标识(类型 `String`)。The channel id.
源码Source io/agentscope/extensions/channel/github/GitHubInboundMapper.java:50–52

方法详情Method Detail

extractCommentId

public static Optional<Long> extractCommentId(JsonNode payload)
static

设置该参数。

Returns the comment.id used as the idempotency key.

参数Parameters
名称Name类型Type说明Description
payloadJsonNode负载(类型 `JsonNode`)。The payload.
返回Returns Optional<Long>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/github/GitHubInboundMapper.java:58–64

extractCommenterId

public static Optional<Long> extractCommenterId(JsonNode payload)
static

设置该参数。

Returns the numeric id of the comment author.

参数Parameters
名称Name类型Type说明Description
payloadJsonNode负载(类型 `JsonNode`)。The payload.
返回Returns Optional<Long>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/github/GitHubInboundMapper.java:69–75

map

public Optional<InboundMessage> map(String eventType, JsonNode payload)

执行映射相关操作。

Maps an issue_comment or pull_request_review_comment payload into an InboundMessage.

参数Parameters
名称Name类型Type说明Description
eventTypeString事件类型(类型 `String`)。The event type.
payloadJsonNode负载(类型 `JsonNode`)。The payload.
返回Returns Optional<InboundMessage>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/github/GitHubInboundMapper.java:82–126
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.