feat: 添加邮件服务器客户端库的基础功能
- 新增完整的Go客户端库实现,支持邮件服务器API的各种操作 - 实现账户管理、签名管理、邮件发送、审计、配额、通道等功能模块 - 提供ServiceAuth和AppAuth两种认证模式的客户端 - 添加详细的README文档,包含安装指南和使用示例 - 配置.gitignore文件以忽略构建产物和开发工具配置 - 支持分页查询、错误处理和客户端选项配置
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package emailcli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
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,
|
||||
"start_date": q.StartDate,
|
||||
"end_date": q.EndDate,
|
||||
})
|
||||
return get[*PaginationResult[CheckLog]](c, ctx, "/api/v1/check-logs", buildQuery(params))
|
||||
}
|
||||
|
||||
func (c *Client) GetCheckSummary(ctx context.Context) ([]SenderHealth, error) {
|
||||
return get[[]SenderHealth](c, ctx, "/api/v1/check-logs/summary", nil)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user