line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Types::GitLab; |
2
|
|
|
|
|
|
|
$Types::GitLab::VERSION = '0.03'; |
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Types::GitLab - Type::Tiny types for GitLab stuff. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Foo; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Types::GitLab -types; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Moo; |
14
|
|
|
|
|
|
|
use strictures 1; |
15
|
|
|
|
|
|
|
use namespace::clean; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has token => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
isa => GitLabToken, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
L is an open source git server. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
This module provides several L types for several of |
27
|
|
|
|
|
|
|
GitLab's data types. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
1
|
|
25385
|
use Type::Library -base; |
|
1
|
|
|
|
|
26175
|
|
|
1
|
|
|
|
|
9
|
|
32
|
1
|
|
|
1
|
|
780
|
use Type::Utils -all; |
|
1
|
|
|
|
|
3397
|
|
|
1
|
|
|
|
|
44
|
|
33
|
1
|
|
|
1
|
|
2737
|
use Types::Standard -types; |
|
1
|
|
|
|
|
33368
|
|
|
1
|
|
|
|
|
14
|
|
34
|
1
|
|
|
1
|
|
3552
|
use Types::Common::Numeric -types; |
|
1
|
|
|
|
|
8582
|
|
|
1
|
|
|
|
|
10
|
|
35
|
1
|
|
|
1
|
|
1424
|
use URI; |
|
1
|
|
|
|
|
3474
|
|
|
1
|
|
|
|
|
27
|
|
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
1
|
|
5
|
use strictures 1; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
25
|
|
38
|
1
|
|
|
1
|
|
459
|
use namespace::clean; |
|
1
|
|
|
|
|
22526
|
|
|
1
|
|
|
|
|
11
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 TYPES |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 GitLabUsername |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Username can contain only letters, digits, '_', '-' and '.'. It must |
45
|
|
|
|
|
|
|
start with letter, digit or '_', optionally preceeded by '.'. It must |
46
|
|
|
|
|
|
|
not end in '.git'. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
declare 'GitLabUsername', |
51
|
|
|
|
|
|
|
as Str, |
52
|
|
|
|
|
|
|
where { |
53
|
|
|
|
|
|
|
length($_) > 0 and |
54
|
|
|
|
|
|
|
$_ !~ m{[^A-Za-z0-9_.-]} and |
55
|
|
|
|
|
|
|
$_ =~ m{^[A-Za-z_]} and |
56
|
|
|
|
|
|
|
$_ !~ m{\.git$} |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 GitLabToken |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
The API token for a user. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
declare 'GitLabToken', |
66
|
|
|
|
|
|
|
as Str, |
67
|
|
|
|
|
|
|
where { length($_) == 20 and $_ !~ m{[^a-zA-Z0-9]} }; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 GitLabAPIURI |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The value must be an L object. A coercion is available to |
72
|
|
|
|
|
|
|
convert a C. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
declare 'GitLabAPIURI', |
77
|
|
|
|
|
|
|
as InstanceOf[ 'URI' ]; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
coerce 'GitLabAPIURI', |
80
|
|
|
|
|
|
|
from Str, |
81
|
|
|
|
|
|
|
via { URI->new($_) }; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 GitLabProjectID |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This type requires that the value by a positive integer. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
declare 'GitLabProjectID', |
90
|
|
|
|
|
|
|
as PositiveInt; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
__END__ |