mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
client: add support for stable version of room summary endpoint
This commit is contained in:
parent
522a373c68
commit
d804b5d961
2 changed files with 8 additions and 2 deletions
|
|
@ -1062,13 +1062,17 @@ func (cli *Client) GetMutualRooms(ctx context.Context, otherUserID id.UserID, ex
|
|||
}
|
||||
|
||||
func (cli *Client) GetRoomSummary(ctx context.Context, roomIDOrAlias string, via ...string) (resp *RespRoomSummary, err error) {
|
||||
urlPath := ClientURLPath{"unstable", "im.nheko.summary", "summary", roomIDOrAlias}
|
||||
if cli.SpecVersions.ContainsGreaterOrEqual(SpecV115) {
|
||||
urlPath = ClientURLPath{"v1", "room_summary", roomIDOrAlias}
|
||||
}
|
||||
// TODO add version check after one is added to MSC3266
|
||||
urlPath := cli.BuildURLWithFullQuery(ClientURLPath{"unstable", "im.nheko.summary", "summary", roomIDOrAlias}, func(q url.Values) {
|
||||
fullURL := cli.BuildURLWithFullQuery(urlPath, func(q url.Values) {
|
||||
if len(via) > 0 {
|
||||
q["via"] = via
|
||||
}
|
||||
})
|
||||
_, err = cli.MakeRequest(ctx, http.MethodGet, urlPath, nil, &resp)
|
||||
_, err = cli.MakeRequest(ctx, http.MethodGet, fullURL, nil, &resp)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ var (
|
|||
SpecV111 = MustParseSpecVersion("v1.11")
|
||||
SpecV112 = MustParseSpecVersion("v1.12")
|
||||
SpecV113 = MustParseSpecVersion("v1.13")
|
||||
SpecV114 = MustParseSpecVersion("v1.14")
|
||||
SpecV115 = MustParseSpecVersion("v1.15")
|
||||
)
|
||||
|
||||
func (svf SpecVersionFormat) String() string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue