mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
client: add request body for user redact
Some checks failed
Some checks failed
This commit is contained in:
parent
990519c29f
commit
642e17f2ae
2 changed files with 15 additions and 5 deletions
15
client.go
15
client.go
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue