line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pithub::Events; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PLU'; |
3
|
|
|
|
|
|
|
our $VERSION = '0.01041'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Github v3 Events API |
6
|
|
|
|
|
|
|
|
7
|
16
|
|
|
16
|
|
1187
|
use Moo; |
|
16
|
|
|
|
|
14725
|
|
|
16
|
|
|
|
|
83
|
|
8
|
16
|
|
|
16
|
|
5960
|
use Carp qw( croak ); |
|
16
|
|
|
|
|
52
|
|
|
16
|
|
|
|
|
10697
|
|
9
|
|
|
|
|
|
|
extends 'Pithub::Base'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub issue { |
13
|
2
|
|
|
2
|
1
|
7044
|
my ( $self, %args ) = @_; |
14
|
2
|
|
|
|
|
19
|
$self->_validate_user_repo_args( \%args ); |
15
|
|
|
|
|
|
|
return $self->request( |
16
|
|
|
|
|
|
|
method => 'GET', |
17
|
|
|
|
|
|
|
path => sprintf( |
18
|
|
|
|
|
|
|
'/repos/%s/%s/issues/events', delete $args{user}, |
19
|
|
|
|
|
|
|
delete $args{repo} |
20
|
2
|
|
|
|
|
27
|
), |
21
|
|
|
|
|
|
|
%args, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub network { |
27
|
2
|
|
|
2
|
1
|
3040
|
my ( $self, %args ) = @_; |
28
|
2
|
|
|
|
|
16
|
$self->_validate_user_repo_args( \%args ); |
29
|
|
|
|
|
|
|
return $self->request( |
30
|
|
|
|
|
|
|
method => 'GET', |
31
|
|
|
|
|
|
|
path => sprintf( |
32
|
|
|
|
|
|
|
'/networks/%s/%s/events', delete $args{user}, delete $args{repo} |
33
|
2
|
|
|
|
|
27
|
), |
34
|
|
|
|
|
|
|
%args, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub org { |
40
|
3
|
|
|
3
|
1
|
4115
|
my ( $self, %args ) = @_; |
41
|
3
|
100
|
|
|
|
23
|
croak 'Missing key in parameters: org' unless $args{org}; |
42
|
|
|
|
|
|
|
return $self->request( |
43
|
|
|
|
|
|
|
method => 'GET', |
44
|
2
|
|
|
|
|
26
|
path => sprintf( '/orgs/%s/events', delete $args{org} ), |
45
|
|
|
|
|
|
|
%args, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub org_for_user { |
51
|
5
|
|
|
5
|
1
|
5212
|
my ( $self, %args ) = @_; |
52
|
5
|
100
|
|
|
|
43
|
croak 'Missing key in parameters: org' unless $args{org}; |
53
|
4
|
100
|
|
|
|
22
|
croak 'Missing key in parameters: user' unless $args{user}; |
54
|
|
|
|
|
|
|
return $self->request( |
55
|
|
|
|
|
|
|
method => 'GET', |
56
|
|
|
|
|
|
|
path => sprintf( |
57
|
|
|
|
|
|
|
'/users/%s/events/orgs/%s', delete $args{user}, delete $args{org} |
58
|
3
|
|
|
|
|
36
|
), |
59
|
|
|
|
|
|
|
%args, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub public { |
65
|
2
|
|
|
2
|
1
|
2888
|
my ( $self, %args ) = @_; |
66
|
2
|
|
|
|
|
14
|
return $self->request( |
67
|
|
|
|
|
|
|
method => 'GET', |
68
|
|
|
|
|
|
|
path => '/events', |
69
|
|
|
|
|
|
|
%args, |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub repos { |
75
|
2
|
|
|
2
|
1
|
2852
|
my ( $self, %args ) = @_; |
76
|
2
|
|
|
|
|
16
|
$self->_validate_user_repo_args( \%args ); |
77
|
|
|
|
|
|
|
return $self->request( |
78
|
|
|
|
|
|
|
method => 'GET', |
79
|
|
|
|
|
|
|
path => sprintf( |
80
|
|
|
|
|
|
|
'/repos/%s/%s/events', delete $args{user}, delete $args{repo} |
81
|
2
|
|
|
|
|
23
|
), |
82
|
|
|
|
|
|
|
%args, |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub user_performed { |
88
|
4
|
|
|
4
|
1
|
5319
|
my ( $self, %args ) = @_; |
89
|
4
|
100
|
|
|
|
62
|
croak 'Missing key in parameters: user' unless $args{user}; |
90
|
3
|
|
|
|
|
17
|
my $path = sprintf( '/users/%s/events', delete $args{user} ); |
91
|
3
|
100
|
|
|
|
11
|
if ( $args{public} ) { |
92
|
1
|
|
|
|
|
3
|
$path .= '/public'; |
93
|
|
|
|
|
|
|
} |
94
|
3
|
|
|
|
|
19
|
return $self->request( |
95
|
|
|
|
|
|
|
method => 'GET', |
96
|
|
|
|
|
|
|
path => $path, |
97
|
|
|
|
|
|
|
%args, |
98
|
|
|
|
|
|
|
); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub user_received { |
103
|
4
|
|
|
4
|
1
|
4256
|
my ( $self, %args ) = @_; |
104
|
4
|
100
|
|
|
|
29
|
croak 'Missing key in parameters: user' unless $args{user}; |
105
|
3
|
|
|
|
|
16
|
my $path = sprintf( '/users/%s/received_events', delete $args{user} ); |
106
|
3
|
100
|
|
|
|
11
|
if ( $args{public} ) { |
107
|
1
|
|
|
|
|
6
|
$path .= '/public'; |
108
|
|
|
|
|
|
|
} |
109
|
3
|
|
|
|
|
18
|
return $self->request( |
110
|
|
|
|
|
|
|
method => 'GET', |
111
|
|
|
|
|
|
|
path => $path, |
112
|
|
|
|
|
|
|
%args, |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
__END__ |