aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2018-06-04 20:05:07 -0300
committerMatias Linares <matiaslina@openmailbox.org>2018-06-04 20:05:07 -0300
commit0bbd2b29349e0aa99c13e93ee12dba50b6ee06c5 (patch)
tree70b9ef29faffc4c2967f8640d381c92c3945c11f /lib
parentef328e890271dfe9739d87c9a292315df885b60d (diff)
downloadperl6-matrix-client-0bbd2b29349e0aa99c13e93ee12dba50b6ee06c5.tar.gz
Add whoami endpoint
Diffstat (limited to 'lib')
-rw-r--r--lib/Matrix/Client.pm610
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Matrix/Client.pm6 b/lib/Matrix/Client.pm6
index b9848a2..73ed923 100644
--- a/lib/Matrix/Client.pm6
+++ b/lib/Matrix/Client.pm6
@@ -92,6 +92,16 @@ multi method change-avatar(Str:D $mxc-url!) {
avatar_url => $mxc-url);
}
+method whoami {
+ unless $!user-id {
+ my $res = $.get('/account/whoami');
+ my $data = from-json($res.content);
+ $!user-id = $data<user_id>;
+ }
+
+ $!user-id
+}
+
# Syncronization
multi method sync(:$since = "") {