All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.visallo.web.clientapi.codegen.UserApi Maven / Gradle / Ivy
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.ClientApiUsers;
import org.visallo.web.clientapi.model.ClientApiUser;
import com.sun.jersey.multipart.FormDataMultiPart;
import javax.ws.rs.core.MediaType;
import java.io.File;
import java.util.*;
public class UserApi {
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 ClientApiUser getMe () throws ApiException {
Object postBody = null;
// create path and map variables
String path = "/user/me".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 (ClientApiUser) ApiInvoker.deserialize(response, "", ClientApiUser.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public ClientApiUsers getAll (String q, String workspaceId) throws ApiException {
Object postBody = null;
// create path and map variables
String path = "/user/all".replaceAll("\\{format\\}","json");
// query params
Map queryParams = new HashMap();
Map headerParams = new HashMap();
Map formParams = new HashMap();
if(!"null".equals(String.valueOf(q)))
queryParams.put("q", String.valueOf(q));
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 (ClientApiUsers) ApiInvoker.deserialize(response, "", ClientApiUsers.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public ClientApiUsers getManyByIds (List userIds) throws ApiException {
Object postBody = null;
// verify required params are set
if(userIds == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/user/all".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(userIds != null) { for(String userId:userIds) { mp.field("userIds[]", userId, 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 (ClientApiUsers) ApiInvoker.deserialize(response, "", ClientApiUsers.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
public ClientApiUser getByUserName (String username) throws ApiException {
Object postBody = null;
// verify required params are set
if(username == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String path = "/user".replaceAll("\\{format\\}","json");
// query params
Map queryParams = new HashMap();
Map headerParams = new HashMap();
Map formParams = new HashMap();
if(!"null".equals(String.valueOf(username)))
queryParams.put("user-name", String.valueOf(username));
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 (ClientApiUser) ApiInvoker.deserialize(response, "", ClientApiUser.class);
}
else {
return null;
}
} catch (ApiException ex) {
if(ex.getCode() == 404) {
return null;
}
else {
throw ex;
}
}
}
}