aboutsummaryrefslogtreecommitdiff
path: root/lib/Matrix/Client/Requester.pm6
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2018-08-08 22:12:34 -0300
committerMatias Linares <matiaslina@gmail.com>2018-08-08 22:12:34 -0300
commit1543101e2cc0b124df8031d3a5b003280b5ce253 (patch)
treea3792efa73640f61468b8b60300be7f0c65837b8 /lib/Matrix/Client/Requester.pm6
parentb8b88f99dcf07168b58d8a04b46b82b24b65a0fc (diff)
downloadperl6-matrix-client-1543101e2cc0b124df8031d3a5b003280b5ce253.tar.gz
Add delete method
Diffstat (limited to 'lib/Matrix/Client/Requester.pm6')
-rw-r--r--lib/Matrix/Client/Requester.pm68
1 files changed, 8 insertions, 0 deletions
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))
+}