Giter Site home page Giter Site logo

chazmcgarvey / webservice-bitbucketserver Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 165 KB

Perl bindings for Bitbucket Server REST APIs

Home Page: https://metacpan.org/pod/WebService::BitbucketServer

License: Other

Makefile 0.08% Perl 99.92%
bitbucket-server perl api

webservice-bitbucketserver's Introduction

NAME

WebService::BitbucketServer - Bindings for Bitbucket Server REST APIs

VERSION

version 0.605

SYNOPSIS

my $api = WebService::BitbucketServer->new(
    base_url    => 'https://stash.example.com/',
    username    => 'bob',
    password    => 'secret',
);

my $response = $api->core->get_application_properties;
my $app_info = $response->data;
print "Making API calls to: $app_info->{displayName} $app_info->{version}\n";

# Or use the low-level method (useful perhaps for new endpoints
# that are not packaged yet):

my $response = $api->call(method => 'GET', url => 'api/1.0/application-properties');

# You can also use your own user agent:

my $api = WebService::BitbucketServer->new(
    base_url    => 'https://stash.example.com/',
    username    => 'bob',
    password    => 'secret',
    ua          => Mojo::UserAgent->new,
);

# If the user agent is nonblocking, responses are Futures:

my $future = $api->core->get_application_properties;
$future->on_done(sub {
    my $app_info = shift->data;
    print "Making API calls to: $app_info->{displayName} $app_info->{version}\n";
});

DESCRIPTION

This is the main module for the Bitbucket Server API bindings for Perl.

ATTRIBUTES

base_url

Get the base URL of the Bitbucket Server host.

path

Get the path from the base URL to the APIs. Defaults to "rest".

username

Get the username of the user for authenticating.

password

Get the password (or personal access token) of the user for authenticating.

ua

Get the user agent used to make API calls.

Defaults to HTTP::Tiny.

Because this API module uses HTTP::AnyUA under the hood, you can actually use any user agent supported by HTTP::AnyUA.

any_ua

Get the HTTP::AnyUA object.

json

Get the JSON::XS (or compatible) object used for encoding and decoding documents.

no_security_warning

Get whether or not a warning will be issued when an insecure action takes place (such as sending credentials unencrypted). Defaults to false (i.e. will issue warning).

METHODS

new

$api = WebService::BitbucketServer->new(base_url => $base_url, %other_attributes);

Create a new API context object. Provide "ATTRIBUTES" to customize.

core

Get the WebService::BitbucketServer::Core::V1 api.

access_tokens

Get the WebService::BitbucketServer::AccessTokens::V1 api.

audit

Get the WebService::BitbucketServer::Audit::V1 api.

ref_restriction

Get the WebService::BitbucketServer::RefRestriction::V2 api.

branch

Get the WebService::BitbucketServer::Branch::V1 api.

build

Get the WebService::BitbucketServer::Build::V1 api.

comment_likes

Get the WebService::BitbucketServer::CommentLikes::V1 api.

default_reviewers

Get the WebService::BitbucketServer::DefaultReviewers::V1 api.

git

Get the WebService::BitbucketServer::Git::V1 api.

gpg

Get the WebService::BitbucketServer::GPG::V1 api.

jira

Get the WebService::BitbucketServer::JIRA::V1 api.

ssh

Get the WebService::BitbucketServer::SSH::V1 api.

mirroring_upstream

Get the WebService::BitbucketServer::MirroringUpstream::V1 api.

repository_ref_sync

Get the WebService::BitbucketServer::RepositoryRefSync::V1 api.

url

$url = $api->url;

Get the URL of the APIs (a combination of "base_url" and "path").

call

$response = $api->call(method => $method, url => $url, %options);

Make a request to an API and get a response (or Future if the user agent is non-blocking).

  • url - the endpoint URL, relative to "url"
  • method - the HTTP method
  • data - request data
  • data_type - type of request data, if any (defaults to "application/json")
  • raw - get a hashref response instead of a WebService::BitbucketServer::Response

write_api_packages

WebService::BitbucketServer->write_api_packages;
WebService::BitbucketServer->write_api_packages(dir => 'lib');

Download API specifications from https://developer.atlassian.com and generate packages for them, writing them to the specified directory. You normally don't need this because this module ships with pre-built APIs, but you can use this to generate other APIs or versions if needed.

Requires XML::LibXML.

BUGS

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.

AUTHOR

Charles McGarvey [email protected]

CONTRIBUTOR

Camspi [email protected]

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 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.

webservice-bitbucketserver's People

Contributors

camspi avatar chazmcgarvey avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

camspi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.