Posted at

Use Trello Api from Groovy


TL;DR


  • Use Library Trello4j


Prepare

Api Keyをこちらから取得する https://trello.com/app-key

合わせて、「手動でトークンを生成」する


Sample

@GrabResolver(name='trello4j', root='https://raw.github.com/joelso/joelso-mvn-repo/master/snapshots/')

@Grab(group='org.trello4j', module='trello4j', version='1.0-SNAPSHOT')
import org.trello4j.*

Trello trello = new TrelloImpl('Api Key', 'token')

// display boards
boardList = trello.getBoardsByMember('YourID')
boardList.each { println "ID: ${it.getId()}, NAME: ${it.getName()}" }

// display list in the Board
listInBoard = trello.getListByBoard('YourBoard')
listInBoard.each { println "ID: ${it.getId()}, NAME: ${it.getName()}" }

// add new card
cardName = 'new card'
cardPropertyMap = ['desc':'description']
card = trello.createCard('list id', cardName, cardPropertyMap)


参考

https://github.com/joelso/trello4j