Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Feat]: Simplification of the client API?

未关闭
#517 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
65/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
停滞
技术栈
java
领域
api

调研方向

查看 spec 模块中的客户端 API,重点关注使用 XXXParams 对象(如 TaskIdParams)的方法。以现有的 sendMessage 方法作为该模式的参考。确定所有可以简化的方法,然后创建接受基本类型参数并委托给现有实现的重载版本。确保向后兼容并测试更改。

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem? Please describe.

The client API is a thin wrapper around the domain objects in the spec module.

I wonder if we could not make the API a bit simpler while retaining all the capabilities it exposes.

Describe the solution you'd like

For example, a lot of calls wrap their parameters in XXXParams object:

public Task cancelTask(TaskIdParams request)

but TaskIdParams is composed of a taskId and a metadata map.
Could the call simply be:

public Task cancelTask(String taskId, Map<String, Object> metadata) {
  return clientTransport.cancelTask(new TaskIdParams(taskId, metadata), request, context);
}

and a default method:

public default Task cancelTask(String taskId) {
    return cancelTask(taskId, emptyMap();
}

This way, the TaskIdParams does not leak to the Client API (making it bigger than it needs to be.

The API is already to that for its sendMessage methods that hides the internal MessageSendParams.
This is a pattern that should be applied to other methods as well

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct
主要语言
Java
星标
504
派生
184
平均合并
1 天 9 小时
30 天内合并 PR
25

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

a2aproject/a2a-java 的其他 Issue

查看 a2aproject/a2a-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。