package io.lumify.web.clientapi.codegen; import io.lumify.web.clientapi.codegen.ApiException; import io.lumify.web.clientapi.ApiInvoker; import io.lumify.web.clientapi.model.ClientApiWorkspaceUndoResponse; import io.lumify.web.clientapi.model.ClientApiWorkspaceVertices; import io.lumify.web.clientapi.model.ClientApiWorkspacePublishResponse; import io.lumify.web.clientapi.model.ClientApiWorkspaceEdges; import io.lumify.web.clientapi.model.ClientApiWorkspace; import io.lumify.web.clientapi.model.ClientApiWorkspaces; import io.lumify.web.clientapi.model.ClientApiWorkspaceDiff; import com.sun.jersey.multipart.FormDataMultiPart; import javax.ws.rs.core.MediaType; import java.io.File; import java.util.*; public class WorkspaceApi { protected String basePath = "http://lumify-dev:8889"; protected ApiInvoker apiInvoker = ApiInvoker.getInstance(); public ApiInvoker getInvoker() { return apiInvoker; } public void setBasePath(String basePath) { this.basePath = basePath; } public String getBasePath() { return basePath; } public ClientApiWorkspaces getAll () throws ApiException { Object postBody = null; // create path and map variables String path = "/workspace/all".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); String[] contentTypes = { "application/json"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); if(hasFields) postBody = mp; } else { } try { String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return (ClientApiWorkspaces) ApiInvoker.deserialize(response, "", ClientApiWorkspaces.class); } else { return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { return null; } else { throw ex; } } } public ClientApiWorkspace getById (String workspaceId) throws ApiException { Object postBody = null; // verify required params are set if(workspaceId == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables String path = "/workspace".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); if(!"null".equals(String.valueOf(workspaceId))) queryParams.put("workspaceId", String.valueOf(workspaceId)); String[] contentTypes = { "application/json"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); if(hasFields) postBody = mp; } else { } try { String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return (ClientApiWorkspace) ApiInvoker.deserialize(response, "", ClientApiWorkspace.class); } else { return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { return null; } else { throw ex; } } } public ClientApiWorkspace create () throws ApiException { Object postBody = null; // create path and map variables String path = "/workspace/create".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); String[] contentTypes = { "application/json"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); if(hasFields) postBody = mp; } else { } try { String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return (ClientApiWorkspace) ApiInvoker.deserialize(response, "", ClientApiWorkspace.class); } else { return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { return null; } else { throw ex; } } } public void update (String data) throws ApiException { Object postBody = null; // verify required params are set if(data == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables String path = "/workspace/update".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); String[] contentTypes = { "multipart/form-data"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); hasFields = true; mp.field("data", data, MediaType.MULTIPART_FORM_DATA_TYPE); if(hasFields) postBody = mp; } else { formParams.put("data", data);} try { String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return ; } else { return ; } } catch (ApiException ex) { if(ex.getCode() == 404) { return ; } else { throw ex; } } } public ClientApiWorkspaceDiff getDiff () throws ApiException { Object postBody = null; // create path and map variables String path = "/workspace/diff".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); String[] contentTypes = { "application/json"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); if(hasFields) postBody = mp; } else { } try { String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return (ClientApiWorkspaceDiff) ApiInvoker.deserialize(response, "", ClientApiWorkspaceDiff.class); } else { return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { return null; } else { throw ex; } } } public ClientApiWorkspacePublishResponse publish (String publishData) throws ApiException { Object postBody = null; // verify required params are set if(publishData == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables String path = "/workspace/publish".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); String[] contentTypes = { "multipart/form-data"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); hasFields = true; mp.field("publishData", publishData, MediaType.MULTIPART_FORM_DATA_TYPE); if(hasFields) postBody = mp; } else { formParams.put("publishData", publishData);} try { String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return (ClientApiWorkspacePublishResponse) ApiInvoker.deserialize(response, "", ClientApiWorkspacePublishResponse.class); } else { return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { return null; } else { throw ex; } } } public ClientApiWorkspaceUndoResponse undo (String undoData) throws ApiException { Object postBody = null; // verify required params are set if(undoData == null ) { throw new ApiException(400, "missing required params"); } // create path and map variables String path = "/workspace/undo".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); String[] contentTypes = { "multipart/form-data"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); hasFields = true; mp.field("undoData", undoData, MediaType.MULTIPART_FORM_DATA_TYPE); if(hasFields) postBody = mp; } else { formParams.put("undoData", undoData);} try { String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return (ClientApiWorkspaceUndoResponse) ApiInvoker.deserialize(response, "", ClientApiWorkspaceUndoResponse.class); } else { return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { return null; } else { throw ex; } } } public ClientApiWorkspaceEdges getEdges (List<String> ids) throws ApiException { Object postBody = null; // create path and map variables String path = "/workspace/edges".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); String[] contentTypes = { "multipart/form-data"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); hasFields = true; if(ids != null) { for(String id:ids) { mp.field("ids[]", id, MediaType.MULTIPART_FORM_DATA_TYPE); } } if(hasFields && !mp.getFields().isEmpty()) postBody = mp; } else { throw new java.lang.RuntimeException("invalid content type");} try { String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return (ClientApiWorkspaceEdges) ApiInvoker.deserialize(response, "", ClientApiWorkspaceEdges.class); } else { return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { return null; } else { throw ex; } } } public ClientApiWorkspaceVertices getVertices () throws ApiException { Object postBody = null; // create path and map variables String path = "/workspace/vertices".replaceAll("\\{format\\}","json"); // query params Map<String, String> queryParams = new HashMap<String, String>(); Map<String, String> headerParams = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); String[] contentTypes = { "application/json"}; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; if(contentType.startsWith("multipart/form-data")) { boolean hasFields = false; FormDataMultiPart mp = new FormDataMultiPart(); if(hasFields) postBody = mp; } else { } try { String response = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType); if(response != null){ return (ClientApiWorkspaceVertices) ApiInvoker.deserialize(response, "", ClientApiWorkspaceVertices.class); } else { return null; } } catch (ApiException ex) { if(ex.getCode() == 404) { return null; } else { throw ex; } } } }