package uk.org.gss_data.pmd_drafter.api @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 ) } }