From dbfd6207290d1eee53fddec4c7c3b4aac0b2d47a Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 8 Apr 2015 18:48:36 +0100 Subject: 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 --- Bugzilla.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Bugzilla.pm') 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 in C. +=item C + +Returns a cached instance of the WebService API server object used for +manipulating Bugzilla resources. + =back =head1 B -- cgit v1.2.3-24-g4f1b