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

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

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