WebService::BitbucketServer::Response - A response object for Bitbucket Server REST APIs
version 0.600
# Normal response with blocking user agent: my $response = $core->get_application_properties; my $app_info = $response->data; print "Making API calls to: $app_info->{displayName} $app_info->{version}\n"; # Normal reponse with non-blocking user agent: my $future = $core->get_application_properties; $future->on_done(sub { my $response = shift; my $app_info = $response->data; print "Making API calls to: $app_info->{displayName} $app_info->{version}\n"; }); # Paged response with blocking user agent: my $response = $core->get_projects; do { last if $response->error; for my $project_info (@{ $response->values }) { print "$project_info->{key}\t$project_info->{name}\n" } } while ($response = $response->next); # Paged response with non-blocking user agent: my $future; my $print_projects; $print_projects = sub { my $response = shift; for my $project_info (@{ $response->values }) { print "$project_info->{key}\t$project_info->{name}\n" } $future = $response->next; # get more projects $future->on_done($print_projects) if $future; }; $future = $core->get_projects; # get first page of projects $future->on_done($print_projects);
This module represents a response from a Bitbucket Server API call. It has various convenient accessors and provides a mechanism to handle paging.
A WebService::BitbucketServer object.
A hashref of the request arguments originally provided to "call" in WebService::BitbucketServer.
The raw response from the server in a hashref structure similar to an HTTP::Tiny response (regardless of which user agent was used to get the response).
Get the decoded response content which may include page info if this is a paged response. Consider using "data", "page_data", etc. before this.
Get the JSON (or compatible) object used for encoding and decoding documents.
Get whether or not the response is a success.
Get the HTTP status code.
Get the error message or structure if this response represents an error (i.e. "is_success" is false), or undef if this response is not an error.
Get whether or not the response is a page of values.
$response = WebService::BitbucketServer::Response->new( context => $webservice_bitbucketserver_obj, request_args => $data, raw => $response, );
Create a new response.
Get the decoded response content. If this is a paged response (see "is_paged"), this will be an arrayref of values.
Get a hashref of page info or undef if this is not a paged response.
filter
is_last_page
limit
next_page_start
size
start
$next_response = $response->next;
Get the next page of results or undef if no more results. As with "call" in WebService::BitbucketServer, the returned response may be a hashref or a Future.
$subresponse = $response->wrap($field);
Sometimes the response doesn't include the page information in the root object, typically when the response has an envelope with other non-repeated information. In such cases, "is_paged" is false and "page_info" is undef. You can use this method to easily create a paged response by specifying the field name of the object that contains the page info.
Please report any bugs or feature requests on the bugtracker website https://github.com/chazmcgarvey/WebService-BitbucketServer/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Charles McGarvey <ccm@cpan.org>
This software is copyright (c) 2017 by Charles McGarvey.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WebService::BitbucketServer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::BitbucketServer
CPAN shell
perl -MCPAN -e shell install WebService::BitbucketServer
For more information on module installation, please visit the detailed CPAN module installation guide.