diff options
author | Matias Linares <matiaslina@openmailbox.org> | 2018-06-04 20:05:07 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@openmailbox.org> | 2018-06-04 20:05:07 -0300 |
commit | 0bbd2b29349e0aa99c13e93ee12dba50b6ee06c5 (patch) | |
tree | 70b9ef29faffc4c2967f8640d381c92c3945c11f /lib | |
parent | ef328e890271dfe9739d87c9a292315df885b60d (diff) | |
download | perl6-matrix-client-0bbd2b29349e0aa99c13e93ee12dba50b6ee06c5.tar.gz |
Add whoami endpoint
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Matrix/Client.pm6 | 10 |
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 = "") { |