QueryAndBuildEvent builds a Matrix event using the event builder and roomserver query API client provided. If also fills roomserver query API response (if provided) in case the function calling FillBuilder needs to use it. Returns ErrRoomNoExists if the state of the room could not be retrieved becau
( ctx context.Context, builder *gomatrixserverlib.EventBuilder, cfg *config.Global, evTime time.Time, rsAPI api.QueryLatestEventsAndStateAPI, queryRes *api.QueryLatestEventsAndStateResponse, )
| 37 | // the room doesn't exist |
| 38 | // Returns an error if something else went wrong |
| 39 | func QueryAndBuildEvent( |
| 40 | ctx context.Context, |
| 41 | builder *gomatrixserverlib.EventBuilder, cfg *config.Global, evTime time.Time, |
| 42 | rsAPI api.QueryLatestEventsAndStateAPI, queryRes *api.QueryLatestEventsAndStateResponse, |
| 43 | ) (*gomatrixserverlib.HeaderedEvent, error) { |
| 44 | if queryRes == nil { |
| 45 | queryRes = &api.QueryLatestEventsAndStateResponse{} |
| 46 | } |
| 47 | |
| 48 | eventsNeeded, err := queryRequiredEventsForBuilder(ctx, builder, rsAPI, queryRes) |
| 49 | if err != nil { |
| 50 | // This can pass through a ErrRoomNoExists to the caller |
| 51 | return nil, err |
| 52 | } |
| 53 | return BuildEvent(ctx, builder, cfg, evTime, eventsNeeded, queryRes) |
| 54 | } |
| 55 | |
| 56 | // BuildEvent builds a Matrix event from the builder and QueryLatestEventsAndStateResponse |
| 57 | // provided. |
nothing calls this directly
no test coverage detected