summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge/gomatrix/client.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-02-09 23:49:17 +0100
committerGitHub <noreply@github.com>2020-02-09 23:49:17 +0100
commit23083f3ae0ffd28ca4094c75c90ba45fc57bd523 (patch)
treeef2dcfd78de408fc9349e18e08d480211c393bb3 /vendor/github.com/matterbridge/gomatrix/client.go
parent1985873494ddcfb73ec04525ebc1b7ba0b1f428d (diff)
downloadmatterbridge-msglm-23083f3ae0ffd28ca4094c75c90ba45fc57bd523.tar.gz
matterbridge-msglm-23083f3ae0ffd28ca4094c75c90ba45fc57bd523.tar.bz2
matterbridge-msglm-23083f3ae0ffd28ca4094c75c90ba45fc57bd523.zip
Rebase gomatrix vendor with upstream (#1006)
Diffstat (limited to 'vendor/github.com/matterbridge/gomatrix/client.go')
-rw-r--r--vendor/github.com/matterbridge/gomatrix/client.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/vendor/github.com/matterbridge/gomatrix/client.go b/vendor/github.com/matterbridge/gomatrix/client.go
index 5a90b52a..09e62d24 100644
--- a/vendor/github.com/matterbridge/gomatrix/client.go
+++ b/vendor/github.com/matterbridge/gomatrix/client.go
@@ -372,6 +372,53 @@ func (cli *Client) Versions() (resp *RespVersions, err error) {
return
}
+// PublicRooms returns the list of public rooms on target server. See https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-unstable-publicrooms
+func (cli *Client) PublicRooms(limit int, since string, server string) (resp *RespPublicRooms, err error) {
+ args := map[string]string{}
+
+ if limit != 0 {
+ args["limit"] = strconv.Itoa(limit)
+ }
+ if since != "" {
+ args["since"] = since
+ }
+ if server != "" {
+ args["server"] = server
+ }
+
+ urlPath := cli.BuildURLWithQuery([]string{"publicRooms"}, args)
+ err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ return
+}
+
+// PublicRoomsFiltered returns a subset of PublicRooms filtered server side.
+// See https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-unstable-publicrooms
+func (cli *Client) PublicRoomsFiltered(limit int, since string, server string, filter string) (resp *RespPublicRooms, err error) {
+ content := map[string]string{}
+
+ if limit != 0 {
+ content["limit"] = strconv.Itoa(limit)
+ }
+ if since != "" {
+ content["since"] = since
+ }
+ if filter != "" {
+ content["filter"] = filter
+ }
+
+ var urlPath string
+ if server == "" {
+ urlPath = cli.BuildURL("publicRooms")
+ } else {
+ urlPath = cli.BuildURLWithQuery([]string{"publicRooms"}, map[string]string{
+ "server": server,
+ })
+ }
+
+ err = cli.MakeRequest("POST", urlPath, content, &resp)
+ return
+}
+
// JoinRoom joins the client to a room ID or alias. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-join-roomidoralias
//
// If serverName is specified, this will be added as a query param to instruct the homeserver to join via that server. If content is specified, it will