From 89c178e90786f668c15506f7e52206214ac29ed6 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Wed, 8 Aug 2018 22:45:01 -0300 Subject: Add /directory/room/ 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 --- lib/Matrix/Client.pm6 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib') 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) } +method get-room-id($room-alias) { + my $res = $.get("/directory/room/$room-alias"); + + from-json($res.content) +} + +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?) { -- cgit v1.2.3-70-g09d2