A #golang package to access the Trello API. Nearly 100% of the read-only surface area of the API is covered, as is creation and modification of Cards. Pull requests are welcome for missing features.
My current development focus is documentation, especially enhancing this README.md with more example use cases.
The Go Trello API has been Tested compatible with Go 1.1 on up. Its only dependency is
the github.com/pkg/errors
package. It otherwise relies only on the Go standard library.
go get github.com/adlio/trello
All interaction starts with a trello.Client
. Create one with your appKey and token:
client := trello.NewClient(appKey, token)
All API requests accept a trello.Arguments object. This object is a simple
map[string]string
, converted to query string arguments in the API call.
Trello has sane defaults on API calls. We have a rello.Defaults
object
which can be used when you desire the default Trello arguments. Internally,
trello.Defaults()
is an empty map, which translates to an empty query string.
board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
// Handle error
}
Boards can be retrieved directly by their ID (see example above), or by asking for all boards for a member:
member, err := client.GetMember("usernameOrId", trello.Defaults())
if err != nil {
// Handle error
}
boards, err := member.GetBoards(trello.Defaults())
if err != nil {
// Handle error
}
board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
// Handle error
}
lists, err := board.GetLists(trello.Defaults())
if err != nil {
// Handle error
}
board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
// Handle error
}
cards, err := board.GetCards(trello.Defaults())
if err != nil {
// Handle error
}
list, err := client.GetList("lIsTID", trello.Defaults())
if err != nil {
// Handle error
}
cards, err := list.GetCards(trello.Defaults())
if err != nil {
// Handle error
}
board, err := client.GetBoard("bOaRdID", trello.Defaults())
if err != nil {
// Handle error
}
actions, err := board.GetActions(trello.Defaults())
if err != nil {
// Handle error
}
card, err := client.GetCard("cArDID", trello.Defaults())
if err != nil {
// Handle error
}
actions, err := card.GetActions(trello.Defaults())
if err != nil {
// Handle error
}