Newer
Older
drafter-groovy / vars / draftset.groovy
@Alex Tucker Alex Tucker on 27 Apr 2018 927 bytes Some debugging.
@Grab('io.swagger:swagger-annotations:1.5.8')
@Grab('com.fasterxml.jackson.core:jackson-core:2.7.0')
@Grab('com.fasterxml.jackson.core:jackson-annotations:2.7.0')
@Grab('com.fasterxml.jackson.core:jackson-databind:2.7.0')
@Grab('com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.7.0')
@Grab('com.fasterxml.jackson.datatype:jackson-datatype-joda:2.1.5')
@Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.7.1')

import uk.org.gss_data.pmd_drafter.api.DraftsetsApi

def list() {
    def api = new DraftsetsApi()
    api.basePath = "https://production-drafter-ons-alpha.publishmydata.com"
    api.versionPath = "/v1"
    String pmd_api = "${PMD_API}"
    api.auth = "Basic " + pmd_api.bytes.encodeBase64()
    def ds = null
    println "Fetching draftsets..."
    api.draftsetsGet(null, { result -> ds = result },
            { status, reason -> throw new Exception(reason) })
    println ds.id
    return ds
}