summaryrefslogtreecommitdiff
path: root/lib/Matrix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Matrix')
-rw-r--r--lib/Matrix/Client/MediaStore.rakumod10
-rw-r--r--lib/Matrix/Response.pm69
2 files changed, 16 insertions, 3 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))
+}
diff --git a/lib/Matrix/Response.pm6 b/lib/Matrix/Response.pm6
index 268be84..ec93cf3 100644
--- a/lib/Matrix/Response.pm6
+++ b/lib/Matrix/Response.pm6
@@ -123,7 +123,6 @@ class Tag {
}
}
-
class Matrix::Response::Device {
has Str $.device-id;
has $.display-name;
@@ -137,3 +136,11 @@ class Matrix::Response::Device {
:last_seen_ts(:$!last-seen-ts)?
) { }
}
+
+class Matrix::Response::MediaStore::Config {
+ has Int $.upload-size;
+
+ method new(%config) {
+ self.bless(:upload-size(%config<m.upload.size> // Int));
+ }
+}