net.leanix.mtm.api.UsersApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leanix-mtm-sdk-java Show documentation
Show all versions of leanix-mtm-sdk-java Show documentation
SDK for Java to access leanIX MTM REST API
package net.leanix.mtm.api;
import net.leanix.dropkit.apiclient.ApiException;
import net.leanix.dropkit.apiclient.ApiClient;
import net.leanix.dropkit.apiclient.Configuration;
import net.leanix.dropkit.apiclient.Pair;
import javax.ws.rs.core.GenericType;
import net.leanix.mtm.api.models.BasicResponse;
import net.leanix.mtm.api.models.EventListResponse;
import net.leanix.mtm.api.models.ParameterForPushNotificationToken;
import net.leanix.mtm.api.models.PasswordChangeRequest;
import net.leanix.mtm.api.models.PermissionListResponse;
import net.leanix.mtm.api.models.SettingListResponse;
import net.leanix.mtm.api.models.User;
import net.leanix.mtm.api.models.UserListResponse;
import net.leanix.mtm.api.models.UserResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class UsersApi {
private ApiClient apiClient;
public UsersApi() {
this(Configuration.getDefaultApiClient());
}
public UsersApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* createPushNotificationToken
* Creates a push notification token for a user
* @param userId User UUID (required)
* @param body Push Notification Token (required)
* @return BasicResponse
* @throws ApiException if fails to make API call
*/
public BasicResponse createPushNotificationToken(String userId, ParameterForPushNotificationToken body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException(400, "Missing the required parameter 'userId' when calling createPushNotificationToken");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createPushNotificationToken");
}
// create path and map variables
String localVarPath = "/users/{userId}/tokens"
.replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* createUser
* Create a user
* @param body (required)
* @return UserResponse
* @throws ApiException if fails to make API call
*/
public UserResponse createUser(User body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createUser");
}
// create path and map variables
String localVarPath = "/users";
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* deletePushNotificationToken
* Deletes a push notification token for a user
* @param userId User UUID (required)
* @param token Token (required)
* @return BasicResponse
* @throws ApiException if fails to make API call
*/
public BasicResponse deletePushNotificationToken(String userId, String token) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException(400, "Missing the required parameter 'userId' when calling deletePushNotificationToken");
}
// verify the required parameter 'token' is set
if (token == null) {
throw new ApiException(400, "Missing the required parameter 'token' when calling deletePushNotificationToken");
}
// create path and map variables
String localVarPath = "/users/{userId}/tokens/{token}"
.replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId.toString()))
.replaceAll("\\{" + "token" + "\\}", apiClient.escapeString(token.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* getEvents
* Retrieves all events for an user (date must be ISO 8601 formatted)
* @param id User UUID (required)
* @param since (optional)
* @param page The page number to access (1 indexed, defaults to 1) (optional, default to 1)
* @param size The page size requested (defaults to 100, max 100) (optional, default to 100)
* @param sort Comma-separated list of sorting (optional) (optional)
* @return EventListResponse
* @throws ApiException if fails to make API call
*/
public EventListResponse getEvents(String id, String since, Integer page, Integer size, String sort) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getEvents");
}
// create path and map variables
String localVarPath = "/users/{id}/events"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "since", since));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "size", size));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* getPermissions
* Endpoint to list the user permissions.
* @param id User UUID (required)
* @param includePotentialPermissions Include potential permissions, i.e. permissions that do not exist yet but would be created on first login attempt. (optional) (optional, default to false)
* @param q Query string to search in workspace and role (optional)
* @param sort Comma-separated list of sorting (optional) (optional)
* @return PermissionListResponse
* @throws ApiException if fails to make API call
*/
public PermissionListResponse getPermissions(String id, Boolean includePotentialPermissions, String q, String sort) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getPermissions");
}
// create path and map variables
String localVarPath = "/users/{id}/permissions"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "includePotentialPermissions", includePotentialPermissions));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "q", q));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* getSettings
* Endpoint to list the user specific settings.
* @param id User UUID (required)
* @param type Setting type (optional)
* @return SettingListResponse
* @throws ApiException if fails to make API call
*/
public SettingListResponse getSettings(String id, String type) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getSettings");
}
// create path and map variables
String localVarPath = "/users/{id}/settings"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "type", type));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* getUser
* Returns user data.
* @param id User UUID (required)
* @param returnSinglePermission If true returns only the permission for the workspace of the auth user (optional)
* @return UserResponse
* @throws ApiException if fails to make API call
*/
public UserResponse getUser(String id, Boolean returnSinglePermission) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling getUser");
}
// create path and map variables
String localVarPath = "/users/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "returnSinglePermission", returnSinglePermission));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* User
* List or search all users.
* @param email Search by email address (optional) (optional)
* @param q Search in user name or name (optional) (optional)
* @param page The page number to access (1 indexed, defaults to 1) (optional, default to 1)
* @param size The page size requested (defaults to 30, max 100) (optional, default to 30)
* @param sort Comma-separated list of sorting (optional) (optional)
* @return UserListResponse
* @throws ApiException if fails to make API call
*/
public UserListResponse getUsers(String email, String q, Integer page, Integer size, String sort) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/users";
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "email", email));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "q", q));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "size", size));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Reset Password
* Endpoint to finish the reset the password process, can only be accessed by systems.
* @param id User UUID (required)
* @param body (required)
* @return UserResponse
* @throws ApiException if fails to make API call
*/
public UserResponse setPassword(String id, PasswordChangeRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling setPassword");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling setPassword");
}
// create path and map variables
String localVarPath = "/users/{id}/passwords"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* updateUser
* Update a user
* @param id User UUID (required)
* @param body (required)
* @return UserResponse
* @throws ApiException if fails to make API call
*/
public UserResponse updateUser(String id, User body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling updateUser");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser");
}
// create path and map variables
String localVarPath = "/users/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "token" };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy