Skip to content

rcarmstrong/go-bitbucket

 
 

Repository files navigation

go-bitbucket

go-bitbucket?status

Bitbucket-API library for golang.

Extention of go-bitbucket by ktrysmt

Supports Bitbucket API v2.0 with the response type being of json format defined by the Bitbucket API.

Install

go get github.com/rcarmstrong/go-bitbucket

Usage

package main

import (
        "github.com/rcarmstrong/go-bitbucket" 
        "fmt"
)

func main() {

        c := bitbucket.NewBasicAuth("username", "password")

        opt := &bitbucket.PullRequestsOptions{
                Owner:      "your-team",
                Repo_slug:  "awesome-project",
                Source_branch: "develop",
                Destination_branch: "master",
                Title: "fix bug. #9999",
                Close_source_branch: true,
        }
        res, err := c.Repositories.PullRequests.Create(opt)
        if err != nil {
                panic(err)
        }

        fmt.Println(res) // receive the data as json format
}

FAQ

Support Bitbucket API v1.0 ?

It does not correspond yet. Because there are many differences between v2.0 and v1.0.

It is officially recommended to use v2.0.
But unfortunately Bitbucket Server (formerly: Stash) API is still v1.0.
And The API v1.0 covers resources that the v2.0 API and API v2.0 is yet to cover.

Development

Install dependencies

It's using dep.

go get github.com/golang/dep/...
git clone https://github.com/rcarmstrong/go-bitbucket 
cd ./go-bitbucket
dep ensure 

How to testing

Set your available user account to Global Env.

export BITBUCKET_TEST_USERNAME=<your_username> 
export BITBUCKET_TEST_PASSWORD=<your_password> 
export BITBUCKET_TEST_OWNER=<your_repo_owner>  
export BITBUCKET_TEST_REPOSLUG=<your_repo_name>

Refs; URL Syntax is https://<your_username>:<your_password>@bitbucket.org/<your_repo_owner>/<your_repo_name>.git.

And just run,

make test

License

Apache License 2.0

Author

Original: ktrysmt

This Fork: rcarmstrong

About

Bitbucket API library for Golang.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.5%
  • Makefile 1.5%