Skip to content

Commit

Permalink
breakingchange: BEWARE! several parameter changes
Browse files Browse the repository at this point in the history
* `Id` -> `ID` and `Url` -> `URL` for linting
* Added comments to clean up linting
* modified stuff to point to TJM/go-trello
  • Loading branch information
TJM committed Oct 21, 2020
1 parent 1db4267 commit fa956c1
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 220 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ sudo: false
language: go

go:
- "1.5"
- 1.4.3
- 1.2
- "1.2"
- tip

install:
- go get 'github.com/franela/goblin'
- go get 'github.com/onsi/gomega'
- go get 'github.com/VojtechVitek/go-trello'
- go get 'github.com/TJM/go-trello'

script:
- go test ./tests/...
154 changes: 79 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,104 @@
Golang Trello API client
------------------------
# Golang Trello API client

go-trello is a [Go](http://golang.org/) client package for accessing the [Trello](http://www.trello.com/) [API](http://trello.com/api).

<a href="http://golang.org"><img alt="Go package" src="https://golang.org/doc/gopher/pencil/gopherhat.jpg" width="20%" /></a>
<a href="http://trello.com"><img src="https://d2k1ftgv7pobq7.cloudfront.net/meta/p/res/images/c13d1cd96a2cff30f0460a5e1860c5ea/header-logo-blue.svg" style="height: 80px; margin-bottom: 2em;"></a>

[![GoDoc](https://godoc.org/github.com/VojtechVitek/go-trello?status.png)](https://godoc.org/github.com/VojtechVitek/go-trello)
[![Travis](https://travis-ci.org/VojtechVitek/go-trello.svg?branch=master)](https://travis-ci.org/VojtechVitek/go-trello)
[![GoDoc](https://godoc.org/github.com/TJM/go-trello?status.png)](https://godoc.org/github.com/TJM/go-trello)
[![Travis](https://travis-ci.org/TJM/go-trello.svg?branch=master)](https://travis-ci.org/TJM/go-trello)

## Example

Prerequisites:

Example
-------
* Retrieve your `appKey`: <https://trello.com/app-key> (NOTE: This identifies "you" as the developer of the application)
* Retrieve your (temporary) `token`: <https://trello.com/1/connect?key=MYKEYFROMABOVE&name=MYAPPNAME&response_type=token&scope=read,write&expiration=1day>

```go
package main

import (
"fmt"
"log"
"fmt"
"log"

"github.com/VojtechVitek/go-trello"
"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)
}
}
}
// 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

```
```console
Trello
* How to Use Trello for Android (https://trello.com/b/9dnaRkNt)
- Getting Started
+ Welcome to Trello! This is a card.
+ Tap on a card to open it up.
+ Color-coded labels can be used to classify cards.
+ Create as many cards as you want. We've got an unlimited supply!
+ Here is a picture of Taco, our Siberian Husky.
- Diving In
+ Tap and hold this card to drag it to another list.
+ Tap on the board name to view other sections.
+ Make as many lists and boards as you need. We'll make more!
- Mastering Trello
+ Finished with a card? Drag it to the top of the board to archive it.
+ You can reorder lists too.
+ Invite team members to collaborate on this board.
- More Info
+ Want updates on new features?
+ You can also view your boards on trello.com
* 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
```

Influenced by
-------------
- [fsouza/go-dockerclient](https://github.com/fsouza/go-dockerclient)
- [jeremytregunna/ruby-trello](https://github.com/jeremytregunna/ruby-trello)
## Acknowledgements

Forked From:

* [VojtechVitek/go-trello](https://github.com/VojtechVitek/go-trello)
* [aQaTL/go-trello](https://github.com/aQaTL/go-trello)

(previously) Influenced by:

* [fsouza/go-dockerclient](https://github.com/fsouza/go-dockerclient)
* [jeremytregunna/ruby-trello](https://github.com/jeremytregunna/ruby-trello)

## License

License
-------
Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
33 changes: 18 additions & 15 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,62 +16,65 @@ limitations under the License.

package trello

// Action struct
type Action struct {
client *Client
Id string `json:"id"`
IdMemberCreator string `json:"idMemberCreator"`
Data struct {
ID string `json:"id"`
IDMemberCreator string `json:"idMemberCreator"`
Data struct {
DateLastEdited string `json:"dateLastEdited"`
ListBefore struct {
Id string `json:"id"`
ListBefore struct {
ID string `json:"id"`
Name string `json:"name"`
} `json:"listBefore"`
ListAfter struct {
Id string `json:"id"`
ID string `json:"id"`
Name string `json:"name"`
} `json:"listAfter"`
CheckItem struct {
Id string `json:"id"`
ID string `json:"id"`
State string `json:"state"`
Name string `json:"name"`
} `json:"checkItem"`
CheckList struct {
Id string `json:"id"`
ID string `json:"id"`
Name string `json:"name"`
} `json:"checklist"`
List struct {
Id string `json:"id"`
ID string `json:"id"`
Name string `json:"name"`
} `json:"list"`
TextData struct {
Emoji struct{} `json:"emoji"`
} `json:"textData"`
Board struct {
Id string `json:"id"`
ID string `json:"id"`
Name string `json:"name"`
ShortLink string `json:"shortLink"`
} `json:"board"`
Card struct {
Id string `json:"id"`
ID string `json:"id"`
Name string `json:"name"`
ShortLink string `json:"shortLink"`
IdShort int `json:"idShort"`
IDShort int `json:"idShort"`
} `json:"card"`
Text string `json:"text"`
} `json:"data"`
Type ActionType `json:"type"`
Date string `json:"date"`
Type ActionType `json:"type"`
Date string `json:"date"`
MemberCreator struct {
Id string `json:"id"`
ID string `json:"id"`
AvatarHash string `json:"avatarHash"`
FullName string `json:"fullName"`
Initials string `json:"initials"`
Username string `json:"username"`
} `json:"memberCreator"`
}

// ActionType Action String
type ActionType string

// Actions
const (
AddAdminToBoard ActionType = "addAdminToBoard"
AddAdminToOrganization ActionType = "addAdminToOrganization"
Expand Down
3 changes: 3 additions & 0 deletions arg.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ package trello

import "net/url"

// Argument struct
type Argument struct {
Name string
Value string
}

// NewArgument creates a new argument type from name and value strings
func NewArgument(name, value string) *Argument {
return &Argument{
Name: name,
Value: value,
}
}

// EncodeArgs URL encodes a list of arguments
func EncodeArgs(args []*Argument) string {
v := url.Values{}
for _, arg := range args {
Expand Down
11 changes: 6 additions & 5 deletions attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,24 @@ limitations under the License.

package trello

// Attachment - Type
type Attachment struct {
client *Client
Id string `json:"id"`
ID string `json:"id"`
Bytes int `json:"bytes"`
Date string `json:"date"`
EdgeColor string `json:"edgeColor"`
IdMember string `json:"idMember"`
IDMember string `json:"idMember"`
IsUpload bool `json:"isUpload"`
MimeType string `json:"mimeType"`
Name string `json:"name"`
Previews []struct {
Width int `json:"width"`
Height int `json:"height"`
Url string `json:"url"`
URL string `json:"url"`
Bytes int `json:"bytes"`
Id string `json:"_id"`
ID string `json:"_id"`
Scaled bool `json:"scaled"`
} `json:"previews"`
Url string `json:"url"`
URL string `json:"url"`
}
Loading

0 comments on commit fa956c1

Please sign in to comment.