From 1543101e2cc0b124df8031d3a5b003280b5ce253 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Wed, 8 Aug 2018 22:12:34 -0300 Subject: Add delete method --- lib/Matrix/Client/Requester.pm6 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Matrix/Client/Requester.pm6 b/lib/Matrix/Client/Requester.pm6 index 22c91c6..1a60014 100644 --- a/lib/Matrix/Client/Requester.pm6 +++ b/lib/Matrix/Client/Requester.pm6 @@ -80,3 +80,11 @@ multi method put(Str $path, Str $json) { multi method put(Str $path, *%params) { self.put($path, to-json(%params)) } + +method delete(Str $path) { + my $encoded-path = $path.subst('#', '%23'); + my $req = HTTP::Request.new( + DELETE => $.base-url ~ $encoded-path ~ "?{self!access-token-arg}", + Content-Type => 'application/json'); + return self!handle-error($!ua.request($req)) +} -- cgit v1.2.3-70-g09d2