Skip to content

Commit 642e17f

Browse files
committed
client: add request body for user redact
1 parent 990519c commit 642e17f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

client.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,11 +1277,16 @@ func (cli *Client) RedactEvent(ctx context.Context, roomID id.RoomID, eventID id
12771277
return
12781278
}
12791279

1280-
func (cli *Client) UnstableRedactUserEvents(ctx context.Context, roomID id.RoomID, userID id.UserID, limit int) (resp *RespRedactUserEvents, err error) {
1281-
urlPath := cli.BuildURLWithQuery(ClientURLPath{"unstable", "org.matrix.msc4194", "rooms", roomID, "redact", "user", userID}, map[string]string{
1282-
"limit": strconv.Itoa(limit),
1283-
})
1284-
_, err = cli.MakeRequest(ctx, http.MethodGet, urlPath, nil, &resp)
1280+
func (cli *Client) UnstableRedactUserEvents(ctx context.Context, roomID id.RoomID, userID id.UserID, req *ReqRedactUser) (resp *RespRedactUserEvents, err error) {
1281+
if req == nil {
1282+
req = &ReqRedactUser{}
1283+
}
1284+
query := map[string]string{}
1285+
if req.Limit > 0 {
1286+
query["limit"] = strconv.Itoa(req.Limit)
1287+
}
1288+
urlPath := cli.BuildURLWithQuery(ClientURLPath{"unstable", "org.matrix.msc4194", "rooms", roomID, "redact", "user", userID}, query)
1289+
_, err = cli.MakeRequest(ctx, http.MethodPost, urlPath, req, &resp)
12851290
return
12861291
}
12871292

requests.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ type ReqRedact struct {
138138
Extra map[string]interface{}
139139
}
140140

141+
type ReqRedactUser struct {
142+
Reason string `json:"reason"`
143+
Limit int `json:"-"`
144+
}
145+
141146
type ReqMembers struct {
142147
At string `json:"at"`
143148
Membership event.Membership `json:"membership,omitempty"`

0 commit comments

Comments
 (0)