Newer
Older
drafter-groovy / src / uk / org / gss_data / pmd_drafter / api / SparqlEndpointsApi.groovy
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 )
                    
    }
}