mirror of
				https://github.com/matrix-org/gomatrix
				synced 2025-11-03 22:08:04 +00:00 
			
		
		
		
	Add /redact endpoint
This commit is contained in:
		
							parent
							
								
									373dfc2ff2
								
							
						
					
					
						commit
						30c7035522
					
				
					 2 changed files with 13 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -393,6 +393,14 @@ func (cli *Client) SendText(roomID, text string) (*RespSendEvent, error) {
 | 
			
		|||
		TextMessage{"m.text", text})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RedactEvent redacts the given event. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid
 | 
			
		||||
func (cli *Client) RedactEvent(roomID, eventID string, req *ReqRedact) (resp *RespSendEvent, err error) {
 | 
			
		||||
	txnID := "go" + strconv.FormatInt(time.Now().UnixNano(), 10)
 | 
			
		||||
	urlPath := cli.BuildURL("rooms", roomID, "redact", eventID, txnID)
 | 
			
		||||
	_, err = cli.MakeRequest("PUT", urlPath, req, &resp)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateRoom creates a new Matrix room. See https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom
 | 
			
		||||
//  resp, err := cli.CreateRoom(&gomatrix.ReqCreateRoom{
 | 
			
		||||
//  	Preset: "public_chat",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,11 @@ type ReqCreateRoom struct {
 | 
			
		|||
	IsDirect        bool                   `json:"is_direct,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ReqRedact is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid
 | 
			
		||||
type ReqRedact struct {
 | 
			
		||||
	Reason string `json:"reason,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ReqInvite3PID is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#id57
 | 
			
		||||
// It is also a JSON object used in https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom
 | 
			
		||||
type ReqInvite3PID struct {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue