diff options
author | Matias Linares <matiaslina@gmail.com> | 2018-08-08 22:45:01 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@gmail.com> | 2018-08-08 22:45:01 -0300 |
commit | 89c178e90786f668c15506f7e52206214ac29ed6 (patch) | |
tree | f2d81049d8d1346cb013baf152513e20cc75e8b0 /lib | |
parent | e69b990cf4ac80adac0496d988717b49f41547d0 (diff) | |
download | perl6-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.pm6 | 15 |
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?) { |