This is a fork of https://github.com/mcdafydd/go-azuredevops, a Go library for accessing the Azure DevOps API. As it develops, the library is looking more like of a port of go-github.
We forked this repo because we wanted to fix bug in atlantis - PR: runatlantis/atlantis#5298
There is partial implementation for the following services:
- Boards
- Builds
- Favourites
- Git
- Iterations
- Pull Requests
- Service Events (webhooks)
- Tests
- Users
- Work Items
For usage with a personal access token, create a token using the process described here:
Add the token to a basic auth transport with an empty username:
tp := azuredevops.BasicAuthTransport{
Username: "",
Password: token,
}
Supply this token in calls to NewClient():
import "github.com/mcdafydd/go-azuredevops/azuredevops
client, _ := azuredevops.NewClient(tp.Client())
Get a list of iterations
iterations, error := v.Iterations.List(team)
if error != nil {
fmt.Println(error)
}
for index := 0; index < len(iterations); index++ {
fmt.Println(iterations[index].Name)
}
Instead of using a personal access token related to your personal user account, consider registering your app in Azure Devops:
Supply a token generated from this process when you call NewClient().
This library is re-using a lot of the code and style from the go-github library:
- Receiving struct members should be pointers google/go-github#19
- Debate on whether nillable fields are important for receiving structs, especially when also using separate request structs. Other popular libraries also use pointers approach, but it is often viewed as a big ugly. google/go-github#537
- Large receiving struct types should return []*Type, not []Type google/go-github#375
- Use omitempty in receiving struct JSON tags
- Pass context in API functions and Do() google/go-github#526
An exception to the pointer members are the count/value receiving structs used for responses containing multiple entities.
May add separate request structs soon.
Add -tags debug
to your go build to get some extra debug logging.