Created
March 28, 2016 21:18
-
-
Save rdmueller/6f49ec4f270b04afefc1 to your computer and use it in GitHub Desktop.
An example on how to fetch all open issues of a repository with groovy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.6' ) | |
import groovyx.net.http.RESTClient | |
import groovyx.net.http.EncoderRegistry | |
def github = new RESTClient( 'https://api.github.com/' ) | |
github.encoderRegistry = new EncoderRegistry( charset: 'utf-8' ) | |
def headers = [ | |
'Content-Type':'application/json; charset=utf-8', | |
'User-Agent':'rdmueller' // replace with your github user name | |
] | |
github.handler.failure = { resp, data -> resp.setData(data); return resp } | |
def res = github.get(path:'repos/rdmueller/grails-filmStrip/issues', query:[:],headers:headers) | |
res.data.each { | |
println "${"#${it.number}".padLeft(3)} ${it.state.padRight(6)} ${it.title.take(120)} " | |
} | |
"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see https://developer.github.com/v3/issues/