summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/matterbridge')
-rw-r--r--vendor/github.com/matterbridge/gomatrix/client.go47
-rw-r--r--vendor/github.com/matterbridge/gomatrix/events.go19
-rw-r--r--vendor/github.com/matterbridge/gomatrix/responses.go8
-rw-r--r--vendor/github.com/matterbridge/gomatrix/room.go13
4 files changed, 78 insertions, 9 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
diff --git a/vendor/github.com/matterbridge/gomatrix/events.go b/vendor/github.com/matterbridge/gomatrix/events.go
index d3ee7491..2ebbedca 100644
--- a/vendor/github.com/matterbridge/gomatrix/events.go
+++ b/vendor/github.com/matterbridge/gomatrix/events.go
@@ -7,15 +7,16 @@ import (
// Event represents a single Matrix event.
type Event struct {
- StateKey *string `json:"state_key,omitempty"` // The state key for the event. Only present on State Events.
- Sender string `json:"sender"` // The user ID of the sender of the event
- Type string `json:"type"` // The event type
- Timestamp int64 `json:"origin_server_ts"` // The unix timestamp when this message was sent by the origin server
- ID string `json:"event_id"` // The unique ID of this event
- RoomID string `json:"room_id"` // The room the event was sent to. May be nil (e.g. for presence)
- Content map[string]interface{} `json:"content"` // The JSON content of the event.
- Redacts string `json:"redacts,omitempty"` // The event ID that was redacted if a m.room.redaction event
- Unsigned map[string]interface{} `json:"unsigned"` // The unsigned portions of the event, such as age and prev_content
+ StateKey *string `json:"state_key,omitempty"` // The state key for the event. Only present on State Events.
+ Sender string `json:"sender"` // The user ID of the sender of the event
+ Type string `json:"type"` // The event type
+ Timestamp int64 `json:"origin_server_ts"` // The unix timestamp when this message was sent by the origin server
+ ID string `json:"event_id"` // The unique ID of this event
+ RoomID string `json:"room_id"` // The room the event was sent to. May be nil (e.g. for presence)
+ Redacts string `json:"redacts,omitempty"` // The event ID that was redacted if a m.room.redaction event
+ Unsigned map[string]interface{} `json:"unsigned"` // The unsigned portions of the event, such as age and prev_content
+ Content map[string]interface{} `json:"content"` // The JSON content of the event.
+ PrevContent map[string]interface{} `json:"prev_content,omitempty"` // The JSON prev_content of the event.
}
// Body returns the value of the "body" key in the event content if it is
diff --git a/vendor/github.com/matterbridge/gomatrix/responses.go b/vendor/github.com/matterbridge/gomatrix/responses.go
index 7a3a4ce3..effb6096 100644
--- a/vendor/github.com/matterbridge/gomatrix/responses.go
+++ b/vendor/github.com/matterbridge/gomatrix/responses.go
@@ -22,6 +22,14 @@ type RespVersions struct {
Versions []string `json:"versions"`
}
+// RespPublicRooms is the JSON response for http://matrix.org/speculator/spec/HEAD/client_server/unstable.html#get-matrix-client-unstable-publicrooms
+type RespPublicRooms struct {
+ TotalRoomCountEstimate int `json:"total_room_count_estimate"`
+ PrevBatch string `json:"prev_batch"`
+ NextBatch string `json:"next_batch"`
+ Chunk []PublicRoom `json:"chunk"`
+}
+
// RespJoinRoom is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-join
type RespJoinRoom struct {
RoomID string `json:"room_id"`
diff --git a/vendor/github.com/matterbridge/gomatrix/room.go b/vendor/github.com/matterbridge/gomatrix/room.go
index c9b2351f..d1d22868 100644
--- a/vendor/github.com/matterbridge/gomatrix/room.go
+++ b/vendor/github.com/matterbridge/gomatrix/room.go
@@ -6,6 +6,19 @@ type Room struct {
State map[string]map[string]*Event
}
+// PublicRoom represents the information about a public room obtainable from the room directory
+type PublicRoom struct {
+ CanonicalAlias string `json:"canonical_alias"`
+ Name string `json:"name"`
+ WorldReadable bool `json:"world_readable"`
+ Topic string `json:"topic"`
+ NumJoinedMembers int `json:"num_joined_members"`
+ AvatarURL string `json:"avatar_url"`
+ RoomID string `json:"room_id"`
+ GuestCanJoin bool `json:"guest_can_join"`
+ Aliases []string `json:"aliases"`
+}
+
// UpdateState updates the room's current state with the given Event. This will clobber events based
// on the type/state_key combination.
func (room Room) UpdateState(event *Event) {