Skip to content

Latest commit

 

History

History
86 lines (53 loc) · 2.02 KB

README.md

File metadata and controls

86 lines (53 loc) · 2.02 KB

Preface

Golang implementation for the BitBucket API.

Please see v1 API and v2 API sections for API coverage, PR are very welcome.

Add dependency

Use Dep to add this library to your project:

dep ensure -add github.com/crossid/bitbucket-golang-api

Insantiate a v1 or v2 api

v2 := bitbucket.NewV2BasicAuth(user, password)
v1 := bitbucket.NewV1BasicAuth(user, password)

Work with the API:

v2.Teams.List(bitbucket.ListTeamsOpts{Role: bitbucket.AdminRole})

Please check unit tests as they cover all supported features.

v2 API

Teams

  • Get a team
  • List Teams (with support for pagination)
  • List Team's members

Repositories

  • List Public Repos (with support for pagination, filtering and sorting)
  • List Repos by Owner (with support for pagination, filtering and sorting)

Users

  • Get current user
  • Get public user

v1 API

Groups

  • List groups matching one or more filters.
  • List of an account's (team / user) groups

Privileges

  • List privileges of an account (team / user)
  • List privileges of an account (team / user) for a specific repo

Group Privileges

  • List group privileges of an account (team / user)
  • List group privileges of an account (team / user) for a specific repo

Running tests

In order to run tests you should simply:

  1. Clone the project
  2. Set two env vars: BITBUCKET_USER & BITBUCKET_PASSWORD with your Bitbucket username and password respectively
  3. dep ensure
  4. export BITBUCKET_USER=<user> ; export BITBUCKET_PASSWORD="<password>"; go test

Note: Unit tests assume that your user have at least:

  • 2 teams
  • 1 member per team
  • 2 repositories

Other projects

License

APACHE 2