| 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 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 2 | our $VERSION = '0.02'; | |
| 12 | |||
| 13 | 2 | ▶ | use HTTP::Request; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | =head1 NAME | ||
| 16 | |||
| 17 | C<Protocol::Matrix::HTTP::Federation> - helpers for HTTP messages relating to Matrix federation | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | sub new | ||
| 22 | 1 | ▶ | { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 23 | 1 | 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 | 1 | ▶ | { |
|
Subroutine
make_key_v1_request: called CC=1 SCAR=0.0
Pod
documented
| |||
| 38 | 1 | shift; | |
| 39 | 1 | my %params = @_; | |
| 40 | |||
| 41 | return HTTP::Request->new( | ||
| 42 | GET => "/_matrix/key/v1", | ||
| 43 | [ | ||
| 44 | Host => $params{server_name}, | ||
| 45 | 1 | ], | |
| 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 | 1 | ▶ | { |
|
Subroutine
make_key_v2_server_request: called CC=1 SCAR=0.0
Pod
documented
| |||
| 57 | 1 | shift; | |
| 58 | 1 | 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 | ], | |
| 65 | ); | ||
| 66 | } | ||
| 67 | |||
| 68 | 2 | 0x55AA; | |