Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

More simple card actions #1

Merged
merged 2 commits into from Feb 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions card.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ func (c *Card) Archive() ([]byte, error) {
return c.client.Put("/cards/"+c.Id+"/closed", payload)
}

// SendToBoard will dearchive the card, or send the card to the board back from archive
// https://developers.trello.com/advanced-reference/card#put-1-cards-card-id-or-shortlink-closed
func (c *Card) SendToBoard() ([]byte, error) {
payload := url.Values{}
payload.Set("value", "false")

return c.client.Put("/cards/"+c.Id+"/closed", payload)
}

// MoveToList will move the card to another list
// https://developers.trello.com/advanced-reference/card#put-1-cards-card-id-or-shortlink-idlist
func (c *Card) MoveToList(listId string) ([]byte, error) {
Expand All @@ -197,3 +206,12 @@ func (c *Card) MoveToList(listId string) ([]byte, error) {

return c.client.Put("/cards/"+c.Id+"/idList", payload)
}

// MoveToPos will move card to the specified position
// https://developers.trello.com/advanced-reference/card#put-1-cards-card-id-or-shortlink-pos
func (c *Card) MoveToPos(pos string) ([]byte, error) {
payload := url.Values{}
payload.Set("value", pos)

return c.client.Put("/cards/"+c.Id+"/pos", payload)
}