Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #11 from dennmart/list-functions
Browse files Browse the repository at this point in the history
Added functions to fetch a list and a list's actions
  • Loading branch information
VojtechVitek committed Jan 27, 2016
2 parents a76f6e0 + c7d7d91 commit 4f2e82c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ type List struct {
Pos float32 `json:"pos"`
}

func (c *Client) List(listId string) (list *List, err error) {
body, err := c.Get("/lists/" + listId)
if err != nil {
return
}

err = json.Unmarshal(body, &list)
list.client = c
return
}

func (l *List) Cards() (cards []Card, err error) {
body, err := l.client.Get("/lists/" + l.Id + "/cards")
if err != nil {
Expand All @@ -41,3 +52,16 @@ func (l *List) Cards() (cards []Card, err error) {
}
return
}

func (l *List) Actions() (actions []Action, err error) {
body, err := l.client.Get("/lists/" + l.Id + "/actions")
if err != nil {
return
}

err = json.Unmarshal(body, &actions)
for i := range actions {
actions[i].client = l.client
}
return
}

0 comments on commit 4f2e82c

Please sign in to comment.