diff options
author | Matias Linares <matiaslina@gmail.com> | 2020-09-06 19:38:12 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@gmail.com> | 2020-09-06 19:38:12 -0300 |
commit | 80d50c14866f6e58ee57792a383920a7e8a1274a (patch) | |
tree | 49e0b5976f74427bb627c88a60b6626d3b20dd13 /lib/Matrix/Client/MediaStore.rakumod | |
parent | ae506f4258324f77b8644459c1cb0c18359d793b (diff) | |
download | perl6-matrix-client-80d50c14866f6e58ee57792a383920a7e8a1274a.tar.gz |
Add media store config method
Diffstat (limited to 'lib/Matrix/Client/MediaStore.rakumod')
-rw-r--r-- | lib/Matrix/Client/MediaStore.rakumod | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Matrix/Client/MediaStore.rakumod b/lib/Matrix/Client/MediaStore.rakumod index 7086083..7afa9e3 100644 --- a/lib/Matrix/Client/MediaStore.rakumod +++ b/lib/Matrix/Client/MediaStore.rakumod @@ -1,7 +1,9 @@ use JSON::Fast; +use URI::Escape; + use Matrix::Client::Requester; use Matrix::Client::Exception; -use URI::Escape; +use Matrix::Response; unit class Matrix::Client::MediaStore does Matrix::Client::Requester; @@ -16,7 +18,6 @@ submethod TWEAK { $!client-endpoint = "/_matrix/media/r0"; } -# https://matrix.deprecated.org/_matrix/media/r0/thumbnail/matrix.org/TKTUVTAazFocrTjezhiXZiIe?width=25&height=25&method=crop method parse-mxc(Str $uri) { if $uri ~~ m/"mxc://" $<server-name> = [.*] "/" $<media-id> = [ .* ]/ { return { @@ -68,3 +69,8 @@ multi method download(Str $server-name, Str $media-id, Bool :$allow-remote = Tru content => $response.content ) } + +method config(--> Matrix::Response::MediaStore::Config) { + my $response = $.get("/config"); + Matrix::Response::MediaStore::Config.new(from-json($response.content)) +} |