com.dominodatalab.api.rest.GatewayApi 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.DominoNucleusGatewayUsersModelsProjectsDependencyGraph;
import com.dominodatalab.api.model.DominoServerProjectsApiProjectGatewayOverview;
import com.dominodatalab.api.model.DominoServerProjectsApiProjectGatewaySummary;
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 GatewayApi {
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 GatewayApi() {
this(new ApiClient());
}
public GatewayApi(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;
}
/**
* Retrieves a project for the Project Overview UI
*
* @param ownerName Username of the Owner (required)
* @param projectName Name of the Project (required)
* @return DominoServerProjectsApiProjectGatewayOverview
* @throws ApiException if fails to make API call
*/
public DominoServerProjectsApiProjectGatewayOverview findProjectByOwnerAndName(String ownerName, String projectName) throws ApiException {
ApiResponse localVarResponse = findProjectByOwnerAndNameWithHttpInfo(ownerName, projectName);
return localVarResponse.getData();
}
/**
* Retrieves a project for the Project Overview UI
*
* @param ownerName Username of the Owner (required)
* @param projectName Name of the Project (required)
* @return ApiResponse<DominoServerProjectsApiProjectGatewayOverview>
* @throws ApiException if fails to make API call
*/
public ApiResponse findProjectByOwnerAndNameWithHttpInfo(String ownerName, String projectName) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = findProjectByOwnerAndNameRequestBuilder(ownerName, 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("findProjectByOwnerAndName", 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 findProjectByOwnerAndNameRequestBuilder(String ownerName, String projectName) throws ApiException {
// verify the required parameter 'ownerName' is set
if (ownerName == null) {
throw new ApiException(400, "Missing the required parameter 'ownerName' when calling findProjectByOwnerAndName");
}
// verify the required parameter 'projectName' is set
if (projectName == null) {
throw new ApiException(400, "Missing the required parameter 'projectName' when calling findProjectByOwnerAndName");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/gateway/projects/findProjectByOwnerAndName";
List localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "ownerName";
localVarQueryParams.addAll(ApiClient.parameterToPairs("ownerName", ownerName));
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;
}
/**
* Retrieves projects for the Project List UI, ordered from most to least recently updated
*
* @param relationship The relationship between the current user and the projects to be returned (required)
* @param showCompleted include projects that are completed (optional, default to true)
* @return List<DominoServerProjectsApiProjectGatewaySummary>
* @throws ApiException if fails to make API call
*/
public List listProjects(String relationship, Boolean showCompleted) throws ApiException {
ApiResponse> localVarResponse = listProjectsWithHttpInfo(relationship, showCompleted);
return localVarResponse.getData();
}
/**
* Retrieves projects for the Project List UI, ordered from most to least recently updated
*
* @param relationship The relationship between the current user and the projects to be returned (required)
* @param showCompleted include projects that are completed (optional, default to true)
* @return ApiResponse<List<DominoServerProjectsApiProjectGatewaySummary>>
* @throws ApiException if fails to make API call
*/
public ApiResponse> listProjectsWithHttpInfo(String relationship, Boolean showCompleted) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = listProjectsRequestBuilder(relationship, showCompleted);
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("listProjects", 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 listProjectsRequestBuilder(String relationship, Boolean showCompleted) throws ApiException {
// verify the required parameter 'relationship' is set
if (relationship == null) {
throw new ApiException(400, "Missing the required parameter 'relationship' when calling listProjects");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/gateway/projects";
List localVarQueryParams = new ArrayList<>();
StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
String localVarQueryParameterBaseName;
localVarQueryParameterBaseName = "relationship";
localVarQueryParams.addAll(ApiClient.parameterToPairs("relationship", relationship));
localVarQueryParameterBaseName = "showCompleted";
localVarQueryParams.addAll(ApiClient.parameterToPairs("showCompleted", showCompleted));
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;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy