File Coverage

blib/lib/Protocol/Matrix/HTTP/Federation.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 2 3 66.6
total 24 25 96.0


line stmt bran cond sub pod time code
1             # You may distribute under the terms of either the GNU General Public License
2             # or the Artistic License (the same terms as Perl itself)
3             #
4             # (C) Paul Evans, 2015 -- leonerd@leonerd.org.uk
5              
6             package Protocol::Matrix::HTTP::Federation;
7              
8 2     2   22476 use strict;
  2         32  
  2         61  
9 2     2   12 use warnings;
  2         4  
  2         93  
10              
11             our $VERSION = '0.02';
12              
13 2     2   1441 use HTTP::Request;
  2         50033  
  2         332  
14              
15             =head1 NAME
16              
17             C - helpers for HTTP messages relating to Matrix federation
18              
19             =cut
20              
21             sub new
22             {
23 1     1 0 14 bless {}, shift;
24             }
25              
26             =head1 METHODS
27              
28             =cut
29              
30             =head2 make_key_v1_request
31              
32             $req = $fed->make_key_v1_request( server_name => $name )
33              
34             =cut
35              
36             sub make_key_v1_request
37             {
38 1     1 1 682 shift;
39 1         4 my %params = @_;
40              
41             return HTTP::Request->new(
42             GET => "/_matrix/key/v1",
43             [
44             Host => $params{server_name},
45 1         10 ],
46             );
47             }
48              
49             =head2 make_key_v2_server_request
50              
51             $req = $fed->make_key_v2_server_request( server_name => $name, key_id => $id )
52              
53             =cut
54              
55             sub make_key_v2_server_request
56             {
57 1     1 1 7583 shift;
58 1         4 my %params = @_;
59              
60             return HTTP::Request->new(
61             GET => "/_matrix/key/v2/server/$params{key_id}",
62             [
63             Host => $params{server_name},
64 1         8 ],
65             );
66             }
67              
68             0x55AA;