line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pithub::Repos::Watching; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PLU'; |
3
|
|
|
|
|
|
|
our $VERSION = '0.01039'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Github v3 Repo Watching API |
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
92
|
use Moo; |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
73
|
|
7
|
15
|
|
|
15
|
|
3757
|
use Carp (); |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
4571
|
|
8
|
|
|
|
|
|
|
extends 'Pithub::Base'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_watching { |
12
|
3
|
|
|
3
|
1
|
7598
|
my ( $self, %args ) = @_; |
13
|
3
|
|
|
|
|
27
|
$self->_validate_user_repo_args( \%args ); |
14
|
|
|
|
|
|
|
return $self->request( |
15
|
|
|
|
|
|
|
method => 'GET', |
16
|
3
|
|
|
|
|
31
|
path => sprintf( '/user/watched/%s/%s', delete $args{user}, delete $args{repo} ), |
17
|
|
|
|
|
|
|
%args, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub list_repos { |
23
|
4
|
|
|
4
|
1
|
4759
|
my ( $self, %args ) = @_; |
24
|
4
|
100
|
|
|
|
14
|
if ( my $user = delete $args{user} ) { |
25
|
2
|
|
|
|
|
21
|
return $self->request( |
26
|
|
|
|
|
|
|
method => 'GET', |
27
|
|
|
|
|
|
|
path => sprintf( '/users/%s/watched', $user ), |
28
|
|
|
|
|
|
|
%args, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
2
|
|
|
|
|
8
|
return $self->request( |
32
|
|
|
|
|
|
|
method => 'GET', |
33
|
|
|
|
|
|
|
path => '/user/watched', |
34
|
|
|
|
|
|
|
%args, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub list { |
40
|
19
|
|
|
19
|
1
|
2300
|
my ( $self, %args ) = @_; |
41
|
19
|
|
|
|
|
77
|
$self->_validate_user_repo_args( \%args ); |
42
|
|
|
|
|
|
|
return $self->request( |
43
|
|
|
|
|
|
|
method => 'GET', |
44
|
13
|
|
|
|
|
79
|
path => sprintf( '/repos/%s/%s/watchers', delete $args{user}, delete $args{repo} ), |
45
|
|
|
|
|
|
|
%args, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub start_watching { |
51
|
3
|
|
|
3
|
1
|
2860
|
my ( $self, %args ) = @_; |
52
|
3
|
|
|
|
|
18
|
$self->_validate_user_repo_args( \%args ); |
53
|
|
|
|
|
|
|
return $self->request( |
54
|
|
|
|
|
|
|
method => 'PUT', |
55
|
3
|
|
|
|
|
25
|
path => sprintf( '/user/watched/%s/%s', delete $args{user}, delete $args{repo} ), |
56
|
|
|
|
|
|
|
%args, |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub stop_watching { |
62
|
3
|
|
|
3
|
1
|
2769
|
my ( $self, %args ) = @_; |
63
|
3
|
|
|
|
|
17
|
$self->_validate_user_repo_args( \%args ); |
64
|
|
|
|
|
|
|
return $self->request( |
65
|
|
|
|
|
|
|
method => 'DELETE', |
66
|
3
|
|
|
|
|
27
|
path => sprintf( '/user/watched/%s/%s', delete $args{user}, delete $args{repo} ), |
67
|
|
|
|
|
|
|
%args, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |