diff --git a/src/main/groovy/io/swagger/api/ApiUtils.groovy b/src/main/groovy/io/swagger/api/ApiUtils.groovy deleted file mode 100644 index 7b3aaef..0000000 --- a/src/main/groovy/io/swagger/api/ApiUtils.groovy +++ /dev/null @@ -1,51 +0,0 @@ -package io.swagger.api; - -import groovyx.net.http.HTTPBuilder -import groovyx.net.http.Method - -import static groovyx.net.http.ContentType.JSON -import static java.net.URI.create; - -class ApiUtils { - - def invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, method, container, type) { - def (url, uriPath) = buildUrlAndUriPath(basePath, versionPath, resourcePath) - println "url=$url uriPath=$uriPath" - def http = new HTTPBuilder(url) - http.request( Method.valueOf(method), JSON ) { - uri.path = uriPath - uri.query = queryParams - headers.Authorization = auth - response.success = { resp, json -> - if (type != null) { - onSuccess(parse(json, container, type)) - } - } - response.failure = { resp -> - onFailure(resp.status, resp.statusLine.reasonPhrase) - } - } - } - - - def buildUrlAndUriPath(basePath, versionPath, resourcePath) { - // HTTPBuilder expects to get as its constructor parameter an URL, - // without any other additions like path, therefore we need to cut the path - // from the basePath as it is represented by swagger APIs - // we use java.net.URI to manipulate the basePath - // then the uriPath will hold the rest of the path - URI baseUri = create(basePath) - def pathOnly = baseUri.getPath() - [basePath-pathOnly, pathOnly+versionPath+resourcePath] - } - - - def parse(object, container, clazz) { - if ((container == "List") || (container == "array")) { - return object.collect {parse(it, "", clazz)} - } else { - return clazz.newInstance(object) - } - } - -} diff --git a/src/main/groovy/io/swagger/api/DraftsetsApi.groovy b/src/main/groovy/io/swagger/api/DraftsetsApi.groovy deleted file mode 100644 index 6f9b05e..0000000 --- a/src/main/groovy/io/swagger/api/DraftsetsApi.groovy +++ /dev/null @@ -1,153 +0,0 @@ -package io.swagger.api; - -import groovyx.net.http.* -import static groovyx.net.http.ContentType.* -import static groovyx.net.http.Method.* -import io.swagger.api.ApiUtils - -import io.swagger.model.AsyncJob -import io.swagger.model.Draftset - -import java.util.*; - -@Mixin(ApiUtils) -class DraftsetsApi { - String basePath = "https://localhost/v1" - String versionPath = "/api/v1" - String auth = "Basic " - - def draftsetIdClaimPut ( String id, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/claim" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, - "PUT", "", - Draftset.class ) - - } - def draftsetIdDelete ( String id, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, - "DELETE", "", - AsyncJob.class ) - - } - def draftsetIdPublishPost ( String id, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/publish" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, - "POST", "", - AsyncJob.class ) - - } - def draftsetIdSubmitToPost ( String id, String role, String user, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/submit-to" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - - if (!"null".equals(String.valueOf(role))) - queryParams.put("role", String.valueOf(role)) -if (!"null".equals(String.valueOf(user))) - queryParams.put("user", String.valueOf(user)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, - "POST", "", - Draftset.class ) - - } - def draftsetsGet ( String include, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftsets" - - // query params - def queryParams = [:] - def headerParams = [:] - - - if (!"null".equals(String.valueOf(include))) - queryParams.put("include", String.valueOf(include)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, - "GET", "array", - Draftset.class ) - - } - def draftsetsPost ( String displayName, String description, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftsets" - - // query params - def queryParams = [:] - def headerParams = [:] - - - if (!"null".equals(String.valueOf(displayName))) - queryParams.put("display-name", String.valueOf(displayName)) -if (!"null".equals(String.valueOf(description))) - queryParams.put("description", String.valueOf(description)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, - "POST", "", - null ) - - } -} diff --git a/src/main/groovy/io/swagger/api/JobsApi.groovy b/src/main/groovy/io/swagger/api/JobsApi.groovy deleted file mode 100644 index 2c8ed0c..0000000 --- a/src/main/groovy/io/swagger/api/JobsApi.groovy +++ /dev/null @@ -1,57 +0,0 @@ -package io.swagger.api; - -import groovyx.net.http.* -import static groovyx.net.http.ContentType.* -import static groovyx.net.http.Method.* -import io.swagger.api.ApiUtils - -import io.swagger.model.FinishedJob - -import java.util.*; - -@Mixin(ApiUtils) -class JobsApi { - String basePath = "https://localhost/v1" - String versionPath = "/api/v1" - - def statusFinishedJobsJobidGet ( String jobid, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/status/finished-jobs/{jobid}" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (jobid == null) { - throw new RuntimeException("missing required params jobid") - } - - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "GET", "", - FinishedJob.class ) - - } - def statusWritesLockedGet ( Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/status/writes-locked" - - // query params - def queryParams = [:] - def headerParams = [:] - - - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "GET", "", - Boolean.class ) - - } -} diff --git a/src/main/groovy/io/swagger/api/MetadataApi.groovy b/src/main/groovy/io/swagger/api/MetadataApi.groovy deleted file mode 100644 index 95973ec..0000000 --- a/src/main/groovy/io/swagger/api/MetadataApi.groovy +++ /dev/null @@ -1,65 +0,0 @@ -package io.swagger.api; - -import groovyx.net.http.* -import static groovyx.net.http.ContentType.* -import static groovyx.net.http.Method.* -import io.swagger.api.ApiUtils - -import io.swagger.model.Draftset - -import java.util.*; - -@Mixin(ApiUtils) -class MetadataApi { - String basePath = "https://localhost/v1" - String versionPath = "/api/v1" - - def draftsetIdGet ( String id, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "GET", "", - Draftset.class ) - - } - def draftsetIdPut ( String id, String displayName, String description, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - - if (!"null".equals(String.valueOf(displayName))) - queryParams.put("display-name", String.valueOf(displayName)) -if (!"null".equals(String.valueOf(description))) - queryParams.put("description", String.valueOf(description)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "PUT", "", - Draftset.class ) - - } -} diff --git a/src/main/groovy/io/swagger/api/QueryingApi.groovy b/src/main/groovy/io/swagger/api/QueryingApi.groovy deleted file mode 100644 index 9f66902..0000000 --- a/src/main/groovy/io/swagger/api/QueryingApi.groovy +++ /dev/null @@ -1,100 +0,0 @@ -package io.swagger.api - -import io.swagger.api.ApiUtils - -@Mixin(ApiUtils) -class QueryingApi { - String basePath = "https://localhost/v1" - String versionPath = "/api/v1" - - def draftsetIdDataGet ( String id, String graph, Boolean unionWithLive, Integer timeout, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/data" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - - if (!"null".equals(String.valueOf(graph))) - queryParams.put("graph", String.valueOf(graph)) -if (!"null".equals(String.valueOf(unionWithLive))) - queryParams.put("union-with-live", String.valueOf(unionWithLive)) -if (!"null".equals(String.valueOf(timeout))) - queryParams.put("timeout", String.valueOf(timeout)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "GET", "", - File.class ) - - } - def draftsetIdQueryGet ( String id, String query, Boolean unionWithLive, Integer timeout, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/query" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - // verify required params are set - if (query == null) { - throw new RuntimeException("missing required params query") - } - - if (!"null".equals(String.valueOf(query))) - queryParams.put("query", String.valueOf(query)) -if (!"null".equals(String.valueOf(unionWithLive))) - queryParams.put("union-with-live", String.valueOf(unionWithLive)) -if (!"null".equals(String.valueOf(timeout))) - queryParams.put("timeout", String.valueOf(timeout)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "GET", "", - File.class ) - - } - def draftsetIdQueryPost ( String id, String query, Boolean unionWithLive, Integer timeout, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/query" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - // verify required params are set - if (query == null) { - throw new RuntimeException("missing required params query") - } - - if (!"null".equals(String.valueOf(unionWithLive))) - queryParams.put("union-with-live", String.valueOf(unionWithLive)) -if (!"null".equals(String.valueOf(timeout))) - queryParams.put("timeout", String.valueOf(timeout)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "POST", "", - File.class ) - - } -} diff --git a/src/main/groovy/io/swagger/api/SparqlEndpointsApi.groovy b/src/main/groovy/io/swagger/api/SparqlEndpointsApi.groovy deleted file mode 100644 index 9fab50a..0000000 --- a/src/main/groovy/io/swagger/api/SparqlEndpointsApi.groovy +++ /dev/null @@ -1,58 +0,0 @@ -package io.swagger.api - -import io.swagger.api.ApiUtils - -@Mixin(ApiUtils) -class SparqlEndpointsApi { - String basePath = "https://localhost/v1" - String versionPath = "/api/v1" - - def sparqlLiveGet ( String query, Integer timeout, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/sparql/live" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (query == null) { - throw new RuntimeException("missing required params query") - } - - if (!"null".equals(String.valueOf(query))) - queryParams.put("query", String.valueOf(query)) -if (!"null".equals(String.valueOf(timeout))) - queryParams.put("timeout", String.valueOf(timeout)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "GET", "", - File.class ) - - } - def sparqlLivePost ( String query, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/sparql/live" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (query == null) { - throw new RuntimeException("missing required params query") - } - - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "POST", "", - File.class ) - - } -} diff --git a/src/main/groovy/io/swagger/api/UpdatingDataApi.groovy b/src/main/groovy/io/swagger/api/UpdatingDataApi.groovy deleted file mode 100644 index eeb713f..0000000 --- a/src/main/groovy/io/swagger/api/UpdatingDataApi.groovy +++ /dev/null @@ -1,160 +0,0 @@ -package io.swagger.api; - -import groovyx.net.http.* -import static groovyx.net.http.ContentType.* -import static groovyx.net.http.Method.* -import io.swagger.api.ApiUtils - -import io.swagger.model.AsyncJob -import io.swagger.model.Draftset - -import java.util.*; - -@Mixin(ApiUtils) -class UpdatingDataApi { - String basePath = "https://localhost/v1" - String versionPath = "/api/v1" - - def draftsetIdChangesDelete ( String id, String graph, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/changes" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - // verify required params are set - if (graph == null) { - throw new RuntimeException("missing required params graph") - } - - if (!"null".equals(String.valueOf(graph))) - queryParams.put("graph", String.valueOf(graph)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "DELETE", "", - Draftset.class ) - - } - def draftsetIdDataDelete ( String id, String data, String graph, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/data" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - // verify required params are set - if (data == null) { - throw new RuntimeException("missing required params data") - } - - if (!"null".equals(String.valueOf(graph))) - queryParams.put("graph", String.valueOf(graph)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "DELETE", "", - AsyncJob.class ) - - } - def draftsetIdDataPut ( String id, String data, String graph, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/data" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - // verify required params are set - if (data == null) { - throw new RuntimeException("missing required params data") - } - - if (!"null".equals(String.valueOf(graph))) - queryParams.put("graph", String.valueOf(graph)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "PUT", "", - AsyncJob.class ) - - } - def draftsetIdGraphDelete ( String id, String graph, Boolean silent, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/graph" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - // verify required params are set - if (graph == null) { - throw new RuntimeException("missing required params graph") - } - - if (!"null".equals(String.valueOf(graph))) - queryParams.put("graph", String.valueOf(graph)) -if (!"null".equals(String.valueOf(silent))) - queryParams.put("silent", String.valueOf(silent)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "DELETE", "", - Draftset.class ) - - } - def draftsetIdGraphPut ( String id, String graph, Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/draftset/{id}/graph" - - // query params - def queryParams = [:] - def headerParams = [:] - - // verify required params are set - if (id == null) { - throw new RuntimeException("missing required params id") - } - // verify required params are set - if (graph == null) { - throw new RuntimeException("missing required params graph") - } - - if (!"null".equals(String.valueOf(graph))) - queryParams.put("graph", String.valueOf(graph)) - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "PUT", "", - AsyncJob.class ) - - } -} diff --git a/src/main/groovy/io/swagger/api/UsersApi.groovy b/src/main/groovy/io/swagger/api/UsersApi.groovy deleted file mode 100644 index 82ef1a3..0000000 --- a/src/main/groovy/io/swagger/api/UsersApi.groovy +++ /dev/null @@ -1,35 +0,0 @@ -package io.swagger.api; - -import groovyx.net.http.* -import static groovyx.net.http.ContentType.* -import static groovyx.net.http.Method.* -import io.swagger.api.ApiUtils - -import io.swagger.model.User - -import java.util.*; - -@Mixin(ApiUtils) -class UsersApi { - String basePath = "https://localhost/v1" - String versionPath = "/api/v1" - - def usersGet ( Closure onSuccess, Closure onFailure) { - // create path and map path parameters (TODO) - String resourcePath = "/users" - - // query params - def queryParams = [:] - def headerParams = [:] - - - - - // Also still TODO: form params, body param - - invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, - "GET", "array", - User.class ) - - } -} diff --git a/src/main/groovy/io/swagger/model/AsyncJob.groovy b/src/main/groovy/io/swagger/model/AsyncJob.groovy deleted file mode 100644 index 164d18a..0000000 --- a/src/main/groovy/io/swagger/model/AsyncJob.groovy +++ /dev/null @@ -1,17 +0,0 @@ -package io.swagger.model; - -import groovy.transform.Canonical -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -@Canonical -class AsyncJob { - - String type = null - - String finishedJob = null - - String restartId = null - - -} - diff --git a/src/main/groovy/io/swagger/model/Draftset.groovy b/src/main/groovy/io/swagger/model/Draftset.groovy deleted file mode 100644 index d2a61a4..0000000 --- a/src/main/groovy/io/swagger/model/Draftset.groovy +++ /dev/null @@ -1,62 +0,0 @@ -package io.swagger.model; - -import groovy.transform.Canonical -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.model.Graph; -import java.util.UUID; -import java.util.List; -import java.time.OffsetDateTime; - -@Canonical -class Draftset { - - Draftset(Map map) { - map?.each { k, v -> - def prop = k.replaceAll("-([A-Za-z0-9])", {Object [] it -> it[1].toUpperCase()}) - def mpType = this.getMetaClass().getMetaProperty(prop).getType() - if (mpType == OffsetDateTime.class) { - this[prop] = OffsetDateTime.parse(v) - } else if (mpType == UUID) { - this[prop] = UUID.fromString(v) - } else { - this[prop] = v - } - } - } - - /* Unique identifier representing this draftset */ - UUID id = null - - /* The user who created this Draftset */ - String createdBy = null - - Map changes = new HashMap() - - /* Display name of the Draftset */ - String displayName = null - - /* The current owner of this Draftset */ - String currentOwner = null - - /* The owner who submitted this Draftset for review */ - String submittedBy = null - - /* The required role for users who can claim this Draftset */ - String claimRole = null - - /* The user who can claim this Draftset */ - String claimUser = null - - /* A description of the Draftset */ - String description = null - - /* IS0 8601 DateTime representing the time the draftsets metadata was last updated */ - OffsetDateTime updatedAt = null - - /* IS0 8601 DateTime representing the time the draftset was created */ - OffsetDateTime createdAt = null - - -} - diff --git a/src/main/groovy/io/swagger/model/Error.groovy b/src/main/groovy/io/swagger/model/Error.groovy deleted file mode 100644 index 13ea3ac..0000000 --- a/src/main/groovy/io/swagger/model/Error.groovy +++ /dev/null @@ -1,19 +0,0 @@ -package io.swagger.model; - -import groovy.transform.Canonical -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import io.swagger.model.ErrorException; -@Canonical -class Error { - - String type = null - - /* String representing the class of error that occurred */ - String errorType = null - - ErrorException exception = null - - -} - diff --git a/src/main/groovy/io/swagger/model/ErrorException.groovy b/src/main/groovy/io/swagger/model/ErrorException.groovy deleted file mode 100644 index af549bb..0000000 --- a/src/main/groovy/io/swagger/model/ErrorException.groovy +++ /dev/null @@ -1,14 +0,0 @@ -package io.swagger.model; - -import groovy.transform.Canonical -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -@Canonical -class ErrorException { - - /* An error message relating to the specific exception */ - String message = null - - -} - diff --git a/src/main/groovy/io/swagger/model/FinishedJob.groovy b/src/main/groovy/io/swagger/model/FinishedJob.groovy deleted file mode 100644 index d70f2ea..0000000 --- a/src/main/groovy/io/swagger/model/FinishedJob.groovy +++ /dev/null @@ -1,21 +0,0 @@ -package io.swagger.model; - -import groovy.transform.Canonical -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -@Canonical -class FinishedJob { - - String type = null - - String restartId = null - - String errorClass = null - - String message = null - - Object details = null - - -} - diff --git a/src/main/groovy/io/swagger/model/Graph.groovy b/src/main/groovy/io/swagger/model/Graph.groovy deleted file mode 100644 index 6914226..0000000 --- a/src/main/groovy/io/swagger/model/Graph.groovy +++ /dev/null @@ -1,13 +0,0 @@ -package io.swagger.model; - -import groovy.transform.Canonical -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -@Canonical -class Graph { - - String status = null - - -} - diff --git a/src/main/groovy/io/swagger/model/User.groovy b/src/main/groovy/io/swagger/model/User.groovy deleted file mode 100644 index baec4a8..0000000 --- a/src/main/groovy/io/swagger/model/User.groovy +++ /dev/null @@ -1,17 +0,0 @@ -package io.swagger.model; - -import groovy.transform.Canonical -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -@Canonical -class User { - - /* Username of the user */ - String username = null - - /* role of the user */ - String role = null - - -} - diff --git a/src/uk/org/gss_data/pmd_drafter/api/ApiUtils.groovy b/src/uk/org/gss_data/pmd_drafter/api/ApiUtils.groovy new file mode 100644 index 0000000..50cd8f6 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/api/ApiUtils.groovy @@ -0,0 +1,51 @@ +package uk.org.gss_data.pmd_drafter.api; + +import groovyx.net.http.HTTPBuilder +import groovyx.net.http.Method + +import static groovyx.net.http.ContentType.JSON +import static java.net.URI.create; + +class ApiUtils { + + def invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, method, container, type) { + def (url, uriPath) = buildUrlAndUriPath(basePath, versionPath, resourcePath) + println "url=$url uriPath=$uriPath" + def http = new HTTPBuilder(url) + http.request( Method.valueOf(method), JSON ) { + uri.path = uriPath + uri.query = queryParams + headers.Authorization = auth + response.success = { resp, json -> + if (type != null) { + onSuccess(parse(json, container, type)) + } + } + response.failure = { resp -> + onFailure(resp.status, resp.statusLine.reasonPhrase) + } + } + } + + + def buildUrlAndUriPath(basePath, versionPath, resourcePath) { + // HTTPBuilder expects to get as its constructor parameter an URL, + // without any other additions like path, therefore we need to cut the path + // from the basePath as it is represented by swagger APIs + // we use java.net.URI to manipulate the basePath + // then the uriPath will hold the rest of the path + URI baseUri = create(basePath) + def pathOnly = baseUri.getPath() + [basePath-pathOnly, pathOnly+versionPath+resourcePath] + } + + + def parse(object, container, clazz) { + if ((container == "List") || (container == "array")) { + return object.collect {parse(it, "", clazz)} + } else { + return clazz.newInstance(object) + } + } + +} diff --git a/src/uk/org/gss_data/pmd_drafter/api/DraftsetsApi.groovy b/src/uk/org/gss_data/pmd_drafter/api/DraftsetsApi.groovy new file mode 100644 index 0000000..c3516e6 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/api/DraftsetsApi.groovy @@ -0,0 +1,153 @@ +package uk.org.gss_data.pmd_drafter.api; + +import groovyx.net.http.* +import static groovyx.net.http.ContentType.* +import static groovyx.net.http.Method.* +import io.swagger.api.ApiUtils + +import io.swagger.model.AsyncJob +import io.swagger.model.Draftset + +import java.util.*; + +@Mixin(ApiUtils) +class DraftsetsApi { + String basePath = "https://localhost/v1" + String versionPath = "/api/v1" + String auth = "Basic " + + def draftsetIdClaimPut ( String id, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/claim" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, + "PUT", "", + Draftset.class ) + + } + def draftsetIdDelete ( String id, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, + "DELETE", "", + AsyncJob.class ) + + } + def draftsetIdPublishPost ( String id, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/publish" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, + "POST", "", + AsyncJob.class ) + + } + def draftsetIdSubmitToPost ( String id, String role, String user, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/submit-to" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + + if (!"null".equals(String.valueOf(role))) + queryParams.put("role", String.valueOf(role)) +if (!"null".equals(String.valueOf(user))) + queryParams.put("user", String.valueOf(user)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, + "POST", "", + Draftset.class ) + + } + def draftsetsGet ( String include, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftsets" + + // query params + def queryParams = [:] + def headerParams = [:] + + + if (!"null".equals(String.valueOf(include))) + queryParams.put("include", String.valueOf(include)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, + "GET", "array", + Draftset.class ) + + } + def draftsetsPost ( String displayName, String description, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftsets" + + // query params + def queryParams = [:] + def headerParams = [:] + + + if (!"null".equals(String.valueOf(displayName))) + queryParams.put("display-name", String.valueOf(displayName)) +if (!"null".equals(String.valueOf(description))) + queryParams.put("description", String.valueOf(description)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, auth, + "POST", "", + null ) + + } +} diff --git a/src/uk/org/gss_data/pmd_drafter/api/JobsApi.groovy b/src/uk/org/gss_data/pmd_drafter/api/JobsApi.groovy new file mode 100644 index 0000000..7600883 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/api/JobsApi.groovy @@ -0,0 +1,57 @@ +package uk.org.gss_data.pmd_drafter.api; + +import groovyx.net.http.* +import static groovyx.net.http.ContentType.* +import static groovyx.net.http.Method.* +import io.swagger.api.ApiUtils + +import io.swagger.model.FinishedJob + +import java.util.*; + +@Mixin(ApiUtils) +class JobsApi { + String basePath = "https://localhost/v1" + String versionPath = "/api/v1" + + def statusFinishedJobsJobidGet ( String jobid, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/status/finished-jobs/{jobid}" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (jobid == null) { + throw new RuntimeException("missing required params jobid") + } + + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "GET", "", + FinishedJob.class ) + + } + def statusWritesLockedGet ( Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/status/writes-locked" + + // query params + def queryParams = [:] + def headerParams = [:] + + + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "GET", "", + Boolean.class ) + + } +} diff --git a/src/uk/org/gss_data/pmd_drafter/api/MetadataApi.groovy b/src/uk/org/gss_data/pmd_drafter/api/MetadataApi.groovy new file mode 100644 index 0000000..41dddf6 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/api/MetadataApi.groovy @@ -0,0 +1,65 @@ +package uk.org.gss_data.pmd_drafter.api; + +import groovyx.net.http.* +import static groovyx.net.http.ContentType.* +import static groovyx.net.http.Method.* +import io.swagger.api.ApiUtils + +import io.swagger.model.Draftset + +import java.util.*; + +@Mixin(ApiUtils) +class MetadataApi { + String basePath = "https://localhost/v1" + String versionPath = "/api/v1" + + def draftsetIdGet ( String id, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "GET", "", + Draftset.class ) + + } + def draftsetIdPut ( String id, String displayName, String description, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + + if (!"null".equals(String.valueOf(displayName))) + queryParams.put("display-name", String.valueOf(displayName)) +if (!"null".equals(String.valueOf(description))) + queryParams.put("description", String.valueOf(description)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "PUT", "", + Draftset.class ) + + } +} diff --git a/src/uk/org/gss_data/pmd_drafter/api/QueryingApi.groovy b/src/uk/org/gss_data/pmd_drafter/api/QueryingApi.groovy new file mode 100644 index 0000000..120a300 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/api/QueryingApi.groovy @@ -0,0 +1,100 @@ +package uk.org.gss_data.pmd_drafter.api; + +import io.swagger.api.ApiUtils + +@Mixin(ApiUtils) +class QueryingApi { + String basePath = "https://localhost/v1" + String versionPath = "/api/v1" + + def draftsetIdDataGet ( String id, String graph, Boolean unionWithLive, Integer timeout, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/data" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + + if (!"null".equals(String.valueOf(graph))) + queryParams.put("graph", String.valueOf(graph)) +if (!"null".equals(String.valueOf(unionWithLive))) + queryParams.put("union-with-live", String.valueOf(unionWithLive)) +if (!"null".equals(String.valueOf(timeout))) + queryParams.put("timeout", String.valueOf(timeout)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "GET", "", + File.class ) + + } + def draftsetIdQueryGet ( String id, String query, Boolean unionWithLive, Integer timeout, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/query" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + // verify required params are set + if (query == null) { + throw new RuntimeException("missing required params query") + } + + if (!"null".equals(String.valueOf(query))) + queryParams.put("query", String.valueOf(query)) +if (!"null".equals(String.valueOf(unionWithLive))) + queryParams.put("union-with-live", String.valueOf(unionWithLive)) +if (!"null".equals(String.valueOf(timeout))) + queryParams.put("timeout", String.valueOf(timeout)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "GET", "", + File.class ) + + } + def draftsetIdQueryPost ( String id, String query, Boolean unionWithLive, Integer timeout, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/query" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + // verify required params are set + if (query == null) { + throw new RuntimeException("missing required params query") + } + + if (!"null".equals(String.valueOf(unionWithLive))) + queryParams.put("union-with-live", String.valueOf(unionWithLive)) +if (!"null".equals(String.valueOf(timeout))) + queryParams.put("timeout", String.valueOf(timeout)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "POST", "", + File.class ) + + } +} diff --git a/src/uk/org/gss_data/pmd_drafter/api/SparqlEndpointsApi.groovy b/src/uk/org/gss_data/pmd_drafter/api/SparqlEndpointsApi.groovy new file mode 100644 index 0000000..f94109e --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/api/SparqlEndpointsApi.groovy @@ -0,0 +1,58 @@ +package uk.org.gss_data.pmd_drafter.api; + +import io.swagger.api.ApiUtils + +@Mixin(ApiUtils) +class SparqlEndpointsApi { + String basePath = "https://localhost/v1" + String versionPath = "/api/v1" + + def sparqlLiveGet ( String query, Integer timeout, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/sparql/live" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (query == null) { + throw new RuntimeException("missing required params query") + } + + if (!"null".equals(String.valueOf(query))) + queryParams.put("query", String.valueOf(query)) +if (!"null".equals(String.valueOf(timeout))) + queryParams.put("timeout", String.valueOf(timeout)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "GET", "", + File.class ) + + } + def sparqlLivePost ( String query, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/sparql/live" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (query == null) { + throw new RuntimeException("missing required params query") + } + + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "POST", "", + File.class ) + + } +} diff --git a/src/uk/org/gss_data/pmd_drafter/api/UpdatingDataApi.groovy b/src/uk/org/gss_data/pmd_drafter/api/UpdatingDataApi.groovy new file mode 100644 index 0000000..6e3b872 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/api/UpdatingDataApi.groovy @@ -0,0 +1,160 @@ +package uk.org.gss_data.pmd_drafter.api; + +import groovyx.net.http.* +import static groovyx.net.http.ContentType.* +import static groovyx.net.http.Method.* +import io.swagger.api.ApiUtils + +import io.swagger.model.AsyncJob +import io.swagger.model.Draftset + +import java.util.*; + +@Mixin(ApiUtils) +class UpdatingDataApi { + String basePath = "https://localhost/v1" + String versionPath = "/api/v1" + + def draftsetIdChangesDelete ( String id, String graph, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/changes" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + // verify required params are set + if (graph == null) { + throw new RuntimeException("missing required params graph") + } + + if (!"null".equals(String.valueOf(graph))) + queryParams.put("graph", String.valueOf(graph)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "DELETE", "", + Draftset.class ) + + } + def draftsetIdDataDelete ( String id, String data, String graph, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/data" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + // verify required params are set + if (data == null) { + throw new RuntimeException("missing required params data") + } + + if (!"null".equals(String.valueOf(graph))) + queryParams.put("graph", String.valueOf(graph)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "DELETE", "", + AsyncJob.class ) + + } + def draftsetIdDataPut ( String id, String data, String graph, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/data" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + // verify required params are set + if (data == null) { + throw new RuntimeException("missing required params data") + } + + if (!"null".equals(String.valueOf(graph))) + queryParams.put("graph", String.valueOf(graph)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "PUT", "", + AsyncJob.class ) + + } + def draftsetIdGraphDelete ( String id, String graph, Boolean silent, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/graph" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + // verify required params are set + if (graph == null) { + throw new RuntimeException("missing required params graph") + } + + if (!"null".equals(String.valueOf(graph))) + queryParams.put("graph", String.valueOf(graph)) +if (!"null".equals(String.valueOf(silent))) + queryParams.put("silent", String.valueOf(silent)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "DELETE", "", + Draftset.class ) + + } + def draftsetIdGraphPut ( String id, String graph, Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/draftset/{id}/graph" + + // query params + def queryParams = [:] + def headerParams = [:] + + // verify required params are set + if (id == null) { + throw new RuntimeException("missing required params id") + } + // verify required params are set + if (graph == null) { + throw new RuntimeException("missing required params graph") + } + + if (!"null".equals(String.valueOf(graph))) + queryParams.put("graph", String.valueOf(graph)) + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "PUT", "", + AsyncJob.class ) + + } +} diff --git a/src/uk/org/gss_data/pmd_drafter/api/UsersApi.groovy b/src/uk/org/gss_data/pmd_drafter/api/UsersApi.groovy new file mode 100644 index 0000000..822ca1b --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/api/UsersApi.groovy @@ -0,0 +1,35 @@ +package uk.org.gss_data.pmd_drafter.api; + +import groovyx.net.http.* +import static groovyx.net.http.ContentType.* +import static groovyx.net.http.Method.* +import io.swagger.api.ApiUtils + +import io.swagger.model.User + +import java.util.*; + +@Mixin(ApiUtils) +class UsersApi { + String basePath = "https://localhost/v1" + String versionPath = "/api/v1" + + def usersGet ( Closure onSuccess, Closure onFailure) { + // create path and map path parameters (TODO) + String resourcePath = "/users" + + // query params + def queryParams = [:] + def headerParams = [:] + + + + + // Also still TODO: form params, body param + + invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, + "GET", "array", + User.class ) + + } +} diff --git a/src/uk/org/gss_data/pmd_drafter/model/AsyncJob.groovy b/src/uk/org/gss_data/pmd_drafter/model/AsyncJob.groovy new file mode 100644 index 0000000..2ad2cd6 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/model/AsyncJob.groovy @@ -0,0 +1,17 @@ +package uk.org.gss_data.pmd_drafter.model; + +import groovy.transform.Canonical +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +@Canonical +class AsyncJob { + + String type = null + + String finishedJob = null + + String restartId = null + + +} + diff --git a/src/uk/org/gss_data/pmd_drafter/model/Draftset.groovy b/src/uk/org/gss_data/pmd_drafter/model/Draftset.groovy new file mode 100644 index 0000000..c041733 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/model/Draftset.groovy @@ -0,0 +1,62 @@ +package uk.org.gss_data.pmd_drafter.model; + +import groovy.transform.Canonical +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Graph; +import java.util.UUID; +import java.util.List; +import java.time.OffsetDateTime; + +@Canonical +class Draftset { + + Draftset(Map map) { + map?.each { k, v -> + def prop = k.replaceAll("-([A-Za-z0-9])", {Object [] it -> it[1].toUpperCase()}) + def mpType = this.getMetaClass().getMetaProperty(prop).getType() + if (mpType == OffsetDateTime.class) { + this[prop] = OffsetDateTime.parse(v) + } else if (mpType == UUID) { + this[prop] = UUID.fromString(v) + } else { + this[prop] = v + } + } + } + + /* Unique identifier representing this draftset */ + UUID id = null + + /* The user who created this Draftset */ + String createdBy = null + + Map changes = new HashMap() + + /* Display name of the Draftset */ + String displayName = null + + /* The current owner of this Draftset */ + String currentOwner = null + + /* The owner who submitted this Draftset for review */ + String submittedBy = null + + /* The required role for users who can claim this Draftset */ + String claimRole = null + + /* The user who can claim this Draftset */ + String claimUser = null + + /* A description of the Draftset */ + String description = null + + /* IS0 8601 DateTime representing the time the draftsets metadata was last updated */ + OffsetDateTime updatedAt = null + + /* IS0 8601 DateTime representing the time the draftset was created */ + OffsetDateTime createdAt = null + + +} + diff --git a/src/uk/org/gss_data/pmd_drafter/model/Error.groovy b/src/uk/org/gss_data/pmd_drafter/model/Error.groovy new file mode 100644 index 0000000..168d26d --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/model/Error.groovy @@ -0,0 +1,19 @@ +package uk.org.gss_data.pmd_drafter.model; + +import groovy.transform.Canonical +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.ErrorException; +@Canonical +class Error { + + String type = null + + /* String representing the class of error that occurred */ + String errorType = null + + ErrorException exception = null + + +} + diff --git a/src/uk/org/gss_data/pmd_drafter/model/ErrorException.groovy b/src/uk/org/gss_data/pmd_drafter/model/ErrorException.groovy new file mode 100644 index 0000000..7184e96 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/model/ErrorException.groovy @@ -0,0 +1,14 @@ +package uk.org.gss_data.pmd_drafter.model; + +import groovy.transform.Canonical +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +@Canonical +class ErrorException { + + /* An error message relating to the specific exception */ + String message = null + + +} + diff --git a/src/uk/org/gss_data/pmd_drafter/model/FinishedJob.groovy b/src/uk/org/gss_data/pmd_drafter/model/FinishedJob.groovy new file mode 100644 index 0000000..1e87979 --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/model/FinishedJob.groovy @@ -0,0 +1,21 @@ +package uk.org.gss_data.pmd_drafter.model; + +import groovy.transform.Canonical +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +@Canonical +class FinishedJob { + + String type = null + + String restartId = null + + String errorClass = null + + String message = null + + Object details = null + + +} + diff --git a/src/uk/org/gss_data/pmd_drafter/model/Graph.groovy b/src/uk/org/gss_data/pmd_drafter/model/Graph.groovy new file mode 100644 index 0000000..edca35f --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/model/Graph.groovy @@ -0,0 +1,13 @@ +package uk.org.gss_data.pmd_drafter.model; + +import groovy.transform.Canonical +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +@Canonical +class Graph { + + String status = null + + +} + diff --git a/src/uk/org/gss_data/pmd_drafter/model/User.groovy b/src/uk/org/gss_data/pmd_drafter/model/User.groovy new file mode 100644 index 0000000..d0b856d --- /dev/null +++ b/src/uk/org/gss_data/pmd_drafter/model/User.groovy @@ -0,0 +1,17 @@ +package uk.org.gss_data.pmd_drafter.model; + +import groovy.transform.Canonical +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +@Canonical +class User { + + /* Username of the user */ + String username = null + + /* role of the user */ + String role = null + + +} + diff --git a/vars/listDraftsets.groovy b/vars/listDraftsets.groovy new file mode 100644 index 0000000..585affc --- /dev/null +++ b/vars/listDraftsets.groovy @@ -0,0 +1,19 @@ +@Grab('org.codehaus.groovy:groovy-all:2.4.6') +@Grab('compile "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 call(auth) { + api = new DraftsetsApi() + api.basePath = "https://production-drafter-ons-alpha.publishmydata.com" + api.versionPath = "/v1" + api.auth = auth + api.draftsetsGet(null, { result -> echo result }, + { status, reason -> echo reason }) +} \ No newline at end of file