项目作者: daeMOn63

项目描述 :
Golang Bitbucket API client
高级语言: Go
项目地址: git://github.com/daeMOn63/bitclient.git
创建时间: 2017-09-07T18:40:19Z
项目社区:https://github.com/daeMOn63/bitclient

开源协议:MIT License

下载


BitClient

BitClient is a Golang Api client for Atlassian Bitbucket REST api (v1.0).

Overview

This library allow you to call Bitbucket api endpoint from you go programs, converting json responses to Go structs (see types.go for the complete list).

It’s currently integrated in a command line utility BitAdmin, aimed to ease and speed up administration of Bitbucket repositories.

Installation

Make sure you have a working Go environment. Go version 1.2+ is supported. See
the install instructions for Go
.

To install bitclient, simply run:

  1. $ go get github.com/daeMOn63/bitclient

Dependencies are managed using Dep. Make sure to follow the installation instructions to setup dep on your workstation.

To install the dependencies, run from the project root:

  1. $ dep ensure

Getting started

The following sample will connect to the bitbucket api and retrieve a list of all projects.

  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "github.com/daeMOn63/bitclient"
  6. )
  7. func main() {
  8. client := bitclient.NewBitClient("https://bitbucket.org/", "<username>", "<password>")
  9. requestParams := bitclient.PagedRequest{
  10. Limit: 10,
  11. Start: 0,
  12. }
  13. projectsResponse, err := client.GetProjects(requestParams)
  14. if err != nil {
  15. fmt.Println(err)
  16. os.Exit(1)
  17. }
  18. for _, project := range projectsResponse.Values {
  19. fmt.Printf("Project : %d - %s\n", project.Id, project.Key)
  20. }
  21. }

Supported versions

The library is currently developed according to the documentation of Atlassian Bitbucket v4.13.1
Other versions have not been tested yet.