com.dominodatalab.api.rest.LayoutApi Maven / Gradle / Ivy
/*
* Domino Data Lab API v4
* This API is going to provide access to all the Domino functions available in the user interface. 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.DominoApiErrorResponse;
import com.dominodatalab.api.model.DominoLayoutWebCompleteWorkflowRequest;
import com.dominodatalab.api.model.DominoLayoutWebCompleteWorkflowResponse;
import com.dominodatalab.api.model.DominoLayoutWebValidateStepRequest;
import com.dominodatalab.api.model.DominoLayoutWebValidateStepResponse;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
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 = "2023-10-17T15:20:46.682098100-04:00[America/New_York]")
public class LayoutApi {
private final HttpClient memberVarHttpClient;
private final ObjectMapper memberVarObjectMapper;
private final String memberVarBaseUri;
private final Consumer memberVarInterceptor;
private final Duration memberVarReadTimeout;
private final Consumer> memberVarResponseInterceptor;
private final Consumer> memberVarAsyncResponseInterceptor;
public LayoutApi() {
this(new ApiClient());
}
public LayoutApi(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);
}
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return operationId + " call failed with: " + statusCode + " - " + body;
}
/**
* Complete a workflow
*
* @param dominoLayoutWebCompleteWorkflowRequest spec with object to validate (required)
* @return DominoLayoutWebCompleteWorkflowResponse
* @throws ApiException if fails to make API call
*/
public DominoLayoutWebCompleteWorkflowResponse completeWorkflow(DominoLayoutWebCompleteWorkflowRequest dominoLayoutWebCompleteWorkflowRequest) throws ApiException {
ApiResponse localVarResponse = completeWorkflowWithHttpInfo(dominoLayoutWebCompleteWorkflowRequest);
return localVarResponse.getData();
}
/**
* Complete a workflow
*
* @param dominoLayoutWebCompleteWorkflowRequest spec with object to validate (required)
* @return ApiResponse<DominoLayoutWebCompleteWorkflowResponse>
* @throws ApiException if fails to make API call
*/
public ApiResponse completeWorkflowWithHttpInfo(DominoLayoutWebCompleteWorkflowRequest dominoLayoutWebCompleteWorkflowRequest) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = completeWorkflowRequestBuilder(dominoLayoutWebCompleteWorkflowRequest);
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("completeWorkflow", 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);
}
}
private HttpRequest.Builder completeWorkflowRequestBuilder(DominoLayoutWebCompleteWorkflowRequest dominoLayoutWebCompleteWorkflowRequest) throws ApiException {
// verify the required parameter 'dominoLayoutWebCompleteWorkflowRequest' is set
if (dominoLayoutWebCompleteWorkflowRequest == null) {
throw new ApiException(400, "Missing the required parameter 'dominoLayoutWebCompleteWorkflowRequest' when calling completeWorkflow");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/layout/complete";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoLayoutWebCompleteWorkflowRequest);
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;
}
/**
* Validate a step in a workflow
*
* @param dominoLayoutWebValidateStepRequest spec with object to validate (required)
* @return DominoLayoutWebValidateStepResponse
* @throws ApiException if fails to make API call
*/
public DominoLayoutWebValidateStepResponse validateStep(DominoLayoutWebValidateStepRequest dominoLayoutWebValidateStepRequest) throws ApiException {
ApiResponse localVarResponse = validateStepWithHttpInfo(dominoLayoutWebValidateStepRequest);
return localVarResponse.getData();
}
/**
* Validate a step in a workflow
*
* @param dominoLayoutWebValidateStepRequest spec with object to validate (required)
* @return ApiResponse<DominoLayoutWebValidateStepResponse>
* @throws ApiException if fails to make API call
*/
public ApiResponse validateStepWithHttpInfo(DominoLayoutWebValidateStepRequest dominoLayoutWebValidateStepRequest) throws ApiException {
HttpRequest.Builder localVarRequestBuilder = validateStepRequestBuilder(dominoLayoutWebValidateStepRequest);
try {
HttpResponse localVarResponse = memberVarHttpClient.send(
localVarRequestBuilder.build(),
HttpResponse.BodyHandlers.ofInputStream());
if (memberVarResponseInterceptor != null) {
memberVarResponseInterceptor.accept(localVarResponse);
}
try {
if (localVarResponse.statusCode()/ 100 != 2) {
throw getApiException("validateStep", 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);
}
}
private HttpRequest.Builder validateStepRequestBuilder(DominoLayoutWebValidateStepRequest dominoLayoutWebValidateStepRequest) throws ApiException {
// verify the required parameter 'dominoLayoutWebValidateStepRequest' is set
if (dominoLayoutWebValidateStepRequest == null) {
throw new ApiException(400, "Missing the required parameter 'dominoLayoutWebValidateStepRequest' when calling validateStep");
}
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
String localVarPath = "/layout/validate";
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
localVarRequestBuilder.header("Content-Type", "application/json");
localVarRequestBuilder.header("Accept", "application/json");
try {
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(dominoLayoutWebValidateStepRequest);
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;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy