client: add request body for user redact
Some checks failed
Go / Lint (latest) (push) Has been cancelled
Go / Build (old, libolm) (push) Has been cancelled
Go / Build (latest, libolm) (push) Has been cancelled
Go / Build (old, goolm) (push) Has been cancelled
Go / Build (latest, goolm) (push) Has been cancelled

This commit is contained in:
Tulir Asokan 2025-01-29 21:52:05 +02:00
commit 642e17f2ae
2 changed files with 15 additions and 5 deletions

View file

@ -1277,11 +1277,16 @@ func (cli *Client) RedactEvent(ctx context.Context, roomID id.RoomID, eventID id
return
}
func (cli *Client) UnstableRedactUserEvents(ctx context.Context, roomID id.RoomID, userID id.UserID, limit int) (resp *RespRedactUserEvents, err error) {
urlPath := cli.BuildURLWithQuery(ClientURLPath{"unstable", "org.matrix.msc4194", "rooms", roomID, "redact", "user", userID}, map[string]string{
"limit": strconv.Itoa(limit),
})
_, err = cli.MakeRequest(ctx, http.MethodGet, urlPath, nil, &resp)
func (cli *Client) UnstableRedactUserEvents(ctx context.Context, roomID id.RoomID, userID id.UserID, req *ReqRedactUser) (resp *RespRedactUserEvents, err error) {
if req == nil {
req = &ReqRedactUser{}
}
query := map[string]string{}
if req.Limit > 0 {
query["limit"] = strconv.Itoa(req.Limit)
}
urlPath := cli.BuildURLWithQuery(ClientURLPath{"unstable", "org.matrix.msc4194", "rooms", roomID, "redact", "user", userID}, query)
_, err = cli.MakeRequest(ctx, http.MethodPost, urlPath, req, &resp)
return
}

View file

@ -138,6 +138,11 @@ type ReqRedact struct {
Extra map[string]interface{}
}
type ReqRedactUser struct {
Reason string `json:"reason"`
Limit int `json:"-"`
}
type ReqMembers struct {
At string `json:"at"`
Membership event.Membership `json:"membership,omitempty"`