go-trello is a Go client package for accessing the Trello API.
Prerequisites:
- Retrieve your
appKey
: https://trello.com/app-key (NOTE: This identifies "you" as the developer of the application) - Retrieve your (temporary)
token
: (put the space there to prevent the link) https ://trello.com/1/connect?key=${MYKEYFROMABOVE}>&name=${MYAPPNAME}&response_type=token&scope=read,write&expiration=1day
package main
import (
"fmt"
"log"
"github.com/TJM/go-trello"
)
func main() {
// New Trello Client
appKey := "application-key"
token := "token"
trello, err := trello.NewAuthClient(appKey, &token)
if err != nil {
log.Fatal(err)
}
// User @trello
user, err := trello.Member("trello")
if err != nil {
log.Fatal(err)
}
fmt.Println(user.FullName)
// @trello Boards
boards, err := user.Boards()
if err != nil {
log.Fatal(err)
}
if len(boards) > 0 {
board := boards[0]
fmt.Printf("* %v (%v)\n", board.Name, board.ShortURL)
// @trello Board Lists
lists, err := board.Lists()
if err != nil {
log.Fatal(err)
}
for _, list := range lists {
fmt.Println(" - ", list.Name)
// @trello Board List Cards
cards, _ := list.Cards()
for _, card := range cards {
fmt.Println(" + ", card.Name)
}
}
}
}
prints
Trello
* Bucket List (https://trello.com/b/Nl2oG77n)
- Goals
+ How To Use This Board
+ Do volunteer work
- Up Next
+ Solve a Rubik’s Cube!
+ Visit Japan
- Underway
+ Improve writing skills
- Done!
+ Learn to sail
Forked From:
(previously) Influenced by:
Licensed under the Apache License, Version 2.0.