docs(README): 更新文档为中文并完善API参考

- 将README从英文翻译为中文
- 添加详细的API参考文档,包括所有管理接口和枚举值说明
- 补充安装、快速开始、认证方式等使用指南

refactor(client): 优化客户端代码结构并添加详细注释

- 为所有API方法添加中文注释和使用说明
- 改进Client结构体和Option配置的设计
- 统一错误处理和响应结构的文档说明
This commit is contained in:
shiran
2026-04-18 15:54:19 +08:00
parent fe19922eff
commit fe43b9bdce
15 changed files with 1013 additions and 291 deletions
+9
View File
@@ -5,6 +5,9 @@ import (
"fmt"
)
// ListCheckLogs 分页查询发信账号的健康检查记录。
//
// GET /api/v1/check-logs?page=&page_size=&sender_account_id=&start_date=&end_date= ServiceAuth
func (c *Client) ListCheckLogs(ctx context.Context, q CheckLogQuery) (*PaginationResult[CheckLog], error) {
params := mergeParams(paginationParams(q.PaginationQuery), map[string]interface{}{
"sender_account_id": q.SenderAccountID,
@@ -14,10 +17,16 @@ func (c *Client) ListCheckLogs(ctx context.Context, q CheckLogQuery) (*Paginatio
return get[*PaginationResult[CheckLog]](c, ctx, "/api/v1/check-logs", buildQuery(params))
}
// GetCheckSummary 获取全部发信账号的健康汇总(近期成功率、状态等)。
//
// GET /api/v1/check-logs/summary ServiceAuth
func (c *Client) GetCheckSummary(ctx context.Context) ([]SenderHealth, error) {
return get[[]SenderHealth](c, ctx, "/api/v1/check-logs/summary", nil)
}
// TriggerCheck 手动触发一次指定发信账号的健康检查(同步返回结果)。
//
// POST /api/v1/check-logs/trigger/{senderAccountID} ServiceAuth
func (c *Client) TriggerCheck(ctx context.Context, senderAccountID uint) (*TriggerCheckResp, error) {
return post[*TriggerCheckResp](c, ctx, fmt.Sprintf("/api/v1/check-logs/trigger/%d", senderAccountID), nil)
}