github.com/daeMOn63/bitclient@v0.0.0-20190425080230-bfee94efac35/README.md (about)

     1  BitClient
     2  ===
     3  
     4  BitClient is a Golang Api client for Atlassian Bitbucket REST api (v1.0).
     5  
     6  <!-- toc -->
     7  - [Overview](#overview)
     8  - [Installation](#installation)
     9  - [Getting Started](#getting-started)
    10  - [Supported versions](#supported-version)
    11  
    12  <!-- tocstop -->
    13  
    14  ## Overview
    15  This library allow you to call Bitbucket api endpoint from you go programs, converting json responses to Go structs (see [types.go](types.go) for the complete list).
    16  
    17  It's currently integrated in a command line utility [BitAdmin](https://github.com/daeMOn63/bitadmin), aimed to ease and speed up administration of Bitbucket repositories.
    18  
    19  ## Installation
    20  Make sure you have a working Go environment.  Go version 1.2+ is supported.  [See
    21  the install instructions for Go](http://golang.org/doc/install.html).
    22  
    23  To install bitclient, simply run:
    24  ```
    25  $ go get github.com/daeMOn63/bitclient
    26  ```
    27  
    28  Dependencies are managed using [Dep](https://github.com/golang/dep). Make sure to follow the [installation instructions](https://github.com/golang/dep#setup) to setup ```dep``` on your workstation.
    29  
    30  To install the dependencies, run from the project root:
    31  ```
    32  $ dep ensure
    33  ```
    34  
    35  ## Getting started
    36  The following sample will connect to the bitbucket api and retrieve a list of all projects.
    37  
    38  ```go
    39  package main
    40  import (
    41      "fmt"
    42      "os"
    43      "github.com/daeMOn63/bitclient"
    44  )
    45  
    46  func main() {
    47      client := bitclient.NewBitClient("https://bitbucket.org/", "<username>", "<password>")
    48  
    49      requestParams := bitclient.PagedRequest{
    50          Limit: 10,
    51          Start: 0,
    52      }
    53  
    54      projectsResponse, err := client.GetProjects(requestParams)
    55  
    56      if err != nil {
    57          fmt.Println(err)
    58          os.Exit(1)
    59      }
    60  
    61      for _, project := range projectsResponse.Values {
    62          fmt.Printf("Project : %d - %s\n", project.Id, project.Key)
    63      }
    64  }
    65  ```
    66  
    67  ## Supported versions
    68  The library is currently developed according to the documentation of [Atlassian Bitbucket v4.13.1](https://developer.atlassian.com/static/rest/bitbucket-server/4.13.1/bitbucket-rest.html)
    69  Other versions have not been tested yet.