blob: 6710948337865b5ac60e6929598b994a77d665ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
=begin pod
=TITLE role Matrix::Client::Requester
=SUBTITLE Role for HTTP requests
role Matrix::Client::Requester { }
Role that gives the base API for objects that interacts to the matrix server. The
attributes that can be set can be:
=head1 Attributes
=head2 Str home-server
The url of the home-server.
=head2 Str access-token
access token to make authorized calls to the matrix server.
=head2 Str url-prefix
Prefix to all the paths used in the methods.
=head1 Methods
=head2 get
method get(Str $path, :$media = False, *%data)
Do a GET to C<$path>.
All the C<*%data> is used to build the query params for the url.
=head2 post
multi method post(Str $path, Str $params, :$media = False)
multi method post(Str $path, :$media = False, *%params)
Do a POST to C<$path> with C<$params> as JSON body. With the
named C<*%params>, those are parameters are converted into JSON.
=head2 post-bin
method post-bin(Str $path, Buf $buf, :$content-type)
Do a POST to C<$path> with binary data in the body.
=head2 put
multi method put(Str $path, Str $params)
multi method put(Str $path, *%params)
Do a PUT to C<$path> with C<$params> as JSON body. With the named
C<*%params>, those parameters are converted into JSON.
=head2 delete
method delete(Str $path)
Do a DELETE to C<$path>.
=end pod
|