From 0bbd2b29349e0aa99c13e93ee12dba50b6ee06c5 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Mon, 4 Jun 2018 20:05:07 -0300 Subject: Add whoami endpoint --- lib/Matrix/Client.pm6 | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib') 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 +} + # Syncronization multi method sync(:$since = "") { -- cgit v1.2.3-70-g09d2