net.leanix.mtm.api.AccountsApi 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.Account;
import net.leanix.mtm.api.models.AccountListResponse;
import net.leanix.mtm.api.models.AccountResponse;
import net.leanix.mtm.api.models.ContractListResponse;
import net.leanix.mtm.api.models.EventListResponse;
import net.leanix.mtm.api.models.InstanceListResponse;
import net.leanix.mtm.api.models.SettingListResponse;
import net.leanix.mtm.api.models.UserListResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AccountsApi {
private ApiClient apiClient;
public AccountsApi() {
this(Configuration.getDefaultApiClient());
}
public AccountsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* createAccount
* Create an account
* @param body (required)
* @return AccountResponse
* @throws ApiException if fails to make API call
*/
public AccountResponse createAccount(Account 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 createAccount");
}
// create path and map variables
String localVarPath = "/accounts";
// 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);
}
/**
* deleteAccount
* Delete an account.
* @param id Account UUID (required)
* @return AccountResponse
* @throws ApiException if fails to make API call
*/
public AccountResponse deleteAccount(String id) 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 deleteAccount");
}
// create path and map variables
String localVarPath = "/accounts/{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, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* getAccount
* Retrieves a single account
* @param id Workspace UUID (required)
* @return AccountResponse
* @throws ApiException if fails to make API call
*/
public AccountResponse getAccount(String id) 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 getAccount");
}
// create path and map variables
String localVarPath = "/accounts/{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, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* getAccounts
* Retrieves all accounts
* @param q A part of the name to search for (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 AccountListResponse
* @throws ApiException if fails to make API call
*/
public AccountListResponse getAccounts(String q, Integer page, Integer size, String sort) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/accounts";
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
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);
}
/**
* getContracts
* Retrieves all contracts for the account
* @param id (required)
* @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 ContractListResponse
* @throws ApiException if fails to make API call
*/
public ContractListResponse getContracts(String id, 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 getContracts");
}
// create path and map variables
String localVarPath = "/accounts/{id}/contracts"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
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);
}
/**
* getEvents
* Retrieves all events for an account (date must be ISO 8601 formatted)
* @param id (required)
* @param since The date offset to fetch events from (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 = "/accounts/{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);
}
/**
* getInstances
* Get all instances for this account
* @param id (required)
* @return InstanceListResponse
* @throws ApiException if fails to make API call
*/
public InstanceListResponse getInstances(String id) 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 getInstances");
}
// create path and map variables
String localVarPath = "/accounts/{id}/instances"
.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, "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 = "/accounts/{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);
}
/**
* getUsers
* Get all users for this account
* @param id (required)
* @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 id, String email, String q, 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 getUsers");
}
// create path and map variables
String localVarPath = "/accounts/{id}/users"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// 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);
}
/**
* updateAccount
* Update account info.
* @param id Account UUID (required)
* @param body Account (optional)
* @return AccountResponse
* @throws ApiException if fails to make API call
*/
public AccountResponse updateAccount(String id, Account 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 updateAccount");
}
// create path and map variables
String localVarPath = "/accounts/{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