Git Product home page Git Product logo

bitbucket-client's Introduction

Bitbucket Client

This repository is build to work as a Java rest client for bitbucket cloud APIs V2

Add dependency

      <dependency>
        <groupId>com.aliction</groupId>
        <artifactId>bitbucket-client</artifactId>
        <version>0.2.0</version>
      </dependency>

Check versions from maven central Bitbucket-Client

Usage

First you need to create an instance of BitbucketV2API class which expects 3 String input parameter:

  • hostURL: your bitbucket api server url
  • username: your bitbucket user name
  • token: bitbucket API token

BitbucketV2API bitbucket = new BitbucketV2API("https://api.bitbucket.org", "my-user","9876234b92g3479cf2geiywrtg62834r");

This newly created bitbucket object will give you access to all the implemented APIs and their provided methods, for example:

  • To get list of all public repositories on bitbucket:

List<BitbucketRepository> userRepos = bitbucket.RepositoryAPI().getAllPublicRepositories();

  • To get the user object of the currently logged user:

BitbucketUser user = bitbucket.UserAPI().getLoggedUser();

  • To get list of teams the user has admin role to:

List<BitbucketTeam> teams = bitbucket.TeamAPI().getUserTeams(BitbucketRole.ADMIN);

JavaDoc

JavaDoc is coming soon HERE

Contribution

The library is published while still work in progress for adding more APIs and handling more functions, you're valuable contribution will help adding more features to the library, contribution can be and not limited to:

  • Opening issues towards the library for any missing functionality
  • Opening new PRs for adding new functionality that you want to make it available to the public and set you as a contributor to the library
  • Actively opening an issue if you found any bug or faced any issue while using the library
  • Opening new PRs for enhancing documentation, JavaDoc, or the README instructions
  • Opening issues for having any questions regarding the library usage
  • Any other contribution scenario that is not mentioned above

Troubleshooting

Sometimes if the your application has conflicting dependencies with other libraries, you may get exceptions while parsing json responses for MessageBodyReader Exceptions like below:

	at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:208)
	at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:132)
	at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1071)
	at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:850)
	at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:784)
	at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:297)
	at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:91)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:365)
	at org.glassfish.jersey.client.InboundJaxrsResponse.runInScopeIfPossible(InboundJaxrsResponse.java:240)
	at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:88)
    ...

Adding the json media library can help solve this issue:

	  <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-json-jackson</artifactId>
        <version>2.29.1</version>
      </dependency>

License

This library is released for Aliction under Apache 2 License. Check License for more information.

Additonal Resources

Bitbucket Deprecating API V1 Announcement

Announcing Bitbucket API V2

Bitbucket API V2 Reference

bitbucket-client's People

Contributors

alyibrahim avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.