blob: 38000fbdb94f850b5c948355efce7c52b5fa75d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
package Bugzilla::API::1_0::Resource::Example;
use 5.14.0;
use strict;
use warnings;
use parent qw(Bugzilla::API::1_0::Resource);
use Bugzilla::Error;
#############
# Constants #
#############
use constant READ_ONLY => qw(
hello
throw_an_error
);
use constant PUBLIC_METHODS => qw(
hello
throw_an_error
);
sub REST_RESOURCES {
my $rest_resources = [
qr{^/hello$}, {
GET => {
method => 'hello'
}
},
qr{^/throw_an_error$}, {
GET => {
method => 'throw_an_error'
}
}
];
return $rest_resources;
}
###########
# Methods #
###########
# This can be called as Example.hello() from the WebService.
sub hello {
return {
message => 'Hello!'
};
}
sub throw_an_error { ThrowUserError('example_my_error') }
1;
|