com.dominodatalab.api.rest.UsersApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of domino-java-client Show documentation
Show all versions of domino-java-client Show documentation
Domino Data Lab API Client to connect to Domino web services using Java HTTP Client.
/*
* Domino Data Lab API v4
* This API provides access to select Domino functions available in Domino's non-public API. To authenticate your requests, include your API Key (which you can find on your account page) with the header X-Domino-Api-Key.
*
* The version of the OpenAPI document: 4.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.dominodatalab.api.rest;
import com.dominodatalab.api.invoker.ApiClient;
import com.dominodatalab.api.invoker.ApiException;
import com.dominodatalab.api.invoker.ApiResponse;
import com.dominodatalab.api.invoker.Pair;
import com.dominodatalab.api.model.DominoCommonModelsEnvironmentVariables;
import com.dominodatalab.api.model.DominoCommonUserCreateUserRequest;
import com.dominodatalab.api.model.DominoCommonUserPerson;
import com.dominodatalab.api.model.DominoNucleusGatewayUsersModelsProjectsDependencyGraph;
import com.dominodatalab.api.model.Error;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.http.HttpRequest;
import java.nio.channels.Channels;
import java.nio.channels.Pipe;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.ArrayList;
import java.util.StringJoiner;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-04T16:37:26.309454-04:00[America/New_York]", comments = "Generator version: 7.8.0")
public class UsersApi {
protected final HttpClient memberVarHttpClient;
protected final ObjectMapper memberVarObjectMapper;
protected final String memberVarBaseUri;
protected final Consumer memberVarInterceptor;
protected final Duration memberVarReadTimeout;
protected final Consumer> memberVarResponseInterceptor;
protected final Consumer> memberVarAsyncResponseInterceptor;
public UsersApi() {
this(new ApiClient());
}
public UsersApi(ApiClient apiClient) {
memberVarHttpClient = apiClient.getHttpClient();
memberVarObjectMapper = apiClient.getObjectMapper();
memberVarBaseUri = apiClient.getBaseUri();
memberVarInterceptor = apiClient.getRequestInterceptor();
memberVarReadTimeout = apiClient.getReadTimeout();
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
}
protected ApiException getApiException(String operationId, HttpResponse response) throws IOException {
String body = response.body() == null ? null : new String(response.body().readAllBytes());
String message = formatExceptionMessage(operationId, response.statusCode(), body);
return new ApiException(response.statusCode(), message, response.headers(), body);
}
protected String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**
* Create a new user
*
* @param dominoCommonUserCreateUserRequest Create user request (required)
* @throws ApiException if fails to make API call
*/
public void createUser(DominoCommonUserCreateUserRequest dominoCommonUserCreateUserRequest) throws ApiException {
createUserWithHttpInfo(dominoCommonUserCreateUserRequest);
}
/**
* Create a new user
*
* @param dominoCommonUserCreateUserRequest Create user request (required)
* @return ApiResponse<Void>
* @throws ApiException if fails to make API call
*/
public ApiResponse createUserWithHttpInfo(DominoCommonUserCreateUserRequest dominoCommonUserCreateUserRequest) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = createUserRequestBuilder(dominoCommonUserCreateUserRequest);
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("createUser", localVarResponse);
}
return new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
null
);
} finally {
// Drain the InputStream
while (localVarResponse.body().read() != -1) {
// Ignore
}
localVarResponse.body().close();
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
protected HttpRequest.Builder createUserRequestBuilder(DominoCommonUserCreateUserRequest dominoCommonUserCreateUserRequest) throws ApiException {
// verify the required parameter 'dominoCommonUserCreateUserRequest' is set
if (dominoCommonUserCreateUserRequest == null) {
throw new ApiException(400, "Missing the required parameter 'dominoCommonUserCreateUserRequest' when calling createUser");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/users";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoCommonUserCreateUserRequest);
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* deletes all of the specified user's environment variables
*
* @return DominoCommonModelsEnvironmentVariables
* @throws ApiException if fails to make API call
*/
public DominoCommonModelsEnvironmentVariables deleteUserEnvironmentVariables() throws ApiException {
ApiResponse localVarResponse = deleteUserEnvironmentVariablesWithHttpInfo();
return localVarResponse.getData();
}
/**
* deletes all of the specified user's environment variables
*
* @return ApiResponse<DominoCommonModelsEnvironmentVariables>
* @throws ApiException if fails to make API call
*/
public ApiResponse deleteUserEnvironmentVariablesWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = deleteUserEnvironmentVariablesRequestBuilder();
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("deleteUserEnvironmentVariables", localVarResponse);
}
return new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
protected HttpRequest.Builder deleteUserEnvironmentVariablesRequestBuilder() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/users/environmentVariables";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("DELETE", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* retrieves the current user
*
* @return DominoCommonUserPerson
* @throws ApiException if fails to make API call
*/
public DominoCommonUserPerson getCurrentUser() throws ApiException {
ApiResponse localVarResponse = getCurrentUserWithHttpInfo();
return localVarResponse.getData();
}
/**
* retrieves the current user
*
* @return ApiResponse<DominoCommonUserPerson>
* @throws ApiException if fails to make API call
*/
public ApiResponse getCurrentUserWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = getCurrentUserRequestBuilder();
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("getCurrentUser", localVarResponse);
}
return new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
protected HttpRequest.Builder getCurrentUserRequestBuilder() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/users/self";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* retrieves the specified user's environment variables
*
* @return DominoCommonModelsEnvironmentVariables
* @throws ApiException if fails to make API call
*/
public DominoCommonModelsEnvironmentVariables listUserEnvironmentVariables() throws ApiException {
ApiResponse localVarResponse = listUserEnvironmentVariablesWithHttpInfo();
return localVarResponse.getData();
}
/**
* retrieves the specified user's environment variables
*
* @return ApiResponse<DominoCommonModelsEnvironmentVariables>
* @throws ApiException if fails to make API call
*/
public ApiResponse listUserEnvironmentVariablesWithHttpInfo() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = listUserEnvironmentVariablesRequestBuilder();
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("listUserEnvironmentVariables", localVarResponse);
}
return new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
protected HttpRequest.Builder listUserEnvironmentVariablesRequestBuilder() throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/users/environmentVariables";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* retrieves a list of users
*
* @param userId Optional list of user identifiers to select the previously known users (optional
* @param userName Optional filter for an exact user name (optional)
* @param query Optional filter for a user name (returns usernames starting with this query) (optional)
* @param listOnlyUsers (optional)
* @return List<DominoCommonUserPerson>
* @throws ApiException if fails to make API call
*/
public List listUsers(List userId, String userName, String query, Boolean listOnlyUsers) throws ApiException {
ApiResponse> localVarResponse = listUsersWithHttpInfo(userId, userName, query, listOnlyUsers);
return localVarResponse.getData();
}
/**
* retrieves a list of users
*
* @param userId Optional list of user identifiers to select the previously known users (optional
* @param userName Optional filter for an exact user name (optional)
* @param query Optional filter for a user name (returns usernames starting with this query) (optional)
* @param listOnlyUsers (optional)
* @return ApiResponse<List<DominoCommonUserPerson>>
* @throws ApiException if fails to make API call
*/
public ApiResponse> listUsersWithHttpInfo(List userId, String userName, String query, Boolean listOnlyUsers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = listUsersRequestBuilder(userId, userName, query, listOnlyUsers);
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("listUsers", localVarResponse);
}
return new ApiResponse>(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference>() {}) // closes the InputStream
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
protected HttpRequest.Builder listUsersRequestBuilder(List userId, String userName, String query, Boolean listOnlyUsers) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/users";
List localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "userId";
localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "userId", userId));
localVarQueryParameterBaseName = "userName";
localVarQueryParams.addAll(ApiClient.parameterToPairs("userName", userName));
localVarQueryParameterBaseName = "query";
localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query));
localVarQueryParameterBaseName = "listOnlyUsers";
localVarQueryParams.addAll(ApiClient.parameterToPairs("listOnlyUsers", listOnlyUsers));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* Retrieves projects dependency graph for a user, and optionally for a specific project
*
* @param ownerUsername Owner username of the project, if dependency graph is being requested for a specific project. (optional)
* @param projectName Project name for which a dependency graph is being requested. When not provided, the dependency graph is for all projects for the current user. (optional)
* @return DominoNucleusGatewayUsersModelsProjectsDependencyGraph
* @throws ApiException if fails to make API call
*/
public DominoNucleusGatewayUsersModelsProjectsDependencyGraph projectsDependencyGraph(String ownerUsername, String projectName) throws ApiException {
ApiResponse localVarResponse = projectsDependencyGraphWithHttpInfo(ownerUsername, projectName);
return localVarResponse.getData();
}
/**
* Retrieves projects dependency graph for a user, and optionally for a specific project
*
* @param ownerUsername Owner username of the project, if dependency graph is being requested for a specific project. (optional)
* @param projectName Project name for which a dependency graph is being requested. When not provided, the dependency graph is for all projects for the current user. (optional)
* @return ApiResponse<DominoNucleusGatewayUsersModelsProjectsDependencyGraph>
* @throws ApiException if fails to make API call
*/
public ApiResponse projectsDependencyGraphWithHttpInfo(String ownerUsername, String projectName) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = projectsDependencyGraphRequestBuilder(ownerUsername, projectName);
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("projectsDependencyGraph", localVarResponse);
}
return new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
protected HttpRequest.Builder projectsDependencyGraphRequestBuilder(String ownerUsername, String projectName) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/gateway/users/projectsDependencyGraph";
List localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "ownerUsername";
localVarQueryParams.addAll(ApiClient.parameterToPairs("ownerUsername", ownerUsername));
localVarQueryParameterBaseName = "projectName";
localVarQueryParams.addAll(ApiClient.parameterToPairs("projectName", projectName));
if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) {
StringJoiner queryJoiner = new StringJoiner("&");
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
if (localVarQueryStringJoiner.length() != 0) {
queryJoiner.add(localVarQueryStringJoiner.toString());
}
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
} else {
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
}
localVarRequestBuilder.header("Accept", "application/json");
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
/**
* set the specified user's environment variables
*
* @param requestBody The user environment variables (required)
* @return DominoCommonModelsEnvironmentVariables
* @throws ApiException if fails to make API call
*/
public DominoCommonModelsEnvironmentVariables setUserEnvironmentVariables(Map requestBody) throws ApiException {
ApiResponse localVarResponse = setUserEnvironmentVariablesWithHttpInfo(requestBody);
return localVarResponse.getData();
}
/**
* set the specified user's environment variables
*
* @param requestBody The user environment variables (required)
* @return ApiResponse<DominoCommonModelsEnvironmentVariables>
* @throws ApiException if fails to make API call
*/
public ApiResponse setUserEnvironmentVariablesWithHttpInfo(Map requestBody) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = setUserEnvironmentVariablesRequestBuilder(requestBody);
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("setUserEnvironmentVariables", localVarResponse);
}
return new ApiResponse(
localVarResponse.statusCode(),
localVarResponse.headers().map(),
localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream
);
} finally {
}
} catch (IOException e) {
throw new ApiException(e);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
}
protected HttpRequest.Builder setUserEnvironmentVariablesRequestBuilder(Map requestBody) throws ApiException {
// verify the required parameter 'requestBody' is set
if (requestBody == null) {
throw new ApiException(400, "Missing the required parameter 'requestBody' when calling setUserEnvironmentVariables");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/users/environmentVariables";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(requestBody);
localVarRequestBuilder.method("PUT", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
} catch (IOException e) {
throw new ApiException(e);
}
if (memberVarReadTimeout != null) {
localVarRequestBuilder.timeout(memberVarReadTimeout);
}
if (memberVarInterceptor != null) {
memberVarInterceptor.accept(localVarRequestBuilder);
}
return localVarRequestBuilder;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy