docs(README): 更新文档为中文并完善API参考
- 将README从英文翻译为中文 - 添加详细的API参考文档,包括所有管理接口和枚举值说明 - 补充安装、快速开始、认证方式等使用指南 refactor(client): 优化客户端代码结构并添加详细注释 - 为所有API方法添加中文注释和使用说明 - 改进Client结构体和Option配置的设计 - 统一错误处理和响应结构的文档说明
This commit is contained in:
@@ -5,10 +5,17 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// CreateSender 在指定通道下创建 SMTP 发信账号。
|
||||
// SmtpPassword 会加密存储,不会在后续接口中返回。
|
||||
//
|
||||
// POST /api/v1/channels/{channelID}/senders ServiceAuth
|
||||
func (c *Client) CreateSender(ctx context.Context, channelID uint, req CreateSenderReq) (*SenderAccount, error) {
|
||||
return post[*SenderAccount](c, ctx, fmt.Sprintf("/api/v1/channels/%d/senders", channelID), req)
|
||||
}
|
||||
|
||||
// ListSendersByChannel 分页查询指定通道下的发信账号。
|
||||
//
|
||||
// GET /api/v1/channels/{channelID}/senders?page=&page_size=&status=&keyword= ServiceAuth
|
||||
func (c *Client) ListSendersByChannel(ctx context.Context, channelID uint, q SenderListQuery) (*PaginationResult[SenderAccount], error) {
|
||||
params := mergeParams(paginationParams(q.PaginationQuery), map[string]interface{}{
|
||||
"status": q.Status,
|
||||
@@ -17,10 +24,16 @@ func (c *Client) ListSendersByChannel(ctx context.Context, channelID uint, q Sen
|
||||
return get[*PaginationResult[SenderAccount]](c, ctx, fmt.Sprintf("/api/v1/channels/%d/senders", channelID), buildQuery(params))
|
||||
}
|
||||
|
||||
// UpdateSender 局部更新发信账号。
|
||||
//
|
||||
// PUT /api/v1/senders/{id} ServiceAuth
|
||||
func (c *Client) UpdateSender(ctx context.Context, id uint, req UpdateSenderReq) (*SenderAccount, error) {
|
||||
return put[*SenderAccount](c, ctx, fmt.Sprintf("/api/v1/senders/%d", id), req)
|
||||
}
|
||||
|
||||
// DeleteSender 删除发信账号(软删除)。
|
||||
//
|
||||
// DELETE /api/v1/senders/{id} ServiceAuth
|
||||
func (c *Client) DeleteSender(ctx context.Context, id uint) error {
|
||||
_, err := del[any](c, ctx, fmt.Sprintf("/api/v1/senders/%d", id))
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user