diff options
author | David Lawrence <dkl@mozilla.com> | 2015-04-08 19:48:36 +0200 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2015-04-08 19:48:36 +0200 |
commit | dbfd6207290d1eee53fddec4c7c3b4aac0b2d47a (patch) | |
tree | aa190d8cc9e2b313dd7e85bf763c1bfe5502b75d /Bugzilla.pm | |
parent | e6d2fb75aa3c183323c534a214f3dd9be5638676 (diff) | |
download | bugzilla-dbfd6207290d1eee53fddec4c7c3b4aac0b2d47a.tar.gz bugzilla-dbfd6207290d1eee53fddec4c7c3b4aac0b2d47a.tar.xz |
Bug 1051056: The REST API needs to be versioned so that new changes can be made that do not break compatibility
r=dylan,a=glob
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r-- | Bugzilla.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm index 3aa6e5489..4b19301aa 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -209,6 +209,20 @@ sub extensions { return $cache->{extensions}; } +sub api_server { + my $class = shift; + my $cache = $class->request_cache; + return $cache->{api_server} if defined $cache->{api_server}; + require Bugzilla::API::Server; + $cache->{api_server} = Bugzilla::API::Server->server; + if (my $load_error = $cache->{api_server}->load_error) { + my @error_params = ($load_error->{error}, $load_error->{vars}); + ThrowCodeError(@error_params) if $load_error->{type} eq 'code'; + ThrowUserError(@error_params) if $load_error->{type} eq 'user'; + } + return $cache->{api_server}; +} + sub feature { my ($class, $feature) = @_; my $cache = $class->request_cache; @@ -980,6 +994,11 @@ this Bugzilla installation. Tells you whether or not a specific feature is enabled. For names of features, see C<OPTIONAL_MODULES> in C<Bugzilla::Install::Requirements>. +=item C<api_server> + +Returns a cached instance of the WebService API server object used for +manipulating Bugzilla resources. + =back =head1 B<CACHING> |