Skip to content

Commit

Permalink
批量操作用户关系
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Sep 9, 2024
1 parent 6b33e28 commit 506e0fa
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,3 +659,22 @@ func (c *Client) ModifyRelation(param ModifyRelationParam) error {
_, err := execute[any](c, method, url, param, fillCsrf(c))
return err
}

type BatchModifyRelationParam struct {
Fids []int `json:"fids"` // 目标用户 mid 列表
Act ModifyRelationAct `json:"act"` // 操作代码。仅可为 1 或 5,故只能进行批量关注和拉黑
ReSrc int `json:"re_src"` // 关注来源代码。同上
}

type BatchModifyRelationResult struct {
FailedFids []int `json:"failed_fids"` // 操作失败的 mid 列表
}

// BatchModifyRelation 批量操作用户关系
func (c *Client) BatchModifyRelation(param BatchModifyRelationParam) (*BatchModifyRelationResult, error) {
const (
method = resty.MethodPost
url = "https://api.bilibili.com/x/relation/batch/modify"
)
return execute[*BatchModifyRelationResult](c, method, url, param, fillCsrf(c))
}

0 comments on commit 506e0fa

Please sign in to comment.