aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2018-08-08 22:45:01 -0300
committerMatias Linares <matiaslina@gmail.com>2018-08-08 22:45:01 -0300
commit89c178e90786f668c15506f7e52206214ac29ed6 (patch)
treef2d81049d8d1346cb013baf152513e20cc75e8b0 /lib
parente69b990cf4ac80adac0496d988717b49f41547d0 (diff)
downloadperl6-matrix-client-89c178e90786f668c15506f7e52206214ac29ed6.tar.gz
Add /directory/room/<alias> endpoints
This allows work with the discoverability of the aliases for the rooms. The next step is allow the client to send a message, join, etc, a room with the room alias like #8 and #14
Diffstat (limited to 'lib')
-rw-r--r--lib/Matrix/Client.pm615
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Matrix/Client.pm6 b/lib/Matrix/Client.pm6
index 1e080bd..5f52779 100644
--- a/lib/Matrix/Client.pm6
+++ b/lib/Matrix/Client.pm6
@@ -197,6 +197,21 @@ method send(Str $room-id, Str $body, :$type? = "m.text") {
from-json($res.content)<event_id>
}
+method get-room-id($room-alias) {
+ my $res = $.get("/directory/room/$room-alias");
+
+ from-json($res.content)<room_id>
+}
+
+method add-room-alias($room-id, $room-alias) {
+ $.put("/directory/room/$room-alias",
+ room_id => $room-id);
+}
+
+method remove-room-alias($room-alias) {
+ $.delete("/directory/room/$room-alias");
+}
+
# Media
method upload(IO::Path $path, Str $filename?) {