From 506e0fa30f428e531e25ca0d93d634fda2db8edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=87=E8=91=A9=E3=81=AE=E7=81=B5=E6=A2=A6?= Date: Mon, 9 Sep 2024 15:35:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=93=8D=E4=BD=9C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- user.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/user.go b/user.go index a7c2308..65e17f8 100644 --- a/user.go +++ b/user.go @@ -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)) +}