Skip to content

Commit

Permalink
client: add request body for user redact
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jan 29, 2025
1 parent 990519c commit 642e17f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
15 changes: 10 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 642e17f

Please sign in to comment.