| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Kanboard::API; ## no critic |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
123234
|
use v5.40; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
22
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
6
|
1
|
|
|
1
|
|
681
|
use Moo; |
|
|
1
|
|
|
|
|
6558
|
|
|
|
1
|
|
|
|
|
4
|
|
|
7
|
1
|
|
|
1
|
|
1711
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
7183
|
|
|
|
1
|
|
|
|
|
69
|
|
|
8
|
1
|
|
|
1
|
|
814
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
70688
|
|
|
|
1
|
|
|
|
|
35
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use HTTP::Request; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
17
|
|
|
10
|
1
|
|
|
1
|
|
650
|
use MIME::Base64; |
|
|
1
|
|
|
|
|
998
|
|
|
|
1
|
|
|
|
|
79
|
|
|
11
|
1
|
|
|
1
|
|
934
|
use JSON; |
|
|
1
|
|
|
|
|
8993
|
|
|
|
1
|
|
|
|
|
4
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Kanboard::API - A Perl interface to the Kanboard API |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Version 0.01 |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Kanboard::API is a Perl interface to the Kanboard API. It provides a simple way to interact with a Kanboard instance. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Kanboard::API; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $kanboard = Kanboard::API->new(username => 'yourusername|jsonrpc', password => 'apikey', endpoint => 'https://yourkanboardinstance.com'); |
|
32
|
|
|
|
|
|
|
... |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 username |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
The username to use for authentication. Defaults to "jsonrpc". |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has username => ( is => 'ro', default => 'jsonrpc' ); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 password |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
The password to use for authentication. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has password => ( is => 'ro', required => 1 ); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 endpoint |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The JSON RPC Endpoint of the Kanboard instance. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has endpoint => ( is => 'ro', required => 1 ); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 ua |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The LWP::UserAgent object used to make requests. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
has 'ua' => ( |
|
67
|
|
|
|
|
|
|
is => 'lazy', |
|
68
|
0
|
|
|
0
|
|
|
builder => sub { LWP::UserAgent->new }, |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 PRIVATE METHODS |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 _request |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
|
|
0
|
|
|
sub _request( $self, $method, $params = [] ) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my $auth = encode_base64( "$self->{username}:$self->{password}", "" ); |
|
79
|
0
|
|
|
|
|
|
my $headers = [ |
|
80
|
|
|
|
|
|
|
'Content-Type' => 'application/json', |
|
81
|
|
|
|
|
|
|
'Authorization' => "Basic $auth", |
|
82
|
|
|
|
|
|
|
]; |
|
83
|
0
|
|
0
|
|
|
|
my $request_json = { |
|
84
|
|
|
|
|
|
|
jsonrpc => "2.0", |
|
85
|
|
|
|
|
|
|
id => 1, |
|
86
|
|
|
|
|
|
|
method => $method, |
|
87
|
|
|
|
|
|
|
params => $params // [], |
|
88
|
|
|
|
|
|
|
}; |
|
89
|
0
|
|
|
|
|
|
my $body = encode_json($request_json); |
|
90
|
0
|
|
|
|
|
|
my $request = |
|
91
|
|
|
|
|
|
|
HTTP::Request->new( 'POST', $self->endpoint, $headers, $body ); |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
my $response = $self->ua->request($request); |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
if ( $response->is_success ) { |
|
96
|
0
|
|
|
|
|
|
my $content = $response->decoded_content; |
|
97
|
0
|
|
|
|
|
|
my $content_json = decode_json($content); |
|
98
|
0
|
0
|
|
|
|
|
if ( $content_json->{error} ) { |
|
99
|
0
|
|
|
|
|
|
die |
|
100
|
|
|
|
|
|
|
"$content_json->{error}{message} - $content_json->{error}{data}"; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
0
|
|
|
|
|
|
return $content_json->{result}; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
else { |
|
105
|
0
|
|
|
|
|
|
die $response->status_line; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 get_version |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Purpose: Get the application version |
|
115
|
|
|
|
|
|
|
Parameters: none |
|
116
|
|
|
|
|
|
|
Result: version (Example: 1.0.12, master) |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
0
|
1
|
|
sub get_version( $self) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
return $self->_request('getVersion'); |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 get_me |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Purpose: Get the current user profile |
|
129
|
|
|
|
|
|
|
Parameters: |
|
130
|
|
|
|
|
|
|
None |
|
131
|
|
|
|
|
|
|
Result on success: user properties |
|
132
|
|
|
|
|
|
|
Result on failure: empty list |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
|
136
|
|
|
|
|
|
|
|
|
137
|
0
|
|
|
0
|
1
|
|
sub get_me( $self) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
return $self->_request('getMe'); |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 create_project |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Purpose: Create a new project |
|
145
|
|
|
|
|
|
|
Parameters: |
|
146
|
|
|
|
|
|
|
name (string, required) |
|
147
|
|
|
|
|
|
|
description (string, optional) |
|
148
|
|
|
|
|
|
|
owner_id (integer, optional) |
|
149
|
|
|
|
|
|
|
identifier (string, optional) |
|
150
|
|
|
|
|
|
|
Result on success: project ID |
|
151
|
|
|
|
|
|
|
Result on failure: false |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
|
|
0
|
1
|
|
sub create_project( $self, $params) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
return $self->_request('createProject', $params); |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 remove_project |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Purpose: Remove a project |
|
164
|
|
|
|
|
|
|
Parameters: |
|
165
|
|
|
|
|
|
|
project_id (integer, required) |
|
166
|
|
|
|
|
|
|
Result on success: true |
|
167
|
|
|
|
|
|
|
Result on failure: false |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
|
171
|
|
|
|
|
|
|
|
|
172
|
0
|
|
|
0
|
1
|
|
sub remove_project( $self, $params) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
return $self->_request('removeProject', $params); |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 get_project |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Purpose: Get project details |
|
180
|
|
|
|
|
|
|
Parameters: |
|
181
|
|
|
|
|
|
|
project_id (integer, required) |
|
182
|
|
|
|
|
|
|
Result on success: project properties |
|
183
|
|
|
|
|
|
|
Result on failure: empty list |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
|
187
|
|
|
|
|
|
|
|
|
188
|
0
|
|
|
0
|
1
|
|
sub get_project( $self, $params) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
|
return $self->_request('getProject', $params); |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 create_task |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Purpose: Create a new task |
|
196
|
|
|
|
|
|
|
Parameters: |
|
197
|
|
|
|
|
|
|
title (string, required) |
|
198
|
|
|
|
|
|
|
project_id (integer, required) |
|
199
|
|
|
|
|
|
|
description (string, optional) |
|
200
|
|
|
|
|
|
|
category_id (integer, optional) |
|
201
|
|
|
|
|
|
|
owner_id (integer, optional) |
|
202
|
|
|
|
|
|
|
color_id (string, optional) |
|
203
|
|
|
|
|
|
|
column_id (integer, optional) |
|
204
|
|
|
|
|
|
|
swimlane_id (integer, optional) |
|
205
|
|
|
|
|
|
|
priority (integer, optional) |
|
206
|
|
|
|
|
|
|
date_due (timestamp, optional) |
|
207
|
|
|
|
|
|
|
Result on success: task ID |
|
208
|
|
|
|
|
|
|
Result on failure: false |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=cut |
|
212
|
|
|
|
|
|
|
|
|
213
|
0
|
|
|
0
|
1
|
|
sub create_task( $self, $params) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
214
|
0
|
|
|
|
|
|
return $self->_request('createTask', $params); |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 remove_task |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Purpose: Remove a task |
|
221
|
|
|
|
|
|
|
Parameters: |
|
222
|
|
|
|
|
|
|
task_id (integer, required) |
|
223
|
|
|
|
|
|
|
Result on success: true |
|
224
|
|
|
|
|
|
|
Result on failure: false |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |
|
228
|
|
|
|
|
|
|
|
|
229
|
0
|
|
|
0
|
1
|
|
sub remove_task( $self, $params) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
return $self->_request('removeTask', $params); |
|
231
|
|
|
|
|
|
|
} |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 get_task |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Purpose: Get task details |
|
237
|
|
|
|
|
|
|
Parameters: |
|
238
|
|
|
|
|
|
|
task_id (integer, required) |
|
239
|
|
|
|
|
|
|
Result on success: task properties |
|
240
|
|
|
|
|
|
|
Result on failure: empty list |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=cut |
|
244
|
|
|
|
|
|
|
|
|
245
|
0
|
|
|
0
|
1
|
|
sub get_task( $self, $params) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
246
|
0
|
|
|
|
|
|
return $self->_request('getTask', $params); |
|
247
|
|
|
|
|
|
|
} |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head2 get_all_tasks |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
Purpose: Get all tasks for a project |
|
253
|
|
|
|
|
|
|
Parameters: |
|
254
|
|
|
|
|
|
|
project_id (integer, required) |
|
255
|
|
|
|
|
|
|
Result on success: list of tasks |
|
256
|
|
|
|
|
|
|
Result on failure: empty list |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=cut |
|
260
|
|
|
|
|
|
|
|
|
261
|
0
|
|
|
0
|
1
|
|
sub get_all_tasks( $self, $params) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
262
|
0
|
|
|
|
|
|
return $self->_request('getAllTasks', $params); |
|
263
|
|
|
|
|
|
|
} |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head2 get_board |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Purpose: Get all necessary information to display a board |
|
269
|
|
|
|
|
|
|
Parameters: |
|
270
|
|
|
|
|
|
|
project_id (integer, required) |
|
271
|
|
|
|
|
|
|
Result on success: board properties |
|
272
|
|
|
|
|
|
|
Result on failure: empty list |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=cut |
|
276
|
|
|
|
|
|
|
|
|
277
|
0
|
|
|
0
|
1
|
|
sub get_board( $self, $params) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
return $self->_request('getBoard', $params); |
|
279
|
|
|
|
|
|
|
} |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head1 AUTHOR |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
Dan Barbarito, C<< >> |
|
285
|
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head1 BUGS |
|
287
|
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
289
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
290
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=head1 SUPPORT |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
295
|
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
perldoc Kanboard::API |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
You can also look for information at: |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=over 4 |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
|
304
|
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
L |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
L |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=item * Search CPAN |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
L |
|
314
|
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=back |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
319
|
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
This software is Copyright (c) 2024 by Dan Barbarito. |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
This is free software, licensed under: |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
328
|
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=cut |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
1; # End of Kanboard::API |