Newer
Older
drafter-groovy / src / uk / org / gss_data / pmd_drafter / api / DraftsetsApi.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 DraftsetsApi extends ApiUtils {
    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
        println "draftsetsGet"

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