All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.visallo.web.clientapi.codegen.WorkspaceApi Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
package org.visallo.web.clientapi.codegen;

import org.visallo.web.clientapi.codegen.ApiException;
import org.visallo.web.clientapi.ApiInvoker;

import org.visallo.web.clientapi.model.ClientApiWorkspaceUndoResponse;
import org.visallo.web.clientapi.model.ClientApiWorkspaceVertices;
import org.visallo.web.clientapi.model.ClientApiWorkspacePublishResponse;
import org.visallo.web.clientapi.model.ClientApiWorkspaceEdges;
import org.visallo.web.clientapi.model.ClientApiWorkspace;
import org.visallo.web.clientapi.model.ClientApiWorkspaces;
import org.visallo.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://visallo-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 queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

    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 queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

    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 queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

    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 queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

    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 queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

    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 queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

    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 queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

    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 ids) throws ApiException {
    Object postBody = null;
    // create path and map variables
    String path = "/workspace/edges".replaceAll("\\{format\\}","json");

    // query params
    Map queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

    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 queryParams = new HashMap();
    Map headerParams = new HashMap();
    Map formParams = new HashMap();

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





© 2015 - 2024 Weber Informatics LLC | Privacy Policy