Newer
Older
drafter-groovy / src / uk / org / gss_data / pmd_drafter / api / UpdatingDataApi.groovy
package uk.org.gss_data.pmd_drafter.api

import uk.org.gss_data.pmd_drafter.model.AsyncJob
import uk.org.gss_data.pmd_drafter.model.Draftset

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 )
                    
    }
}