summaryrefslogtreecommitdiff
path: root/lib/Matrix/Client/Room.pm6
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Matrix/Client/Room.pm6')
-rw-r--r--lib/Matrix/Client/Room.pm67
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Matrix/Client/Room.pm6 b/lib/Matrix/Client/Room.pm6
index e0b14a2..4ec774f 100644
--- a/lib/Matrix/Client/Room.pm6
+++ b/lib/Matrix/Client/Room.pm6
@@ -25,6 +25,7 @@ method !get-name() {
$!name = $data<name>;
}
+#| GET - /_matrix/client/r0/rooms/{roomId}/joined_members
method joined-members {
my %data = from-json($.get("/joined_members").content);
%data<joined>
@@ -51,6 +52,7 @@ method fallback-name(--> Str) {
};
}
+#| GET - /_matrix/client/r0/rooms/{roomId}/messages
method messages() {
my $res = $.get("/messages");
my $data = from-json($res.content);
@@ -58,6 +60,7 @@ method messages() {
return $data<chunk>.clone;
}
+#| PUT - /_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}
method send(Str $body!, Str :$type? = "m.text") {
$Matrix::Client::Common::TXN-ID++;
my $res = $.put(
@@ -68,6 +71,7 @@ method send(Str $body!, Str :$type? = "m.text") {
from-json($res.content)<event_id>
}
+#| GET - /_matrix/client/r0/rooms/{roomId}/state
multi method state(--> Seq) {
my $data = from-json($.get('/state').content);
@@ -76,10 +80,12 @@ multi method state(--> Seq) {
}
}
+#| GET - /_matrix/client/r0/rooms/{roomId}/state/{eventType}
multi method state(Str $event-type) {
from-json($.get("/state/$event-type").content)
}
+#| PUT - /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}
method send-state(Str:D $event-type, :$state-key = "", *%args --> Str) {
my $res = $.put(
"/state/$event-type/$state-key",
@@ -88,6 +94,7 @@ method send-state(Str:D $event-type, :$state-key = "", *%args --> Str) {
from-json($res.content)<event_id>
}
+#| POST - /_matrix/client/r0/rooms/{roomId}/leave
method leave() {
$.post('/leave')
}