@@ -459,7 +459,7 @@ func (c *CSAPI) SendRedaction(t ct.TestLike, roomID string, content map[string]i
459459 return c .Do (t , "PUT" , paths , WithJSONBody (t , content ))
460460}
461461
462- // MustGetStateEvent returns the event content for the given state event. Fails the test if the state event does not exist.
462+ // MustGetStateEventContent returns the event content for the given state event. Fails the test if the state event does not exist.
463463func (c * CSAPI ) MustGetStateEventContent (t ct.TestLike , roomID , eventType , stateKey string ) (content gjson.Result ) {
464464 t .Helper ()
465465 res := c .GetStateEventContent (t , roomID , eventType , stateKey )
@@ -468,12 +468,27 @@ func (c *CSAPI) MustGetStateEventContent(t ct.TestLike, roomID, eventType, state
468468 return gjson .ParseBytes (body )
469469}
470470
471- // GetStateEvent returns the event content for the given state event. Use this form to detect absence via 404.
471+ // GetStateEventContent returns the event content for the given state event. Use this form to detect absence via 404.
472472func (c * CSAPI ) GetStateEventContent (t ct.TestLike , roomID , eventType , stateKey string ) * http.Response {
473473 t .Helper ()
474474 return c .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "state" , eventType , stateKey })
475475}
476476
477+ // MustGetEvent returns the event content for the given state event. Fails the test if the state event does not exist.
478+ func (c * CSAPI ) MustGetEvent (t ct.TestLike , roomID , eventID string ) (eventJson gjson.Result ) {
479+ t .Helper ()
480+ res := c .GetEvent (t , roomID , eventID )
481+ mustRespond2xx (t , res )
482+ body := ParseJSON (t , res )
483+ return gjson .ParseBytes (body )
484+ }
485+
486+ // GetEvent returns the event JSON. Use this form to detect absence via 404.
487+ func (c * CSAPI ) GetEvent (t ct.TestLike , roomID , eventID string ) * http.Response {
488+ t .Helper ()
489+ return c .Do (t , "GET" , []string {"_matrix" , "client" , "v3" , "rooms" , roomID , "event" , eventID })
490+ }
491+
477492// MustSendTyping marks this user as typing until the timeout is reached. If isTyping is false, timeout is ignored.
478493func (c * CSAPI ) MustSendTyping (t ct.TestLike , roomID string , isTyping bool , timeoutMillis int ) {
479494 res := c .SendTyping (t , roomID , isTyping , timeoutMillis )
0 commit comments