index
int64 | repo_id
string | file_path
string | content
string |
|---|---|---|---|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processor
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processor/types/ProcessorCreateResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processor.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.Processor;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorCreateResponse.Builder.class)
public final class ProcessorCreateResponse {
private final boolean success;
private final Processor processor;
private final Map<String, Object> additionalProperties;
private ProcessorCreateResponse(boolean success, Processor processor, Map<String, Object> additionalProperties) {
this.success = success;
this.processor = processor;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("processor")
public Processor getProcessor() {
return processor;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorCreateResponse && equalTo((ProcessorCreateResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorCreateResponse other) {
return success == other.success && processor.equals(other.processor);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.processor);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
ProcessorStage success(boolean success);
Builder from(ProcessorCreateResponse other);
}
public interface ProcessorStage {
_FinalStage processor(@NotNull Processor processor);
}
public interface _FinalStage {
ProcessorCreateResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, ProcessorStage, _FinalStage {
private boolean success;
private Processor processor;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorCreateResponse other) {
success(other.getSuccess());
processor(other.getProcessor());
return this;
}
@java.lang.Override
@JsonSetter("success")
public ProcessorStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("processor")
public _FinalStage processor(@NotNull Processor processor) {
this.processor = Objects.requireNonNull(processor, "processor must not be null");
return this;
}
@java.lang.Override
public ProcessorCreateResponse build() {
return new ProcessorCreateResponse(success, processor, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processor
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processor/types/ProcessorUpdateRequestConfig.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processor.types;
import ai.extend.types.ClassificationConfig;
import ai.extend.types.ExtractionConfig;
import ai.extend.types.SplitterConfig;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Objects;
import java.util.Optional;
public final class ProcessorUpdateRequestConfig {
private final Value value;
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
private ProcessorUpdateRequestConfig(Value value) {
this.value = value;
}
public <T> T visit(Visitor<T> visitor) {
return value.visit(visitor);
}
public static ProcessorUpdateRequestConfig classify(ClassificationConfig value) {
return new ProcessorUpdateRequestConfig(new ClassifyValue(value));
}
public static ProcessorUpdateRequestConfig extract(ExtractionConfig value) {
return new ProcessorUpdateRequestConfig(new ExtractValue(value));
}
public static ProcessorUpdateRequestConfig splitter(SplitterConfig value) {
return new ProcessorUpdateRequestConfig(new SplitterValue(value));
}
public boolean isClassify() {
return value instanceof ClassifyValue;
}
public boolean isExtract() {
return value instanceof ExtractValue;
}
public boolean isSplitter() {
return value instanceof SplitterValue;
}
public boolean _isUnknown() {
return value instanceof _UnknownValue;
}
public Optional<ClassificationConfig> getClassify() {
if (isClassify()) {
return Optional.of(((ClassifyValue) value).value);
}
return Optional.empty();
}
public Optional<ExtractionConfig> getExtract() {
if (isExtract()) {
return Optional.of(((ExtractValue) value).value);
}
return Optional.empty();
}
public Optional<SplitterConfig> getSplitter() {
if (isSplitter()) {
return Optional.of(((SplitterValue) value).value);
}
return Optional.empty();
}
public Optional<Object> _getUnknown() {
if (_isUnknown()) {
return Optional.of(((_UnknownValue) value).value);
}
return Optional.empty();
}
@JsonValue
private Value getValue() {
return this.value;
}
public interface Visitor<T> {
T visitClassify(ClassificationConfig classify);
T visitExtract(ExtractionConfig extract);
T visitSplitter(SplitterConfig splitter);
T _visitUnknown(Object unknownType);
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class)
@JsonSubTypes({
@JsonSubTypes.Type(ClassifyValue.class),
@JsonSubTypes.Type(ExtractValue.class),
@JsonSubTypes.Type(SplitterValue.class)
})
@JsonIgnoreProperties(ignoreUnknown = true)
private interface Value {
<T> T visit(Visitor<T> visitor);
}
@JsonTypeName("CLASSIFY")
@JsonIgnoreProperties("type")
private static final class ClassifyValue implements Value {
@JsonUnwrapped
private ClassificationConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private ClassifyValue() {}
private ClassifyValue(ClassificationConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitClassify(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ClassifyValue && equalTo((ClassifyValue) other);
}
private boolean equalTo(ClassifyValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorUpdateRequestConfig{" + "value: " + value + "}";
}
}
@JsonTypeName("EXTRACT")
@JsonIgnoreProperties("type")
private static final class ExtractValue implements Value {
@JsonUnwrapped
private ExtractionConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private ExtractValue() {}
private ExtractValue(ExtractionConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitExtract(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractValue && equalTo((ExtractValue) other);
}
private boolean equalTo(ExtractValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorUpdateRequestConfig{" + "value: " + value + "}";
}
}
@JsonTypeName("SPLITTER")
@JsonIgnoreProperties("type")
private static final class SplitterValue implements Value {
@JsonUnwrapped
private SplitterConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private SplitterValue() {}
private SplitterValue(SplitterConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitSplitter(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof SplitterValue && equalTo((SplitterValue) other);
}
private boolean equalTo(SplitterValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorUpdateRequestConfig{" + "value: " + value + "}";
}
}
@JsonIgnoreProperties("type")
private static final class _UnknownValue implements Value {
private String type;
@JsonValue
private Object value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private _UnknownValue(@JsonProperty("value") Object value) {}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor._visitUnknown(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof _UnknownValue && equalTo((_UnknownValue) other);
}
private boolean equalTo(_UnknownValue other) {
return type.equals(other.type) && value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.type, this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorUpdateRequestConfig{" + "type: " + type + ", value: " + value + "}";
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processor
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processor/types/ProcessorUpdateResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processor.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.Processor;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorUpdateResponse.Builder.class)
public final class ProcessorUpdateResponse {
private final boolean success;
private final Processor processor;
private final Map<String, Object> additionalProperties;
private ProcessorUpdateResponse(boolean success, Processor processor, Map<String, Object> additionalProperties) {
this.success = success;
this.processor = processor;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("processor")
public Processor getProcessor() {
return processor;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorUpdateResponse && equalTo((ProcessorUpdateResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorUpdateResponse other) {
return success == other.success && processor.equals(other.processor);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.processor);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
ProcessorStage success(boolean success);
Builder from(ProcessorUpdateResponse other);
}
public interface ProcessorStage {
_FinalStage processor(@NotNull Processor processor);
}
public interface _FinalStage {
ProcessorUpdateResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, ProcessorStage, _FinalStage {
private boolean success;
private Processor processor;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorUpdateResponse other) {
success(other.getSuccess());
processor(other.getProcessor());
return this;
}
@java.lang.Override
@JsonSetter("success")
public ProcessorStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("processor")
public _FinalStage processor(@NotNull Processor processor) {
this.processor = Objects.requireNonNull(processor, "processor must not be null");
return this;
}
@java.lang.Override
public ProcessorUpdateResponse build() {
return new ProcessorUpdateResponse(success, processor, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/AsyncProcessorRunClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.processorrun.requests.ProcessorRunCreateRequest;
import ai.extend.resources.processorrun.types.ProcessorRunCancelResponse;
import ai.extend.resources.processorrun.types.ProcessorRunCreateResponse;
import ai.extend.resources.processorrun.types.ProcessorRunDeleteResponse;
import ai.extend.resources.processorrun.types.ProcessorRunGetResponse;
import java.util.concurrent.CompletableFuture;
public class AsyncProcessorRunClient {
protected final ClientOptions clientOptions;
private final AsyncRawProcessorRunClient rawClient;
public AsyncProcessorRunClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawProcessorRunClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawProcessorRunClient withRawResponse() {
return this.rawClient;
}
/**
* Run processors (extraction, classification, splitting, etc.) on a given document.
* <p><strong>Synchronous vs Asynchronous Processing:</strong></p>
* <ul>
* <li><strong>Asynchronous (default)</strong>: Returns immediately with <code>PROCESSING</code> status. Use webhooks or polling to get results.</li>
* <li><strong>Synchronous</strong>: Set <code>sync: true</code> to wait for completion and get final results in the response (5-minute timeout).</li>
* </ul>
* <p><strong>For asynchronous processing:</strong></p>
* <ul>
* <li>You can <a href="https://docs.extend.ai/2025-04-21/developers/webhooks/configuration">configure webhooks</a> to receive notifications when a processor run is complete or failed.</li>
* <li>Or you can <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/get-processor-run">poll the get endpoint</a> for updates on the status of the processor run.</li>
* </ul>
*/
public CompletableFuture<ProcessorRunCreateResponse> create(ProcessorRunCreateRequest request) {
return this.rawClient.create(request).thenApply(response -> response.body());
}
/**
* Run processors (extraction, classification, splitting, etc.) on a given document.
* <p><strong>Synchronous vs Asynchronous Processing:</strong></p>
* <ul>
* <li><strong>Asynchronous (default)</strong>: Returns immediately with <code>PROCESSING</code> status. Use webhooks or polling to get results.</li>
* <li><strong>Synchronous</strong>: Set <code>sync: true</code> to wait for completion and get final results in the response (5-minute timeout).</li>
* </ul>
* <p><strong>For asynchronous processing:</strong></p>
* <ul>
* <li>You can <a href="https://docs.extend.ai/2025-04-21/developers/webhooks/configuration">configure webhooks</a> to receive notifications when a processor run is complete or failed.</li>
* <li>Or you can <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/get-processor-run">poll the get endpoint</a> for updates on the status of the processor run.</li>
* </ul>
*/
public CompletableFuture<ProcessorRunCreateResponse> create(
ProcessorRunCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(request, requestOptions).thenApply(response -> response.body());
}
/**
* Retrieve details about a specific processor run, including its status, outputs, and any edits made during review.
* <p>A common use case for this endpoint is to poll for the status and final output of an async processor run when using the <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/run-processor">Run Processor</a> endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.</p>
*/
public CompletableFuture<ProcessorRunGetResponse> get(String id) {
return this.rawClient.get(id).thenApply(response -> response.body());
}
/**
* Retrieve details about a specific processor run, including its status, outputs, and any edits made during review.
* <p>A common use case for this endpoint is to poll for the status and final output of an async processor run when using the <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/run-processor">Run Processor</a> endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.</p>
*/
public CompletableFuture<ProcessorRunGetResponse> get(String id, RequestOptions requestOptions) {
return this.rawClient.get(id, requestOptions).thenApply(response -> response.body());
}
/**
* Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public CompletableFuture<ProcessorRunDeleteResponse> delete(String id) {
return this.rawClient.delete(id).thenApply(response -> response.body());
}
/**
* Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public CompletableFuture<ProcessorRunDeleteResponse> delete(String id, RequestOptions requestOptions) {
return this.rawClient.delete(id, requestOptions).thenApply(response -> response.body());
}
/**
* Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress.
* <p>Note: Only processor runs with a status of <code>"PROCESSING"</code> can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.</p>
*/
public CompletableFuture<ProcessorRunCancelResponse> cancel(String id) {
return this.rawClient.cancel(id).thenApply(response -> response.body());
}
/**
* Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress.
* <p>Note: Only processor runs with a status of <code>"PROCESSING"</code> can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.</p>
*/
public CompletableFuture<ProcessorRunCancelResponse> cancel(String id, RequestOptions requestOptions) {
return this.rawClient.cancel(id, requestOptions).thenApply(response -> response.body());
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/AsyncRawProcessorRunClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.InternalServerError;
import ai.extend.errors.NotFoundError;
import ai.extend.errors.TooManyRequestsError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.processorrun.requests.ProcessorRunCreateRequest;
import ai.extend.resources.processorrun.types.ProcessorRunCancelResponse;
import ai.extend.resources.processorrun.types.ProcessorRunCreateResponse;
import ai.extend.resources.processorrun.types.ProcessorRunDeleteResponse;
import ai.extend.resources.processorrun.types.ProcessorRunGetResponse;
import ai.extend.types.Error;
import ai.extend.types.ExtendError;
import ai.extend.types.TooManyRequestsErrorBody;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;
public class AsyncRawProcessorRunClient {
protected final ClientOptions clientOptions;
public AsyncRawProcessorRunClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* Run processors (extraction, classification, splitting, etc.) on a given document.
* <p><strong>Synchronous vs Asynchronous Processing:</strong></p>
* <ul>
* <li><strong>Asynchronous (default)</strong>: Returns immediately with <code>PROCESSING</code> status. Use webhooks or polling to get results.</li>
* <li><strong>Synchronous</strong>: Set <code>sync: true</code> to wait for completion and get final results in the response (5-minute timeout).</li>
* </ul>
* <p><strong>For asynchronous processing:</strong></p>
* <ul>
* <li>You can <a href="https://docs.extend.ai/2025-04-21/developers/webhooks/configuration">configure webhooks</a> to receive notifications when a processor run is complete or failed.</li>
* <li>Or you can <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/get-processor-run">poll the get endpoint</a> for updates on the status of the processor run.</li>
* </ul>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorRunCreateResponse>> create(
ProcessorRunCreateRequest request) {
return create(request, null);
}
/**
* Run processors (extraction, classification, splitting, etc.) on a given document.
* <p><strong>Synchronous vs Asynchronous Processing:</strong></p>
* <ul>
* <li><strong>Asynchronous (default)</strong>: Returns immediately with <code>PROCESSING</code> status. Use webhooks or polling to get results.</li>
* <li><strong>Synchronous</strong>: Set <code>sync: true</code> to wait for completion and get final results in the response (5-minute timeout).</li>
* </ul>
* <p><strong>For asynchronous processing:</strong></p>
* <ul>
* <li>You can <a href="https://docs.extend.ai/2025-04-21/developers/webhooks/configuration">configure webhooks</a> to receive notifications when a processor run is complete or failed.</li>
* <li>Or you can <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/get-processor-run">poll the get endpoint</a> for updates on the status of the processor run.</li>
* </ul>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorRunCreateResponse>> create(
ProcessorRunCreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processor_runs")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<ProcessorRunCreateResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), ProcessorRunCreateResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 429:
future.completeExceptionally(new TooManyRequestsError(
ObjectMappers.JSON_MAPPER.readValue(
responseBodyString, TooManyRequestsErrorBody.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* Retrieve details about a specific processor run, including its status, outputs, and any edits made during review.
* <p>A common use case for this endpoint is to poll for the status and final output of an async processor run when using the <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/run-processor">Run Processor</a> endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorRunGetResponse>> get(String id) {
return get(id, null);
}
/**
* Retrieve details about a specific processor run, including its status, outputs, and any edits made during review.
* <p>A common use case for this endpoint is to poll for the status and final output of an async processor run when using the <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/run-processor">Run Processor</a> endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorRunGetResponse>> get(
String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processor_runs")
.addPathSegment(id)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<ProcessorRunGetResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), ProcessorRunGetResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorRunDeleteResponse>> delete(String id) {
return delete(id, null);
}
/**
* Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorRunDeleteResponse>> delete(
String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processor_runs")
.addPathSegment(id)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<ProcessorRunDeleteResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), ProcessorRunDeleteResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 500:
future.completeExceptionally(new InternalServerError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtendError.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress.
* <p>Note: Only processor runs with a status of <code>"PROCESSING"</code> can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorRunCancelResponse>> cancel(String id) {
return cancel(id, null);
}
/**
* Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress.
* <p>Note: Only processor runs with a status of <code>"PROCESSING"</code> can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorRunCancelResponse>> cancel(
String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processor_runs")
.addPathSegment(id)
.addPathSegments("cancel")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", RequestBody.create("", null))
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<ProcessorRunCancelResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), ProcessorRunCancelResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/ProcessorRunClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.processorrun.requests.ProcessorRunCreateRequest;
import ai.extend.resources.processorrun.types.ProcessorRunCancelResponse;
import ai.extend.resources.processorrun.types.ProcessorRunCreateResponse;
import ai.extend.resources.processorrun.types.ProcessorRunDeleteResponse;
import ai.extend.resources.processorrun.types.ProcessorRunGetResponse;
public class ProcessorRunClient {
protected final ClientOptions clientOptions;
private final RawProcessorRunClient rawClient;
public ProcessorRunClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawProcessorRunClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public RawProcessorRunClient withRawResponse() {
return this.rawClient;
}
/**
* Run processors (extraction, classification, splitting, etc.) on a given document.
* <p><strong>Synchronous vs Asynchronous Processing:</strong></p>
* <ul>
* <li><strong>Asynchronous (default)</strong>: Returns immediately with <code>PROCESSING</code> status. Use webhooks or polling to get results.</li>
* <li><strong>Synchronous</strong>: Set <code>sync: true</code> to wait for completion and get final results in the response (5-minute timeout).</li>
* </ul>
* <p><strong>For asynchronous processing:</strong></p>
* <ul>
* <li>You can <a href="https://docs.extend.ai/2025-04-21/developers/webhooks/configuration">configure webhooks</a> to receive notifications when a processor run is complete or failed.</li>
* <li>Or you can <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/get-processor-run">poll the get endpoint</a> for updates on the status of the processor run.</li>
* </ul>
*/
public ProcessorRunCreateResponse create(ProcessorRunCreateRequest request) {
return this.rawClient.create(request).body();
}
/**
* Run processors (extraction, classification, splitting, etc.) on a given document.
* <p><strong>Synchronous vs Asynchronous Processing:</strong></p>
* <ul>
* <li><strong>Asynchronous (default)</strong>: Returns immediately with <code>PROCESSING</code> status. Use webhooks or polling to get results.</li>
* <li><strong>Synchronous</strong>: Set <code>sync: true</code> to wait for completion and get final results in the response (5-minute timeout).</li>
* </ul>
* <p><strong>For asynchronous processing:</strong></p>
* <ul>
* <li>You can <a href="https://docs.extend.ai/2025-04-21/developers/webhooks/configuration">configure webhooks</a> to receive notifications when a processor run is complete or failed.</li>
* <li>Or you can <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/get-processor-run">poll the get endpoint</a> for updates on the status of the processor run.</li>
* </ul>
*/
public ProcessorRunCreateResponse create(ProcessorRunCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(request, requestOptions).body();
}
/**
* Retrieve details about a specific processor run, including its status, outputs, and any edits made during review.
* <p>A common use case for this endpoint is to poll for the status and final output of an async processor run when using the <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/run-processor">Run Processor</a> endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.</p>
*/
public ProcessorRunGetResponse get(String id) {
return this.rawClient.get(id).body();
}
/**
* Retrieve details about a specific processor run, including its status, outputs, and any edits made during review.
* <p>A common use case for this endpoint is to poll for the status and final output of an async processor run when using the <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/run-processor">Run Processor</a> endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.</p>
*/
public ProcessorRunGetResponse get(String id, RequestOptions requestOptions) {
return this.rawClient.get(id, requestOptions).body();
}
/**
* Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public ProcessorRunDeleteResponse delete(String id) {
return this.rawClient.delete(id).body();
}
/**
* Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public ProcessorRunDeleteResponse delete(String id, RequestOptions requestOptions) {
return this.rawClient.delete(id, requestOptions).body();
}
/**
* Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress.
* <p>Note: Only processor runs with a status of <code>"PROCESSING"</code> can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.</p>
*/
public ProcessorRunCancelResponse cancel(String id) {
return this.rawClient.cancel(id).body();
}
/**
* Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress.
* <p>Note: Only processor runs with a status of <code>"PROCESSING"</code> can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.</p>
*/
public ProcessorRunCancelResponse cancel(String id, RequestOptions requestOptions) {
return this.rawClient.cancel(id, requestOptions).body();
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/RawProcessorRunClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.InternalServerError;
import ai.extend.errors.NotFoundError;
import ai.extend.errors.TooManyRequestsError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.processorrun.requests.ProcessorRunCreateRequest;
import ai.extend.resources.processorrun.types.ProcessorRunCancelResponse;
import ai.extend.resources.processorrun.types.ProcessorRunCreateResponse;
import ai.extend.resources.processorrun.types.ProcessorRunDeleteResponse;
import ai.extend.resources.processorrun.types.ProcessorRunGetResponse;
import ai.extend.types.Error;
import ai.extend.types.ExtendError;
import ai.extend.types.TooManyRequestsErrorBody;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class RawProcessorRunClient {
protected final ClientOptions clientOptions;
public RawProcessorRunClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* Run processors (extraction, classification, splitting, etc.) on a given document.
* <p><strong>Synchronous vs Asynchronous Processing:</strong></p>
* <ul>
* <li><strong>Asynchronous (default)</strong>: Returns immediately with <code>PROCESSING</code> status. Use webhooks or polling to get results.</li>
* <li><strong>Synchronous</strong>: Set <code>sync: true</code> to wait for completion and get final results in the response (5-minute timeout).</li>
* </ul>
* <p><strong>For asynchronous processing:</strong></p>
* <ul>
* <li>You can <a href="https://docs.extend.ai/2025-04-21/developers/webhooks/configuration">configure webhooks</a> to receive notifications when a processor run is complete or failed.</li>
* <li>Or you can <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/get-processor-run">poll the get endpoint</a> for updates on the status of the processor run.</li>
* </ul>
*/
public ExtendClientHttpResponse<ProcessorRunCreateResponse> create(ProcessorRunCreateRequest request) {
return create(request, null);
}
/**
* Run processors (extraction, classification, splitting, etc.) on a given document.
* <p><strong>Synchronous vs Asynchronous Processing:</strong></p>
* <ul>
* <li><strong>Asynchronous (default)</strong>: Returns immediately with <code>PROCESSING</code> status. Use webhooks or polling to get results.</li>
* <li><strong>Synchronous</strong>: Set <code>sync: true</code> to wait for completion and get final results in the response (5-minute timeout).</li>
* </ul>
* <p><strong>For asynchronous processing:</strong></p>
* <ul>
* <li>You can <a href="https://docs.extend.ai/2025-04-21/developers/webhooks/configuration">configure webhooks</a> to receive notifications when a processor run is complete or failed.</li>
* <li>Or you can <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/get-processor-run">poll the get endpoint</a> for updates on the status of the processor run.</li>
* </ul>
*/
public ExtendClientHttpResponse<ProcessorRunCreateResponse> create(
ProcessorRunCreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processor_runs")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProcessorRunCreateResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 429:
throw new TooManyRequestsError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TooManyRequestsErrorBody.class),
response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* Retrieve details about a specific processor run, including its status, outputs, and any edits made during review.
* <p>A common use case for this endpoint is to poll for the status and final output of an async processor run when using the <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/run-processor">Run Processor</a> endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.</p>
*/
public ExtendClientHttpResponse<ProcessorRunGetResponse> get(String id) {
return get(id, null);
}
/**
* Retrieve details about a specific processor run, including its status, outputs, and any edits made during review.
* <p>A common use case for this endpoint is to poll for the status and final output of an async processor run when using the <a href="https://docs.extend.ai/2025-04-21/developers/api-reference/processor-endpoints/run-processor">Run Processor</a> endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.</p>
*/
public ExtendClientHttpResponse<ProcessorRunGetResponse> get(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processor_runs")
.addPathSegment(id)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProcessorRunGetResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public ExtendClientHttpResponse<ProcessorRunDeleteResponse> delete(String id) {
return delete(id, null);
}
/**
* Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public ExtendClientHttpResponse<ProcessorRunDeleteResponse> delete(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processor_runs")
.addPathSegment(id)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProcessorRunDeleteResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 500:
throw new InternalServerError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtendError.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress.
* <p>Note: Only processor runs with a status of <code>"PROCESSING"</code> can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.</p>
*/
public ExtendClientHttpResponse<ProcessorRunCancelResponse> cancel(String id) {
return cancel(id, null);
}
/**
* Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress.
* <p>Note: Only processor runs with a status of <code>"PROCESSING"</code> can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.</p>
*/
public ExtendClientHttpResponse<ProcessorRunCancelResponse> cancel(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processor_runs")
.addPathSegment(id)
.addPathSegments("cancel")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", RequestBody.create("", null))
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProcessorRunCancelResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/requests/ProcessorRunCreateRequest.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun.requests;
import ai.extend.core.ObjectMappers;
import ai.extend.resources.processorrun.types.ProcessorRunCreateRequestConfig;
import ai.extend.types.ProcessorRunFileInput;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorRunCreateRequest.Builder.class)
public final class ProcessorRunCreateRequest {
private final String processorId;
private final Optional<String> version;
private final Optional<ProcessorRunFileInput> file;
private final Optional<String> rawText;
private final Optional<Boolean> sync;
private final Optional<Integer> priority;
private final Optional<Map<String, Object>> metadata;
private final Optional<ProcessorRunCreateRequestConfig> config;
private final Map<String, Object> additionalProperties;
private ProcessorRunCreateRequest(
String processorId,
Optional<String> version,
Optional<ProcessorRunFileInput> file,
Optional<String> rawText,
Optional<Boolean> sync,
Optional<Integer> priority,
Optional<Map<String, Object>> metadata,
Optional<ProcessorRunCreateRequestConfig> config,
Map<String, Object> additionalProperties) {
this.processorId = processorId;
this.version = version;
this.file = file;
this.rawText = rawText;
this.sync = sync;
this.priority = priority;
this.metadata = metadata;
this.config = config;
this.additionalProperties = additionalProperties;
}
@JsonProperty("processorId")
public String getProcessorId() {
return processorId;
}
/**
* @return An optional version of the processor to use. When not supplied, the most recent published version of the processor will be used. Special values include:
* <ul>
* <li><code>"latest"</code> for the most recent published version. If there are no published versions, the draft version will be used.</li>
* <li><code>"draft"</code> for the draft version.</li>
* <li>Specific version numbers corresponding to versions your team has published, e.g. <code>"1.0"</code>, <code>"2.2"</code>, etc.</li>
* </ul>
*/
@JsonProperty("version")
public Optional<String> getVersion() {
return version;
}
/**
* @return The file to be processed. One of <code>file</code> or <code>rawText</code> must be provided. Supported file types can be found <a href="/product/supported-file-types">here</a>.
*/
@JsonProperty("file")
public Optional<ProcessorRunFileInput> getFile() {
return file;
}
/**
* @return A raw string to be processed. Can be used in place of file when passing raw text data streams. One of <code>file</code> or <code>rawText</code> must be provided.
*/
@JsonProperty("rawText")
public Optional<String> getRawText() {
return rawText;
}
/**
* @return Whether to run the processor synchronously. When <code>true</code>, the request will wait for the processor run to complete and return the final results. When <code>false</code> (default), the request returns immediately with a <code>PROCESSING</code> status, and you can poll for completion or use webhooks. For production use cases, we recommending leaving sync off and building around an async integration for more resiliency, unless your use case is predictably fast (e.g. sub < 30 seconds) run time or otherwise have integration constraints that require a synchronous API.
* <p><strong>Timeout</strong>: Synchronous requests have a 5-minute timeout. If the processor run takes longer, it will continue processing asynchronously and you can retrieve the results via the GET endpoint.</p>
*/
@JsonProperty("sync")
public Optional<Boolean> getSync() {
return sync;
}
/**
* @return An optional value used to determine the relative order of ProcessorRuns when rate limiting is in effect. Lower values will be prioritized before higher values.
*/
@JsonProperty("priority")
public Optional<Integer> getPriority() {
return priority;
}
/**
* @return An optional object that can be passed in to identify the run of the document processor. It will be returned back to you in the response and webhooks.
*/
@JsonProperty("metadata")
public Optional<Map<String, Object>> getMetadata() {
return metadata;
}
/**
* @return The configuration for the processor run. If this is provided, this config will be used. If not provided, the config for the specific version you provide will be used. The type of configuration must match the processor type.
*/
@JsonProperty("config")
public Optional<ProcessorRunCreateRequestConfig> getConfig() {
return config;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorRunCreateRequest && equalTo((ProcessorRunCreateRequest) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorRunCreateRequest other) {
return processorId.equals(other.processorId)
&& version.equals(other.version)
&& file.equals(other.file)
&& rawText.equals(other.rawText)
&& sync.equals(other.sync)
&& priority.equals(other.priority)
&& metadata.equals(other.metadata)
&& config.equals(other.config);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.processorId,
this.version,
this.file,
this.rawText,
this.sync,
this.priority,
this.metadata,
this.config);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ProcessorIdStage builder() {
return new Builder();
}
public interface ProcessorIdStage {
_FinalStage processorId(@NotNull String processorId);
Builder from(ProcessorRunCreateRequest other);
}
public interface _FinalStage {
ProcessorRunCreateRequest build();
/**
* <p>An optional version of the processor to use. When not supplied, the most recent published version of the processor will be used. Special values include:</p>
* <ul>
* <li><code>"latest"</code> for the most recent published version. If there are no published versions, the draft version will be used.</li>
* <li><code>"draft"</code> for the draft version.</li>
* <li>Specific version numbers corresponding to versions your team has published, e.g. <code>"1.0"</code>, <code>"2.2"</code>, etc.</li>
* </ul>
*/
_FinalStage version(Optional<String> version);
_FinalStage version(String version);
/**
* <p>The file to be processed. One of <code>file</code> or <code>rawText</code> must be provided. Supported file types can be found <a href="/product/supported-file-types">here</a>.</p>
*/
_FinalStage file(Optional<ProcessorRunFileInput> file);
_FinalStage file(ProcessorRunFileInput file);
/**
* <p>A raw string to be processed. Can be used in place of file when passing raw text data streams. One of <code>file</code> or <code>rawText</code> must be provided.</p>
*/
_FinalStage rawText(Optional<String> rawText);
_FinalStage rawText(String rawText);
/**
* <p>Whether to run the processor synchronously. When <code>true</code>, the request will wait for the processor run to complete and return the final results. When <code>false</code> (default), the request returns immediately with a <code>PROCESSING</code> status, and you can poll for completion or use webhooks. For production use cases, we recommending leaving sync off and building around an async integration for more resiliency, unless your use case is predictably fast (e.g. sub < 30 seconds) run time or otherwise have integration constraints that require a synchronous API.</p>
* <p><strong>Timeout</strong>: Synchronous requests have a 5-minute timeout. If the processor run takes longer, it will continue processing asynchronously and you can retrieve the results via the GET endpoint.</p>
*/
_FinalStage sync(Optional<Boolean> sync);
_FinalStage sync(Boolean sync);
/**
* <p>An optional value used to determine the relative order of ProcessorRuns when rate limiting is in effect. Lower values will be prioritized before higher values.</p>
*/
_FinalStage priority(Optional<Integer> priority);
_FinalStage priority(Integer priority);
/**
* <p>An optional object that can be passed in to identify the run of the document processor. It will be returned back to you in the response and webhooks.</p>
*/
_FinalStage metadata(Optional<Map<String, Object>> metadata);
_FinalStage metadata(Map<String, Object> metadata);
/**
* <p>The configuration for the processor run. If this is provided, this config will be used. If not provided, the config for the specific version you provide will be used. The type of configuration must match the processor type.</p>
*/
_FinalStage config(Optional<ProcessorRunCreateRequestConfig> config);
_FinalStage config(ProcessorRunCreateRequestConfig config);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ProcessorIdStage, _FinalStage {
private String processorId;
private Optional<ProcessorRunCreateRequestConfig> config = Optional.empty();
private Optional<Map<String, Object>> metadata = Optional.empty();
private Optional<Integer> priority = Optional.empty();
private Optional<Boolean> sync = Optional.empty();
private Optional<String> rawText = Optional.empty();
private Optional<ProcessorRunFileInput> file = Optional.empty();
private Optional<String> version = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorRunCreateRequest other) {
processorId(other.getProcessorId());
version(other.getVersion());
file(other.getFile());
rawText(other.getRawText());
sync(other.getSync());
priority(other.getPriority());
metadata(other.getMetadata());
config(other.getConfig());
return this;
}
@java.lang.Override
@JsonSetter("processorId")
public _FinalStage processorId(@NotNull String processorId) {
this.processorId = Objects.requireNonNull(processorId, "processorId must not be null");
return this;
}
/**
* <p>The configuration for the processor run. If this is provided, this config will be used. If not provided, the config for the specific version you provide will be used. The type of configuration must match the processor type.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage config(ProcessorRunCreateRequestConfig config) {
this.config = Optional.ofNullable(config);
return this;
}
/**
* <p>The configuration for the processor run. If this is provided, this config will be used. If not provided, the config for the specific version you provide will be used. The type of configuration must match the processor type.</p>
*/
@java.lang.Override
@JsonSetter(value = "config", nulls = Nulls.SKIP)
public _FinalStage config(Optional<ProcessorRunCreateRequestConfig> config) {
this.config = config;
return this;
}
/**
* <p>An optional object that can be passed in to identify the run of the document processor. It will be returned back to you in the response and webhooks.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage metadata(Map<String, Object> metadata) {
this.metadata = Optional.ofNullable(metadata);
return this;
}
/**
* <p>An optional object that can be passed in to identify the run of the document processor. It will be returned back to you in the response and webhooks.</p>
*/
@java.lang.Override
@JsonSetter(value = "metadata", nulls = Nulls.SKIP)
public _FinalStage metadata(Optional<Map<String, Object>> metadata) {
this.metadata = metadata;
return this;
}
/**
* <p>An optional value used to determine the relative order of ProcessorRuns when rate limiting is in effect. Lower values will be prioritized before higher values.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage priority(Integer priority) {
this.priority = Optional.ofNullable(priority);
return this;
}
/**
* <p>An optional value used to determine the relative order of ProcessorRuns when rate limiting is in effect. Lower values will be prioritized before higher values.</p>
*/
@java.lang.Override
@JsonSetter(value = "priority", nulls = Nulls.SKIP)
public _FinalStage priority(Optional<Integer> priority) {
this.priority = priority;
return this;
}
/**
* <p>Whether to run the processor synchronously. When <code>true</code>, the request will wait for the processor run to complete and return the final results. When <code>false</code> (default), the request returns immediately with a <code>PROCESSING</code> status, and you can poll for completion or use webhooks. For production use cases, we recommending leaving sync off and building around an async integration for more resiliency, unless your use case is predictably fast (e.g. sub < 30 seconds) run time or otherwise have integration constraints that require a synchronous API.</p>
* <p><strong>Timeout</strong>: Synchronous requests have a 5-minute timeout. If the processor run takes longer, it will continue processing asynchronously and you can retrieve the results via the GET endpoint.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage sync(Boolean sync) {
this.sync = Optional.ofNullable(sync);
return this;
}
/**
* <p>Whether to run the processor synchronously. When <code>true</code>, the request will wait for the processor run to complete and return the final results. When <code>false</code> (default), the request returns immediately with a <code>PROCESSING</code> status, and you can poll for completion or use webhooks. For production use cases, we recommending leaving sync off and building around an async integration for more resiliency, unless your use case is predictably fast (e.g. sub < 30 seconds) run time or otherwise have integration constraints that require a synchronous API.</p>
* <p><strong>Timeout</strong>: Synchronous requests have a 5-minute timeout. If the processor run takes longer, it will continue processing asynchronously and you can retrieve the results via the GET endpoint.</p>
*/
@java.lang.Override
@JsonSetter(value = "sync", nulls = Nulls.SKIP)
public _FinalStage sync(Optional<Boolean> sync) {
this.sync = sync;
return this;
}
/**
* <p>A raw string to be processed. Can be used in place of file when passing raw text data streams. One of <code>file</code> or <code>rawText</code> must be provided.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage rawText(String rawText) {
this.rawText = Optional.ofNullable(rawText);
return this;
}
/**
* <p>A raw string to be processed. Can be used in place of file when passing raw text data streams. One of <code>file</code> or <code>rawText</code> must be provided.</p>
*/
@java.lang.Override
@JsonSetter(value = "rawText", nulls = Nulls.SKIP)
public _FinalStage rawText(Optional<String> rawText) {
this.rawText = rawText;
return this;
}
/**
* <p>The file to be processed. One of <code>file</code> or <code>rawText</code> must be provided. Supported file types can be found <a href="/product/supported-file-types">here</a>.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage file(ProcessorRunFileInput file) {
this.file = Optional.ofNullable(file);
return this;
}
/**
* <p>The file to be processed. One of <code>file</code> or <code>rawText</code> must be provided. Supported file types can be found <a href="/product/supported-file-types">here</a>.</p>
*/
@java.lang.Override
@JsonSetter(value = "file", nulls = Nulls.SKIP)
public _FinalStage file(Optional<ProcessorRunFileInput> file) {
this.file = file;
return this;
}
/**
* <p>An optional version of the processor to use. When not supplied, the most recent published version of the processor will be used. Special values include:</p>
* <ul>
* <li><code>"latest"</code> for the most recent published version. If there are no published versions, the draft version will be used.</li>
* <li><code>"draft"</code> for the draft version.</li>
* <li>Specific version numbers corresponding to versions your team has published, e.g. <code>"1.0"</code>, <code>"2.2"</code>, etc.</li>
* </ul>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage version(String version) {
this.version = Optional.ofNullable(version);
return this;
}
/**
* <p>An optional version of the processor to use. When not supplied, the most recent published version of the processor will be used. Special values include:</p>
* <ul>
* <li><code>"latest"</code> for the most recent published version. If there are no published versions, the draft version will be used.</li>
* <li><code>"draft"</code> for the draft version.</li>
* <li>Specific version numbers corresponding to versions your team has published, e.g. <code>"1.0"</code>, <code>"2.2"</code>, etc.</li>
* </ul>
*/
@java.lang.Override
@JsonSetter(value = "version", nulls = Nulls.SKIP)
public _FinalStage version(Optional<String> version) {
this.version = version;
return this;
}
@java.lang.Override
public ProcessorRunCreateRequest build() {
return new ProcessorRunCreateRequest(
processorId, version, file, rawText, sync, priority, metadata, config, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/types/ProcessorRunCancelResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.ProcessorRun;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorRunCancelResponse.Builder.class)
public final class ProcessorRunCancelResponse {
private final boolean success;
private final ProcessorRun processorRun;
private final Map<String, Object> additionalProperties;
private ProcessorRunCancelResponse(
boolean success, ProcessorRun processorRun, Map<String, Object> additionalProperties) {
this.success = success;
this.processorRun = processorRun;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("processorRun")
public ProcessorRun getProcessorRun() {
return processorRun;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorRunCancelResponse && equalTo((ProcessorRunCancelResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorRunCancelResponse other) {
return success == other.success && processorRun.equals(other.processorRun);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.processorRun);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
ProcessorRunStage success(boolean success);
Builder from(ProcessorRunCancelResponse other);
}
public interface ProcessorRunStage {
_FinalStage processorRun(@NotNull ProcessorRun processorRun);
}
public interface _FinalStage {
ProcessorRunCancelResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, ProcessorRunStage, _FinalStage {
private boolean success;
private ProcessorRun processorRun;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorRunCancelResponse other) {
success(other.getSuccess());
processorRun(other.getProcessorRun());
return this;
}
@java.lang.Override
@JsonSetter("success")
public ProcessorRunStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("processorRun")
public _FinalStage processorRun(@NotNull ProcessorRun processorRun) {
this.processorRun = Objects.requireNonNull(processorRun, "processorRun must not be null");
return this;
}
@java.lang.Override
public ProcessorRunCancelResponse build() {
return new ProcessorRunCancelResponse(success, processorRun, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/types/ProcessorRunCreateRequestConfig.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun.types;
import ai.extend.types.ClassificationConfig;
import ai.extend.types.ExtractionConfig;
import ai.extend.types.SplitterConfig;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Objects;
import java.util.Optional;
public final class ProcessorRunCreateRequestConfig {
private final Value value;
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
private ProcessorRunCreateRequestConfig(Value value) {
this.value = value;
}
public <T> T visit(Visitor<T> visitor) {
return value.visit(visitor);
}
public static ProcessorRunCreateRequestConfig classify(ClassificationConfig value) {
return new ProcessorRunCreateRequestConfig(new ClassifyValue(value));
}
public static ProcessorRunCreateRequestConfig extract(ExtractionConfig value) {
return new ProcessorRunCreateRequestConfig(new ExtractValue(value));
}
public static ProcessorRunCreateRequestConfig splitter(SplitterConfig value) {
return new ProcessorRunCreateRequestConfig(new SplitterValue(value));
}
public boolean isClassify() {
return value instanceof ClassifyValue;
}
public boolean isExtract() {
return value instanceof ExtractValue;
}
public boolean isSplitter() {
return value instanceof SplitterValue;
}
public boolean _isUnknown() {
return value instanceof _UnknownValue;
}
public Optional<ClassificationConfig> getClassify() {
if (isClassify()) {
return Optional.of(((ClassifyValue) value).value);
}
return Optional.empty();
}
public Optional<ExtractionConfig> getExtract() {
if (isExtract()) {
return Optional.of(((ExtractValue) value).value);
}
return Optional.empty();
}
public Optional<SplitterConfig> getSplitter() {
if (isSplitter()) {
return Optional.of(((SplitterValue) value).value);
}
return Optional.empty();
}
public Optional<Object> _getUnknown() {
if (_isUnknown()) {
return Optional.of(((_UnknownValue) value).value);
}
return Optional.empty();
}
@JsonValue
private Value getValue() {
return this.value;
}
public interface Visitor<T> {
T visitClassify(ClassificationConfig classify);
T visitExtract(ExtractionConfig extract);
T visitSplitter(SplitterConfig splitter);
T _visitUnknown(Object unknownType);
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class)
@JsonSubTypes({
@JsonSubTypes.Type(ClassifyValue.class),
@JsonSubTypes.Type(ExtractValue.class),
@JsonSubTypes.Type(SplitterValue.class)
})
@JsonIgnoreProperties(ignoreUnknown = true)
private interface Value {
<T> T visit(Visitor<T> visitor);
}
@JsonTypeName("CLASSIFY")
@JsonIgnoreProperties("type")
private static final class ClassifyValue implements Value {
@JsonUnwrapped
private ClassificationConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private ClassifyValue() {}
private ClassifyValue(ClassificationConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitClassify(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ClassifyValue && equalTo((ClassifyValue) other);
}
private boolean equalTo(ClassifyValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorRunCreateRequestConfig{" + "value: " + value + "}";
}
}
@JsonTypeName("EXTRACT")
@JsonIgnoreProperties("type")
private static final class ExtractValue implements Value {
@JsonUnwrapped
private ExtractionConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private ExtractValue() {}
private ExtractValue(ExtractionConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitExtract(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractValue && equalTo((ExtractValue) other);
}
private boolean equalTo(ExtractValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorRunCreateRequestConfig{" + "value: " + value + "}";
}
}
@JsonTypeName("SPLITTER")
@JsonIgnoreProperties("type")
private static final class SplitterValue implements Value {
@JsonUnwrapped
private SplitterConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private SplitterValue() {}
private SplitterValue(SplitterConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitSplitter(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof SplitterValue && equalTo((SplitterValue) other);
}
private boolean equalTo(SplitterValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorRunCreateRequestConfig{" + "value: " + value + "}";
}
}
@JsonIgnoreProperties("type")
private static final class _UnknownValue implements Value {
private String type;
@JsonValue
private Object value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private _UnknownValue(@JsonProperty("value") Object value) {}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor._visitUnknown(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof _UnknownValue && equalTo((_UnknownValue) other);
}
private boolean equalTo(_UnknownValue other) {
return type.equals(other.type) && value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.type, this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorRunCreateRequestConfig{" + "type: " + type + ", value: " + value + "}";
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/types/ProcessorRunCreateResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.ProcessorRun;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorRunCreateResponse.Builder.class)
public final class ProcessorRunCreateResponse {
private final boolean success;
private final ProcessorRun processorRun;
private final Map<String, Object> additionalProperties;
private ProcessorRunCreateResponse(
boolean success, ProcessorRun processorRun, Map<String, Object> additionalProperties) {
this.success = success;
this.processorRun = processorRun;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("processorRun")
public ProcessorRun getProcessorRun() {
return processorRun;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorRunCreateResponse && equalTo((ProcessorRunCreateResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorRunCreateResponse other) {
return success == other.success && processorRun.equals(other.processorRun);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.processorRun);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
ProcessorRunStage success(boolean success);
Builder from(ProcessorRunCreateResponse other);
}
public interface ProcessorRunStage {
_FinalStage processorRun(@NotNull ProcessorRun processorRun);
}
public interface _FinalStage {
ProcessorRunCreateResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, ProcessorRunStage, _FinalStage {
private boolean success;
private ProcessorRun processorRun;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorRunCreateResponse other) {
success(other.getSuccess());
processorRun(other.getProcessorRun());
return this;
}
@java.lang.Override
@JsonSetter("success")
public ProcessorRunStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("processorRun")
public _FinalStage processorRun(@NotNull ProcessorRun processorRun) {
this.processorRun = Objects.requireNonNull(processorRun, "processorRun must not be null");
return this;
}
@java.lang.Override
public ProcessorRunCreateResponse build() {
return new ProcessorRunCreateResponse(success, processorRun, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/types/ProcessorRunDeleteResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorRunDeleteResponse.Builder.class)
public final class ProcessorRunDeleteResponse {
private final boolean success;
private final String documentProcessorRunId;
private final String message;
private final Map<String, Object> additionalProperties;
private ProcessorRunDeleteResponse(
boolean success, String documentProcessorRunId, String message, Map<String, Object> additionalProperties) {
this.success = success;
this.documentProcessorRunId = documentProcessorRunId;
this.message = message;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
/**
* @return The ID of the deleted processor run
*/
@JsonProperty("documentProcessorRunId")
public String getDocumentProcessorRunId() {
return documentProcessorRunId;
}
/**
* @return Confirmation message
*/
@JsonProperty("message")
public String getMessage() {
return message;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorRunDeleteResponse && equalTo((ProcessorRunDeleteResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorRunDeleteResponse other) {
return success == other.success
&& documentProcessorRunId.equals(other.documentProcessorRunId)
&& message.equals(other.message);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.documentProcessorRunId, this.message);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
DocumentProcessorRunIdStage success(boolean success);
Builder from(ProcessorRunDeleteResponse other);
}
public interface DocumentProcessorRunIdStage {
/**
* <p>The ID of the deleted processor run</p>
*/
MessageStage documentProcessorRunId(@NotNull String documentProcessorRunId);
}
public interface MessageStage {
/**
* <p>Confirmation message</p>
*/
_FinalStage message(@NotNull String message);
}
public interface _FinalStage {
ProcessorRunDeleteResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, DocumentProcessorRunIdStage, MessageStage, _FinalStage {
private boolean success;
private String documentProcessorRunId;
private String message;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorRunDeleteResponse other) {
success(other.getSuccess());
documentProcessorRunId(other.getDocumentProcessorRunId());
message(other.getMessage());
return this;
}
@java.lang.Override
@JsonSetter("success")
public DocumentProcessorRunIdStage success(boolean success) {
this.success = success;
return this;
}
/**
* <p>The ID of the deleted processor run</p>
* <p>The ID of the deleted processor run</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("documentProcessorRunId")
public MessageStage documentProcessorRunId(@NotNull String documentProcessorRunId) {
this.documentProcessorRunId =
Objects.requireNonNull(documentProcessorRunId, "documentProcessorRunId must not be null");
return this;
}
/**
* <p>Confirmation message</p>
* <p>Confirmation message</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("message")
public _FinalStage message(@NotNull String message) {
this.message = Objects.requireNonNull(message, "message must not be null");
return this;
}
@java.lang.Override
public ProcessorRunDeleteResponse build() {
return new ProcessorRunDeleteResponse(success, documentProcessorRunId, message, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorrun/types/ProcessorRunGetResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorrun.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.ProcessorRun;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorRunGetResponse.Builder.class)
public final class ProcessorRunGetResponse {
private final boolean success;
private final ProcessorRun processorRun;
private final Map<String, Object> additionalProperties;
private ProcessorRunGetResponse(
boolean success, ProcessorRun processorRun, Map<String, Object> additionalProperties) {
this.success = success;
this.processorRun = processorRun;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("processorRun")
public ProcessorRun getProcessorRun() {
return processorRun;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorRunGetResponse && equalTo((ProcessorRunGetResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorRunGetResponse other) {
return success == other.success && processorRun.equals(other.processorRun);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.processorRun);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
ProcessorRunStage success(boolean success);
Builder from(ProcessorRunGetResponse other);
}
public interface ProcessorRunStage {
_FinalStage processorRun(@NotNull ProcessorRun processorRun);
}
public interface _FinalStage {
ProcessorRunGetResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, ProcessorRunStage, _FinalStage {
private boolean success;
private ProcessorRun processorRun;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorRunGetResponse other) {
success(other.getSuccess());
processorRun(other.getProcessorRun());
return this;
}
@java.lang.Override
@JsonSetter("success")
public ProcessorRunStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("processorRun")
public _FinalStage processorRun(@NotNull ProcessorRun processorRun) {
this.processorRun = Objects.requireNonNull(processorRun, "processorRun must not be null");
return this;
}
@java.lang.Override
public ProcessorRunGetResponse build() {
return new ProcessorRunGetResponse(success, processorRun, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/AsyncProcessorVersionClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.processorversion.requests.ProcessorVersionCreateRequest;
import ai.extend.resources.processorversion.types.ProcessorVersionCreateResponse;
import ai.extend.resources.processorversion.types.ProcessorVersionGetResponse;
import ai.extend.resources.processorversion.types.ProcessorVersionListResponse;
import java.util.concurrent.CompletableFuture;
public class AsyncProcessorVersionClient {
protected final ClientOptions clientOptions;
private final AsyncRawProcessorVersionClient rawClient;
public AsyncProcessorVersionClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawProcessorVersionClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawProcessorVersionClient withRawResponse() {
return this.rawClient;
}
/**
* Retrieve a specific version of a processor in Extend
*/
public CompletableFuture<ProcessorVersionGetResponse> get(String processorId, String processorVersionId) {
return this.rawClient.get(processorId, processorVersionId).thenApply(response -> response.body());
}
/**
* Retrieve a specific version of a processor in Extend
*/
public CompletableFuture<ProcessorVersionGetResponse> get(
String processorId, String processorVersionId, RequestOptions requestOptions) {
return this.rawClient
.get(processorId, processorVersionId, requestOptions)
.thenApply(response -> response.body());
}
/**
* This endpoint allows you to fetch all versions of a given processor, including the current <code>draft</code> version.
* <p>Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation.
* The <code>draft</code> version is the latest unpublished version of the processor, which can be published to create a new version. It might not have any changes from the last published version.</p>
*/
public CompletableFuture<ProcessorVersionListResponse> list(String id) {
return this.rawClient.list(id).thenApply(response -> response.body());
}
/**
* This endpoint allows you to fetch all versions of a given processor, including the current <code>draft</code> version.
* <p>Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation.
* The <code>draft</code> version is the latest unpublished version of the processor, which can be published to create a new version. It might not have any changes from the last published version.</p>
*/
public CompletableFuture<ProcessorVersionListResponse> list(String id, RequestOptions requestOptions) {
return this.rawClient.list(id, requestOptions).thenApply(response -> response.body());
}
/**
* This endpoint allows you to publish a new version of an existing processor. Publishing a new version creates a snapshot of the processor's current configuration and makes it available for use in workflows.
* <p>Publishing a new version does not automatically update existing workflows using this processor. You may need to manually update workflows to use the new version if desired.</p>
*/
public CompletableFuture<ProcessorVersionCreateResponse> create(String id, ProcessorVersionCreateRequest request) {
return this.rawClient.create(id, request).thenApply(response -> response.body());
}
/**
* This endpoint allows you to publish a new version of an existing processor. Publishing a new version creates a snapshot of the processor's current configuration and makes it available for use in workflows.
* <p>Publishing a new version does not automatically update existing workflows using this processor. You may need to manually update workflows to use the new version if desired.</p>
*/
public CompletableFuture<ProcessorVersionCreateResponse> create(
String id, ProcessorVersionCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(id, request, requestOptions).thenApply(response -> response.body());
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/AsyncRawProcessorVersionClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.NotFoundError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.processorversion.requests.ProcessorVersionCreateRequest;
import ai.extend.resources.processorversion.types.ProcessorVersionCreateResponse;
import ai.extend.resources.processorversion.types.ProcessorVersionGetResponse;
import ai.extend.resources.processorversion.types.ProcessorVersionListResponse;
import ai.extend.types.Error;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;
public class AsyncRawProcessorVersionClient {
protected final ClientOptions clientOptions;
public AsyncRawProcessorVersionClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* Retrieve a specific version of a processor in Extend
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorVersionGetResponse>> get(
String processorId, String processorVersionId) {
return get(processorId, processorVersionId, null);
}
/**
* Retrieve a specific version of a processor in Extend
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorVersionGetResponse>> get(
String processorId, String processorVersionId, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processors")
.addPathSegment(processorId)
.addPathSegments("versions")
.addPathSegment(processorVersionId)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<ProcessorVersionGetResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), ProcessorVersionGetResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* This endpoint allows you to fetch all versions of a given processor, including the current <code>draft</code> version.
* <p>Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation.
* The <code>draft</code> version is the latest unpublished version of the processor, which can be published to create a new version. It might not have any changes from the last published version.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorVersionListResponse>> list(String id) {
return list(id, null);
}
/**
* This endpoint allows you to fetch all versions of a given processor, including the current <code>draft</code> version.
* <p>Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation.
* The <code>draft</code> version is the latest unpublished version of the processor, which can be published to create a new version. It might not have any changes from the last published version.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorVersionListResponse>> list(
String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processors")
.addPathSegment(id)
.addPathSegments("versions")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<ProcessorVersionListResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), ProcessorVersionListResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* This endpoint allows you to publish a new version of an existing processor. Publishing a new version creates a snapshot of the processor's current configuration and makes it available for use in workflows.
* <p>Publishing a new version does not automatically update existing workflows using this processor. You may need to manually update workflows to use the new version if desired.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorVersionCreateResponse>> create(
String id, ProcessorVersionCreateRequest request) {
return create(id, request, null);
}
/**
* This endpoint allows you to publish a new version of an existing processor. Publishing a new version creates a snapshot of the processor's current configuration and makes it available for use in workflows.
* <p>Publishing a new version does not automatically update existing workflows using this processor. You may need to manually update workflows to use the new version if desired.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<ProcessorVersionCreateResponse>> create(
String id, ProcessorVersionCreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processors")
.addPathSegment(id)
.addPathSegments("publish")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<ProcessorVersionCreateResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), ProcessorVersionCreateResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/ProcessorVersionClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.processorversion.requests.ProcessorVersionCreateRequest;
import ai.extend.resources.processorversion.types.ProcessorVersionCreateResponse;
import ai.extend.resources.processorversion.types.ProcessorVersionGetResponse;
import ai.extend.resources.processorversion.types.ProcessorVersionListResponse;
public class ProcessorVersionClient {
protected final ClientOptions clientOptions;
private final RawProcessorVersionClient rawClient;
public ProcessorVersionClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawProcessorVersionClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public RawProcessorVersionClient withRawResponse() {
return this.rawClient;
}
/**
* Retrieve a specific version of a processor in Extend
*/
public ProcessorVersionGetResponse get(String processorId, String processorVersionId) {
return this.rawClient.get(processorId, processorVersionId).body();
}
/**
* Retrieve a specific version of a processor in Extend
*/
public ProcessorVersionGetResponse get(
String processorId, String processorVersionId, RequestOptions requestOptions) {
return this.rawClient
.get(processorId, processorVersionId, requestOptions)
.body();
}
/**
* This endpoint allows you to fetch all versions of a given processor, including the current <code>draft</code> version.
* <p>Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation.
* The <code>draft</code> version is the latest unpublished version of the processor, which can be published to create a new version. It might not have any changes from the last published version.</p>
*/
public ProcessorVersionListResponse list(String id) {
return this.rawClient.list(id).body();
}
/**
* This endpoint allows you to fetch all versions of a given processor, including the current <code>draft</code> version.
* <p>Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation.
* The <code>draft</code> version is the latest unpublished version of the processor, which can be published to create a new version. It might not have any changes from the last published version.</p>
*/
public ProcessorVersionListResponse list(String id, RequestOptions requestOptions) {
return this.rawClient.list(id, requestOptions).body();
}
/**
* This endpoint allows you to publish a new version of an existing processor. Publishing a new version creates a snapshot of the processor's current configuration and makes it available for use in workflows.
* <p>Publishing a new version does not automatically update existing workflows using this processor. You may need to manually update workflows to use the new version if desired.</p>
*/
public ProcessorVersionCreateResponse create(String id, ProcessorVersionCreateRequest request) {
return this.rawClient.create(id, request).body();
}
/**
* This endpoint allows you to publish a new version of an existing processor. Publishing a new version creates a snapshot of the processor's current configuration and makes it available for use in workflows.
* <p>Publishing a new version does not automatically update existing workflows using this processor. You may need to manually update workflows to use the new version if desired.</p>
*/
public ProcessorVersionCreateResponse create(
String id, ProcessorVersionCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(id, request, requestOptions).body();
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/RawProcessorVersionClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.NotFoundError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.processorversion.requests.ProcessorVersionCreateRequest;
import ai.extend.resources.processorversion.types.ProcessorVersionCreateResponse;
import ai.extend.resources.processorversion.types.ProcessorVersionGetResponse;
import ai.extend.resources.processorversion.types.ProcessorVersionListResponse;
import ai.extend.types.Error;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class RawProcessorVersionClient {
protected final ClientOptions clientOptions;
public RawProcessorVersionClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* Retrieve a specific version of a processor in Extend
*/
public ExtendClientHttpResponse<ProcessorVersionGetResponse> get(String processorId, String processorVersionId) {
return get(processorId, processorVersionId, null);
}
/**
* Retrieve a specific version of a processor in Extend
*/
public ExtendClientHttpResponse<ProcessorVersionGetResponse> get(
String processorId, String processorVersionId, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processors")
.addPathSegment(processorId)
.addPathSegments("versions")
.addPathSegment(processorVersionId)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProcessorVersionGetResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* This endpoint allows you to fetch all versions of a given processor, including the current <code>draft</code> version.
* <p>Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation.
* The <code>draft</code> version is the latest unpublished version of the processor, which can be published to create a new version. It might not have any changes from the last published version.</p>
*/
public ExtendClientHttpResponse<ProcessorVersionListResponse> list(String id) {
return list(id, null);
}
/**
* This endpoint allows you to fetch all versions of a given processor, including the current <code>draft</code> version.
* <p>Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation.
* The <code>draft</code> version is the latest unpublished version of the processor, which can be published to create a new version. It might not have any changes from the last published version.</p>
*/
public ExtendClientHttpResponse<ProcessorVersionListResponse> list(String id, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processors")
.addPathSegment(id)
.addPathSegments("versions")
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProcessorVersionListResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* This endpoint allows you to publish a new version of an existing processor. Publishing a new version creates a snapshot of the processor's current configuration and makes it available for use in workflows.
* <p>Publishing a new version does not automatically update existing workflows using this processor. You may need to manually update workflows to use the new version if desired.</p>
*/
public ExtendClientHttpResponse<ProcessorVersionCreateResponse> create(
String id, ProcessorVersionCreateRequest request) {
return create(id, request, null);
}
/**
* This endpoint allows you to publish a new version of an existing processor. Publishing a new version creates a snapshot of the processor's current configuration and makes it available for use in workflows.
* <p>Publishing a new version does not automatically update existing workflows using this processor. You may need to manually update workflows to use the new version if desired.</p>
*/
public ExtendClientHttpResponse<ProcessorVersionCreateResponse> create(
String id, ProcessorVersionCreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("processors")
.addPathSegment(id)
.addPathSegments("publish")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), ProcessorVersionCreateResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/requests/ProcessorVersionCreateRequest.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion.requests;
import ai.extend.core.ObjectMappers;
import ai.extend.resources.processorversion.types.ProcessorVersionCreateRequestConfig;
import ai.extend.resources.processorversion.types.ProcessorVersionCreateRequestReleaseType;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorVersionCreateRequest.Builder.class)
public final class ProcessorVersionCreateRequest {
private final ProcessorVersionCreateRequestReleaseType releaseType;
private final Optional<String> description;
private final Optional<ProcessorVersionCreateRequestConfig> config;
private final Map<String, Object> additionalProperties;
private ProcessorVersionCreateRequest(
ProcessorVersionCreateRequestReleaseType releaseType,
Optional<String> description,
Optional<ProcessorVersionCreateRequestConfig> config,
Map<String, Object> additionalProperties) {
this.releaseType = releaseType;
this.description = description;
this.config = config;
this.additionalProperties = additionalProperties;
}
/**
* @return The type of release for this version. The two options are "major" and "minor", which will increment the version number accordingly.
*/
@JsonProperty("releaseType")
public ProcessorVersionCreateRequestReleaseType getReleaseType() {
return releaseType;
}
/**
* @return A description of the changes in this version. This helps track the evolution of the processor over time.
*/
@JsonProperty("description")
public Optional<String> getDescription() {
return description;
}
/**
* @return The configuration for this version of the processor. The type of configuration must match the processor type.
*/
@JsonProperty("config")
public Optional<ProcessorVersionCreateRequestConfig> getConfig() {
return config;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorVersionCreateRequest && equalTo((ProcessorVersionCreateRequest) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorVersionCreateRequest other) {
return releaseType.equals(other.releaseType)
&& description.equals(other.description)
&& config.equals(other.config);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.releaseType, this.description, this.config);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ReleaseTypeStage builder() {
return new Builder();
}
public interface ReleaseTypeStage {
/**
* <p>The type of release for this version. The two options are "major" and "minor", which will increment the version number accordingly.</p>
*/
_FinalStage releaseType(@NotNull ProcessorVersionCreateRequestReleaseType releaseType);
Builder from(ProcessorVersionCreateRequest other);
}
public interface _FinalStage {
ProcessorVersionCreateRequest build();
/**
* <p>A description of the changes in this version. This helps track the evolution of the processor over time.</p>
*/
_FinalStage description(Optional<String> description);
_FinalStage description(String description);
/**
* <p>The configuration for this version of the processor. The type of configuration must match the processor type.</p>
*/
_FinalStage config(Optional<ProcessorVersionCreateRequestConfig> config);
_FinalStage config(ProcessorVersionCreateRequestConfig config);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ReleaseTypeStage, _FinalStage {
private ProcessorVersionCreateRequestReleaseType releaseType;
private Optional<ProcessorVersionCreateRequestConfig> config = Optional.empty();
private Optional<String> description = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorVersionCreateRequest other) {
releaseType(other.getReleaseType());
description(other.getDescription());
config(other.getConfig());
return this;
}
/**
* <p>The type of release for this version. The two options are "major" and "minor", which will increment the version number accordingly.</p>
* <p>The type of release for this version. The two options are "major" and "minor", which will increment the version number accordingly.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("releaseType")
public _FinalStage releaseType(@NotNull ProcessorVersionCreateRequestReleaseType releaseType) {
this.releaseType = Objects.requireNonNull(releaseType, "releaseType must not be null");
return this;
}
/**
* <p>The configuration for this version of the processor. The type of configuration must match the processor type.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage config(ProcessorVersionCreateRequestConfig config) {
this.config = Optional.ofNullable(config);
return this;
}
/**
* <p>The configuration for this version of the processor. The type of configuration must match the processor type.</p>
*/
@java.lang.Override
@JsonSetter(value = "config", nulls = Nulls.SKIP)
public _FinalStage config(Optional<ProcessorVersionCreateRequestConfig> config) {
this.config = config;
return this;
}
/**
* <p>A description of the changes in this version. This helps track the evolution of the processor over time.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage description(String description) {
this.description = Optional.ofNullable(description);
return this;
}
/**
* <p>A description of the changes in this version. This helps track the evolution of the processor over time.</p>
*/
@java.lang.Override
@JsonSetter(value = "description", nulls = Nulls.SKIP)
public _FinalStage description(Optional<String> description) {
this.description = description;
return this;
}
@java.lang.Override
public ProcessorVersionCreateRequest build() {
return new ProcessorVersionCreateRequest(releaseType, description, config, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/types/ProcessorVersionCreateRequestConfig.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion.types;
import ai.extend.types.ClassificationConfig;
import ai.extend.types.ExtractionConfig;
import ai.extend.types.SplitterConfig;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Objects;
import java.util.Optional;
public final class ProcessorVersionCreateRequestConfig {
private final Value value;
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
private ProcessorVersionCreateRequestConfig(Value value) {
this.value = value;
}
public <T> T visit(Visitor<T> visitor) {
return value.visit(visitor);
}
public static ProcessorVersionCreateRequestConfig classify(ClassificationConfig value) {
return new ProcessorVersionCreateRequestConfig(new ClassifyValue(value));
}
public static ProcessorVersionCreateRequestConfig extract(ExtractionConfig value) {
return new ProcessorVersionCreateRequestConfig(new ExtractValue(value));
}
public static ProcessorVersionCreateRequestConfig splitter(SplitterConfig value) {
return new ProcessorVersionCreateRequestConfig(new SplitterValue(value));
}
public boolean isClassify() {
return value instanceof ClassifyValue;
}
public boolean isExtract() {
return value instanceof ExtractValue;
}
public boolean isSplitter() {
return value instanceof SplitterValue;
}
public boolean _isUnknown() {
return value instanceof _UnknownValue;
}
public Optional<ClassificationConfig> getClassify() {
if (isClassify()) {
return Optional.of(((ClassifyValue) value).value);
}
return Optional.empty();
}
public Optional<ExtractionConfig> getExtract() {
if (isExtract()) {
return Optional.of(((ExtractValue) value).value);
}
return Optional.empty();
}
public Optional<SplitterConfig> getSplitter() {
if (isSplitter()) {
return Optional.of(((SplitterValue) value).value);
}
return Optional.empty();
}
public Optional<Object> _getUnknown() {
if (_isUnknown()) {
return Optional.of(((_UnknownValue) value).value);
}
return Optional.empty();
}
@JsonValue
private Value getValue() {
return this.value;
}
public interface Visitor<T> {
T visitClassify(ClassificationConfig classify);
T visitExtract(ExtractionConfig extract);
T visitSplitter(SplitterConfig splitter);
T _visitUnknown(Object unknownType);
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class)
@JsonSubTypes({
@JsonSubTypes.Type(ClassifyValue.class),
@JsonSubTypes.Type(ExtractValue.class),
@JsonSubTypes.Type(SplitterValue.class)
})
@JsonIgnoreProperties(ignoreUnknown = true)
private interface Value {
<T> T visit(Visitor<T> visitor);
}
@JsonTypeName("CLASSIFY")
@JsonIgnoreProperties("type")
private static final class ClassifyValue implements Value {
@JsonUnwrapped
private ClassificationConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private ClassifyValue() {}
private ClassifyValue(ClassificationConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitClassify(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ClassifyValue && equalTo((ClassifyValue) other);
}
private boolean equalTo(ClassifyValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorVersionCreateRequestConfig{" + "value: " + value + "}";
}
}
@JsonTypeName("EXTRACT")
@JsonIgnoreProperties("type")
private static final class ExtractValue implements Value {
@JsonUnwrapped
private ExtractionConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private ExtractValue() {}
private ExtractValue(ExtractionConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitExtract(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractValue && equalTo((ExtractValue) other);
}
private boolean equalTo(ExtractValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorVersionCreateRequestConfig{" + "value: " + value + "}";
}
}
@JsonTypeName("SPLITTER")
@JsonIgnoreProperties("type")
private static final class SplitterValue implements Value {
@JsonUnwrapped
private SplitterConfig value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private SplitterValue() {}
private SplitterValue(SplitterConfig value) {
this.value = value;
}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor.visitSplitter(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof SplitterValue && equalTo((SplitterValue) other);
}
private boolean equalTo(SplitterValue other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorVersionCreateRequestConfig{" + "value: " + value + "}";
}
}
@JsonIgnoreProperties("type")
private static final class _UnknownValue implements Value {
private String type;
@JsonValue
private Object value;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
private _UnknownValue(@JsonProperty("value") Object value) {}
@java.lang.Override
public <T> T visit(Visitor<T> visitor) {
return visitor._visitUnknown(value);
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof _UnknownValue && equalTo((_UnknownValue) other);
}
private boolean equalTo(_UnknownValue other) {
return type.equals(other.type) && value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.type, this.value);
}
@java.lang.Override
public String toString() {
return "ProcessorVersionCreateRequestConfig{" + "type: " + type + ", value: " + value + "}";
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/types/ProcessorVersionCreateRequestReleaseType.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ProcessorVersionCreateRequestReleaseType {
MAJOR("major"),
MINOR("minor");
private final String value;
ProcessorVersionCreateRequestReleaseType(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/types/ProcessorVersionCreateResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.ProcessorVersion;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorVersionCreateResponse.Builder.class)
public final class ProcessorVersionCreateResponse {
private final boolean success;
private final ProcessorVersion processorVersion;
private final Map<String, Object> additionalProperties;
private ProcessorVersionCreateResponse(
boolean success, ProcessorVersion processorVersion, Map<String, Object> additionalProperties) {
this.success = success;
this.processorVersion = processorVersion;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("processorVersion")
public ProcessorVersion getProcessorVersion() {
return processorVersion;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorVersionCreateResponse && equalTo((ProcessorVersionCreateResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorVersionCreateResponse other) {
return success == other.success && processorVersion.equals(other.processorVersion);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.processorVersion);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
ProcessorVersionStage success(boolean success);
Builder from(ProcessorVersionCreateResponse other);
}
public interface ProcessorVersionStage {
_FinalStage processorVersion(@NotNull ProcessorVersion processorVersion);
}
public interface _FinalStage {
ProcessorVersionCreateResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, ProcessorVersionStage, _FinalStage {
private boolean success;
private ProcessorVersion processorVersion;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorVersionCreateResponse other) {
success(other.getSuccess());
processorVersion(other.getProcessorVersion());
return this;
}
@java.lang.Override
@JsonSetter("success")
public ProcessorVersionStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("processorVersion")
public _FinalStage processorVersion(@NotNull ProcessorVersion processorVersion) {
this.processorVersion = Objects.requireNonNull(processorVersion, "processorVersion must not be null");
return this;
}
@java.lang.Override
public ProcessorVersionCreateResponse build() {
return new ProcessorVersionCreateResponse(success, processorVersion, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/types/ProcessorVersionGetResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.ProcessorVersion;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorVersionGetResponse.Builder.class)
public final class ProcessorVersionGetResponse {
private final boolean success;
private final ProcessorVersion version;
private final Map<String, Object> additionalProperties;
private ProcessorVersionGetResponse(
boolean success, ProcessorVersion version, Map<String, Object> additionalProperties) {
this.success = success;
this.version = version;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
/**
* @return A ProcessorVersion object representing the requested version of the processor.
*/
@JsonProperty("version")
public ProcessorVersion getVersion() {
return version;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorVersionGetResponse && equalTo((ProcessorVersionGetResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorVersionGetResponse other) {
return success == other.success && version.equals(other.version);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.version);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
VersionStage success(boolean success);
Builder from(ProcessorVersionGetResponse other);
}
public interface VersionStage {
/**
* <p>A ProcessorVersion object representing the requested version of the processor.</p>
*/
_FinalStage version(@NotNull ProcessorVersion version);
}
public interface _FinalStage {
ProcessorVersionGetResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, VersionStage, _FinalStage {
private boolean success;
private ProcessorVersion version;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorVersionGetResponse other) {
success(other.getSuccess());
version(other.getVersion());
return this;
}
@java.lang.Override
@JsonSetter("success")
public VersionStage success(boolean success) {
this.success = success;
return this;
}
/**
* <p>A ProcessorVersion object representing the requested version of the processor.</p>
* <p>A ProcessorVersion object representing the requested version of the processor.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("version")
public _FinalStage version(@NotNull ProcessorVersion version) {
this.version = Objects.requireNonNull(version, "version must not be null");
return this;
}
@java.lang.Override
public ProcessorVersionGetResponse build() {
return new ProcessorVersionGetResponse(success, version, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/processorversion/types/ProcessorVersionListResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.processorversion.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.ProcessorVersion;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ProcessorVersionListResponse.Builder.class)
public final class ProcessorVersionListResponse {
private final boolean success;
private final List<ProcessorVersion> versions;
private final Map<String, Object> additionalProperties;
private ProcessorVersionListResponse(
boolean success, List<ProcessorVersion> versions, Map<String, Object> additionalProperties) {
this.success = success;
this.versions = versions;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
/**
* @return An array of ProcessorVersion objects representing all versions of the specified processor.
*/
@JsonProperty("versions")
public List<ProcessorVersion> getVersions() {
return versions;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ProcessorVersionListResponse && equalTo((ProcessorVersionListResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ProcessorVersionListResponse other) {
return success == other.success && versions.equals(other.versions);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.versions);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
_FinalStage success(boolean success);
Builder from(ProcessorVersionListResponse other);
}
public interface _FinalStage {
ProcessorVersionListResponse build();
/**
* <p>An array of ProcessorVersion objects representing all versions of the specified processor.</p>
*/
_FinalStage versions(List<ProcessorVersion> versions);
_FinalStage addVersions(ProcessorVersion versions);
_FinalStage addAllVersions(List<ProcessorVersion> versions);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, _FinalStage {
private boolean success;
private List<ProcessorVersion> versions = new ArrayList<>();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ProcessorVersionListResponse other) {
success(other.getSuccess());
versions(other.getVersions());
return this;
}
@java.lang.Override
@JsonSetter("success")
public _FinalStage success(boolean success) {
this.success = success;
return this;
}
/**
* <p>An array of ProcessorVersion objects representing all versions of the specified processor.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addAllVersions(List<ProcessorVersion> versions) {
this.versions.addAll(versions);
return this;
}
/**
* <p>An array of ProcessorVersion objects representing all versions of the specified processor.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addVersions(ProcessorVersion versions) {
this.versions.add(versions);
return this;
}
/**
* <p>An array of ProcessorVersion objects representing all versions of the specified processor.</p>
*/
@java.lang.Override
@JsonSetter(value = "versions", nulls = Nulls.SKIP)
public _FinalStage versions(List<ProcessorVersion> versions) {
this.versions.clear();
this.versions.addAll(versions);
return this;
}
@java.lang.Override
public ProcessorVersionListResponse build() {
return new ProcessorVersionListResponse(success, versions, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflow/AsyncRawWorkflowClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflow;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.workflow.requests.WorkflowCreateRequest;
import ai.extend.resources.workflow.types.WorkflowCreateResponse;
import ai.extend.types.Error;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;
public class AsyncRawWorkflowClient {
protected final ClientOptions clientOptions;
public AsyncRawWorkflowClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* Create a new workflow in Extend. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome.
* <p>This endpoint will create a new workflow in Extend, which can then be configured and deployed. Typically, workflows are created from our UI, however this endpoint can be used to create workflows programmatically. Configuration of the flow still needs to be done in the dashboard.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowCreateResponse>> create(WorkflowCreateRequest request) {
return create(request, null);
}
/**
* Create a new workflow in Extend. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome.
* <p>This endpoint will create a new workflow in Extend, which can then be configured and deployed. Typically, workflows are created from our UI, however this endpoint can be used to create workflows programmatically. Configuration of the flow still needs to be done in the dashboard.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowCreateResponse>> create(
WorkflowCreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflows")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<WorkflowCreateResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), WorkflowCreateResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflow/AsyncWorkflowClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflow;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.workflow.requests.WorkflowCreateRequest;
import ai.extend.resources.workflow.types.WorkflowCreateResponse;
import java.util.concurrent.CompletableFuture;
public class AsyncWorkflowClient {
protected final ClientOptions clientOptions;
private final AsyncRawWorkflowClient rawClient;
public AsyncWorkflowClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawWorkflowClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawWorkflowClient withRawResponse() {
return this.rawClient;
}
/**
* Create a new workflow in Extend. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome.
* <p>This endpoint will create a new workflow in Extend, which can then be configured and deployed. Typically, workflows are created from our UI, however this endpoint can be used to create workflows programmatically. Configuration of the flow still needs to be done in the dashboard.</p>
*/
public CompletableFuture<WorkflowCreateResponse> create(WorkflowCreateRequest request) {
return this.rawClient.create(request).thenApply(response -> response.body());
}
/**
* Create a new workflow in Extend. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome.
* <p>This endpoint will create a new workflow in Extend, which can then be configured and deployed. Typically, workflows are created from our UI, however this endpoint can be used to create workflows programmatically. Configuration of the flow still needs to be done in the dashboard.</p>
*/
public CompletableFuture<WorkflowCreateResponse> create(
WorkflowCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(request, requestOptions).thenApply(response -> response.body());
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflow/RawWorkflowClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflow;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.workflow.requests.WorkflowCreateRequest;
import ai.extend.resources.workflow.types.WorkflowCreateResponse;
import ai.extend.types.Error;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class RawWorkflowClient {
protected final ClientOptions clientOptions;
public RawWorkflowClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* Create a new workflow in Extend. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome.
* <p>This endpoint will create a new workflow in Extend, which can then be configured and deployed. Typically, workflows are created from our UI, however this endpoint can be used to create workflows programmatically. Configuration of the flow still needs to be done in the dashboard.</p>
*/
public ExtendClientHttpResponse<WorkflowCreateResponse> create(WorkflowCreateRequest request) {
return create(request, null);
}
/**
* Create a new workflow in Extend. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome.
* <p>This endpoint will create a new workflow in Extend, which can then be configured and deployed. Typically, workflows are created from our UI, however this endpoint can be used to create workflows programmatically. Configuration of the flow still needs to be done in the dashboard.</p>
*/
public ExtendClientHttpResponse<WorkflowCreateResponse> create(
WorkflowCreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflows")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), WorkflowCreateResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflow/WorkflowClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflow;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.workflow.requests.WorkflowCreateRequest;
import ai.extend.resources.workflow.types.WorkflowCreateResponse;
public class WorkflowClient {
protected final ClientOptions clientOptions;
private final RawWorkflowClient rawClient;
public WorkflowClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawWorkflowClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public RawWorkflowClient withRawResponse() {
return this.rawClient;
}
/**
* Create a new workflow in Extend. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome.
* <p>This endpoint will create a new workflow in Extend, which can then be configured and deployed. Typically, workflows are created from our UI, however this endpoint can be used to create workflows programmatically. Configuration of the flow still needs to be done in the dashboard.</p>
*/
public WorkflowCreateResponse create(WorkflowCreateRequest request) {
return this.rawClient.create(request).body();
}
/**
* Create a new workflow in Extend. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome.
* <p>This endpoint will create a new workflow in Extend, which can then be configured and deployed. Typically, workflows are created from our UI, however this endpoint can be used to create workflows programmatically. Configuration of the flow still needs to be done in the dashboard.</p>
*/
public WorkflowCreateResponse create(WorkflowCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(request, requestOptions).body();
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflow
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflow/requests/WorkflowCreateRequest.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflow.requests;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowCreateRequest.Builder.class)
public final class WorkflowCreateRequest {
private final String name;
private final Map<String, Object> additionalProperties;
private WorkflowCreateRequest(String name, Map<String, Object> additionalProperties) {
this.name = name;
this.additionalProperties = additionalProperties;
}
/**
* @return The name of the workflow
*/
@JsonProperty("name")
public String getName() {
return name;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowCreateRequest && equalTo((WorkflowCreateRequest) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowCreateRequest other) {
return name.equals(other.name);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.name);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static NameStage builder() {
return new Builder();
}
public interface NameStage {
/**
* <p>The name of the workflow</p>
*/
_FinalStage name(@NotNull String name);
Builder from(WorkflowCreateRequest other);
}
public interface _FinalStage {
WorkflowCreateRequest build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements NameStage, _FinalStage {
private String name;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowCreateRequest other) {
name(other.getName());
return this;
}
/**
* <p>The name of the workflow</p>
* <p>The name of the workflow</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("name")
public _FinalStage name(@NotNull String name) {
this.name = Objects.requireNonNull(name, "name must not be null");
return this;
}
@java.lang.Override
public WorkflowCreateRequest build() {
return new WorkflowCreateRequest(name, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflow
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflow/types/WorkflowCreateResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflow.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.Workflow;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowCreateResponse.Builder.class)
public final class WorkflowCreateResponse {
private final boolean success;
private final Workflow workflow;
private final Map<String, Object> additionalProperties;
private WorkflowCreateResponse(boolean success, Workflow workflow, Map<String, Object> additionalProperties) {
this.success = success;
this.workflow = workflow;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("workflow")
public Workflow getWorkflow() {
return workflow;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowCreateResponse && equalTo((WorkflowCreateResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowCreateResponse other) {
return success == other.success && workflow.equals(other.workflow);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.workflow);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
WorkflowStage success(boolean success);
Builder from(WorkflowCreateResponse other);
}
public interface WorkflowStage {
_FinalStage workflow(@NotNull Workflow workflow);
}
public interface _FinalStage {
WorkflowCreateResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, WorkflowStage, _FinalStage {
private boolean success;
private Workflow workflow;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowCreateResponse other) {
success(other.getSuccess());
workflow(other.getWorkflow());
return this;
}
@java.lang.Override
@JsonSetter("success")
public WorkflowStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("workflow")
public _FinalStage workflow(@NotNull Workflow workflow) {
this.workflow = Objects.requireNonNull(workflow, "workflow must not be null");
return this;
}
@java.lang.Override
public WorkflowCreateResponse build() {
return new WorkflowCreateResponse(success, workflow, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/AsyncRawWorkflowRunClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.QueryStringMapper;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.InternalServerError;
import ai.extend.errors.NotFoundError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.workflowrun.requests.WorkflowRunCreateRequest;
import ai.extend.resources.workflowrun.requests.WorkflowRunListRequest;
import ai.extend.resources.workflowrun.requests.WorkflowRunUpdateRequest;
import ai.extend.resources.workflowrun.types.WorkflowRunCreateResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunDeleteResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunGetResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunListResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunUpdateResponse;
import ai.extend.types.Error;
import ai.extend.types.ExtendError;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;
public class AsyncRawWorkflowRunClient {
protected final ClientOptions clientOptions;
public AsyncRawWorkflowRunClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunListResponse>> list() {
return list(WorkflowRunListRequest.builder().build());
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunListResponse>> list(WorkflowRunListRequest request) {
return list(request, null);
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunListResponse>> list(
WorkflowRunListRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs");
if (request.getStatus().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "status", request.getStatus().get(), false);
}
if (request.getWorkflowId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "workflowId", request.getWorkflowId().get(), false);
}
if (request.getBatchId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "batchId", request.getBatchId().get(), false);
}
if (request.getFileNameContains().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "fileNameContains", request.getFileNameContains().get(), false);
}
if (request.getSortBy().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "sortBy", request.getSortBy().get(), false);
}
if (request.getSortDir().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "sortDir", request.getSortDir().get(), false);
}
if (request.getNextPageToken().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "nextPageToken", request.getNextPageToken().get(), false);
}
if (request.getMaxPageSize().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "maxPageSize", request.getMaxPageSize().get(), false);
}
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json");
Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<WorkflowRunListResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), WorkflowRunListResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* Run a Workflow with files. A Workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun will be created for each file processed. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunCreateResponse>> create(
WorkflowRunCreateRequest request) {
return create(request, null);
}
/**
* Run a Workflow with files. A Workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun will be created for each file processed. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunCreateResponse>> create(
WorkflowRunCreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<WorkflowRunCreateResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), WorkflowRunCreateResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* Once a workflow has been run, you can check the status and output of a specific WorkflowRun.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunGetResponse>> get(String workflowRunId) {
return get(workflowRunId, null);
}
/**
* Once a workflow has been run, you can check the status and output of a specific WorkflowRun.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunGetResponse>> get(
String workflowRunId, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.addPathSegment(workflowRunId)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<WorkflowRunGetResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), WorkflowRunGetResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunUpdateResponse>> update(String workflowRunId) {
return update(workflowRunId, WorkflowRunUpdateRequest.builder().build());
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunUpdateResponse>> update(
String workflowRunId, WorkflowRunUpdateRequest request) {
return update(workflowRunId, request, null);
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunUpdateResponse>> update(
String workflowRunId, WorkflowRunUpdateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.addPathSegment(workflowRunId)
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<WorkflowRunUpdateResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), WorkflowRunUpdateResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
/**
* Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunDeleteResponse>> delete(String workflowRunId) {
return delete(workflowRunId, null);
}
/**
* Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunDeleteResponse>> delete(
String workflowRunId, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.addPathSegment(workflowRunId)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<WorkflowRunDeleteResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), WorkflowRunDeleteResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 500:
future.completeExceptionally(new InternalServerError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtendError.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/AsyncWorkflowRunClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.workflowrun.requests.WorkflowRunCreateRequest;
import ai.extend.resources.workflowrun.requests.WorkflowRunListRequest;
import ai.extend.resources.workflowrun.requests.WorkflowRunUpdateRequest;
import ai.extend.resources.workflowrun.types.WorkflowRunCreateResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunDeleteResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunGetResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunListResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunUpdateResponse;
import java.util.concurrent.CompletableFuture;
public class AsyncWorkflowRunClient {
protected final ClientOptions clientOptions;
private final AsyncRawWorkflowRunClient rawClient;
public AsyncWorkflowRunClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawWorkflowRunClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawWorkflowRunClient withRawResponse() {
return this.rawClient;
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<WorkflowRunListResponse> list() {
return this.rawClient.list().thenApply(response -> response.body());
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<WorkflowRunListResponse> list(WorkflowRunListRequest request) {
return this.rawClient.list(request).thenApply(response -> response.body());
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<WorkflowRunListResponse> list(
WorkflowRunListRequest request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
}
/**
* Run a Workflow with files. A Workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun will be created for each file processed. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<WorkflowRunCreateResponse> create(WorkflowRunCreateRequest request) {
return this.rawClient.create(request).thenApply(response -> response.body());
}
/**
* Run a Workflow with files. A Workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun will be created for each file processed. A WorkflowRun represents a single execution of a workflow against a file.
*/
public CompletableFuture<WorkflowRunCreateResponse> create(
WorkflowRunCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(request, requestOptions).thenApply(response -> response.body());
}
/**
* Once a workflow has been run, you can check the status and output of a specific WorkflowRun.
*/
public CompletableFuture<WorkflowRunGetResponse> get(String workflowRunId) {
return this.rawClient.get(workflowRunId).thenApply(response -> response.body());
}
/**
* Once a workflow has been run, you can check the status and output of a specific WorkflowRun.
*/
public CompletableFuture<WorkflowRunGetResponse> get(String workflowRunId, RequestOptions requestOptions) {
return this.rawClient.get(workflowRunId, requestOptions).thenApply(response -> response.body());
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public CompletableFuture<WorkflowRunUpdateResponse> update(String workflowRunId) {
return this.rawClient.update(workflowRunId).thenApply(response -> response.body());
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public CompletableFuture<WorkflowRunUpdateResponse> update(String workflowRunId, WorkflowRunUpdateRequest request) {
return this.rawClient.update(workflowRunId, request).thenApply(response -> response.body());
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public CompletableFuture<WorkflowRunUpdateResponse> update(
String workflowRunId, WorkflowRunUpdateRequest request, RequestOptions requestOptions) {
return this.rawClient.update(workflowRunId, request, requestOptions).thenApply(response -> response.body());
}
/**
* Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public CompletableFuture<WorkflowRunDeleteResponse> delete(String workflowRunId) {
return this.rawClient.delete(workflowRunId).thenApply(response -> response.body());
}
/**
* Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public CompletableFuture<WorkflowRunDeleteResponse> delete(String workflowRunId, RequestOptions requestOptions) {
return this.rawClient.delete(workflowRunId, requestOptions).thenApply(response -> response.body());
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/RawWorkflowRunClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.QueryStringMapper;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.InternalServerError;
import ai.extend.errors.NotFoundError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.workflowrun.requests.WorkflowRunCreateRequest;
import ai.extend.resources.workflowrun.requests.WorkflowRunListRequest;
import ai.extend.resources.workflowrun.requests.WorkflowRunUpdateRequest;
import ai.extend.resources.workflowrun.types.WorkflowRunCreateResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunDeleteResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunGetResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunListResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunUpdateResponse;
import ai.extend.types.Error;
import ai.extend.types.ExtendError;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class RawWorkflowRunClient {
protected final ClientOptions clientOptions;
public RawWorkflowRunClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public ExtendClientHttpResponse<WorkflowRunListResponse> list() {
return list(WorkflowRunListRequest.builder().build());
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public ExtendClientHttpResponse<WorkflowRunListResponse> list(WorkflowRunListRequest request) {
return list(request, null);
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public ExtendClientHttpResponse<WorkflowRunListResponse> list(
WorkflowRunListRequest request, RequestOptions requestOptions) {
HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs");
if (request.getStatus().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "status", request.getStatus().get(), false);
}
if (request.getWorkflowId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "workflowId", request.getWorkflowId().get(), false);
}
if (request.getBatchId().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "batchId", request.getBatchId().get(), false);
}
if (request.getFileNameContains().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "fileNameContains", request.getFileNameContains().get(), false);
}
if (request.getSortBy().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "sortBy", request.getSortBy().get(), false);
}
if (request.getSortDir().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "sortDir", request.getSortDir().get(), false);
}
if (request.getNextPageToken().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "nextPageToken", request.getNextPageToken().get(), false);
}
if (request.getMaxPageSize().isPresent()) {
QueryStringMapper.addQueryParameter(
httpUrl, "maxPageSize", request.getMaxPageSize().get(), false);
}
Request.Builder _requestBuilder = new Request.Builder()
.url(httpUrl.build())
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json");
Request okhttpRequest = _requestBuilder.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), WorkflowRunListResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* Run a Workflow with files. A Workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun will be created for each file processed. A WorkflowRun represents a single execution of a workflow against a file.
*/
public ExtendClientHttpResponse<WorkflowRunCreateResponse> create(WorkflowRunCreateRequest request) {
return create(request, null);
}
/**
* Run a Workflow with files. A Workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun will be created for each file processed. A WorkflowRun represents a single execution of a workflow against a file.
*/
public ExtendClientHttpResponse<WorkflowRunCreateResponse> create(
WorkflowRunCreateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), WorkflowRunCreateResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* Once a workflow has been run, you can check the status and output of a specific WorkflowRun.
*/
public ExtendClientHttpResponse<WorkflowRunGetResponse> get(String workflowRunId) {
return get(workflowRunId, null);
}
/**
* Once a workflow has been run, you can check the status and output of a specific WorkflowRun.
*/
public ExtendClientHttpResponse<WorkflowRunGetResponse> get(String workflowRunId, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.addPathSegment(workflowRunId)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("GET", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), WorkflowRunGetResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public ExtendClientHttpResponse<WorkflowRunUpdateResponse> update(String workflowRunId) {
return update(workflowRunId, WorkflowRunUpdateRequest.builder().build());
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public ExtendClientHttpResponse<WorkflowRunUpdateResponse> update(
String workflowRunId, WorkflowRunUpdateRequest request) {
return update(workflowRunId, request, null);
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public ExtendClientHttpResponse<WorkflowRunUpdateResponse> update(
String workflowRunId, WorkflowRunUpdateRequest request, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.addPathSegment(workflowRunId)
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), WorkflowRunUpdateResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
/**
* Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public ExtendClientHttpResponse<WorkflowRunDeleteResponse> delete(String workflowRunId) {
return delete(workflowRunId, null);
}
/**
* Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public ExtendClientHttpResponse<WorkflowRunDeleteResponse> delete(
String workflowRunId, RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.addPathSegment(workflowRunId)
.build();
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("DELETE", null)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), WorkflowRunDeleteResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 500:
throw new InternalServerError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtendError.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/WorkflowRunClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.workflowrun.requests.WorkflowRunCreateRequest;
import ai.extend.resources.workflowrun.requests.WorkflowRunListRequest;
import ai.extend.resources.workflowrun.requests.WorkflowRunUpdateRequest;
import ai.extend.resources.workflowrun.types.WorkflowRunCreateResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunDeleteResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunGetResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunListResponse;
import ai.extend.resources.workflowrun.types.WorkflowRunUpdateResponse;
public class WorkflowRunClient {
protected final ClientOptions clientOptions;
private final RawWorkflowRunClient rawClient;
public WorkflowRunClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawWorkflowRunClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public RawWorkflowRunClient withRawResponse() {
return this.rawClient;
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public WorkflowRunListResponse list() {
return this.rawClient.list().body();
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public WorkflowRunListResponse list(WorkflowRunListRequest request) {
return this.rawClient.list(request).body();
}
/**
* List runs of a Workflow. Workflows are sequences of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun represents a single execution of a workflow against a file.
*/
public WorkflowRunListResponse list(WorkflowRunListRequest request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).body();
}
/**
* Run a Workflow with files. A Workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun will be created for each file processed. A WorkflowRun represents a single execution of a workflow against a file.
*/
public WorkflowRunCreateResponse create(WorkflowRunCreateRequest request) {
return this.rawClient.create(request).body();
}
/**
* Run a Workflow with files. A Workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. A WorkflowRun will be created for each file processed. A WorkflowRun represents a single execution of a workflow against a file.
*/
public WorkflowRunCreateResponse create(WorkflowRunCreateRequest request, RequestOptions requestOptions) {
return this.rawClient.create(request, requestOptions).body();
}
/**
* Once a workflow has been run, you can check the status and output of a specific WorkflowRun.
*/
public WorkflowRunGetResponse get(String workflowRunId) {
return this.rawClient.get(workflowRunId).body();
}
/**
* Once a workflow has been run, you can check the status and output of a specific WorkflowRun.
*/
public WorkflowRunGetResponse get(String workflowRunId, RequestOptions requestOptions) {
return this.rawClient.get(workflowRunId, requestOptions).body();
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public WorkflowRunUpdateResponse update(String workflowRunId) {
return this.rawClient.update(workflowRunId).body();
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public WorkflowRunUpdateResponse update(String workflowRunId, WorkflowRunUpdateRequest request) {
return this.rawClient.update(workflowRunId, request).body();
}
/**
* You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint.
*/
public WorkflowRunUpdateResponse update(
String workflowRunId, WorkflowRunUpdateRequest request, RequestOptions requestOptions) {
return this.rawClient.update(workflowRunId, request, requestOptions).body();
}
/**
* Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public WorkflowRunDeleteResponse delete(String workflowRunId) {
return this.rawClient.delete(workflowRunId).body();
}
/**
* Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone.
* <p>This endpoint can be used if you'd like to manage data retention on your own rather than automated data retention policies. Or make one-off deletions for your downstream customers.</p>
*/
public WorkflowRunDeleteResponse delete(String workflowRunId, RequestOptions requestOptions) {
return this.rawClient.delete(workflowRunId, requestOptions).body();
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/requests/WorkflowRunCreateRequest.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun.requests;
import ai.extend.core.ObjectMappers;
import ai.extend.types.WorkflowRunFileInput;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunCreateRequest.Builder.class)
public final class WorkflowRunCreateRequest {
private final String workflowId;
private final Optional<List<WorkflowRunFileInput>> files;
private final Optional<List<String>> rawTexts;
private final Optional<String> version;
private final Optional<Integer> priority;
private final Optional<Map<String, Object>> metadata;
private final Map<String, Object> additionalProperties;
private WorkflowRunCreateRequest(
String workflowId,
Optional<List<WorkflowRunFileInput>> files,
Optional<List<String>> rawTexts,
Optional<String> version,
Optional<Integer> priority,
Optional<Map<String, Object>> metadata,
Map<String, Object> additionalProperties) {
this.workflowId = workflowId;
this.files = files;
this.rawTexts = rawTexts;
this.version = version;
this.priority = priority;
this.metadata = metadata;
this.additionalProperties = additionalProperties;
}
/**
* @return The ID of the workflow to run.
* <p>Example: <code>"workflow_BMdfq_yWM3sT-ZzvCnA3f"</code></p>
*/
@JsonProperty("workflowId")
public String getWorkflowId() {
return workflowId;
}
/**
* @return An array of files to process through the workflow. Either the <code>files</code> array or <code>rawTexts</code> array must be provided. Supported file types can be found <a href="/product/supported-file-types">here</a>. There is a limit if 50 files that can be processed at once using this endpoint. If you wish to process more at a time, consider using the <a href="/developers/api-reference/workflow-endpoints/batch-run-workflow">Batch Run Workflow</a> endpoint.
*/
@JsonProperty("files")
public Optional<List<WorkflowRunFileInput>> getFiles() {
return files;
}
/**
* @return An array of raw strings. Can be used in place of files when passing raw data. The raw data will be converted to <code>.txt</code> files and run through the workflow. If the data follows a specific format, it is recommended to use the files parameter instead. Either <code>files</code> or <code>rawTexts</code> must be provided.
*/
@JsonProperty("rawTexts")
public Optional<List<String>> getRawTexts() {
return rawTexts;
}
/**
* @return An optional version of the workflow that files will be run through. This number can be found when viewing the workflow on the Extend platform. When a version number is not supplied, the most recent published version of the workflow will be used. If no published versions exist, the draft version will be used. To run the <code>"draft"</code> version of a workflow, use <code>"draft"</code> as the version.
* <p>Examples:</p>
* <ul>
* <li><code>"3"</code> - Run version 3 of the workflow</li>
* <li><code>"draft"</code> - Run the draft version of the workflow</li>
* </ul>
*/
@JsonProperty("version")
public Optional<String> getVersion() {
return version;
}
/**
* @return An optional value used to determine the relative order of WorkflowRuns when rate limiting is in effect. Lower values will be prioritized before higher values.
*/
@JsonProperty("priority")
public Optional<Integer> getPriority() {
return priority;
}
/**
* @return A optional metadata object that can be assigned to a specific WorkflowRun to help identify it. It will be returned in the response and webhooks. You can place any arbitrary <code>key : value</code> pairs in this object.
*/
@JsonProperty("metadata")
public Optional<Map<String, Object>> getMetadata() {
return metadata;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunCreateRequest && equalTo((WorkflowRunCreateRequest) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunCreateRequest other) {
return workflowId.equals(other.workflowId)
&& files.equals(other.files)
&& rawTexts.equals(other.rawTexts)
&& version.equals(other.version)
&& priority.equals(other.priority)
&& metadata.equals(other.metadata);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.workflowId, this.files, this.rawTexts, this.version, this.priority, this.metadata);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static WorkflowIdStage builder() {
return new Builder();
}
public interface WorkflowIdStage {
/**
* <p>The ID of the workflow to run.</p>
* <p>Example: <code>"workflow_BMdfq_yWM3sT-ZzvCnA3f"</code></p>
*/
_FinalStage workflowId(@NotNull String workflowId);
Builder from(WorkflowRunCreateRequest other);
}
public interface _FinalStage {
WorkflowRunCreateRequest build();
/**
* <p>An array of files to process through the workflow. Either the <code>files</code> array or <code>rawTexts</code> array must be provided. Supported file types can be found <a href="/product/supported-file-types">here</a>. There is a limit if 50 files that can be processed at once using this endpoint. If you wish to process more at a time, consider using the <a href="/developers/api-reference/workflow-endpoints/batch-run-workflow">Batch Run Workflow</a> endpoint.</p>
*/
_FinalStage files(Optional<List<WorkflowRunFileInput>> files);
_FinalStage files(List<WorkflowRunFileInput> files);
/**
* <p>An array of raw strings. Can be used in place of files when passing raw data. The raw data will be converted to <code>.txt</code> files and run through the workflow. If the data follows a specific format, it is recommended to use the files parameter instead. Either <code>files</code> or <code>rawTexts</code> must be provided.</p>
*/
_FinalStage rawTexts(Optional<List<String>> rawTexts);
_FinalStage rawTexts(List<String> rawTexts);
/**
* <p>An optional version of the workflow that files will be run through. This number can be found when viewing the workflow on the Extend platform. When a version number is not supplied, the most recent published version of the workflow will be used. If no published versions exist, the draft version will be used. To run the <code>"draft"</code> version of a workflow, use <code>"draft"</code> as the version.</p>
* <p>Examples:</p>
* <ul>
* <li><code>"3"</code> - Run version 3 of the workflow</li>
* <li><code>"draft"</code> - Run the draft version of the workflow</li>
* </ul>
*/
_FinalStage version(Optional<String> version);
_FinalStage version(String version);
/**
* <p>An optional value used to determine the relative order of WorkflowRuns when rate limiting is in effect. Lower values will be prioritized before higher values.</p>
*/
_FinalStage priority(Optional<Integer> priority);
_FinalStage priority(Integer priority);
/**
* <p>A optional metadata object that can be assigned to a specific WorkflowRun to help identify it. It will be returned in the response and webhooks. You can place any arbitrary <code>key : value</code> pairs in this object.</p>
*/
_FinalStage metadata(Optional<Map<String, Object>> metadata);
_FinalStage metadata(Map<String, Object> metadata);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements WorkflowIdStage, _FinalStage {
private String workflowId;
private Optional<Map<String, Object>> metadata = Optional.empty();
private Optional<Integer> priority = Optional.empty();
private Optional<String> version = Optional.empty();
private Optional<List<String>> rawTexts = Optional.empty();
private Optional<List<WorkflowRunFileInput>> files = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowRunCreateRequest other) {
workflowId(other.getWorkflowId());
files(other.getFiles());
rawTexts(other.getRawTexts());
version(other.getVersion());
priority(other.getPriority());
metadata(other.getMetadata());
return this;
}
/**
* <p>The ID of the workflow to run.</p>
* <p>Example: <code>"workflow_BMdfq_yWM3sT-ZzvCnA3f"</code></p>
* <p>The ID of the workflow to run.</p>
* <p>Example: <code>"workflow_BMdfq_yWM3sT-ZzvCnA3f"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("workflowId")
public _FinalStage workflowId(@NotNull String workflowId) {
this.workflowId = Objects.requireNonNull(workflowId, "workflowId must not be null");
return this;
}
/**
* <p>A optional metadata object that can be assigned to a specific WorkflowRun to help identify it. It will be returned in the response and webhooks. You can place any arbitrary <code>key : value</code> pairs in this object.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage metadata(Map<String, Object> metadata) {
this.metadata = Optional.ofNullable(metadata);
return this;
}
/**
* <p>A optional metadata object that can be assigned to a specific WorkflowRun to help identify it. It will be returned in the response and webhooks. You can place any arbitrary <code>key : value</code> pairs in this object.</p>
*/
@java.lang.Override
@JsonSetter(value = "metadata", nulls = Nulls.SKIP)
public _FinalStage metadata(Optional<Map<String, Object>> metadata) {
this.metadata = metadata;
return this;
}
/**
* <p>An optional value used to determine the relative order of WorkflowRuns when rate limiting is in effect. Lower values will be prioritized before higher values.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage priority(Integer priority) {
this.priority = Optional.ofNullable(priority);
return this;
}
/**
* <p>An optional value used to determine the relative order of WorkflowRuns when rate limiting is in effect. Lower values will be prioritized before higher values.</p>
*/
@java.lang.Override
@JsonSetter(value = "priority", nulls = Nulls.SKIP)
public _FinalStage priority(Optional<Integer> priority) {
this.priority = priority;
return this;
}
/**
* <p>An optional version of the workflow that files will be run through. This number can be found when viewing the workflow on the Extend platform. When a version number is not supplied, the most recent published version of the workflow will be used. If no published versions exist, the draft version will be used. To run the <code>"draft"</code> version of a workflow, use <code>"draft"</code> as the version.</p>
* <p>Examples:</p>
* <ul>
* <li><code>"3"</code> - Run version 3 of the workflow</li>
* <li><code>"draft"</code> - Run the draft version of the workflow</li>
* </ul>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage version(String version) {
this.version = Optional.ofNullable(version);
return this;
}
/**
* <p>An optional version of the workflow that files will be run through. This number can be found when viewing the workflow on the Extend platform. When a version number is not supplied, the most recent published version of the workflow will be used. If no published versions exist, the draft version will be used. To run the <code>"draft"</code> version of a workflow, use <code>"draft"</code> as the version.</p>
* <p>Examples:</p>
* <ul>
* <li><code>"3"</code> - Run version 3 of the workflow</li>
* <li><code>"draft"</code> - Run the draft version of the workflow</li>
* </ul>
*/
@java.lang.Override
@JsonSetter(value = "version", nulls = Nulls.SKIP)
public _FinalStage version(Optional<String> version) {
this.version = version;
return this;
}
/**
* <p>An array of raw strings. Can be used in place of files when passing raw data. The raw data will be converted to <code>.txt</code> files and run through the workflow. If the data follows a specific format, it is recommended to use the files parameter instead. Either <code>files</code> or <code>rawTexts</code> must be provided.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage rawTexts(List<String> rawTexts) {
this.rawTexts = Optional.ofNullable(rawTexts);
return this;
}
/**
* <p>An array of raw strings. Can be used in place of files when passing raw data. The raw data will be converted to <code>.txt</code> files and run through the workflow. If the data follows a specific format, it is recommended to use the files parameter instead. Either <code>files</code> or <code>rawTexts</code> must be provided.</p>
*/
@java.lang.Override
@JsonSetter(value = "rawTexts", nulls = Nulls.SKIP)
public _FinalStage rawTexts(Optional<List<String>> rawTexts) {
this.rawTexts = rawTexts;
return this;
}
/**
* <p>An array of files to process through the workflow. Either the <code>files</code> array or <code>rawTexts</code> array must be provided. Supported file types can be found <a href="/product/supported-file-types">here</a>. There is a limit if 50 files that can be processed at once using this endpoint. If you wish to process more at a time, consider using the <a href="/developers/api-reference/workflow-endpoints/batch-run-workflow">Batch Run Workflow</a> endpoint.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage files(List<WorkflowRunFileInput> files) {
this.files = Optional.ofNullable(files);
return this;
}
/**
* <p>An array of files to process through the workflow. Either the <code>files</code> array or <code>rawTexts</code> array must be provided. Supported file types can be found <a href="/product/supported-file-types">here</a>. There is a limit if 50 files that can be processed at once using this endpoint. If you wish to process more at a time, consider using the <a href="/developers/api-reference/workflow-endpoints/batch-run-workflow">Batch Run Workflow</a> endpoint.</p>
*/
@java.lang.Override
@JsonSetter(value = "files", nulls = Nulls.SKIP)
public _FinalStage files(Optional<List<WorkflowRunFileInput>> files) {
this.files = files;
return this;
}
@java.lang.Override
public WorkflowRunCreateRequest build() {
return new WorkflowRunCreateRequest(
workflowId, files, rawTexts, version, priority, metadata, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/requests/WorkflowRunListRequest.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun.requests;
import ai.extend.core.ObjectMappers;
import ai.extend.types.SortByEnum;
import ai.extend.types.SortDirEnum;
import ai.extend.types.WorkflowStatus;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunListRequest.Builder.class)
public final class WorkflowRunListRequest {
private final Optional<WorkflowStatus> status;
private final Optional<String> workflowId;
private final Optional<String> batchId;
private final Optional<String> fileNameContains;
private final Optional<SortByEnum> sortBy;
private final Optional<SortDirEnum> sortDir;
private final Optional<String> nextPageToken;
private final Optional<Integer> maxPageSize;
private final Map<String, Object> additionalProperties;
private WorkflowRunListRequest(
Optional<WorkflowStatus> status,
Optional<String> workflowId,
Optional<String> batchId,
Optional<String> fileNameContains,
Optional<SortByEnum> sortBy,
Optional<SortDirEnum> sortDir,
Optional<String> nextPageToken,
Optional<Integer> maxPageSize,
Map<String, Object> additionalProperties) {
this.status = status;
this.workflowId = workflowId;
this.batchId = batchId;
this.fileNameContains = fileNameContains;
this.sortBy = sortBy;
this.sortDir = sortDir;
this.nextPageToken = nextPageToken;
this.maxPageSize = maxPageSize;
this.additionalProperties = additionalProperties;
}
/**
* @return Filters workflow runs by their status. If not provided, no filter is applied.
* <p>The status of a workflow run:</p>
* <ul>
* <li><code>"PENDING"</code> - The workflow run has not started yet</li>
* <li><code>"PROCESSING"</code> - The workflow run is in progress</li>
* <li><code>"NEEDS_REVIEW"</code> - The workflow run requires manual review</li>
* <li><code>"REJECTED"</code> - The workflow run was rejected during manual review</li>
* <li><code>"PROCESSED"</code> - The workflow run completed successfully</li>
* <li><code>"FAILED"</code> - The workflow run encountered an error</li>
* </ul>
*/
@JsonProperty("status")
public Optional<WorkflowStatus> getStatus() {
return status;
}
/**
* @return Filters workflow runs by the workflow ID. If not provided, runs for all workflows are returned.
* <p>Example: <code>"workflow_BMdfq_yWM3sT-ZzvCnA3f"</code></p>
*/
@JsonProperty("workflowId")
public Optional<String> getWorkflowId() {
return workflowId;
}
/**
* @return Filters workflow runs by the batch ID. This is useful for fetching all runs for a given batch created via the <a href="/developers/api-reference/workflow-endpoints/batch-run-workflow">Batch Run Workflow</a> endpoint.
* <p>Example: <code>"batch_7Ws31-F5"</code></p>
*/
@JsonProperty("batchId")
public Optional<String> getBatchId() {
return batchId;
}
/**
* @return Filters workflow runs by the name of the file. Only returns workflow runs where the file name contains this string.
* <p>Example: <code>"invoice"</code></p>
*/
@JsonProperty("fileNameContains")
public Optional<String> getFileNameContains() {
return fileNameContains;
}
/**
* @return Sorts the workflow runs by the given field.
*/
@JsonProperty("sortBy")
public Optional<SortByEnum> getSortBy() {
return sortBy;
}
/**
* @return Sorts the workflow runs in ascending or descending order. Ascending order means the earliest workflow run is returned first.
*/
@JsonProperty("sortDir")
public Optional<SortDirEnum> getSortDir() {
return sortDir;
}
@JsonProperty("nextPageToken")
public Optional<String> getNextPageToken() {
return nextPageToken;
}
@JsonProperty("maxPageSize")
public Optional<Integer> getMaxPageSize() {
return maxPageSize;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunListRequest && equalTo((WorkflowRunListRequest) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunListRequest other) {
return status.equals(other.status)
&& workflowId.equals(other.workflowId)
&& batchId.equals(other.batchId)
&& fileNameContains.equals(other.fileNameContains)
&& sortBy.equals(other.sortBy)
&& sortDir.equals(other.sortDir)
&& nextPageToken.equals(other.nextPageToken)
&& maxPageSize.equals(other.maxPageSize);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.status,
this.workflowId,
this.batchId,
this.fileNameContains,
this.sortBy,
this.sortDir,
this.nextPageToken,
this.maxPageSize);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<WorkflowStatus> status = Optional.empty();
private Optional<String> workflowId = Optional.empty();
private Optional<String> batchId = Optional.empty();
private Optional<String> fileNameContains = Optional.empty();
private Optional<SortByEnum> sortBy = Optional.empty();
private Optional<SortDirEnum> sortDir = Optional.empty();
private Optional<String> nextPageToken = Optional.empty();
private Optional<Integer> maxPageSize = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(WorkflowRunListRequest other) {
status(other.getStatus());
workflowId(other.getWorkflowId());
batchId(other.getBatchId());
fileNameContains(other.getFileNameContains());
sortBy(other.getSortBy());
sortDir(other.getSortDir());
nextPageToken(other.getNextPageToken());
maxPageSize(other.getMaxPageSize());
return this;
}
/**
* <p>Filters workflow runs by their status. If not provided, no filter is applied.</p>
* <p>The status of a workflow run:</p>
* <ul>
* <li><code>"PENDING"</code> - The workflow run has not started yet</li>
* <li><code>"PROCESSING"</code> - The workflow run is in progress</li>
* <li><code>"NEEDS_REVIEW"</code> - The workflow run requires manual review</li>
* <li><code>"REJECTED"</code> - The workflow run was rejected during manual review</li>
* <li><code>"PROCESSED"</code> - The workflow run completed successfully</li>
* <li><code>"FAILED"</code> - The workflow run encountered an error</li>
* </ul>
*/
@JsonSetter(value = "status", nulls = Nulls.SKIP)
public Builder status(Optional<WorkflowStatus> status) {
this.status = status;
return this;
}
public Builder status(WorkflowStatus status) {
this.status = Optional.ofNullable(status);
return this;
}
/**
* <p>Filters workflow runs by the workflow ID. If not provided, runs for all workflows are returned.</p>
* <p>Example: <code>"workflow_BMdfq_yWM3sT-ZzvCnA3f"</code></p>
*/
@JsonSetter(value = "workflowId", nulls = Nulls.SKIP)
public Builder workflowId(Optional<String> workflowId) {
this.workflowId = workflowId;
return this;
}
public Builder workflowId(String workflowId) {
this.workflowId = Optional.ofNullable(workflowId);
return this;
}
/**
* <p>Filters workflow runs by the batch ID. This is useful for fetching all runs for a given batch created via the <a href="/developers/api-reference/workflow-endpoints/batch-run-workflow">Batch Run Workflow</a> endpoint.</p>
* <p>Example: <code>"batch_7Ws31-F5"</code></p>
*/
@JsonSetter(value = "batchId", nulls = Nulls.SKIP)
public Builder batchId(Optional<String> batchId) {
this.batchId = batchId;
return this;
}
public Builder batchId(String batchId) {
this.batchId = Optional.ofNullable(batchId);
return this;
}
/**
* <p>Filters workflow runs by the name of the file. Only returns workflow runs where the file name contains this string.</p>
* <p>Example: <code>"invoice"</code></p>
*/
@JsonSetter(value = "fileNameContains", nulls = Nulls.SKIP)
public Builder fileNameContains(Optional<String> fileNameContains) {
this.fileNameContains = fileNameContains;
return this;
}
public Builder fileNameContains(String fileNameContains) {
this.fileNameContains = Optional.ofNullable(fileNameContains);
return this;
}
/**
* <p>Sorts the workflow runs by the given field.</p>
*/
@JsonSetter(value = "sortBy", nulls = Nulls.SKIP)
public Builder sortBy(Optional<SortByEnum> sortBy) {
this.sortBy = sortBy;
return this;
}
public Builder sortBy(SortByEnum sortBy) {
this.sortBy = Optional.ofNullable(sortBy);
return this;
}
/**
* <p>Sorts the workflow runs in ascending or descending order. Ascending order means the earliest workflow run is returned first.</p>
*/
@JsonSetter(value = "sortDir", nulls = Nulls.SKIP)
public Builder sortDir(Optional<SortDirEnum> sortDir) {
this.sortDir = sortDir;
return this;
}
public Builder sortDir(SortDirEnum sortDir) {
this.sortDir = Optional.ofNullable(sortDir);
return this;
}
@JsonSetter(value = "nextPageToken", nulls = Nulls.SKIP)
public Builder nextPageToken(Optional<String> nextPageToken) {
this.nextPageToken = nextPageToken;
return this;
}
public Builder nextPageToken(String nextPageToken) {
this.nextPageToken = Optional.ofNullable(nextPageToken);
return this;
}
@JsonSetter(value = "maxPageSize", nulls = Nulls.SKIP)
public Builder maxPageSize(Optional<Integer> maxPageSize) {
this.maxPageSize = maxPageSize;
return this;
}
public Builder maxPageSize(Integer maxPageSize) {
this.maxPageSize = Optional.ofNullable(maxPageSize);
return this;
}
public WorkflowRunListRequest build() {
return new WorkflowRunListRequest(
status,
workflowId,
batchId,
fileNameContains,
sortBy,
sortDir,
nextPageToken,
maxPageSize,
additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/requests/WorkflowRunUpdateRequest.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun.requests;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunUpdateRequest.Builder.class)
public final class WorkflowRunUpdateRequest {
private final Optional<String> name;
private final Optional<Map<String, Object>> metadata;
private final Map<String, Object> additionalProperties;
private WorkflowRunUpdateRequest(
Optional<String> name, Optional<Map<String, Object>> metadata, Map<String, Object> additionalProperties) {
this.name = name;
this.metadata = metadata;
this.additionalProperties = additionalProperties;
}
/**
* @return An optional name that can be assigned to a specific WorkflowRun
*/
@JsonProperty("name")
public Optional<String> getName() {
return name;
}
/**
* @return A metadata object that can be assigned to a specific WorkflowRun. If metadata already exists on this WorkflowRun, the newly incoming metadata will be merged with the existing metadata, with the incoming metadata taking field precedence.
* <p>You can include any arbitrary <code>key : value</code> pairs in this object.</p>
*/
@JsonProperty("metadata")
public Optional<Map<String, Object>> getMetadata() {
return metadata;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunUpdateRequest && equalTo((WorkflowRunUpdateRequest) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunUpdateRequest other) {
return name.equals(other.name) && metadata.equals(other.metadata);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.name, this.metadata);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<String> name = Optional.empty();
private Optional<Map<String, Object>> metadata = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(WorkflowRunUpdateRequest other) {
name(other.getName());
metadata(other.getMetadata());
return this;
}
/**
* <p>An optional name that can be assigned to a specific WorkflowRun</p>
*/
@JsonSetter(value = "name", nulls = Nulls.SKIP)
public Builder name(Optional<String> name) {
this.name = name;
return this;
}
public Builder name(String name) {
this.name = Optional.ofNullable(name);
return this;
}
/**
* <p>A metadata object that can be assigned to a specific WorkflowRun. If metadata already exists on this WorkflowRun, the newly incoming metadata will be merged with the existing metadata, with the incoming metadata taking field precedence.</p>
* <p>You can include any arbitrary <code>key : value</code> pairs in this object.</p>
*/
@JsonSetter(value = "metadata", nulls = Nulls.SKIP)
public Builder metadata(Optional<Map<String, Object>> metadata) {
this.metadata = metadata;
return this;
}
public Builder metadata(Map<String, Object> metadata) {
this.metadata = Optional.ofNullable(metadata);
return this;
}
public WorkflowRunUpdateRequest build() {
return new WorkflowRunUpdateRequest(name, metadata, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/types/WorkflowRunCreateResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.WorkflowRun;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunCreateResponse.Builder.class)
public final class WorkflowRunCreateResponse {
private final boolean success;
private final List<WorkflowRun> workflowRuns;
private final Map<String, Object> additionalProperties;
private WorkflowRunCreateResponse(
boolean success, List<WorkflowRun> workflowRuns, Map<String, Object> additionalProperties) {
this.success = success;
this.workflowRuns = workflowRuns;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
/**
* @return An array of WorkflowRun objects, with each WorkflowRun corresponding to a single File that was passed in.
*/
@JsonProperty("workflowRuns")
public List<WorkflowRun> getWorkflowRuns() {
return workflowRuns;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunCreateResponse && equalTo((WorkflowRunCreateResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunCreateResponse other) {
return success == other.success && workflowRuns.equals(other.workflowRuns);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.workflowRuns);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
_FinalStage success(boolean success);
Builder from(WorkflowRunCreateResponse other);
}
public interface _FinalStage {
WorkflowRunCreateResponse build();
/**
* <p>An array of WorkflowRun objects, with each WorkflowRun corresponding to a single File that was passed in.</p>
*/
_FinalStage workflowRuns(List<WorkflowRun> workflowRuns);
_FinalStage addWorkflowRuns(WorkflowRun workflowRuns);
_FinalStage addAllWorkflowRuns(List<WorkflowRun> workflowRuns);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, _FinalStage {
private boolean success;
private List<WorkflowRun> workflowRuns = new ArrayList<>();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowRunCreateResponse other) {
success(other.getSuccess());
workflowRuns(other.getWorkflowRuns());
return this;
}
@java.lang.Override
@JsonSetter("success")
public _FinalStage success(boolean success) {
this.success = success;
return this;
}
/**
* <p>An array of WorkflowRun objects, with each WorkflowRun corresponding to a single File that was passed in.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addAllWorkflowRuns(List<WorkflowRun> workflowRuns) {
this.workflowRuns.addAll(workflowRuns);
return this;
}
/**
* <p>An array of WorkflowRun objects, with each WorkflowRun corresponding to a single File that was passed in.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addWorkflowRuns(WorkflowRun workflowRuns) {
this.workflowRuns.add(workflowRuns);
return this;
}
/**
* <p>An array of WorkflowRun objects, with each WorkflowRun corresponding to a single File that was passed in.</p>
*/
@java.lang.Override
@JsonSetter(value = "workflowRuns", nulls = Nulls.SKIP)
public _FinalStage workflowRuns(List<WorkflowRun> workflowRuns) {
this.workflowRuns.clear();
this.workflowRuns.addAll(workflowRuns);
return this;
}
@java.lang.Override
public WorkflowRunCreateResponse build() {
return new WorkflowRunCreateResponse(success, workflowRuns, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/types/WorkflowRunDeleteResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunDeleteResponse.Builder.class)
public final class WorkflowRunDeleteResponse {
private final boolean success;
private final String workflowRunId;
private final String message;
private final Map<String, Object> additionalProperties;
private WorkflowRunDeleteResponse(
boolean success, String workflowRunId, String message, Map<String, Object> additionalProperties) {
this.success = success;
this.workflowRunId = workflowRunId;
this.message = message;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
/**
* @return The ID of the deleted workflow run
*/
@JsonProperty("workflowRunId")
public String getWorkflowRunId() {
return workflowRunId;
}
/**
* @return Confirmation message
*/
@JsonProperty("message")
public String getMessage() {
return message;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunDeleteResponse && equalTo((WorkflowRunDeleteResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunDeleteResponse other) {
return success == other.success && workflowRunId.equals(other.workflowRunId) && message.equals(other.message);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.workflowRunId, this.message);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
WorkflowRunIdStage success(boolean success);
Builder from(WorkflowRunDeleteResponse other);
}
public interface WorkflowRunIdStage {
/**
* <p>The ID of the deleted workflow run</p>
*/
MessageStage workflowRunId(@NotNull String workflowRunId);
}
public interface MessageStage {
/**
* <p>Confirmation message</p>
*/
_FinalStage message(@NotNull String message);
}
public interface _FinalStage {
WorkflowRunDeleteResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, WorkflowRunIdStage, MessageStage, _FinalStage {
private boolean success;
private String workflowRunId;
private String message;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowRunDeleteResponse other) {
success(other.getSuccess());
workflowRunId(other.getWorkflowRunId());
message(other.getMessage());
return this;
}
@java.lang.Override
@JsonSetter("success")
public WorkflowRunIdStage success(boolean success) {
this.success = success;
return this;
}
/**
* <p>The ID of the deleted workflow run</p>
* <p>The ID of the deleted workflow run</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("workflowRunId")
public MessageStage workflowRunId(@NotNull String workflowRunId) {
this.workflowRunId = Objects.requireNonNull(workflowRunId, "workflowRunId must not be null");
return this;
}
/**
* <p>Confirmation message</p>
* <p>Confirmation message</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("message")
public _FinalStage message(@NotNull String message) {
this.message = Objects.requireNonNull(message, "message must not be null");
return this;
}
@java.lang.Override
public WorkflowRunDeleteResponse build() {
return new WorkflowRunDeleteResponse(success, workflowRunId, message, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/types/WorkflowRunGetResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.WorkflowRun;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunGetResponse.Builder.class)
public final class WorkflowRunGetResponse {
private final boolean success;
private final WorkflowRun workflowRun;
private final Map<String, Object> additionalProperties;
private WorkflowRunGetResponse(boolean success, WorkflowRun workflowRun, Map<String, Object> additionalProperties) {
this.success = success;
this.workflowRun = workflowRun;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("workflowRun")
public WorkflowRun getWorkflowRun() {
return workflowRun;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunGetResponse && equalTo((WorkflowRunGetResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunGetResponse other) {
return success == other.success && workflowRun.equals(other.workflowRun);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.workflowRun);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
WorkflowRunStage success(boolean success);
Builder from(WorkflowRunGetResponse other);
}
public interface WorkflowRunStage {
_FinalStage workflowRun(@NotNull WorkflowRun workflowRun);
}
public interface _FinalStage {
WorkflowRunGetResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, WorkflowRunStage, _FinalStage {
private boolean success;
private WorkflowRun workflowRun;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowRunGetResponse other) {
success(other.getSuccess());
workflowRun(other.getWorkflowRun());
return this;
}
@java.lang.Override
@JsonSetter("success")
public WorkflowRunStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("workflowRun")
public _FinalStage workflowRun(@NotNull WorkflowRun workflowRun) {
this.workflowRun = Objects.requireNonNull(workflowRun, "workflowRun must not be null");
return this;
}
@java.lang.Override
public WorkflowRunGetResponse build() {
return new WorkflowRunGetResponse(success, workflowRun, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/types/WorkflowRunListResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.WorkflowRunSummary;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunListResponse.Builder.class)
public final class WorkflowRunListResponse {
private final boolean success;
private final List<WorkflowRunSummary> workflowRuns;
private final Optional<String> nextPageToken;
private final Map<String, Object> additionalProperties;
private WorkflowRunListResponse(
boolean success,
List<WorkflowRunSummary> workflowRuns,
Optional<String> nextPageToken,
Map<String, Object> additionalProperties) {
this.success = success;
this.workflowRuns = workflowRuns;
this.nextPageToken = nextPageToken;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("workflowRuns")
public List<WorkflowRunSummary> getWorkflowRuns() {
return workflowRuns;
}
@JsonProperty("nextPageToken")
public Optional<String> getNextPageToken() {
return nextPageToken;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunListResponse && equalTo((WorkflowRunListResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunListResponse other) {
return success == other.success
&& workflowRuns.equals(other.workflowRuns)
&& nextPageToken.equals(other.nextPageToken);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.workflowRuns, this.nextPageToken);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
_FinalStage success(boolean success);
Builder from(WorkflowRunListResponse other);
}
public interface _FinalStage {
WorkflowRunListResponse build();
_FinalStage workflowRuns(List<WorkflowRunSummary> workflowRuns);
_FinalStage addWorkflowRuns(WorkflowRunSummary workflowRuns);
_FinalStage addAllWorkflowRuns(List<WorkflowRunSummary> workflowRuns);
_FinalStage nextPageToken(Optional<String> nextPageToken);
_FinalStage nextPageToken(String nextPageToken);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, _FinalStage {
private boolean success;
private Optional<String> nextPageToken = Optional.empty();
private List<WorkflowRunSummary> workflowRuns = new ArrayList<>();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowRunListResponse other) {
success(other.getSuccess());
workflowRuns(other.getWorkflowRuns());
nextPageToken(other.getNextPageToken());
return this;
}
@java.lang.Override
@JsonSetter("success")
public _FinalStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
public _FinalStage nextPageToken(String nextPageToken) {
this.nextPageToken = Optional.ofNullable(nextPageToken);
return this;
}
@java.lang.Override
@JsonSetter(value = "nextPageToken", nulls = Nulls.SKIP)
public _FinalStage nextPageToken(Optional<String> nextPageToken) {
this.nextPageToken = nextPageToken;
return this;
}
@java.lang.Override
public _FinalStage addAllWorkflowRuns(List<WorkflowRunSummary> workflowRuns) {
this.workflowRuns.addAll(workflowRuns);
return this;
}
@java.lang.Override
public _FinalStage addWorkflowRuns(WorkflowRunSummary workflowRuns) {
this.workflowRuns.add(workflowRuns);
return this;
}
@java.lang.Override
@JsonSetter(value = "workflowRuns", nulls = Nulls.SKIP)
public _FinalStage workflowRuns(List<WorkflowRunSummary> workflowRuns) {
this.workflowRuns.clear();
this.workflowRuns.addAll(workflowRuns);
return this;
}
@java.lang.Override
public WorkflowRunListResponse build() {
return new WorkflowRunListResponse(success, workflowRuns, nextPageToken, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrun/types/WorkflowRunUpdateResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrun.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.WorkflowRun;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunUpdateResponse.Builder.class)
public final class WorkflowRunUpdateResponse {
private final boolean success;
private final WorkflowRun workflowRun;
private final Map<String, Object> additionalProperties;
private WorkflowRunUpdateResponse(
boolean success, WorkflowRun workflowRun, Map<String, Object> additionalProperties) {
this.success = success;
this.workflowRun = workflowRun;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("workflowRun")
public WorkflowRun getWorkflowRun() {
return workflowRun;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunUpdateResponse && equalTo((WorkflowRunUpdateResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunUpdateResponse other) {
return success == other.success && workflowRun.equals(other.workflowRun);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.workflowRun);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
WorkflowRunStage success(boolean success);
Builder from(WorkflowRunUpdateResponse other);
}
public interface WorkflowRunStage {
_FinalStage workflowRun(@NotNull WorkflowRun workflowRun);
}
public interface _FinalStage {
WorkflowRunUpdateResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, WorkflowRunStage, _FinalStage {
private boolean success;
private WorkflowRun workflowRun;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowRunUpdateResponse other) {
success(other.getSuccess());
workflowRun(other.getWorkflowRun());
return this;
}
@java.lang.Override
@JsonSetter("success")
public WorkflowRunStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("workflowRun")
public _FinalStage workflowRun(@NotNull WorkflowRun workflowRun) {
this.workflowRun = Objects.requireNonNull(workflowRun, "workflowRun must not be null");
return this;
}
@java.lang.Override
public WorkflowRunUpdateResponse build() {
return new WorkflowRunUpdateResponse(success, workflowRun, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrunoutput/AsyncRawWorkflowRunOutputClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrunoutput;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.NotFoundError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.workflowrunoutput.requests.WorkflowRunOutputUpdateRequest;
import ai.extend.resources.workflowrunoutput.types.WorkflowRunOutputUpdateResponse;
import ai.extend.types.Error;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.jetbrains.annotations.NotNull;
public class AsyncRawWorkflowRunOutputClient {
protected final ClientOptions clientOptions;
public AsyncRawWorkflowRunOutputClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* Use this endpoint to submit corrected outputs for a WorkflowRun for future processor evaluation and tuning in Extend.
* <p>If you are using our Human-in-the-loop workflow review, then we already will be collecting your operator submitted corrections. However, if you are receiving data via the API without human review, there could be incorrect outputs that you would like to correct for future usage in evaluation and tuning within the Extend platform. This endpoint allows you to submit corrected outputs for a WorkflowRun, by providing the correct output for a given output ID.</p>
* <p>The output ID, would be found in a given entry within the outputs arrays of a Workflow Run payload. The ID would look something like <code>dpr_gwkZZNRrPgkjcq0y-***</code>.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunOutputUpdateResponse>> update(
String workflowRunId, String outputId, WorkflowRunOutputUpdateRequest request) {
return update(workflowRunId, outputId, request, null);
}
/**
* Use this endpoint to submit corrected outputs for a WorkflowRun for future processor evaluation and tuning in Extend.
* <p>If you are using our Human-in-the-loop workflow review, then we already will be collecting your operator submitted corrections. However, if you are receiving data via the API without human review, there could be incorrect outputs that you would like to correct for future usage in evaluation and tuning within the Extend platform. This endpoint allows you to submit corrected outputs for a WorkflowRun, by providing the correct output for a given output ID.</p>
* <p>The output ID, would be found in a given entry within the outputs arrays of a Workflow Run payload. The ID would look something like <code>dpr_gwkZZNRrPgkjcq0y-***</code>.</p>
*/
public CompletableFuture<ExtendClientHttpResponse<WorkflowRunOutputUpdateResponse>> update(
String workflowRunId,
String outputId,
WorkflowRunOutputUpdateRequest request,
RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.addPathSegment(workflowRunId)
.addPathSegments("outputs")
.addPathSegment(outputId)
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
CompletableFuture<ExtendClientHttpResponse<WorkflowRunOutputUpdateResponse>> future = new CompletableFuture<>();
client.newCall(okhttpRequest).enqueue(new Callback() {
@Override
public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
try (ResponseBody responseBody = response.body()) {
if (response.isSuccessful()) {
future.complete(new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), WorkflowRunOutputUpdateResponse.class),
response));
return;
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
future.completeExceptionally(new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
case 401:
future.completeExceptionally(new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
response));
return;
case 404:
future.completeExceptionally(new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
future.completeExceptionally(new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response));
return;
} catch (IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
}
@Override
public void onFailure(@NotNull Call call, @NotNull IOException e) {
future.completeExceptionally(new ExtendClientException("Network error executing HTTP request", e));
}
});
return future;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrunoutput/AsyncWorkflowRunOutputClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrunoutput;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.workflowrunoutput.requests.WorkflowRunOutputUpdateRequest;
import ai.extend.resources.workflowrunoutput.types.WorkflowRunOutputUpdateResponse;
import java.util.concurrent.CompletableFuture;
public class AsyncWorkflowRunOutputClient {
protected final ClientOptions clientOptions;
private final AsyncRawWorkflowRunOutputClient rawClient;
public AsyncWorkflowRunOutputClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawWorkflowRunOutputClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawWorkflowRunOutputClient withRawResponse() {
return this.rawClient;
}
/**
* Use this endpoint to submit corrected outputs for a WorkflowRun for future processor evaluation and tuning in Extend.
* <p>If you are using our Human-in-the-loop workflow review, then we already will be collecting your operator submitted corrections. However, if you are receiving data via the API without human review, there could be incorrect outputs that you would like to correct for future usage in evaluation and tuning within the Extend platform. This endpoint allows you to submit corrected outputs for a WorkflowRun, by providing the correct output for a given output ID.</p>
* <p>The output ID, would be found in a given entry within the outputs arrays of a Workflow Run payload. The ID would look something like <code>dpr_gwkZZNRrPgkjcq0y-***</code>.</p>
*/
public CompletableFuture<WorkflowRunOutputUpdateResponse> update(
String workflowRunId, String outputId, WorkflowRunOutputUpdateRequest request) {
return this.rawClient.update(workflowRunId, outputId, request).thenApply(response -> response.body());
}
/**
* Use this endpoint to submit corrected outputs for a WorkflowRun for future processor evaluation and tuning in Extend.
* <p>If you are using our Human-in-the-loop workflow review, then we already will be collecting your operator submitted corrections. However, if you are receiving data via the API without human review, there could be incorrect outputs that you would like to correct for future usage in evaluation and tuning within the Extend platform. This endpoint allows you to submit corrected outputs for a WorkflowRun, by providing the correct output for a given output ID.</p>
* <p>The output ID, would be found in a given entry within the outputs arrays of a Workflow Run payload. The ID would look something like <code>dpr_gwkZZNRrPgkjcq0y-***</code>.</p>
*/
public CompletableFuture<WorkflowRunOutputUpdateResponse> update(
String workflowRunId,
String outputId,
WorkflowRunOutputUpdateRequest request,
RequestOptions requestOptions) {
return this.rawClient
.update(workflowRunId, outputId, request, requestOptions)
.thenApply(response -> response.body());
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrunoutput/RawWorkflowRunOutputClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrunoutput;
import ai.extend.core.ClientOptions;
import ai.extend.core.ExtendClientApiException;
import ai.extend.core.ExtendClientException;
import ai.extend.core.ExtendClientHttpResponse;
import ai.extend.core.MediaTypes;
import ai.extend.core.ObjectMappers;
import ai.extend.core.RequestOptions;
import ai.extend.errors.BadRequestError;
import ai.extend.errors.NotFoundError;
import ai.extend.errors.UnauthorizedError;
import ai.extend.resources.workflowrunoutput.requests.WorkflowRunOutputUpdateRequest;
import ai.extend.resources.workflowrunoutput.types.WorkflowRunOutputUpdateResponse;
import ai.extend.types.Error;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
public class RawWorkflowRunOutputClient {
protected final ClientOptions clientOptions;
public RawWorkflowRunOutputClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
}
/**
* Use this endpoint to submit corrected outputs for a WorkflowRun for future processor evaluation and tuning in Extend.
* <p>If you are using our Human-in-the-loop workflow review, then we already will be collecting your operator submitted corrections. However, if you are receiving data via the API without human review, there could be incorrect outputs that you would like to correct for future usage in evaluation and tuning within the Extend platform. This endpoint allows you to submit corrected outputs for a WorkflowRun, by providing the correct output for a given output ID.</p>
* <p>The output ID, would be found in a given entry within the outputs arrays of a Workflow Run payload. The ID would look something like <code>dpr_gwkZZNRrPgkjcq0y-***</code>.</p>
*/
public ExtendClientHttpResponse<WorkflowRunOutputUpdateResponse> update(
String workflowRunId, String outputId, WorkflowRunOutputUpdateRequest request) {
return update(workflowRunId, outputId, request, null);
}
/**
* Use this endpoint to submit corrected outputs for a WorkflowRun for future processor evaluation and tuning in Extend.
* <p>If you are using our Human-in-the-loop workflow review, then we already will be collecting your operator submitted corrections. However, if you are receiving data via the API without human review, there could be incorrect outputs that you would like to correct for future usage in evaluation and tuning within the Extend platform. This endpoint allows you to submit corrected outputs for a WorkflowRun, by providing the correct output for a given output ID.</p>
* <p>The output ID, would be found in a given entry within the outputs arrays of a Workflow Run payload. The ID would look something like <code>dpr_gwkZZNRrPgkjcq0y-***</code>.</p>
*/
public ExtendClientHttpResponse<WorkflowRunOutputUpdateResponse> update(
String workflowRunId,
String outputId,
WorkflowRunOutputUpdateRequest request,
RequestOptions requestOptions) {
HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
.newBuilder()
.addPathSegments("workflow_runs")
.addPathSegment(workflowRunId)
.addPathSegments("outputs")
.addPathSegment(outputId)
.build();
RequestBody body;
try {
body = RequestBody.create(
ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
} catch (JsonProcessingException e) {
throw new ExtendClientException("Failed to serialize request", e);
}
Request okhttpRequest = new Request.Builder()
.url(httpUrl)
.method("POST", body)
.headers(Headers.of(clientOptions.headers(requestOptions)))
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.build();
OkHttpClient client = clientOptions.httpClient();
if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
client = clientOptions.httpClientWithTimeout(requestOptions);
}
try (Response response = client.newCall(okhttpRequest).execute()) {
ResponseBody responseBody = response.body();
if (response.isSuccessful()) {
return new ExtendClientHttpResponse<>(
ObjectMappers.JSON_MAPPER.readValue(
responseBody.string(), WorkflowRunOutputUpdateResponse.class),
response);
}
String responseBodyString = responseBody != null ? responseBody.string() : "{}";
try {
switch (response.code()) {
case 400:
throw new BadRequestError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
case 401:
throw new UnauthorizedError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
case 404:
throw new NotFoundError(
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response);
}
} catch (JsonProcessingException ignored) {
// unable to map error response, throwing generic error
}
throw new ExtendClientApiException(
"Error with status code " + response.code(),
response.code(),
ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class),
response);
} catch (IOException e) {
throw new ExtendClientException("Network error executing HTTP request", e);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrunoutput/WorkflowRunOutputClient.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrunoutput;
import ai.extend.core.ClientOptions;
import ai.extend.core.RequestOptions;
import ai.extend.resources.workflowrunoutput.requests.WorkflowRunOutputUpdateRequest;
import ai.extend.resources.workflowrunoutput.types.WorkflowRunOutputUpdateResponse;
public class WorkflowRunOutputClient {
protected final ClientOptions clientOptions;
private final RawWorkflowRunOutputClient rawClient;
public WorkflowRunOutputClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new RawWorkflowRunOutputClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public RawWorkflowRunOutputClient withRawResponse() {
return this.rawClient;
}
/**
* Use this endpoint to submit corrected outputs for a WorkflowRun for future processor evaluation and tuning in Extend.
* <p>If you are using our Human-in-the-loop workflow review, then we already will be collecting your operator submitted corrections. However, if you are receiving data via the API without human review, there could be incorrect outputs that you would like to correct for future usage in evaluation and tuning within the Extend platform. This endpoint allows you to submit corrected outputs for a WorkflowRun, by providing the correct output for a given output ID.</p>
* <p>The output ID, would be found in a given entry within the outputs arrays of a Workflow Run payload. The ID would look something like <code>dpr_gwkZZNRrPgkjcq0y-***</code>.</p>
*/
public WorkflowRunOutputUpdateResponse update(
String workflowRunId, String outputId, WorkflowRunOutputUpdateRequest request) {
return this.rawClient.update(workflowRunId, outputId, request).body();
}
/**
* Use this endpoint to submit corrected outputs for a WorkflowRun for future processor evaluation and tuning in Extend.
* <p>If you are using our Human-in-the-loop workflow review, then we already will be collecting your operator submitted corrections. However, if you are receiving data via the API without human review, there could be incorrect outputs that you would like to correct for future usage in evaluation and tuning within the Extend platform. This endpoint allows you to submit corrected outputs for a WorkflowRun, by providing the correct output for a given output ID.</p>
* <p>The output ID, would be found in a given entry within the outputs arrays of a Workflow Run payload. The ID would look something like <code>dpr_gwkZZNRrPgkjcq0y-***</code>.</p>
*/
public WorkflowRunOutputUpdateResponse update(
String workflowRunId,
String outputId,
WorkflowRunOutputUpdateRequest request,
RequestOptions requestOptions) {
return this.rawClient
.update(workflowRunId, outputId, request, requestOptions)
.body();
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrunoutput
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrunoutput/requests/WorkflowRunOutputUpdateRequest.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrunoutput.requests;
import ai.extend.core.ObjectMappers;
import ai.extend.types.ProvidedProcessorOutput;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunOutputUpdateRequest.Builder.class)
public final class WorkflowRunOutputUpdateRequest {
private final ProvidedProcessorOutput reviewedOutput;
private final Map<String, Object> additionalProperties;
private WorkflowRunOutputUpdateRequest(
ProvidedProcessorOutput reviewedOutput, Map<String, Object> additionalProperties) {
this.reviewedOutput = reviewedOutput;
this.additionalProperties = additionalProperties;
}
/**
* @return The corrected output of the processor when run against the file.
* <p>This should conform to the output type schema of the given processor.</p>
* <p>If this is an extraction result, you can include all fields, or just the ones that were corrected, our system will handle merges/dedupes. However, if you do include a field, we assume the value included in the final reviewed value.</p>
*/
@JsonProperty("reviewedOutput")
public ProvidedProcessorOutput getReviewedOutput() {
return reviewedOutput;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunOutputUpdateRequest && equalTo((WorkflowRunOutputUpdateRequest) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunOutputUpdateRequest other) {
return reviewedOutput.equals(other.reviewedOutput);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.reviewedOutput);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ReviewedOutputStage builder() {
return new Builder();
}
public interface ReviewedOutputStage {
/**
* <p>The corrected output of the processor when run against the file.</p>
* <p>This should conform to the output type schema of the given processor.</p>
* <p>If this is an extraction result, you can include all fields, or just the ones that were corrected, our system will handle merges/dedupes. However, if you do include a field, we assume the value included in the final reviewed value.</p>
*/
_FinalStage reviewedOutput(@NotNull ProvidedProcessorOutput reviewedOutput);
Builder from(WorkflowRunOutputUpdateRequest other);
}
public interface _FinalStage {
WorkflowRunOutputUpdateRequest build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ReviewedOutputStage, _FinalStage {
private ProvidedProcessorOutput reviewedOutput;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowRunOutputUpdateRequest other) {
reviewedOutput(other.getReviewedOutput());
return this;
}
/**
* <p>The corrected output of the processor when run against the file.</p>
* <p>This should conform to the output type schema of the given processor.</p>
* <p>If this is an extraction result, you can include all fields, or just the ones that were corrected, our system will handle merges/dedupes. However, if you do include a field, we assume the value included in the final reviewed value.</p>
* <p>The corrected output of the processor when run against the file.</p>
* <p>This should conform to the output type schema of the given processor.</p>
* <p>If this is an extraction result, you can include all fields, or just the ones that were corrected, our system will handle merges/dedupes. However, if you do include a field, we assume the value included in the final reviewed value.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("reviewedOutput")
public _FinalStage reviewedOutput(@NotNull ProvidedProcessorOutput reviewedOutput) {
this.reviewedOutput = Objects.requireNonNull(reviewedOutput, "reviewedOutput must not be null");
return this;
}
@java.lang.Override
public WorkflowRunOutputUpdateRequest build() {
return new WorkflowRunOutputUpdateRequest(reviewedOutput, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrunoutput
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/resources/workflowrunoutput/types/WorkflowRunOutputUpdateResponse.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.resources.workflowrunoutput.types;
import ai.extend.core.ObjectMappers;
import ai.extend.types.WorkflowRun;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = WorkflowRunOutputUpdateResponse.Builder.class)
public final class WorkflowRunOutputUpdateResponse {
private final boolean success;
private final WorkflowRun workflowRun;
private final Map<String, Object> additionalProperties;
private WorkflowRunOutputUpdateResponse(
boolean success, WorkflowRun workflowRun, Map<String, Object> additionalProperties) {
this.success = success;
this.workflowRun = workflowRun;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
public boolean getSuccess() {
return success;
}
@JsonProperty("workflowRun")
public WorkflowRun getWorkflowRun() {
return workflowRun;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WorkflowRunOutputUpdateResponse && equalTo((WorkflowRunOutputUpdateResponse) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(WorkflowRunOutputUpdateResponse other) {
return success == other.success && workflowRun.equals(other.workflowRun);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.workflowRun);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static SuccessStage builder() {
return new Builder();
}
public interface SuccessStage {
WorkflowRunStage success(boolean success);
Builder from(WorkflowRunOutputUpdateResponse other);
}
public interface WorkflowRunStage {
_FinalStage workflowRun(@NotNull WorkflowRun workflowRun);
}
public interface _FinalStage {
WorkflowRunOutputUpdateResponse build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements SuccessStage, WorkflowRunStage, _FinalStage {
private boolean success;
private WorkflowRun workflowRun;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(WorkflowRunOutputUpdateResponse other) {
success(other.getSuccess());
workflowRun(other.getWorkflowRun());
return this;
}
@java.lang.Override
@JsonSetter("success")
public WorkflowRunStage success(boolean success) {
this.success = success;
return this;
}
@java.lang.Override
@JsonSetter("workflowRun")
public _FinalStage workflowRun(@NotNull WorkflowRun workflowRun) {
this.workflowRun = Objects.requireNonNull(workflowRun, "workflowRun must not be null");
return this;
}
@java.lang.Override
public WorkflowRunOutputUpdateResponse build() {
return new WorkflowRunOutputUpdateResponse(success, workflowRun, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ApiVersionEnum.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ApiVersionEnum {
TWO_THOUSAND_TWENTY_FIVE_0421("2025-04-21"),
TWO_THOUSAND_TWENTY_FOUR_1223("2024-12-23"),
TWO_THOUSAND_TWENTY_FOUR_1114("2024-11-14"),
TWO_THOUSAND_TWENTY_FOUR_0730("2024-07-30"),
TWO_THOUSAND_TWENTY_FOUR_0201("2024-02-01");
private final String value;
ApiVersionEnum(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BadRequestErrorBody.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BadRequestErrorBody.Builder.class)
public final class BadRequestErrorBody implements IError {
private final Optional<Boolean> success;
private final Optional<String> error;
private final Optional<BadRequestErrorBodyCode> code;
private final Map<String, Object> additionalProperties;
private BadRequestErrorBody(
Optional<Boolean> success,
Optional<String> error,
Optional<BadRequestErrorBodyCode> code,
Map<String, Object> additionalProperties) {
this.success = success;
this.error = error;
this.code = code;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
@java.lang.Override
public Optional<Boolean> getSuccess() {
return success;
}
/**
* @return Error message
*/
@JsonProperty("error")
@java.lang.Override
public Optional<String> getError() {
return error;
}
@JsonProperty("code")
public Optional<BadRequestErrorBodyCode> getCode() {
return code;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BadRequestErrorBody && equalTo((BadRequestErrorBody) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BadRequestErrorBody other) {
return success.equals(other.success) && error.equals(other.error) && code.equals(other.code);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.error, this.code);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Boolean> success = Optional.empty();
private Optional<String> error = Optional.empty();
private Optional<BadRequestErrorBodyCode> code = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(BadRequestErrorBody other) {
success(other.getSuccess());
error(other.getError());
code(other.getCode());
return this;
}
@JsonSetter(value = "success", nulls = Nulls.SKIP)
public Builder success(Optional<Boolean> success) {
this.success = success;
return this;
}
public Builder success(Boolean success) {
this.success = Optional.ofNullable(success);
return this;
}
/**
* <p>Error message</p>
*/
@JsonSetter(value = "error", nulls = Nulls.SKIP)
public Builder error(Optional<String> error) {
this.error = error;
return this;
}
public Builder error(String error) {
this.error = Optional.ofNullable(error);
return this;
}
@JsonSetter(value = "code", nulls = Nulls.SKIP)
public Builder code(Optional<BadRequestErrorBodyCode> code) {
this.code = code;
return this;
}
public Builder code(BadRequestErrorBodyCode code) {
this.code = Optional.ofNullable(code);
return this;
}
public BadRequestErrorBody build() {
return new BadRequestErrorBody(success, error, code, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BadRequestErrorBodyCode.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum BadRequestErrorBodyCode {
FILE_TYPE_NOT_SUPPORTED("FILE_TYPE_NOT_SUPPORTED"),
FILE_SIZE_TOO_LARGE("FILE_SIZE_TOO_LARGE"),
CORRUPT_FILE("CORRUPT_FILE"),
PASSWORD_PROTECTED_FILE("PASSWORD_PROTECTED_FILE");
private final String value;
BadRequestErrorBodyCode(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BaseMetrics.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BaseMetrics.Builder.class)
public final class BaseMetrics implements IBaseMetrics {
private final Optional<Double> numFiles;
private final Optional<Double> numPages;
private final Optional<Double> meanRunTimeMs;
private final Map<String, Object> additionalProperties;
private BaseMetrics(
Optional<Double> numFiles,
Optional<Double> numPages,
Optional<Double> meanRunTimeMs,
Map<String, Object> additionalProperties) {
this.numFiles = numFiles;
this.numPages = numPages;
this.meanRunTimeMs = meanRunTimeMs;
this.additionalProperties = additionalProperties;
}
/**
* @return The total number of files that were processed.
*/
@JsonProperty("numFiles")
@java.lang.Override
public Optional<Double> getNumFiles() {
return numFiles;
}
/**
* @return The total number of pages that were processed.
*/
@JsonProperty("numPages")
@java.lang.Override
public Optional<Double> getNumPages() {
return numPages;
}
/**
* @return The mean runtime in milliseconds per document.
*/
@JsonProperty("meanRunTimeMs")
@java.lang.Override
public Optional<Double> getMeanRunTimeMs() {
return meanRunTimeMs;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BaseMetrics && equalTo((BaseMetrics) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BaseMetrics other) {
return numFiles.equals(other.numFiles)
&& numPages.equals(other.numPages)
&& meanRunTimeMs.equals(other.meanRunTimeMs);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.numFiles, this.numPages, this.meanRunTimeMs);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Double> numFiles = Optional.empty();
private Optional<Double> numPages = Optional.empty();
private Optional<Double> meanRunTimeMs = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(BaseMetrics other) {
numFiles(other.getNumFiles());
numPages(other.getNumPages());
meanRunTimeMs(other.getMeanRunTimeMs());
return this;
}
/**
* <p>The total number of files that were processed.</p>
*/
@JsonSetter(value = "numFiles", nulls = Nulls.SKIP)
public Builder numFiles(Optional<Double> numFiles) {
this.numFiles = numFiles;
return this;
}
public Builder numFiles(Double numFiles) {
this.numFiles = Optional.ofNullable(numFiles);
return this;
}
/**
* <p>The total number of pages that were processed.</p>
*/
@JsonSetter(value = "numPages", nulls = Nulls.SKIP)
public Builder numPages(Optional<Double> numPages) {
this.numPages = numPages;
return this;
}
public Builder numPages(Double numPages) {
this.numPages = Optional.ofNullable(numPages);
return this;
}
/**
* <p>The mean runtime in milliseconds per document.</p>
*/
@JsonSetter(value = "meanRunTimeMs", nulls = Nulls.SKIP)
public Builder meanRunTimeMs(Optional<Double> meanRunTimeMs) {
this.meanRunTimeMs = meanRunTimeMs;
return this;
}
public Builder meanRunTimeMs(Double meanRunTimeMs) {
this.meanRunTimeMs = Optional.ofNullable(meanRunTimeMs);
return this;
}
public BaseMetrics build() {
return new BaseMetrics(numFiles, numPages, meanRunTimeMs, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BatchProcessorRun.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BatchProcessorRun.Builder.class)
public final class BatchProcessorRun {
private final String object;
private final String id;
private final String processorId;
private final String processorVersionId;
private final String processorName;
private final BatchProcessorRunMetrics metrics;
private final BatchProcessorRunStatus status;
private final BatchProcessorRunSource source;
private final Optional<String> sourceId;
private final int runCount;
private final BatchProcessorRunOptions options;
private final OffsetDateTime createdAt;
private final OffsetDateTime updatedAt;
private final Map<String, Object> additionalProperties;
private BatchProcessorRun(
String object,
String id,
String processorId,
String processorVersionId,
String processorName,
BatchProcessorRunMetrics metrics,
BatchProcessorRunStatus status,
BatchProcessorRunSource source,
Optional<String> sourceId,
int runCount,
BatchProcessorRunOptions options,
OffsetDateTime createdAt,
OffsetDateTime updatedAt,
Map<String, Object> additionalProperties) {
this.object = object;
this.id = id;
this.processorId = processorId;
this.processorVersionId = processorVersionId;
this.processorName = processorName;
this.metrics = metrics;
this.status = status;
this.source = source;
this.sourceId = sourceId;
this.runCount = runCount;
this.options = options;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
this.additionalProperties = additionalProperties;
}
/**
* @return The type of response. In this case, it will always be <code>"batch_processor_run"</code>.
*/
@JsonProperty("object")
public String getObject() {
return object;
}
/**
* @return The unique identifier for this batch processor run.
* <p>Example: <code>"batch_processor_run_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return The ID of the processor used for this run.
* <p>Example: <code>"dp_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
*/
@JsonProperty("processorId")
public String getProcessorId() {
return processorId;
}
/**
* @return The ID of the specific processor version used.
* <p>Example: <code>"dpv_xK9mLPqRtN3vS8wF5hB2cQ"</code></p>
*/
@JsonProperty("processorVersionId")
public String getProcessorVersionId() {
return processorVersionId;
}
/**
* @return The name of the processor.
* <p>Example: <code>"Invoice Processor"</code></p>
*/
@JsonProperty("processorName")
public String getProcessorName() {
return processorName;
}
@JsonProperty("metrics")
public BatchProcessorRunMetrics getMetrics() {
return metrics;
}
/**
* @return The current status of the batch processor run:
* <ul>
* <li><code>"PENDING"</code> - The batch processor run is waiting to start</li>
* <li><code>"PROCESSING"</code> - The batch processor run is in progress</li>
* <li><code>"PROCESSED"</code> - The batch processor run completed successfully</li>
* <li><code>"FAILED"</code> - The batch processor run encountered an error</li>
* </ul>
*/
@JsonProperty("status")
public BatchProcessorRunStatus getStatus() {
return status;
}
/**
* @return The source of the batch processor run:
* <ul>
* <li><code>"EVAL_SET"</code> - The batch processor run was made from an evaluation set. The <code>sourceId</code> will be the ID of the evaluation set (e.g., <code>"ev_1234"</code>)</li>
* <li><code>"PLAYGROUND"</code> - The batch processor run was made from the playground. The <code>sourceId</code> will not be set</li>
* <li><code>"STUDIO"</code> - The batch processor run was made for a processor in Studio. The <code>sourceId</code> will be the ID of the processor (e.g., <code>"dp_1234"</code>)</li>
* </ul>
*/
@JsonProperty("source")
public BatchProcessorRunSource getSource() {
return source;
}
/**
* @return The ID of the source of the batch processor run. See the <code>source</code> field for more details.
* Example: <code>"ev_1234"</code> for EVAL_SET source, <code>"dp_1234"</code> for STUDIO source
*/
@JsonProperty("sourceId")
public Optional<String> getSourceId() {
return sourceId;
}
/**
* @return The number of runs that were made.
*/
@JsonProperty("runCount")
public int getRunCount() {
return runCount;
}
/**
* @return The options for the batch processor run.
*/
@JsonProperty("options")
public BatchProcessorRunOptions getOptions() {
return options;
}
/**
* @return The time (in UTC) at which the batch processor run was created. Will follow the RFC 3339 format.
* <p>Example: <code>"2024-03-21T15:30:00Z"</code></p>
*/
@JsonProperty("createdAt")
public OffsetDateTime getCreatedAt() {
return createdAt;
}
/**
* @return The time (in UTC) at which the batch processor run was last updated. Will follow the RFC 3339 format.
* <p>Example: <code>"2024-03-21T16:45:00Z"</code></p>
*/
@JsonProperty("updatedAt")
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BatchProcessorRun && equalTo((BatchProcessorRun) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BatchProcessorRun other) {
return object.equals(other.object)
&& id.equals(other.id)
&& processorId.equals(other.processorId)
&& processorVersionId.equals(other.processorVersionId)
&& processorName.equals(other.processorName)
&& metrics.equals(other.metrics)
&& status.equals(other.status)
&& source.equals(other.source)
&& sourceId.equals(other.sourceId)
&& runCount == other.runCount
&& options.equals(other.options)
&& createdAt.equals(other.createdAt)
&& updatedAt.equals(other.updatedAt);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.object,
this.id,
this.processorId,
this.processorVersionId,
this.processorName,
this.metrics,
this.status,
this.source,
this.sourceId,
this.runCount,
this.options,
this.createdAt,
this.updatedAt);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ObjectStage builder() {
return new Builder();
}
public interface ObjectStage {
/**
* <p>The type of response. In this case, it will always be <code>"batch_processor_run"</code>.</p>
*/
IdStage object(@NotNull String object);
Builder from(BatchProcessorRun other);
}
public interface IdStage {
/**
* <p>The unique identifier for this batch processor run.</p>
* <p>Example: <code>"batch_processor_run_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
*/
ProcessorIdStage id(@NotNull String id);
}
public interface ProcessorIdStage {
/**
* <p>The ID of the processor used for this run.</p>
* <p>Example: <code>"dp_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
*/
ProcessorVersionIdStage processorId(@NotNull String processorId);
}
public interface ProcessorVersionIdStage {
/**
* <p>The ID of the specific processor version used.</p>
* <p>Example: <code>"dpv_xK9mLPqRtN3vS8wF5hB2cQ"</code></p>
*/
ProcessorNameStage processorVersionId(@NotNull String processorVersionId);
}
public interface ProcessorNameStage {
/**
* <p>The name of the processor.</p>
* <p>Example: <code>"Invoice Processor"</code></p>
*/
MetricsStage processorName(@NotNull String processorName);
}
public interface MetricsStage {
StatusStage metrics(@NotNull BatchProcessorRunMetrics metrics);
}
public interface StatusStage {
/**
* <p>The current status of the batch processor run:</p>
* <ul>
* <li><code>"PENDING"</code> - The batch processor run is waiting to start</li>
* <li><code>"PROCESSING"</code> - The batch processor run is in progress</li>
* <li><code>"PROCESSED"</code> - The batch processor run completed successfully</li>
* <li><code>"FAILED"</code> - The batch processor run encountered an error</li>
* </ul>
*/
SourceStage status(@NotNull BatchProcessorRunStatus status);
}
public interface SourceStage {
/**
* <p>The source of the batch processor run:</p>
* <ul>
* <li><code>"EVAL_SET"</code> - The batch processor run was made from an evaluation set. The <code>sourceId</code> will be the ID of the evaluation set (e.g., <code>"ev_1234"</code>)</li>
* <li><code>"PLAYGROUND"</code> - The batch processor run was made from the playground. The <code>sourceId</code> will not be set</li>
* <li><code>"STUDIO"</code> - The batch processor run was made for a processor in Studio. The <code>sourceId</code> will be the ID of the processor (e.g., <code>"dp_1234"</code>)</li>
* </ul>
*/
RunCountStage source(@NotNull BatchProcessorRunSource source);
}
public interface RunCountStage {
/**
* <p>The number of runs that were made.</p>
*/
OptionsStage runCount(int runCount);
}
public interface OptionsStage {
/**
* <p>The options for the batch processor run.</p>
*/
CreatedAtStage options(@NotNull BatchProcessorRunOptions options);
}
public interface CreatedAtStage {
/**
* <p>The time (in UTC) at which the batch processor run was created. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T15:30:00Z"</code></p>
*/
UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt);
}
public interface UpdatedAtStage {
/**
* <p>The time (in UTC) at which the batch processor run was last updated. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T16:45:00Z"</code></p>
*/
_FinalStage updatedAt(@NotNull OffsetDateTime updatedAt);
}
public interface _FinalStage {
BatchProcessorRun build();
/**
* <p>The ID of the source of the batch processor run. See the <code>source</code> field for more details.
* Example: <code>"ev_1234"</code> for EVAL_SET source, <code>"dp_1234"</code> for STUDIO source</p>
*/
_FinalStage sourceId(Optional<String> sourceId);
_FinalStage sourceId(String sourceId);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder
implements ObjectStage,
IdStage,
ProcessorIdStage,
ProcessorVersionIdStage,
ProcessorNameStage,
MetricsStage,
StatusStage,
SourceStage,
RunCountStage,
OptionsStage,
CreatedAtStage,
UpdatedAtStage,
_FinalStage {
private String object;
private String id;
private String processorId;
private String processorVersionId;
private String processorName;
private BatchProcessorRunMetrics metrics;
private BatchProcessorRunStatus status;
private BatchProcessorRunSource source;
private int runCount;
private BatchProcessorRunOptions options;
private OffsetDateTime createdAt;
private OffsetDateTime updatedAt;
private Optional<String> sourceId = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(BatchProcessorRun other) {
object(other.getObject());
id(other.getId());
processorId(other.getProcessorId());
processorVersionId(other.getProcessorVersionId());
processorName(other.getProcessorName());
metrics(other.getMetrics());
status(other.getStatus());
source(other.getSource());
sourceId(other.getSourceId());
runCount(other.getRunCount());
options(other.getOptions());
createdAt(other.getCreatedAt());
updatedAt(other.getUpdatedAt());
return this;
}
/**
* <p>The type of response. In this case, it will always be <code>"batch_processor_run"</code>.</p>
* <p>The type of response. In this case, it will always be <code>"batch_processor_run"</code>.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("object")
public IdStage object(@NotNull String object) {
this.object = Objects.requireNonNull(object, "object must not be null");
return this;
}
/**
* <p>The unique identifier for this batch processor run.</p>
* <p>Example: <code>"batch_processor_run_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
* <p>The unique identifier for this batch processor run.</p>
* <p>Example: <code>"batch_processor_run_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public ProcessorIdStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>The ID of the processor used for this run.</p>
* <p>Example: <code>"dp_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
* <p>The ID of the processor used for this run.</p>
* <p>Example: <code>"dp_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("processorId")
public ProcessorVersionIdStage processorId(@NotNull String processorId) {
this.processorId = Objects.requireNonNull(processorId, "processorId must not be null");
return this;
}
/**
* <p>The ID of the specific processor version used.</p>
* <p>Example: <code>"dpv_xK9mLPqRtN3vS8wF5hB2cQ"</code></p>
* <p>The ID of the specific processor version used.</p>
* <p>Example: <code>"dpv_xK9mLPqRtN3vS8wF5hB2cQ"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("processorVersionId")
public ProcessorNameStage processorVersionId(@NotNull String processorVersionId) {
this.processorVersionId = Objects.requireNonNull(processorVersionId, "processorVersionId must not be null");
return this;
}
/**
* <p>The name of the processor.</p>
* <p>Example: <code>"Invoice Processor"</code></p>
* <p>The name of the processor.</p>
* <p>Example: <code>"Invoice Processor"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("processorName")
public MetricsStage processorName(@NotNull String processorName) {
this.processorName = Objects.requireNonNull(processorName, "processorName must not be null");
return this;
}
@java.lang.Override
@JsonSetter("metrics")
public StatusStage metrics(@NotNull BatchProcessorRunMetrics metrics) {
this.metrics = Objects.requireNonNull(metrics, "metrics must not be null");
return this;
}
/**
* <p>The current status of the batch processor run:</p>
* <ul>
* <li><code>"PENDING"</code> - The batch processor run is waiting to start</li>
* <li><code>"PROCESSING"</code> - The batch processor run is in progress</li>
* <li><code>"PROCESSED"</code> - The batch processor run completed successfully</li>
* <li><code>"FAILED"</code> - The batch processor run encountered an error</li>
* </ul>
* <p>The current status of the batch processor run:</p>
* <ul>
* <li><code>"PENDING"</code> - The batch processor run is waiting to start</li>
* <li><code>"PROCESSING"</code> - The batch processor run is in progress</li>
* <li><code>"PROCESSED"</code> - The batch processor run completed successfully</li>
* <li><code>"FAILED"</code> - The batch processor run encountered an error</li>
* </ul>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("status")
public SourceStage status(@NotNull BatchProcessorRunStatus status) {
this.status = Objects.requireNonNull(status, "status must not be null");
return this;
}
/**
* <p>The source of the batch processor run:</p>
* <ul>
* <li><code>"EVAL_SET"</code> - The batch processor run was made from an evaluation set. The <code>sourceId</code> will be the ID of the evaluation set (e.g., <code>"ev_1234"</code>)</li>
* <li><code>"PLAYGROUND"</code> - The batch processor run was made from the playground. The <code>sourceId</code> will not be set</li>
* <li><code>"STUDIO"</code> - The batch processor run was made for a processor in Studio. The <code>sourceId</code> will be the ID of the processor (e.g., <code>"dp_1234"</code>)</li>
* </ul>
* <p>The source of the batch processor run:</p>
* <ul>
* <li><code>"EVAL_SET"</code> - The batch processor run was made from an evaluation set. The <code>sourceId</code> will be the ID of the evaluation set (e.g., <code>"ev_1234"</code>)</li>
* <li><code>"PLAYGROUND"</code> - The batch processor run was made from the playground. The <code>sourceId</code> will not be set</li>
* <li><code>"STUDIO"</code> - The batch processor run was made for a processor in Studio. The <code>sourceId</code> will be the ID of the processor (e.g., <code>"dp_1234"</code>)</li>
* </ul>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("source")
public RunCountStage source(@NotNull BatchProcessorRunSource source) {
this.source = Objects.requireNonNull(source, "source must not be null");
return this;
}
/**
* <p>The number of runs that were made.</p>
* <p>The number of runs that were made.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("runCount")
public OptionsStage runCount(int runCount) {
this.runCount = runCount;
return this;
}
/**
* <p>The options for the batch processor run.</p>
* <p>The options for the batch processor run.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("options")
public CreatedAtStage options(@NotNull BatchProcessorRunOptions options) {
this.options = Objects.requireNonNull(options, "options must not be null");
return this;
}
/**
* <p>The time (in UTC) at which the batch processor run was created. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T15:30:00Z"</code></p>
* <p>The time (in UTC) at which the batch processor run was created. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T15:30:00Z"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("createdAt")
public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) {
this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null");
return this;
}
/**
* <p>The time (in UTC) at which the batch processor run was last updated. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T16:45:00Z"</code></p>
* <p>The time (in UTC) at which the batch processor run was last updated. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T16:45:00Z"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("updatedAt")
public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) {
this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null");
return this;
}
/**
* <p>The ID of the source of the batch processor run. See the <code>source</code> field for more details.
* Example: <code>"ev_1234"</code> for EVAL_SET source, <code>"dp_1234"</code> for STUDIO source</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage sourceId(String sourceId) {
this.sourceId = Optional.ofNullable(sourceId);
return this;
}
/**
* <p>The ID of the source of the batch processor run. See the <code>source</code> field for more details.
* Example: <code>"ev_1234"</code> for EVAL_SET source, <code>"dp_1234"</code> for STUDIO source</p>
*/
@java.lang.Override
@JsonSetter(value = "sourceId", nulls = Nulls.SKIP)
public _FinalStage sourceId(Optional<String> sourceId) {
this.sourceId = sourceId;
return this;
}
@java.lang.Override
public BatchProcessorRun build() {
return new BatchProcessorRun(
object,
id,
processorId,
processorVersionId,
processorName,
metrics,
status,
source,
sourceId,
runCount,
options,
createdAt,
updatedAt,
additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BatchProcessorRunMetrics.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BatchProcessorRunMetrics.Builder.class)
public final class BatchProcessorRunMetrics {
private final Optional<Double> numFiles;
private final Optional<Double> numPages;
private final Map<String, Object> additionalProperties;
private BatchProcessorRunMetrics(
Optional<Double> numFiles, Optional<Double> numPages, Map<String, Object> additionalProperties) {
this.numFiles = numFiles;
this.numPages = numPages;
this.additionalProperties = additionalProperties;
}
/**
* @return The total number of files processed in this batch run
*/
@JsonProperty("numFiles")
public Optional<Double> getNumFiles() {
return numFiles;
}
/**
* @return The total number of pages processed in this batch run
*/
@JsonProperty("numPages")
public Optional<Double> getNumPages() {
return numPages;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BatchProcessorRunMetrics && equalTo((BatchProcessorRunMetrics) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BatchProcessorRunMetrics other) {
return numFiles.equals(other.numFiles) && numPages.equals(other.numPages);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.numFiles, this.numPages);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Double> numFiles = Optional.empty();
private Optional<Double> numPages = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(BatchProcessorRunMetrics other) {
numFiles(other.getNumFiles());
numPages(other.getNumPages());
return this;
}
/**
* <p>The total number of files processed in this batch run</p>
*/
@JsonSetter(value = "numFiles", nulls = Nulls.SKIP)
public Builder numFiles(Optional<Double> numFiles) {
this.numFiles = numFiles;
return this;
}
public Builder numFiles(Double numFiles) {
this.numFiles = Optional.ofNullable(numFiles);
return this;
}
/**
* <p>The total number of pages processed in this batch run</p>
*/
@JsonSetter(value = "numPages", nulls = Nulls.SKIP)
public Builder numPages(Optional<Double> numPages) {
this.numPages = numPages;
return this;
}
public Builder numPages(Double numPages) {
this.numPages = Optional.ofNullable(numPages);
return this;
}
public BatchProcessorRunMetrics build() {
return new BatchProcessorRunMetrics(numFiles, numPages, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BatchProcessorRunOptions.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BatchProcessorRunOptions.Builder.class)
public final class BatchProcessorRunOptions {
private final Optional<List<String>> fuzzyMatchFields;
private final Optional<List<String>> excludeFields;
private final Map<String, Object> additionalProperties;
private BatchProcessorRunOptions(
Optional<List<String>> fuzzyMatchFields,
Optional<List<String>> excludeFields,
Map<String, Object> additionalProperties) {
this.fuzzyMatchFields = fuzzyMatchFields;
this.excludeFields = excludeFields;
this.additionalProperties = additionalProperties;
}
/**
* @return The fields that were fuzzy matched.
*/
@JsonProperty("fuzzyMatchFields")
public Optional<List<String>> getFuzzyMatchFields() {
return fuzzyMatchFields;
}
/**
* @return The fields that were excluded from the run.
*/
@JsonProperty("excludeFields")
public Optional<List<String>> getExcludeFields() {
return excludeFields;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BatchProcessorRunOptions && equalTo((BatchProcessorRunOptions) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BatchProcessorRunOptions other) {
return fuzzyMatchFields.equals(other.fuzzyMatchFields) && excludeFields.equals(other.excludeFields);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.fuzzyMatchFields, this.excludeFields);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<List<String>> fuzzyMatchFields = Optional.empty();
private Optional<List<String>> excludeFields = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(BatchProcessorRunOptions other) {
fuzzyMatchFields(other.getFuzzyMatchFields());
excludeFields(other.getExcludeFields());
return this;
}
/**
* <p>The fields that were fuzzy matched.</p>
*/
@JsonSetter(value = "fuzzyMatchFields", nulls = Nulls.SKIP)
public Builder fuzzyMatchFields(Optional<List<String>> fuzzyMatchFields) {
this.fuzzyMatchFields = fuzzyMatchFields;
return this;
}
public Builder fuzzyMatchFields(List<String> fuzzyMatchFields) {
this.fuzzyMatchFields = Optional.ofNullable(fuzzyMatchFields);
return this;
}
/**
* <p>The fields that were excluded from the run.</p>
*/
@JsonSetter(value = "excludeFields", nulls = Nulls.SKIP)
public Builder excludeFields(Optional<List<String>> excludeFields) {
this.excludeFields = excludeFields;
return this;
}
public Builder excludeFields(List<String> excludeFields) {
this.excludeFields = Optional.ofNullable(excludeFields);
return this;
}
public BatchProcessorRunOptions build() {
return new BatchProcessorRunOptions(fuzzyMatchFields, excludeFields, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BatchProcessorRunSource.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum BatchProcessorRunSource {
EVAL_SET("EVAL_SET"),
PLAYGROUND("PLAYGROUND"),
STUDIO("STUDIO");
private final String value;
BatchProcessorRunSource(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BatchProcessorRunStatus.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum BatchProcessorRunStatus {
PENDING("PENDING"),
PROCESSING("PROCESSING"),
PROCESSED("PROCESSED"),
FAILED("FAILED");
private final String value;
BatchProcessorRunStatus(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BatchWorkflowRunFileInput.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BatchWorkflowRunFileInput.Builder.class)
public final class BatchWorkflowRunFileInput {
private final Optional<String> fileName;
private final Optional<String> fileUrl;
private final Optional<String> fileId;
private final Map<String, Object> additionalProperties;
private BatchWorkflowRunFileInput(
Optional<String> fileName,
Optional<String> fileUrl,
Optional<String> fileId,
Map<String, Object> additionalProperties) {
this.fileName = fileName;
this.fileUrl = fileUrl;
this.fileId = fileId;
this.additionalProperties = additionalProperties;
}
/**
* @return The name to associate with the file. If not provided when using <code>fileUrl</code>, the name may be inferred from the URL. This param is only for your reference, and will be rendered in our dashboard, it is not used by the workflow.
*/
@JsonProperty("fileName")
public Optional<String> getFileName() {
return fileName;
}
/**
* @return A URL where the file can be downloaded from. If you use presigned URLs, we suggest a slightly longer expiration time, ideally 30 minutes for a worst case scenario. One of a <code>fileUrl</code> or <code>fileId</code> must be provided.
*/
@JsonProperty("fileUrl")
public Optional<String> getFileUrl() {
return fileUrl;
}
/**
* @return Extend's internal ID for the file. It will always start with <code>file_</code>. One of a <code>fileUrl</code> or <code>fileId</code> must be provided. You can view a file ID from the Extend UI, for instance from running a parser or from a previous file creation. If you provide a <code>fileId</code>, any parsed data will be reused.
* <p>Example: <code>"file_Zk9mNP12Qw4yTv8BdR3H"</code></p>
*/
@JsonProperty("fileId")
public Optional<String> getFileId() {
return fileId;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BatchWorkflowRunFileInput && equalTo((BatchWorkflowRunFileInput) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BatchWorkflowRunFileInput other) {
return fileName.equals(other.fileName) && fileUrl.equals(other.fileUrl) && fileId.equals(other.fileId);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.fileName, this.fileUrl, this.fileId);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<String> fileName = Optional.empty();
private Optional<String> fileUrl = Optional.empty();
private Optional<String> fileId = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(BatchWorkflowRunFileInput other) {
fileName(other.getFileName());
fileUrl(other.getFileUrl());
fileId(other.getFileId());
return this;
}
/**
* <p>The name to associate with the file. If not provided when using <code>fileUrl</code>, the name may be inferred from the URL. This param is only for your reference, and will be rendered in our dashboard, it is not used by the workflow.</p>
*/
@JsonSetter(value = "fileName", nulls = Nulls.SKIP)
public Builder fileName(Optional<String> fileName) {
this.fileName = fileName;
return this;
}
public Builder fileName(String fileName) {
this.fileName = Optional.ofNullable(fileName);
return this;
}
/**
* <p>A URL where the file can be downloaded from. If you use presigned URLs, we suggest a slightly longer expiration time, ideally 30 minutes for a worst case scenario. One of a <code>fileUrl</code> or <code>fileId</code> must be provided.</p>
*/
@JsonSetter(value = "fileUrl", nulls = Nulls.SKIP)
public Builder fileUrl(Optional<String> fileUrl) {
this.fileUrl = fileUrl;
return this;
}
public Builder fileUrl(String fileUrl) {
this.fileUrl = Optional.ofNullable(fileUrl);
return this;
}
/**
* <p>Extend's internal ID for the file. It will always start with <code>file_</code>. One of a <code>fileUrl</code> or <code>fileId</code> must be provided. You can view a file ID from the Extend UI, for instance from running a parser or from a previous file creation. If you provide a <code>fileId</code>, any parsed data will be reused.</p>
* <p>Example: <code>"file_Zk9mNP12Qw4yTv8BdR3H"</code></p>
*/
@JsonSetter(value = "fileId", nulls = Nulls.SKIP)
public Builder fileId(Optional<String> fileId) {
this.fileId = fileId;
return this;
}
public Builder fileId(String fileId) {
this.fileId = Optional.ofNullable(fileId);
return this;
}
public BatchWorkflowRunFileInput build() {
return new BatchWorkflowRunFileInput(fileName, fileUrl, fileId, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/Block.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = Block.Builder.class)
public final class Block {
private final String object;
private final String id;
private final BlockType type;
private final String content;
private final BlockDetails details;
private final BlockMetadata metadata;
private final List<BlockPolygonItem> polygon;
private final BlockBoundingBox boundingBox;
private final Map<String, Object> additionalProperties;
private Block(
String object,
String id,
BlockType type,
String content,
BlockDetails details,
BlockMetadata metadata,
List<BlockPolygonItem> polygon,
BlockBoundingBox boundingBox,
Map<String, Object> additionalProperties) {
this.object = object;
this.id = id;
this.type = type;
this.content = content;
this.details = details;
this.metadata = metadata;
this.polygon = polygon;
this.boundingBox = boundingBox;
this.additionalProperties = additionalProperties;
}
/**
* @return The type of object. In this case, it will always be <code>"block"</code>.
*/
@JsonProperty("object")
public String getObject() {
return object;
}
/**
* @return A unique identifier for the block, deterministically generated as a hash of the block content.
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return The type of block:
* <ul>
* <li><code>"text"</code> - Regular text content</li>
* <li><code>"heading"</code> - Section or document headings</li>
* <li><code>"section_heading"</code> - Subsection headings</li>
* <li><code>"table"</code> - Tabular data with rows and columns</li>
* <li><code>"table_head"</code> - Table header cells</li>
* <li><code>"table_cell"</code> - Table body cells</li>
* <li><code>"figure"</code> - Images, charts, diagrams, or logos</li>
* </ul>
*/
@JsonProperty("type")
public BlockType getType() {
return type;
}
/**
* @return The textual content of the block formatted based on the target format.
*/
@JsonProperty("content")
public String getContent() {
return content;
}
/**
* @return Additional details specific to the block type. The schema depends on the block type.
*/
@JsonProperty("details")
public BlockDetails getDetails() {
return details;
}
/**
* @return Metadata about the block.
*/
@JsonProperty("metadata")
public BlockMetadata getMetadata() {
return metadata;
}
/**
* @return An array of points defining the polygon that bounds the block.
*/
@JsonProperty("polygon")
public List<BlockPolygonItem> getPolygon() {
return polygon;
}
/**
* @return A simplified bounding box for the block.
*/
@JsonProperty("boundingBox")
public BlockBoundingBox getBoundingBox() {
return boundingBox;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof Block && equalTo((Block) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(Block other) {
return object.equals(other.object)
&& id.equals(other.id)
&& type.equals(other.type)
&& content.equals(other.content)
&& details.equals(other.details)
&& metadata.equals(other.metadata)
&& polygon.equals(other.polygon)
&& boundingBox.equals(other.boundingBox);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.object,
this.id,
this.type,
this.content,
this.details,
this.metadata,
this.polygon,
this.boundingBox);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ObjectStage builder() {
return new Builder();
}
public interface ObjectStage {
/**
* <p>The type of object. In this case, it will always be <code>"block"</code>.</p>
*/
IdStage object(@NotNull String object);
Builder from(Block other);
}
public interface IdStage {
/**
* <p>A unique identifier for the block, deterministically generated as a hash of the block content.</p>
*/
TypeStage id(@NotNull String id);
}
public interface TypeStage {
/**
* <p>The type of block:</p>
* <ul>
* <li><code>"text"</code> - Regular text content</li>
* <li><code>"heading"</code> - Section or document headings</li>
* <li><code>"section_heading"</code> - Subsection headings</li>
* <li><code>"table"</code> - Tabular data with rows and columns</li>
* <li><code>"table_head"</code> - Table header cells</li>
* <li><code>"table_cell"</code> - Table body cells</li>
* <li><code>"figure"</code> - Images, charts, diagrams, or logos</li>
* </ul>
*/
ContentStage type(@NotNull BlockType type);
}
public interface ContentStage {
/**
* <p>The textual content of the block formatted based on the target format.</p>
*/
DetailsStage content(@NotNull String content);
}
public interface DetailsStage {
/**
* <p>Additional details specific to the block type. The schema depends on the block type.</p>
*/
MetadataStage details(@NotNull BlockDetails details);
}
public interface MetadataStage {
/**
* <p>Metadata about the block.</p>
*/
BoundingBoxStage metadata(@NotNull BlockMetadata metadata);
}
public interface BoundingBoxStage {
/**
* <p>A simplified bounding box for the block.</p>
*/
_FinalStage boundingBox(@NotNull BlockBoundingBox boundingBox);
}
public interface _FinalStage {
Block build();
/**
* <p>An array of points defining the polygon that bounds the block.</p>
*/
_FinalStage polygon(List<BlockPolygonItem> polygon);
_FinalStage addPolygon(BlockPolygonItem polygon);
_FinalStage addAllPolygon(List<BlockPolygonItem> polygon);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder
implements ObjectStage,
IdStage,
TypeStage,
ContentStage,
DetailsStage,
MetadataStage,
BoundingBoxStage,
_FinalStage {
private String object;
private String id;
private BlockType type;
private String content;
private BlockDetails details;
private BlockMetadata metadata;
private BlockBoundingBox boundingBox;
private List<BlockPolygonItem> polygon = new ArrayList<>();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(Block other) {
object(other.getObject());
id(other.getId());
type(other.getType());
content(other.getContent());
details(other.getDetails());
metadata(other.getMetadata());
polygon(other.getPolygon());
boundingBox(other.getBoundingBox());
return this;
}
/**
* <p>The type of object. In this case, it will always be <code>"block"</code>.</p>
* <p>The type of object. In this case, it will always be <code>"block"</code>.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("object")
public IdStage object(@NotNull String object) {
this.object = Objects.requireNonNull(object, "object must not be null");
return this;
}
/**
* <p>A unique identifier for the block, deterministically generated as a hash of the block content.</p>
* <p>A unique identifier for the block, deterministically generated as a hash of the block content.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public TypeStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>The type of block:</p>
* <ul>
* <li><code>"text"</code> - Regular text content</li>
* <li><code>"heading"</code> - Section or document headings</li>
* <li><code>"section_heading"</code> - Subsection headings</li>
* <li><code>"table"</code> - Tabular data with rows and columns</li>
* <li><code>"table_head"</code> - Table header cells</li>
* <li><code>"table_cell"</code> - Table body cells</li>
* <li><code>"figure"</code> - Images, charts, diagrams, or logos</li>
* </ul>
* <p>The type of block:</p>
* <ul>
* <li><code>"text"</code> - Regular text content</li>
* <li><code>"heading"</code> - Section or document headings</li>
* <li><code>"section_heading"</code> - Subsection headings</li>
* <li><code>"table"</code> - Tabular data with rows and columns</li>
* <li><code>"table_head"</code> - Table header cells</li>
* <li><code>"table_cell"</code> - Table body cells</li>
* <li><code>"figure"</code> - Images, charts, diagrams, or logos</li>
* </ul>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("type")
public ContentStage type(@NotNull BlockType type) {
this.type = Objects.requireNonNull(type, "type must not be null");
return this;
}
/**
* <p>The textual content of the block formatted based on the target format.</p>
* <p>The textual content of the block formatted based on the target format.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("content")
public DetailsStage content(@NotNull String content) {
this.content = Objects.requireNonNull(content, "content must not be null");
return this;
}
/**
* <p>Additional details specific to the block type. The schema depends on the block type.</p>
* <p>Additional details specific to the block type. The schema depends on the block type.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("details")
public MetadataStage details(@NotNull BlockDetails details) {
this.details = Objects.requireNonNull(details, "details must not be null");
return this;
}
/**
* <p>Metadata about the block.</p>
* <p>Metadata about the block.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("metadata")
public BoundingBoxStage metadata(@NotNull BlockMetadata metadata) {
this.metadata = Objects.requireNonNull(metadata, "metadata must not be null");
return this;
}
/**
* <p>A simplified bounding box for the block.</p>
* <p>A simplified bounding box for the block.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("boundingBox")
public _FinalStage boundingBox(@NotNull BlockBoundingBox boundingBox) {
this.boundingBox = Objects.requireNonNull(boundingBox, "boundingBox must not be null");
return this;
}
/**
* <p>An array of points defining the polygon that bounds the block.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addAllPolygon(List<BlockPolygonItem> polygon) {
this.polygon.addAll(polygon);
return this;
}
/**
* <p>An array of points defining the polygon that bounds the block.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addPolygon(BlockPolygonItem polygon) {
this.polygon.add(polygon);
return this;
}
/**
* <p>An array of points defining the polygon that bounds the block.</p>
*/
@java.lang.Override
@JsonSetter(value = "polygon", nulls = Nulls.SKIP)
public _FinalStage polygon(List<BlockPolygonItem> polygon) {
this.polygon.clear();
this.polygon.addAll(polygon);
return this;
}
@java.lang.Override
public Block build() {
return new Block(object, id, type, content, details, metadata, polygon, boundingBox, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BlockBoundingBox.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BlockBoundingBox.Builder.class)
public final class BlockBoundingBox {
private final Optional<Double> left;
private final Optional<Double> right;
private final Optional<Double> top;
private final Optional<Double> bottom;
private final Map<String, Object> additionalProperties;
private BlockBoundingBox(
Optional<Double> left,
Optional<Double> right,
Optional<Double> top,
Optional<Double> bottom,
Map<String, Object> additionalProperties) {
this.left = left;
this.right = right;
this.top = top;
this.bottom = bottom;
this.additionalProperties = additionalProperties;
}
@JsonProperty("left")
public Optional<Double> getLeft() {
return left;
}
@JsonProperty("right")
public Optional<Double> getRight() {
return right;
}
@JsonProperty("top")
public Optional<Double> getTop() {
return top;
}
@JsonProperty("bottom")
public Optional<Double> getBottom() {
return bottom;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BlockBoundingBox && equalTo((BlockBoundingBox) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BlockBoundingBox other) {
return left.equals(other.left)
&& right.equals(other.right)
&& top.equals(other.top)
&& bottom.equals(other.bottom);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.left, this.right, this.top, this.bottom);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Double> left = Optional.empty();
private Optional<Double> right = Optional.empty();
private Optional<Double> top = Optional.empty();
private Optional<Double> bottom = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(BlockBoundingBox other) {
left(other.getLeft());
right(other.getRight());
top(other.getTop());
bottom(other.getBottom());
return this;
}
@JsonSetter(value = "left", nulls = Nulls.SKIP)
public Builder left(Optional<Double> left) {
this.left = left;
return this;
}
public Builder left(Double left) {
this.left = Optional.ofNullable(left);
return this;
}
@JsonSetter(value = "right", nulls = Nulls.SKIP)
public Builder right(Optional<Double> right) {
this.right = right;
return this;
}
public Builder right(Double right) {
this.right = Optional.ofNullable(right);
return this;
}
@JsonSetter(value = "top", nulls = Nulls.SKIP)
public Builder top(Optional<Double> top) {
this.top = top;
return this;
}
public Builder top(Double top) {
this.top = Optional.ofNullable(top);
return this;
}
@JsonSetter(value = "bottom", nulls = Nulls.SKIP)
public Builder bottom(Optional<Double> bottom) {
this.bottom = bottom;
return this;
}
public Builder bottom(Double bottom) {
this.bottom = Optional.ofNullable(bottom);
return this;
}
public BlockBoundingBox build() {
return new BlockBoundingBox(left, right, top, bottom, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BlockDetails.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
@JsonDeserialize(using = BlockDetails.Deserializer.class)
public final class BlockDetails {
private final Object value;
private final int type;
private BlockDetails(Object value, int type) {
this.value = value;
this.type = type;
}
@JsonValue
public Object get() {
return this.value;
}
@SuppressWarnings("unchecked")
public <T> T visit(Visitor<T> visitor) {
if (this.type == 0) {
return visitor.visit((TableDetails) this.value);
} else if (this.type == 1) {
return visitor.visit((TableCellDetails) this.value);
} else if (this.type == 2) {
return visitor.visit((FigureDetails) this.value);
} else if (this.type == 3) {
return visitor.visit((Map<String, Object>) this.value);
}
throw new IllegalStateException("Failed to visit value. This should never happen.");
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BlockDetails && equalTo((BlockDetails) other);
}
private boolean equalTo(BlockDetails other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return this.value.toString();
}
public static BlockDetails of(TableDetails value) {
return new BlockDetails(value, 0);
}
public static BlockDetails of(TableCellDetails value) {
return new BlockDetails(value, 1);
}
public static BlockDetails of(FigureDetails value) {
return new BlockDetails(value, 2);
}
public static BlockDetails of(Map<String, Object> value) {
return new BlockDetails(value, 3);
}
public interface Visitor<T> {
T visit(TableDetails value);
T visit(TableCellDetails value);
T visit(FigureDetails value);
T visit(Map<String, Object> value);
}
static final class Deserializer extends StdDeserializer<BlockDetails> {
Deserializer() {
super(BlockDetails.class);
}
@java.lang.Override
public BlockDetails deserialize(JsonParser p, DeserializationContext context) throws IOException {
Object value = p.readValueAs(Object.class);
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, TableDetails.class));
} catch (RuntimeException e) {
}
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, TableCellDetails.class));
} catch (RuntimeException e) {
}
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, FigureDetails.class));
} catch (RuntimeException e) {
}
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference<Map<String, Object>>() {}));
} catch (RuntimeException e) {
}
throw new JsonParseException(p, "Failed to deserialize");
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BlockMetadata.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BlockMetadata.Builder.class)
public final class BlockMetadata {
private final Optional<BlockMetadataPage> page;
private final Map<String, Object> additionalProperties;
private BlockMetadata(Optional<BlockMetadataPage> page, Map<String, Object> additionalProperties) {
this.page = page;
this.additionalProperties = additionalProperties;
}
/**
* @return Information about the page this block appears on.
*/
@JsonProperty("page")
public Optional<BlockMetadataPage> getPage() {
return page;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BlockMetadata && equalTo((BlockMetadata) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BlockMetadata other) {
return page.equals(other.page);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.page);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<BlockMetadataPage> page = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(BlockMetadata other) {
page(other.getPage());
return this;
}
/**
* <p>Information about the page this block appears on.</p>
*/
@JsonSetter(value = "page", nulls = Nulls.SKIP)
public Builder page(Optional<BlockMetadataPage> page) {
this.page = page;
return this;
}
public Builder page(BlockMetadataPage page) {
this.page = Optional.ofNullable(page);
return this;
}
public BlockMetadata build() {
return new BlockMetadata(page, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BlockMetadataPage.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BlockMetadataPage.Builder.class)
public final class BlockMetadataPage {
private final int number;
private final Optional<Double> width;
private final Optional<Double> height;
private final Map<String, Object> additionalProperties;
private BlockMetadataPage(
int number, Optional<Double> width, Optional<Double> height, Map<String, Object> additionalProperties) {
this.number = number;
this.width = width;
this.height = height;
this.additionalProperties = additionalProperties;
}
/**
* @return The page number where this block appears.
*/
@JsonProperty("number")
public int getNumber() {
return number;
}
/**
* @return The width of the page in points.
*/
@JsonProperty("width")
public Optional<Double> getWidth() {
return width;
}
/**
* @return The height of the page in points.
*/
@JsonProperty("height")
public Optional<Double> getHeight() {
return height;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BlockMetadataPage && equalTo((BlockMetadataPage) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BlockMetadataPage other) {
return number == other.number && width.equals(other.width) && height.equals(other.height);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.number, this.width, this.height);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static NumberStage builder() {
return new Builder();
}
public interface NumberStage {
/**
* <p>The page number where this block appears.</p>
*/
_FinalStage number(int number);
Builder from(BlockMetadataPage other);
}
public interface _FinalStage {
BlockMetadataPage build();
/**
* <p>The width of the page in points.</p>
*/
_FinalStage width(Optional<Double> width);
_FinalStage width(Double width);
/**
* <p>The height of the page in points.</p>
*/
_FinalStage height(Optional<Double> height);
_FinalStage height(Double height);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements NumberStage, _FinalStage {
private int number;
private Optional<Double> height = Optional.empty();
private Optional<Double> width = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(BlockMetadataPage other) {
number(other.getNumber());
width(other.getWidth());
height(other.getHeight());
return this;
}
/**
* <p>The page number where this block appears.</p>
* <p>The page number where this block appears.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("number")
public _FinalStage number(int number) {
this.number = number;
return this;
}
/**
* <p>The height of the page in points.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage height(Double height) {
this.height = Optional.ofNullable(height);
return this;
}
/**
* <p>The height of the page in points.</p>
*/
@java.lang.Override
@JsonSetter(value = "height", nulls = Nulls.SKIP)
public _FinalStage height(Optional<Double> height) {
this.height = height;
return this;
}
/**
* <p>The width of the page in points.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage width(Double width) {
this.width = Optional.ofNullable(width);
return this;
}
/**
* <p>The width of the page in points.</p>
*/
@java.lang.Override
@JsonSetter(value = "width", nulls = Nulls.SKIP)
public _FinalStage width(Optional<Double> width) {
this.width = width;
return this;
}
@java.lang.Override
public BlockMetadataPage build() {
return new BlockMetadataPage(number, width, height, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BlockPolygonItem.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = BlockPolygonItem.Builder.class)
public final class BlockPolygonItem {
private final double x;
private final double y;
private final Map<String, Object> additionalProperties;
private BlockPolygonItem(double x, double y, Map<String, Object> additionalProperties) {
this.x = x;
this.y = y;
this.additionalProperties = additionalProperties;
}
@JsonProperty("x")
public double getX() {
return x;
}
@JsonProperty("y")
public double getY() {
return y;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof BlockPolygonItem && equalTo((BlockPolygonItem) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(BlockPolygonItem other) {
return x == other.x && y == other.y;
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.x, this.y);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static XStage builder() {
return new Builder();
}
public interface XStage {
YStage x(double x);
Builder from(BlockPolygonItem other);
}
public interface YStage {
_FinalStage y(double y);
}
public interface _FinalStage {
BlockPolygonItem build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements XStage, YStage, _FinalStage {
private double x;
private double y;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(BlockPolygonItem other) {
x(other.getX());
y(other.getY());
return this;
}
@java.lang.Override
@JsonSetter("x")
public YStage x(double x) {
this.x = x;
return this;
}
@java.lang.Override
@JsonSetter("y")
public _FinalStage y(double y) {
this.y = y;
return this;
}
@java.lang.Override
public BlockPolygonItem build() {
return new BlockPolygonItem(x, y, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/BlockType.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum BlockType {
TEXT("text"),
HEADING("heading"),
SECTION_HEADING("section_heading"),
TABLE("table"),
FIGURE("figure");
private final String value;
BlockType(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/Chunk.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = Chunk.Builder.class)
public final class Chunk {
private final String object;
private final ChunkType type;
private final String content;
private final ChunkMetadata metadata;
private final List<Block> blocks;
private final Map<String, Object> additionalProperties;
private Chunk(
String object,
ChunkType type,
String content,
ChunkMetadata metadata,
List<Block> blocks,
Map<String, Object> additionalProperties) {
this.object = object;
this.type = type;
this.content = content;
this.metadata = metadata;
this.blocks = blocks;
this.additionalProperties = additionalProperties;
}
/**
* @return The type of object. In this case, it will always be <code>"chunk"</code>.
*/
@JsonProperty("object")
public String getObject() {
return object;
}
/**
* @return The type of chunk.
*/
@JsonProperty("type")
public ChunkType getType() {
return type;
}
/**
* @return The parsed content of the chunk.
*/
@JsonProperty("content")
public String getContent() {
return content;
}
/**
* @return Metadata about the chunk.
*/
@JsonProperty("metadata")
public ChunkMetadata getMetadata() {
return metadata;
}
/**
* @return An array of block objects that make up the chunk. A Block represents a distinct content element within a document, such as a paragraph of text, a heading, a table, or a figure. Blocks are the fundamental units that make up chunks in parsed documents.
*/
@JsonProperty("blocks")
public List<Block> getBlocks() {
return blocks;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof Chunk && equalTo((Chunk) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(Chunk other) {
return object.equals(other.object)
&& type.equals(other.type)
&& content.equals(other.content)
&& metadata.equals(other.metadata)
&& blocks.equals(other.blocks);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.object, this.type, this.content, this.metadata, this.blocks);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ObjectStage builder() {
return new Builder();
}
public interface ObjectStage {
/**
* <p>The type of object. In this case, it will always be <code>"chunk"</code>.</p>
*/
TypeStage object(@NotNull String object);
Builder from(Chunk other);
}
public interface TypeStage {
/**
* <p>The type of chunk.</p>
*/
ContentStage type(@NotNull ChunkType type);
}
public interface ContentStage {
/**
* <p>The parsed content of the chunk.</p>
*/
MetadataStage content(@NotNull String content);
}
public interface MetadataStage {
/**
* <p>Metadata about the chunk.</p>
*/
_FinalStage metadata(@NotNull ChunkMetadata metadata);
}
public interface _FinalStage {
Chunk build();
/**
* <p>An array of block objects that make up the chunk. A Block represents a distinct content element within a document, such as a paragraph of text, a heading, a table, or a figure. Blocks are the fundamental units that make up chunks in parsed documents.</p>
*/
_FinalStage blocks(List<Block> blocks);
_FinalStage addBlocks(Block blocks);
_FinalStage addAllBlocks(List<Block> blocks);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ObjectStage, TypeStage, ContentStage, MetadataStage, _FinalStage {
private String object;
private ChunkType type;
private String content;
private ChunkMetadata metadata;
private List<Block> blocks = new ArrayList<>();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(Chunk other) {
object(other.getObject());
type(other.getType());
content(other.getContent());
metadata(other.getMetadata());
blocks(other.getBlocks());
return this;
}
/**
* <p>The type of object. In this case, it will always be <code>"chunk"</code>.</p>
* <p>The type of object. In this case, it will always be <code>"chunk"</code>.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("object")
public TypeStage object(@NotNull String object) {
this.object = Objects.requireNonNull(object, "object must not be null");
return this;
}
/**
* <p>The type of chunk.</p>
* <p>The type of chunk.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("type")
public ContentStage type(@NotNull ChunkType type) {
this.type = Objects.requireNonNull(type, "type must not be null");
return this;
}
/**
* <p>The parsed content of the chunk.</p>
* <p>The parsed content of the chunk.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("content")
public MetadataStage content(@NotNull String content) {
this.content = Objects.requireNonNull(content, "content must not be null");
return this;
}
/**
* <p>Metadata about the chunk.</p>
* <p>Metadata about the chunk.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("metadata")
public _FinalStage metadata(@NotNull ChunkMetadata metadata) {
this.metadata = Objects.requireNonNull(metadata, "metadata must not be null");
return this;
}
/**
* <p>An array of block objects that make up the chunk. A Block represents a distinct content element within a document, such as a paragraph of text, a heading, a table, or a figure. Blocks are the fundamental units that make up chunks in parsed documents.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addAllBlocks(List<Block> blocks) {
this.blocks.addAll(blocks);
return this;
}
/**
* <p>An array of block objects that make up the chunk. A Block represents a distinct content element within a document, such as a paragraph of text, a heading, a table, or a figure. Blocks are the fundamental units that make up chunks in parsed documents.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addBlocks(Block blocks) {
this.blocks.add(blocks);
return this;
}
/**
* <p>An array of block objects that make up the chunk. A Block represents a distinct content element within a document, such as a paragraph of text, a heading, a table, or a figure. Blocks are the fundamental units that make up chunks in parsed documents.</p>
*/
@java.lang.Override
@JsonSetter(value = "blocks", nulls = Nulls.SKIP)
public _FinalStage blocks(List<Block> blocks) {
this.blocks.clear();
this.blocks.addAll(blocks);
return this;
}
@java.lang.Override
public Chunk build() {
return new Chunk(object, type, content, metadata, blocks, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ChunkMetadata.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ChunkMetadata.Builder.class)
public final class ChunkMetadata {
private final ChunkMetadataPageRange pageRange;
private final Map<String, Object> additionalProperties;
private ChunkMetadata(ChunkMetadataPageRange pageRange, Map<String, Object> additionalProperties) {
this.pageRange = pageRange;
this.additionalProperties = additionalProperties;
}
/**
* @return The page range this chunk covers. Often will just be a partial page, in which cases <code>start</code> and <code>end</code> will be the same.
*/
@JsonProperty("pageRange")
public ChunkMetadataPageRange getPageRange() {
return pageRange;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ChunkMetadata && equalTo((ChunkMetadata) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ChunkMetadata other) {
return pageRange.equals(other.pageRange);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.pageRange);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static PageRangeStage builder() {
return new Builder();
}
public interface PageRangeStage {
/**
* <p>The page range this chunk covers. Often will just be a partial page, in which cases <code>start</code> and <code>end</code> will be the same.</p>
*/
_FinalStage pageRange(@NotNull ChunkMetadataPageRange pageRange);
Builder from(ChunkMetadata other);
}
public interface _FinalStage {
ChunkMetadata build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements PageRangeStage, _FinalStage {
private ChunkMetadataPageRange pageRange;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ChunkMetadata other) {
pageRange(other.getPageRange());
return this;
}
/**
* <p>The page range this chunk covers. Often will just be a partial page, in which cases <code>start</code> and <code>end</code> will be the same.</p>
* <p>The page range this chunk covers. Often will just be a partial page, in which cases <code>start</code> and <code>end</code> will be the same.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("pageRange")
public _FinalStage pageRange(@NotNull ChunkMetadataPageRange pageRange) {
this.pageRange = Objects.requireNonNull(pageRange, "pageRange must not be null");
return this;
}
@java.lang.Override
public ChunkMetadata build() {
return new ChunkMetadata(pageRange, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ChunkMetadataPageRange.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ChunkMetadataPageRange.Builder.class)
public final class ChunkMetadataPageRange {
private final int start;
private final int end;
private final Map<String, Object> additionalProperties;
private ChunkMetadataPageRange(int start, int end, Map<String, Object> additionalProperties) {
this.start = start;
this.end = end;
this.additionalProperties = additionalProperties;
}
/**
* @return The starting page number (inclusive).
*/
@JsonProperty("start")
public int getStart() {
return start;
}
/**
* @return The ending page number (inclusive).
*/
@JsonProperty("end")
public int getEnd() {
return end;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ChunkMetadataPageRange && equalTo((ChunkMetadataPageRange) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ChunkMetadataPageRange other) {
return start == other.start && end == other.end;
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.start, this.end);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static StartStage builder() {
return new Builder();
}
public interface StartStage {
/**
* <p>The starting page number (inclusive).</p>
*/
EndStage start(int start);
Builder from(ChunkMetadataPageRange other);
}
public interface EndStage {
/**
* <p>The ending page number (inclusive).</p>
*/
_FinalStage end(int end);
}
public interface _FinalStage {
ChunkMetadataPageRange build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements StartStage, EndStage, _FinalStage {
private int start;
private int end;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ChunkMetadataPageRange other) {
start(other.getStart());
end(other.getEnd());
return this;
}
/**
* <p>The starting page number (inclusive).</p>
* <p>The starting page number (inclusive).</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("start")
public EndStage start(int start) {
this.start = start;
return this;
}
/**
* <p>The ending page number (inclusive).</p>
* <p>The ending page number (inclusive).</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("end")
public _FinalStage end(int end) {
this.end = end;
return this;
}
@java.lang.Override
public ChunkMetadataPageRange build() {
return new ChunkMetadataPageRange(start, end, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ChunkType.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ChunkType {
PAGE("page"),
DOCUMENT("document"),
SECTION("section");
private final String value;
ChunkType(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/Citation.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = Citation.Builder.class)
public final class Citation {
private final Optional<Double> page;
private final Optional<String> referenceText;
private final Optional<List<Polygon>> polygon;
private final Map<String, Object> additionalProperties;
private Citation(
Optional<Double> page,
Optional<String> referenceText,
Optional<List<Polygon>> polygon,
Map<String, Object> additionalProperties) {
this.page = page;
this.referenceText = referenceText;
this.polygon = polygon;
this.additionalProperties = additionalProperties;
}
/**
* @return Page number where the citation was found
*/
@JsonProperty("page")
public Optional<Double> getPage() {
return page;
}
/**
* @return The text that was referenced
*/
@JsonProperty("referenceText")
public Optional<String> getReferenceText() {
return referenceText;
}
/**
* @return Array of points defining the polygon
*/
@JsonProperty("polygon")
public Optional<List<Polygon>> getPolygon() {
return polygon;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof Citation && equalTo((Citation) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(Citation other) {
return page.equals(other.page) && referenceText.equals(other.referenceText) && polygon.equals(other.polygon);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.page, this.referenceText, this.polygon);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Double> page = Optional.empty();
private Optional<String> referenceText = Optional.empty();
private Optional<List<Polygon>> polygon = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(Citation other) {
page(other.getPage());
referenceText(other.getReferenceText());
polygon(other.getPolygon());
return this;
}
/**
* <p>Page number where the citation was found</p>
*/
@JsonSetter(value = "page", nulls = Nulls.SKIP)
public Builder page(Optional<Double> page) {
this.page = page;
return this;
}
public Builder page(Double page) {
this.page = Optional.ofNullable(page);
return this;
}
/**
* <p>The text that was referenced</p>
*/
@JsonSetter(value = "referenceText", nulls = Nulls.SKIP)
public Builder referenceText(Optional<String> referenceText) {
this.referenceText = referenceText;
return this;
}
public Builder referenceText(String referenceText) {
this.referenceText = Optional.ofNullable(referenceText);
return this;
}
/**
* <p>Array of points defining the polygon</p>
*/
@JsonSetter(value = "polygon", nulls = Nulls.SKIP)
public Builder polygon(Optional<List<Polygon>> polygon) {
this.polygon = polygon;
return this;
}
public Builder polygon(List<Polygon> polygon) {
this.polygon = Optional.ofNullable(polygon);
return this;
}
public Citation build() {
return new Citation(page, referenceText, polygon, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/Classification.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = Classification.Builder.class)
public final class Classification {
private final String id;
private final String type;
private final String description;
private final Map<String, Object> additionalProperties;
private Classification(String id, String type, String description, Map<String, Object> additionalProperties) {
this.id = id;
this.type = type;
this.description = description;
this.additionalProperties = additionalProperties;
}
/**
* @return Unique identifier for the classification. We recommend lowercase, underscore-separated format.
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return Type identifier for the classification.
*/
@JsonProperty("type")
public String getType() {
return type;
}
/**
* @return A detailed description of the classification.
*/
@JsonProperty("description")
public String getDescription() {
return description;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof Classification && equalTo((Classification) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(Classification other) {
return id.equals(other.id) && type.equals(other.type) && description.equals(other.description);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.id, this.type, this.description);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static IdStage builder() {
return new Builder();
}
public interface IdStage {
/**
* <p>Unique identifier for the classification. We recommend lowercase, underscore-separated format.</p>
*/
TypeStage id(@NotNull String id);
Builder from(Classification other);
}
public interface TypeStage {
/**
* <p>Type identifier for the classification.</p>
*/
DescriptionStage type(@NotNull String type);
}
public interface DescriptionStage {
/**
* <p>A detailed description of the classification.</p>
*/
_FinalStage description(@NotNull String description);
}
public interface _FinalStage {
Classification build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements IdStage, TypeStage, DescriptionStage, _FinalStage {
private String id;
private String type;
private String description;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(Classification other) {
id(other.getId());
type(other.getType());
description(other.getDescription());
return this;
}
/**
* <p>Unique identifier for the classification. We recommend lowercase, underscore-separated format.</p>
* <p>Unique identifier for the classification. We recommend lowercase, underscore-separated format.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public TypeStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>Type identifier for the classification.</p>
* <p>Type identifier for the classification.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("type")
public DescriptionStage type(@NotNull String type) {
this.type = Objects.requireNonNull(type, "type must not be null");
return this;
}
/**
* <p>A detailed description of the classification.</p>
* <p>A detailed description of the classification.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("description")
public _FinalStage description(@NotNull String description) {
this.description = Objects.requireNonNull(description, "description must not be null");
return this;
}
@java.lang.Override
public Classification build() {
return new Classification(id, type, description, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ClassificationAdvancedOptions.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ClassificationAdvancedOptions.Builder.class)
public final class ClassificationAdvancedOptions {
private final Optional<ClassificationAdvancedOptionsContext> context;
private final Optional<Boolean> advancedMultimodalEnabled;
private final Optional<Integer> fixedPageLimit;
private final Optional<List<PageRangesItem>> pageRanges;
private final Map<String, Object> additionalProperties;
private ClassificationAdvancedOptions(
Optional<ClassificationAdvancedOptionsContext> context,
Optional<Boolean> advancedMultimodalEnabled,
Optional<Integer> fixedPageLimit,
Optional<List<PageRangesItem>> pageRanges,
Map<String, Object> additionalProperties) {
this.context = context;
this.advancedMultimodalEnabled = advancedMultimodalEnabled;
this.fixedPageLimit = fixedPageLimit;
this.pageRanges = pageRanges;
this.additionalProperties = additionalProperties;
}
/**
* @return The context to use for classification.
*/
@JsonProperty("context")
public Optional<ClassificationAdvancedOptionsContext> getContext() {
return context;
}
/**
* @return Enable advanced multimodal processing for better handling of visual elements during classification.
*/
@JsonProperty("advancedMultimodalEnabled")
public Optional<Boolean> getAdvancedMultimodalEnabled() {
return advancedMultimodalEnabled;
}
/**
* @return Limit processing to a specific number of pages from the beginning of the document. See <a href="/product/page-ranges">Page Ranges</a>.
*/
@JsonProperty("fixedPageLimit")
public Optional<Integer> getFixedPageLimit() {
return fixedPageLimit;
}
@JsonProperty("pageRanges")
public Optional<List<PageRangesItem>> getPageRanges() {
return pageRanges;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ClassificationAdvancedOptions && equalTo((ClassificationAdvancedOptions) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ClassificationAdvancedOptions other) {
return context.equals(other.context)
&& advancedMultimodalEnabled.equals(other.advancedMultimodalEnabled)
&& fixedPageLimit.equals(other.fixedPageLimit)
&& pageRanges.equals(other.pageRanges);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.context, this.advancedMultimodalEnabled, this.fixedPageLimit, this.pageRanges);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<ClassificationAdvancedOptionsContext> context = Optional.empty();
private Optional<Boolean> advancedMultimodalEnabled = Optional.empty();
private Optional<Integer> fixedPageLimit = Optional.empty();
private Optional<List<PageRangesItem>> pageRanges = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ClassificationAdvancedOptions other) {
context(other.getContext());
advancedMultimodalEnabled(other.getAdvancedMultimodalEnabled());
fixedPageLimit(other.getFixedPageLimit());
pageRanges(other.getPageRanges());
return this;
}
/**
* <p>The context to use for classification.</p>
*/
@JsonSetter(value = "context", nulls = Nulls.SKIP)
public Builder context(Optional<ClassificationAdvancedOptionsContext> context) {
this.context = context;
return this;
}
public Builder context(ClassificationAdvancedOptionsContext context) {
this.context = Optional.ofNullable(context);
return this;
}
/**
* <p>Enable advanced multimodal processing for better handling of visual elements during classification.</p>
*/
@JsonSetter(value = "advancedMultimodalEnabled", nulls = Nulls.SKIP)
public Builder advancedMultimodalEnabled(Optional<Boolean> advancedMultimodalEnabled) {
this.advancedMultimodalEnabled = advancedMultimodalEnabled;
return this;
}
public Builder advancedMultimodalEnabled(Boolean advancedMultimodalEnabled) {
this.advancedMultimodalEnabled = Optional.ofNullable(advancedMultimodalEnabled);
return this;
}
/**
* <p>Limit processing to a specific number of pages from the beginning of the document. See <a href="/product/page-ranges">Page Ranges</a>.</p>
*/
@JsonSetter(value = "fixedPageLimit", nulls = Nulls.SKIP)
public Builder fixedPageLimit(Optional<Integer> fixedPageLimit) {
this.fixedPageLimit = fixedPageLimit;
return this;
}
public Builder fixedPageLimit(Integer fixedPageLimit) {
this.fixedPageLimit = Optional.ofNullable(fixedPageLimit);
return this;
}
@JsonSetter(value = "pageRanges", nulls = Nulls.SKIP)
public Builder pageRanges(Optional<List<PageRangesItem>> pageRanges) {
this.pageRanges = pageRanges;
return this;
}
public Builder pageRanges(List<PageRangesItem> pageRanges) {
this.pageRanges = Optional.ofNullable(pageRanges);
return this;
}
public ClassificationAdvancedOptions build() {
return new ClassificationAdvancedOptions(
context, advancedMultimodalEnabled, fixedPageLimit, pageRanges, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ClassificationAdvancedOptionsContext.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ClassificationAdvancedOptionsContext {
DEFAULT("default"),
MAX("max");
private final String value;
ClassificationAdvancedOptionsContext(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ClassificationConfig.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ClassificationConfig.Builder.class)
public final class ClassificationConfig {
private final Optional<ClassificationConfigBaseProcessor> baseProcessor;
private final Optional<String> baseVersion;
private final List<Classification> classifications;
private final Optional<String> classificationRules;
private final Optional<ClassificationAdvancedOptions> advancedOptions;
private final Optional<ParseConfig> parser;
private final Map<String, Object> additionalProperties;
private ClassificationConfig(
Optional<ClassificationConfigBaseProcessor> baseProcessor,
Optional<String> baseVersion,
List<Classification> classifications,
Optional<String> classificationRules,
Optional<ClassificationAdvancedOptions> advancedOptions,
Optional<ParseConfig> parser,
Map<String, Object> additionalProperties) {
this.baseProcessor = baseProcessor;
this.baseVersion = baseVersion;
this.classifications = classifications;
this.classificationRules = classificationRules;
this.advancedOptions = advancedOptions;
this.parser = parser;
this.additionalProperties = additionalProperties;
}
/**
* @return The base processor to use. For classifiers, this must be either <code>"classification_performance"</code> or <code>"classification_light"</code>. See <a href="/changelog/classification/classification-performance">Classification Changelog</a> for more details.
*/
@JsonProperty("baseProcessor")
public Optional<ClassificationConfigBaseProcessor> getBaseProcessor() {
return baseProcessor;
}
/**
* @return The version of the <code>"classification_performance"</code> or <code>"classification_light"</code> processor to use. If this is provided, the <code>baseProcessor</code> must also be provided. See <a href="/changelog/classification/classification-performance">Classification Changelog</a> for more details.
*/
@JsonProperty("baseVersion")
public Optional<String> getBaseVersion() {
return baseVersion;
}
/**
* @return Array of possible classifications for the document.
*/
@JsonProperty("classifications")
public List<Classification> getClassifications() {
return classifications;
}
/**
* @return Custom rules to guide the classification process in natural language.
*/
@JsonProperty("classificationRules")
public Optional<String> getClassificationRules() {
return classificationRules;
}
/**
* @return Advanced configuration options.
*/
@JsonProperty("advancedOptions")
public Optional<ClassificationAdvancedOptions> getAdvancedOptions() {
return advancedOptions;
}
/**
* @return Configuration options for the parsing process.
*/
@JsonProperty("parser")
public Optional<ParseConfig> getParser() {
return parser;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ClassificationConfig && equalTo((ClassificationConfig) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ClassificationConfig other) {
return baseProcessor.equals(other.baseProcessor)
&& baseVersion.equals(other.baseVersion)
&& classifications.equals(other.classifications)
&& classificationRules.equals(other.classificationRules)
&& advancedOptions.equals(other.advancedOptions)
&& parser.equals(other.parser);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.baseProcessor,
this.baseVersion,
this.classifications,
this.classificationRules,
this.advancedOptions,
this.parser);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<ClassificationConfigBaseProcessor> baseProcessor = Optional.empty();
private Optional<String> baseVersion = Optional.empty();
private List<Classification> classifications = new ArrayList<>();
private Optional<String> classificationRules = Optional.empty();
private Optional<ClassificationAdvancedOptions> advancedOptions = Optional.empty();
private Optional<ParseConfig> parser = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ClassificationConfig other) {
baseProcessor(other.getBaseProcessor());
baseVersion(other.getBaseVersion());
classifications(other.getClassifications());
classificationRules(other.getClassificationRules());
advancedOptions(other.getAdvancedOptions());
parser(other.getParser());
return this;
}
/**
* <p>The base processor to use. For classifiers, this must be either <code>"classification_performance"</code> or <code>"classification_light"</code>. See <a href="/changelog/classification/classification-performance">Classification Changelog</a> for more details.</p>
*/
@JsonSetter(value = "baseProcessor", nulls = Nulls.SKIP)
public Builder baseProcessor(Optional<ClassificationConfigBaseProcessor> baseProcessor) {
this.baseProcessor = baseProcessor;
return this;
}
public Builder baseProcessor(ClassificationConfigBaseProcessor baseProcessor) {
this.baseProcessor = Optional.ofNullable(baseProcessor);
return this;
}
/**
* <p>The version of the <code>"classification_performance"</code> or <code>"classification_light"</code> processor to use. If this is provided, the <code>baseProcessor</code> must also be provided. See <a href="/changelog/classification/classification-performance">Classification Changelog</a> for more details.</p>
*/
@JsonSetter(value = "baseVersion", nulls = Nulls.SKIP)
public Builder baseVersion(Optional<String> baseVersion) {
this.baseVersion = baseVersion;
return this;
}
public Builder baseVersion(String baseVersion) {
this.baseVersion = Optional.ofNullable(baseVersion);
return this;
}
/**
* <p>Array of possible classifications for the document.</p>
*/
@JsonSetter(value = "classifications", nulls = Nulls.SKIP)
public Builder classifications(List<Classification> classifications) {
this.classifications.clear();
this.classifications.addAll(classifications);
return this;
}
public Builder addClassifications(Classification classifications) {
this.classifications.add(classifications);
return this;
}
public Builder addAllClassifications(List<Classification> classifications) {
this.classifications.addAll(classifications);
return this;
}
/**
* <p>Custom rules to guide the classification process in natural language.</p>
*/
@JsonSetter(value = "classificationRules", nulls = Nulls.SKIP)
public Builder classificationRules(Optional<String> classificationRules) {
this.classificationRules = classificationRules;
return this;
}
public Builder classificationRules(String classificationRules) {
this.classificationRules = Optional.ofNullable(classificationRules);
return this;
}
/**
* <p>Advanced configuration options.</p>
*/
@JsonSetter(value = "advancedOptions", nulls = Nulls.SKIP)
public Builder advancedOptions(Optional<ClassificationAdvancedOptions> advancedOptions) {
this.advancedOptions = advancedOptions;
return this;
}
public Builder advancedOptions(ClassificationAdvancedOptions advancedOptions) {
this.advancedOptions = Optional.ofNullable(advancedOptions);
return this;
}
/**
* <p>Configuration options for the parsing process.</p>
*/
@JsonSetter(value = "parser", nulls = Nulls.SKIP)
public Builder parser(Optional<ParseConfig> parser) {
this.parser = parser;
return this;
}
public Builder parser(ParseConfig parser) {
this.parser = Optional.ofNullable(parser);
return this;
}
public ClassificationConfig build() {
return new ClassificationConfig(
baseProcessor,
baseVersion,
classifications,
classificationRules,
advancedOptions,
parser,
additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ClassificationConfigBaseProcessor.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ClassificationConfigBaseProcessor {
CLASSIFICATION_PERFORMANCE("classification_performance"),
CLASSIFICATION_LIGHT("classification_light");
private final String value;
ClassificationConfigBaseProcessor(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ClassifierOutput.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ClassifierOutput.Builder.class)
public final class ClassifierOutput {
private final String id;
private final String type;
private final double confidence;
private final List<Insight> insights;
private final Map<String, Object> additionalProperties;
private ClassifierOutput(
String id,
String type,
double confidence,
List<Insight> insights,
Map<String, Object> additionalProperties) {
this.id = id;
this.type = type;
this.confidence = confidence;
this.insights = insights;
this.additionalProperties = additionalProperties;
}
/**
* @return The unique identifier for this classification
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return The type of classification
*/
@JsonProperty("type")
public String getType() {
return type;
}
/**
* @return A value between 0 and 1 indicating the model's confidence in the classification, where 1 represents maximum confidence
*/
@JsonProperty("confidence")
public double getConfidence() {
return confidence;
}
/**
* @return Additional insights about the classification decision
*/
@JsonProperty("insights")
public List<Insight> getInsights() {
return insights;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ClassifierOutput && equalTo((ClassifierOutput) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ClassifierOutput other) {
return id.equals(other.id)
&& type.equals(other.type)
&& confidence == other.confidence
&& insights.equals(other.insights);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.id, this.type, this.confidence, this.insights);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static IdStage builder() {
return new Builder();
}
public interface IdStage {
/**
* <p>The unique identifier for this classification</p>
*/
TypeStage id(@NotNull String id);
Builder from(ClassifierOutput other);
}
public interface TypeStage {
/**
* <p>The type of classification</p>
*/
ConfidenceStage type(@NotNull String type);
}
public interface ConfidenceStage {
/**
* <p>A value between 0 and 1 indicating the model's confidence in the classification, where 1 represents maximum confidence</p>
*/
_FinalStage confidence(double confidence);
}
public interface _FinalStage {
ClassifierOutput build();
/**
* <p>Additional insights about the classification decision</p>
*/
_FinalStage insights(List<Insight> insights);
_FinalStage addInsights(Insight insights);
_FinalStage addAllInsights(List<Insight> insights);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements IdStage, TypeStage, ConfidenceStage, _FinalStage {
private String id;
private String type;
private double confidence;
private List<Insight> insights = new ArrayList<>();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ClassifierOutput other) {
id(other.getId());
type(other.getType());
confidence(other.getConfidence());
insights(other.getInsights());
return this;
}
/**
* <p>The unique identifier for this classification</p>
* <p>The unique identifier for this classification</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public TypeStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>The type of classification</p>
* <p>The type of classification</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("type")
public ConfidenceStage type(@NotNull String type) {
this.type = Objects.requireNonNull(type, "type must not be null");
return this;
}
/**
* <p>A value between 0 and 1 indicating the model's confidence in the classification, where 1 represents maximum confidence</p>
* <p>A value between 0 and 1 indicating the model's confidence in the classification, where 1 represents maximum confidence</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("confidence")
public _FinalStage confidence(double confidence) {
this.confidence = confidence;
return this;
}
/**
* <p>Additional insights about the classification decision</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addAllInsights(List<Insight> insights) {
this.insights.addAll(insights);
return this;
}
/**
* <p>Additional insights about the classification decision</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addInsights(Insight insights) {
this.insights.add(insights);
return this;
}
/**
* <p>Additional insights about the classification decision</p>
*/
@java.lang.Override
@JsonSetter(value = "insights", nulls = Nulls.SKIP)
public _FinalStage insights(List<Insight> insights) {
this.insights.clear();
this.insights.addAll(insights);
return this;
}
@java.lang.Override
public ClassifierOutput build() {
return new ClassifierOutput(id, type, confidence, insights, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ClassifyMetrics.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ClassifyMetrics.Builder.class)
public final class ClassifyMetrics implements IBaseMetrics {
private final Optional<Double> numFiles;
private final Optional<Double> numPages;
private final Optional<Double> meanRunTimeMs;
private final Optional<String> type;
private final Optional<Double> accuracyPerc;
private final Optional<Double> meanConfidence;
private final Optional<Map<String, Object>> distribution;
private final Optional<Map<String, Object>> accuracyPercByClassification;
private final Optional<Map<String, Object>> confusionMatrix;
private final Map<String, Object> additionalProperties;
private ClassifyMetrics(
Optional<Double> numFiles,
Optional<Double> numPages,
Optional<Double> meanRunTimeMs,
Optional<String> type,
Optional<Double> accuracyPerc,
Optional<Double> meanConfidence,
Optional<Map<String, Object>> distribution,
Optional<Map<String, Object>> accuracyPercByClassification,
Optional<Map<String, Object>> confusionMatrix,
Map<String, Object> additionalProperties) {
this.numFiles = numFiles;
this.numPages = numPages;
this.meanRunTimeMs = meanRunTimeMs;
this.type = type;
this.accuracyPerc = accuracyPerc;
this.meanConfidence = meanConfidence;
this.distribution = distribution;
this.accuracyPercByClassification = accuracyPercByClassification;
this.confusionMatrix = confusionMatrix;
this.additionalProperties = additionalProperties;
}
/**
* @return The total number of files that were processed.
*/
@JsonProperty("numFiles")
@java.lang.Override
public Optional<Double> getNumFiles() {
return numFiles;
}
/**
* @return The total number of pages that were processed.
*/
@JsonProperty("numPages")
@java.lang.Override
public Optional<Double> getNumPages() {
return numPages;
}
/**
* @return The mean runtime in milliseconds per document.
*/
@JsonProperty("meanRunTimeMs")
@java.lang.Override
public Optional<Double> getMeanRunTimeMs() {
return meanRunTimeMs;
}
/**
* @return The type of metrics. Will always be <code>"CLASSIFY"</code> for classification processors.
*/
@JsonProperty("type")
public Optional<String> getType() {
return type;
}
/**
* @return The overall accuracy percentage.
*/
@JsonProperty("accuracyPerc")
public Optional<Double> getAccuracyPerc() {
return accuracyPerc;
}
/**
* @return The mean confidence score.
*/
@JsonProperty("meanConfidence")
public Optional<Double> getMeanConfidence() {
return meanConfidence;
}
/**
* @return Record mapping classification values to their counts.
*/
@JsonProperty("distribution")
public Optional<Map<String, Object>> getDistribution() {
return distribution;
}
/**
* @return Mapping from classification to accuracy percentage as calculated from the confusion matrix.
*/
@JsonProperty("accuracyPercByClassification")
public Optional<Map<String, Object>> getAccuracyPercByClassification() {
return accuracyPercByClassification;
}
/**
* @return Mapping from actual class to predicted class to count. Only present when accuracy percentage is present.
*/
@JsonProperty("confusionMatrix")
public Optional<Map<String, Object>> getConfusionMatrix() {
return confusionMatrix;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ClassifyMetrics && equalTo((ClassifyMetrics) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ClassifyMetrics other) {
return numFiles.equals(other.numFiles)
&& numPages.equals(other.numPages)
&& meanRunTimeMs.equals(other.meanRunTimeMs)
&& type.equals(other.type)
&& accuracyPerc.equals(other.accuracyPerc)
&& meanConfidence.equals(other.meanConfidence)
&& distribution.equals(other.distribution)
&& accuracyPercByClassification.equals(other.accuracyPercByClassification)
&& confusionMatrix.equals(other.confusionMatrix);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.numFiles,
this.numPages,
this.meanRunTimeMs,
this.type,
this.accuracyPerc,
this.meanConfidence,
this.distribution,
this.accuracyPercByClassification,
this.confusionMatrix);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Double> numFiles = Optional.empty();
private Optional<Double> numPages = Optional.empty();
private Optional<Double> meanRunTimeMs = Optional.empty();
private Optional<String> type = Optional.empty();
private Optional<Double> accuracyPerc = Optional.empty();
private Optional<Double> meanConfidence = Optional.empty();
private Optional<Map<String, Object>> distribution = Optional.empty();
private Optional<Map<String, Object>> accuracyPercByClassification = Optional.empty();
private Optional<Map<String, Object>> confusionMatrix = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ClassifyMetrics other) {
numFiles(other.getNumFiles());
numPages(other.getNumPages());
meanRunTimeMs(other.getMeanRunTimeMs());
type(other.getType());
accuracyPerc(other.getAccuracyPerc());
meanConfidence(other.getMeanConfidence());
distribution(other.getDistribution());
accuracyPercByClassification(other.getAccuracyPercByClassification());
confusionMatrix(other.getConfusionMatrix());
return this;
}
/**
* <p>The total number of files that were processed.</p>
*/
@JsonSetter(value = "numFiles", nulls = Nulls.SKIP)
public Builder numFiles(Optional<Double> numFiles) {
this.numFiles = numFiles;
return this;
}
public Builder numFiles(Double numFiles) {
this.numFiles = Optional.ofNullable(numFiles);
return this;
}
/**
* <p>The total number of pages that were processed.</p>
*/
@JsonSetter(value = "numPages", nulls = Nulls.SKIP)
public Builder numPages(Optional<Double> numPages) {
this.numPages = numPages;
return this;
}
public Builder numPages(Double numPages) {
this.numPages = Optional.ofNullable(numPages);
return this;
}
/**
* <p>The mean runtime in milliseconds per document.</p>
*/
@JsonSetter(value = "meanRunTimeMs", nulls = Nulls.SKIP)
public Builder meanRunTimeMs(Optional<Double> meanRunTimeMs) {
this.meanRunTimeMs = meanRunTimeMs;
return this;
}
public Builder meanRunTimeMs(Double meanRunTimeMs) {
this.meanRunTimeMs = Optional.ofNullable(meanRunTimeMs);
return this;
}
/**
* <p>The type of metrics. Will always be <code>"CLASSIFY"</code> for classification processors.</p>
*/
@JsonSetter(value = "type", nulls = Nulls.SKIP)
public Builder type(Optional<String> type) {
this.type = type;
return this;
}
public Builder type(String type) {
this.type = Optional.ofNullable(type);
return this;
}
/**
* <p>The overall accuracy percentage.</p>
*/
@JsonSetter(value = "accuracyPerc", nulls = Nulls.SKIP)
public Builder accuracyPerc(Optional<Double> accuracyPerc) {
this.accuracyPerc = accuracyPerc;
return this;
}
public Builder accuracyPerc(Double accuracyPerc) {
this.accuracyPerc = Optional.ofNullable(accuracyPerc);
return this;
}
/**
* <p>The mean confidence score.</p>
*/
@JsonSetter(value = "meanConfidence", nulls = Nulls.SKIP)
public Builder meanConfidence(Optional<Double> meanConfidence) {
this.meanConfidence = meanConfidence;
return this;
}
public Builder meanConfidence(Double meanConfidence) {
this.meanConfidence = Optional.ofNullable(meanConfidence);
return this;
}
/**
* <p>Record mapping classification values to their counts.</p>
*/
@JsonSetter(value = "distribution", nulls = Nulls.SKIP)
public Builder distribution(Optional<Map<String, Object>> distribution) {
this.distribution = distribution;
return this;
}
public Builder distribution(Map<String, Object> distribution) {
this.distribution = Optional.ofNullable(distribution);
return this;
}
/**
* <p>Mapping from classification to accuracy percentage as calculated from the confusion matrix.</p>
*/
@JsonSetter(value = "accuracyPercByClassification", nulls = Nulls.SKIP)
public Builder accuracyPercByClassification(Optional<Map<String, Object>> accuracyPercByClassification) {
this.accuracyPercByClassification = accuracyPercByClassification;
return this;
}
public Builder accuracyPercByClassification(Map<String, Object> accuracyPercByClassification) {
this.accuracyPercByClassification = Optional.ofNullable(accuracyPercByClassification);
return this;
}
/**
* <p>Mapping from actual class to predicted class to count. Only present when accuracy percentage is present.</p>
*/
@JsonSetter(value = "confusionMatrix", nulls = Nulls.SKIP)
public Builder confusionMatrix(Optional<Map<String, Object>> confusionMatrix) {
this.confusionMatrix = confusionMatrix;
return this;
}
public Builder confusionMatrix(Map<String, Object> confusionMatrix) {
this.confusionMatrix = Optional.ofNullable(confusionMatrix);
return this;
}
public ClassifyMetrics build() {
return new ClassifyMetrics(
numFiles,
numPages,
meanRunTimeMs,
type,
accuracyPerc,
meanConfidence,
distribution,
accuracyPercByClassification,
confusionMatrix,
additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/Enum.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = Enum.Builder.class)
public final class Enum {
private final String value;
private final String description;
private final Map<String, Object> additionalProperties;
private Enum(String value, String description, Map<String, Object> additionalProperties) {
this.value = value;
this.description = description;
this.additionalProperties = additionalProperties;
}
/**
* @return The value of the enum option.
*/
@JsonProperty("value")
public String getValue() {
return value;
}
/**
* @return Description of what this enum value represents.
*/
@JsonProperty("description")
public String getDescription() {
return description;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof Enum && equalTo((Enum) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(Enum other) {
return value.equals(other.value) && description.equals(other.description);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value, this.description);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ValueStage builder() {
return new Builder();
}
public interface ValueStage {
/**
* <p>The value of the enum option.</p>
*/
DescriptionStage value(@NotNull String value);
Builder from(Enum other);
}
public interface DescriptionStage {
/**
* <p>Description of what this enum value represents.</p>
*/
_FinalStage description(@NotNull String description);
}
public interface _FinalStage {
Enum build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ValueStage, DescriptionStage, _FinalStage {
private String value;
private String description;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(Enum other) {
value(other.getValue());
description(other.getDescription());
return this;
}
/**
* <p>The value of the enum option.</p>
* <p>The value of the enum option.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("value")
public DescriptionStage value(@NotNull String value) {
this.value = Objects.requireNonNull(value, "value must not be null");
return this;
}
/**
* <p>Description of what this enum value represents.</p>
* <p>Description of what this enum value represents.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("description")
public _FinalStage description(@NotNull String description) {
this.description = Objects.requireNonNull(description, "description must not be null");
return this;
}
@java.lang.Override
public Enum build() {
return new Enum(value, description, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/EnumOption.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = EnumOption.Builder.class)
public final class EnumOption {
private final String value;
private final String description;
private final Map<String, Object> additionalProperties;
private EnumOption(String value, String description, Map<String, Object> additionalProperties) {
this.value = value;
this.description = description;
this.additionalProperties = additionalProperties;
}
/**
* @return The enum value (e.g. "ANNUAL", "MONTHLY", etc.)
*/
@JsonProperty("value")
public String getValue() {
return value;
}
/**
* @return The description of the enum value
*/
@JsonProperty("description")
public String getDescription() {
return description;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof EnumOption && equalTo((EnumOption) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(EnumOption other) {
return value.equals(other.value) && description.equals(other.description);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value, this.description);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ValueStage builder() {
return new Builder();
}
public interface ValueStage {
/**
* <p>The enum value (e.g. "ANNUAL", "MONTHLY", etc.)</p>
*/
DescriptionStage value(@NotNull String value);
Builder from(EnumOption other);
}
public interface DescriptionStage {
/**
* <p>The description of the enum value</p>
*/
_FinalStage description(@NotNull String description);
}
public interface _FinalStage {
EnumOption build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements ValueStage, DescriptionStage, _FinalStage {
private String value;
private String description;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(EnumOption other) {
value(other.getValue());
description(other.getDescription());
return this;
}
/**
* <p>The enum value (e.g. "ANNUAL", "MONTHLY", etc.)</p>
* <p>The enum value (e.g. "ANNUAL", "MONTHLY", etc.)</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("value")
public DescriptionStage value(@NotNull String value) {
this.value = Objects.requireNonNull(value, "value must not be null");
return this;
}
/**
* <p>The description of the enum value</p>
* <p>The description of the enum value</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("description")
public _FinalStage description(@NotNull String description) {
this.description = Objects.requireNonNull(description, "description must not be null");
return this;
}
@java.lang.Override
public EnumOption build() {
return new EnumOption(value, description, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/Error.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = Error.Builder.class)
public final class Error implements IError {
private final Optional<Boolean> success;
private final Optional<String> error;
private final Map<String, Object> additionalProperties;
private Error(Optional<Boolean> success, Optional<String> error, Map<String, Object> additionalProperties) {
this.success = success;
this.error = error;
this.additionalProperties = additionalProperties;
}
@JsonProperty("success")
@java.lang.Override
public Optional<Boolean> getSuccess() {
return success;
}
/**
* @return Error message
*/
@JsonProperty("error")
@java.lang.Override
public Optional<String> getError() {
return error;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof Error && equalTo((Error) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(Error other) {
return success.equals(other.success) && error.equals(other.error);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.success, this.error);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Boolean> success = Optional.empty();
private Optional<String> error = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(Error other) {
success(other.getSuccess());
error(other.getError());
return this;
}
@JsonSetter(value = "success", nulls = Nulls.SKIP)
public Builder success(Optional<Boolean> success) {
this.success = success;
return this;
}
public Builder success(Boolean success) {
this.success = Optional.ofNullable(success);
return this;
}
/**
* <p>Error message</p>
*/
@JsonSetter(value = "error", nulls = Nulls.SKIP)
public Builder error(Optional<String> error) {
this.error = error;
return this;
}
public Builder error(String error) {
this.error = Optional.ofNullable(error);
return this;
}
public Error build() {
return new Error(success, error, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/EvaluationSet.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = EvaluationSet.Builder.class)
public final class EvaluationSet {
private final String object;
private final String id;
private final String name;
private final String description;
private final String processorId;
private final OffsetDateTime createdAt;
private final OffsetDateTime updatedAt;
private final Map<String, Object> additionalProperties;
private EvaluationSet(
String object,
String id,
String name,
String description,
String processorId,
OffsetDateTime createdAt,
OffsetDateTime updatedAt,
Map<String, Object> additionalProperties) {
this.object = object;
this.id = id;
this.name = name;
this.description = description;
this.processorId = processorId;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
this.additionalProperties = additionalProperties;
}
/**
* @return The type of response. In this case, it will always be <code>"evaluation_set"</code>.
*/
@JsonProperty("object")
public String getObject() {
return object;
}
/**
* @return The ID of the evaluation set.
* <p>Example: <code>"ev_2LcgeY_mp2T5yPaEuq5Lw"</code></p>
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return The name of the evaluation set.
* <p>Example: <code>"Invoice Processing Test Set"</code></p>
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* @return A description of the evaluation set.
* <p>Example: <code>"Q4 2023 vendor invoices for accuracy testing"</code></p>
*/
@JsonProperty("description")
public String getDescription() {
return description;
}
/**
* @return The ID of the processor associated with this evaluation set.
* <p>Example: <code>"dp_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
*/
@JsonProperty("processorId")
public String getProcessorId() {
return processorId;
}
/**
* @return The time (in UTC) at which the evaluation set was created. Will follow the RFC 3339 format.
* <p>Example: <code>"2024-03-21T15:30:00Z"</code></p>
*/
@JsonProperty("createdAt")
public OffsetDateTime getCreatedAt() {
return createdAt;
}
/**
* @return The time (in UTC) at which the evaluation set was last updated. Will follow the RFC 3339 format.
* <p>Example: <code>"2024-03-21T16:45:00Z"</code></p>
*/
@JsonProperty("updatedAt")
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof EvaluationSet && equalTo((EvaluationSet) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(EvaluationSet other) {
return object.equals(other.object)
&& id.equals(other.id)
&& name.equals(other.name)
&& description.equals(other.description)
&& processorId.equals(other.processorId)
&& createdAt.equals(other.createdAt)
&& updatedAt.equals(other.updatedAt);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.object, this.id, this.name, this.description, this.processorId, this.createdAt, this.updatedAt);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ObjectStage builder() {
return new Builder();
}
public interface ObjectStage {
/**
* <p>The type of response. In this case, it will always be <code>"evaluation_set"</code>.</p>
*/
IdStage object(@NotNull String object);
Builder from(EvaluationSet other);
}
public interface IdStage {
/**
* <p>The ID of the evaluation set.</p>
* <p>Example: <code>"ev_2LcgeY_mp2T5yPaEuq5Lw"</code></p>
*/
NameStage id(@NotNull String id);
}
public interface NameStage {
/**
* <p>The name of the evaluation set.</p>
* <p>Example: <code>"Invoice Processing Test Set"</code></p>
*/
DescriptionStage name(@NotNull String name);
}
public interface DescriptionStage {
/**
* <p>A description of the evaluation set.</p>
* <p>Example: <code>"Q4 2023 vendor invoices for accuracy testing"</code></p>
*/
ProcessorIdStage description(@NotNull String description);
}
public interface ProcessorIdStage {
/**
* <p>The ID of the processor associated with this evaluation set.</p>
* <p>Example: <code>"dp_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
*/
CreatedAtStage processorId(@NotNull String processorId);
}
public interface CreatedAtStage {
/**
* <p>The time (in UTC) at which the evaluation set was created. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T15:30:00Z"</code></p>
*/
UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt);
}
public interface UpdatedAtStage {
/**
* <p>The time (in UTC) at which the evaluation set was last updated. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T16:45:00Z"</code></p>
*/
_FinalStage updatedAt(@NotNull OffsetDateTime updatedAt);
}
public interface _FinalStage {
EvaluationSet build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder
implements ObjectStage,
IdStage,
NameStage,
DescriptionStage,
ProcessorIdStage,
CreatedAtStage,
UpdatedAtStage,
_FinalStage {
private String object;
private String id;
private String name;
private String description;
private String processorId;
private OffsetDateTime createdAt;
private OffsetDateTime updatedAt;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(EvaluationSet other) {
object(other.getObject());
id(other.getId());
name(other.getName());
description(other.getDescription());
processorId(other.getProcessorId());
createdAt(other.getCreatedAt());
updatedAt(other.getUpdatedAt());
return this;
}
/**
* <p>The type of response. In this case, it will always be <code>"evaluation_set"</code>.</p>
* <p>The type of response. In this case, it will always be <code>"evaluation_set"</code>.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("object")
public IdStage object(@NotNull String object) {
this.object = Objects.requireNonNull(object, "object must not be null");
return this;
}
/**
* <p>The ID of the evaluation set.</p>
* <p>Example: <code>"ev_2LcgeY_mp2T5yPaEuq5Lw"</code></p>
* <p>The ID of the evaluation set.</p>
* <p>Example: <code>"ev_2LcgeY_mp2T5yPaEuq5Lw"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public NameStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>The name of the evaluation set.</p>
* <p>Example: <code>"Invoice Processing Test Set"</code></p>
* <p>The name of the evaluation set.</p>
* <p>Example: <code>"Invoice Processing Test Set"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("name")
public DescriptionStage name(@NotNull String name) {
this.name = Objects.requireNonNull(name, "name must not be null");
return this;
}
/**
* <p>A description of the evaluation set.</p>
* <p>Example: <code>"Q4 2023 vendor invoices for accuracy testing"</code></p>
* <p>A description of the evaluation set.</p>
* <p>Example: <code>"Q4 2023 vendor invoices for accuracy testing"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("description")
public ProcessorIdStage description(@NotNull String description) {
this.description = Objects.requireNonNull(description, "description must not be null");
return this;
}
/**
* <p>The ID of the processor associated with this evaluation set.</p>
* <p>Example: <code>"dp_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
* <p>The ID of the processor associated with this evaluation set.</p>
* <p>Example: <code>"dp_Xj8mK2pL9nR4vT7qY5wZ"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("processorId")
public CreatedAtStage processorId(@NotNull String processorId) {
this.processorId = Objects.requireNonNull(processorId, "processorId must not be null");
return this;
}
/**
* <p>The time (in UTC) at which the evaluation set was created. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T15:30:00Z"</code></p>
* <p>The time (in UTC) at which the evaluation set was created. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T15:30:00Z"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("createdAt")
public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) {
this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null");
return this;
}
/**
* <p>The time (in UTC) at which the evaluation set was last updated. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T16:45:00Z"</code></p>
* <p>The time (in UTC) at which the evaluation set was last updated. Will follow the RFC 3339 format.</p>
* <p>Example: <code>"2024-03-21T16:45:00Z"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("updatedAt")
public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) {
this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null");
return this;
}
@java.lang.Override
public EvaluationSet build() {
return new EvaluationSet(
object, id, name, description, processorId, createdAt, updatedAt, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/EvaluationSetItem.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = EvaluationSetItem.Builder.class)
public final class EvaluationSetItem {
private final String object;
private final String id;
private final String evaluationSetId;
private final String fileId;
private final ProvidedProcessorOutput expectedOutput;
private final Map<String, Object> additionalProperties;
private EvaluationSetItem(
String object,
String id,
String evaluationSetId,
String fileId,
ProvidedProcessorOutput expectedOutput,
Map<String, Object> additionalProperties) {
this.object = object;
this.id = id;
this.evaluationSetId = evaluationSetId;
this.fileId = fileId;
this.expectedOutput = expectedOutput;
this.additionalProperties = additionalProperties;
}
/**
* @return The type of response. In this case, it will always be <code>"evaluation_set_item"</code>.
*/
@JsonProperty("object")
public String getObject() {
return object;
}
/**
* @return The ID of the evaluation set item.
* <p>Example: <code>"evi_kR9mNP12Qw4yTv8BdR3H"</code></p>
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return The ID of the evaluation set that this item belongs to.
* <p>Example: <code>"ev_2LcgeY_mp2T5yPaEuq5Lw"</code></p>
*/
@JsonProperty("evaluationSetId")
public String getEvaluationSetId() {
return evaluationSetId;
}
/**
* @return Extend's internal ID for the file. It will always start with "file_".
* <p>Example: <code>"file_xK9mLPqRtN3vS8wF5hB2cQ"</code></p>
*/
@JsonProperty("fileId")
public String getFileId() {
return fileId;
}
/**
* @return The expected output that will be used to evaluate the processor's performance. This will confirm to the output type schema of the processor.
*/
@JsonProperty("expectedOutput")
public ProvidedProcessorOutput getExpectedOutput() {
return expectedOutput;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof EvaluationSetItem && equalTo((EvaluationSetItem) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(EvaluationSetItem other) {
return object.equals(other.object)
&& id.equals(other.id)
&& evaluationSetId.equals(other.evaluationSetId)
&& fileId.equals(other.fileId)
&& expectedOutput.equals(other.expectedOutput);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.object, this.id, this.evaluationSetId, this.fileId, this.expectedOutput);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static ObjectStage builder() {
return new Builder();
}
public interface ObjectStage {
/**
* <p>The type of response. In this case, it will always be <code>"evaluation_set_item"</code>.</p>
*/
IdStage object(@NotNull String object);
Builder from(EvaluationSetItem other);
}
public interface IdStage {
/**
* <p>The ID of the evaluation set item.</p>
* <p>Example: <code>"evi_kR9mNP12Qw4yTv8BdR3H"</code></p>
*/
EvaluationSetIdStage id(@NotNull String id);
}
public interface EvaluationSetIdStage {
/**
* <p>The ID of the evaluation set that this item belongs to.</p>
* <p>Example: <code>"ev_2LcgeY_mp2T5yPaEuq5Lw"</code></p>
*/
FileIdStage evaluationSetId(@NotNull String evaluationSetId);
}
public interface FileIdStage {
/**
* <p>Extend's internal ID for the file. It will always start with "file_".</p>
* <p>Example: <code>"file_xK9mLPqRtN3vS8wF5hB2cQ"</code></p>
*/
ExpectedOutputStage fileId(@NotNull String fileId);
}
public interface ExpectedOutputStage {
/**
* <p>The expected output that will be used to evaluate the processor's performance. This will confirm to the output type schema of the processor.</p>
*/
_FinalStage expectedOutput(@NotNull ProvidedProcessorOutput expectedOutput);
}
public interface _FinalStage {
EvaluationSetItem build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder
implements ObjectStage, IdStage, EvaluationSetIdStage, FileIdStage, ExpectedOutputStage, _FinalStage {
private String object;
private String id;
private String evaluationSetId;
private String fileId;
private ProvidedProcessorOutput expectedOutput;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(EvaluationSetItem other) {
object(other.getObject());
id(other.getId());
evaluationSetId(other.getEvaluationSetId());
fileId(other.getFileId());
expectedOutput(other.getExpectedOutput());
return this;
}
/**
* <p>The type of response. In this case, it will always be <code>"evaluation_set_item"</code>.</p>
* <p>The type of response. In this case, it will always be <code>"evaluation_set_item"</code>.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("object")
public IdStage object(@NotNull String object) {
this.object = Objects.requireNonNull(object, "object must not be null");
return this;
}
/**
* <p>The ID of the evaluation set item.</p>
* <p>Example: <code>"evi_kR9mNP12Qw4yTv8BdR3H"</code></p>
* <p>The ID of the evaluation set item.</p>
* <p>Example: <code>"evi_kR9mNP12Qw4yTv8BdR3H"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public EvaluationSetIdStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>The ID of the evaluation set that this item belongs to.</p>
* <p>Example: <code>"ev_2LcgeY_mp2T5yPaEuq5Lw"</code></p>
* <p>The ID of the evaluation set that this item belongs to.</p>
* <p>Example: <code>"ev_2LcgeY_mp2T5yPaEuq5Lw"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("evaluationSetId")
public FileIdStage evaluationSetId(@NotNull String evaluationSetId) {
this.evaluationSetId = Objects.requireNonNull(evaluationSetId, "evaluationSetId must not be null");
return this;
}
/**
* <p>Extend's internal ID for the file. It will always start with "file_".</p>
* <p>Example: <code>"file_xK9mLPqRtN3vS8wF5hB2cQ"</code></p>
* <p>Extend's internal ID for the file. It will always start with "file_".</p>
* <p>Example: <code>"file_xK9mLPqRtN3vS8wF5hB2cQ"</code></p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("fileId")
public ExpectedOutputStage fileId(@NotNull String fileId) {
this.fileId = Objects.requireNonNull(fileId, "fileId must not be null");
return this;
}
/**
* <p>The expected output that will be used to evaluate the processor's performance. This will confirm to the output type schema of the processor.</p>
* <p>The expected output that will be used to evaluate the processor's performance. This will confirm to the output type schema of the processor.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("expectedOutput")
public _FinalStage expectedOutput(@NotNull ProvidedProcessorOutput expectedOutput) {
this.expectedOutput = Objects.requireNonNull(expectedOutput, "expectedOutput must not be null");
return this;
}
@java.lang.Override
public EvaluationSetItem build() {
return new EvaluationSetItem(object, id, evaluationSetId, fileId, expectedOutput, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtendError.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtendError.Builder.class)
public final class ExtendError {
private final String code;
private final String message;
private final String requestId;
private final boolean retryable;
private final Map<String, Object> additionalProperties;
private ExtendError(
String code,
String message,
String requestId,
boolean retryable,
Map<String, Object> additionalProperties) {
this.code = code;
this.message = message;
this.requestId = requestId;
this.retryable = retryable;
this.additionalProperties = additionalProperties;
}
/**
* @return Error code identifying the type of error
*/
@JsonProperty("code")
public String getCode() {
return code;
}
/**
* @return Human-readable error message
*/
@JsonProperty("message")
public String getMessage() {
return message;
}
/**
* @return Unique request identifier for support purposes
*/
@JsonProperty("requestId")
public String getRequestId() {
return requestId;
}
/**
* @return Whether the request can be retried
*/
@JsonProperty("retryable")
public boolean getRetryable() {
return retryable;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtendError && equalTo((ExtendError) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtendError other) {
return code.equals(other.code)
&& message.equals(other.message)
&& requestId.equals(other.requestId)
&& retryable == other.retryable;
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.code, this.message, this.requestId, this.retryable);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static CodeStage builder() {
return new Builder();
}
public interface CodeStage {
/**
* <p>Error code identifying the type of error</p>
*/
MessageStage code(@NotNull String code);
Builder from(ExtendError other);
}
public interface MessageStage {
/**
* <p>Human-readable error message</p>
*/
RequestIdStage message(@NotNull String message);
}
public interface RequestIdStage {
/**
* <p>Unique request identifier for support purposes</p>
*/
RetryableStage requestId(@NotNull String requestId);
}
public interface RetryableStage {
/**
* <p>Whether the request can be retried</p>
*/
_FinalStage retryable(boolean retryable);
}
public interface _FinalStage {
ExtendError build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements CodeStage, MessageStage, RequestIdStage, RetryableStage, _FinalStage {
private String code;
private String message;
private String requestId;
private boolean retryable;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ExtendError other) {
code(other.getCode());
message(other.getMessage());
requestId(other.getRequestId());
retryable(other.getRetryable());
return this;
}
/**
* <p>Error code identifying the type of error</p>
* <p>Error code identifying the type of error</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("code")
public MessageStage code(@NotNull String code) {
this.code = Objects.requireNonNull(code, "code must not be null");
return this;
}
/**
* <p>Human-readable error message</p>
* <p>Human-readable error message</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("message")
public RequestIdStage message(@NotNull String message) {
this.message = Objects.requireNonNull(message, "message must not be null");
return this;
}
/**
* <p>Unique request identifier for support purposes</p>
* <p>Unique request identifier for support purposes</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("requestId")
public RetryableStage requestId(@NotNull String requestId) {
this.requestId = Objects.requireNonNull(requestId, "requestId must not be null");
return this;
}
/**
* <p>Whether the request can be retried</p>
* <p>Whether the request can be retried</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("retryable")
public _FinalStage retryable(boolean retryable) {
this.retryable = retryable;
return this;
}
@java.lang.Override
public ExtendError build() {
return new ExtendError(code, message, requestId, retryable, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractChunkingOptions.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractChunkingOptions.Builder.class)
public final class ExtractChunkingOptions {
private final Optional<ExtractChunkingOptionsChunkingStrategy> chunkingStrategy;
private final Optional<Integer> pageChunkSize;
private final Optional<ExtractChunkingOptionsChunkSelectionStrategy> chunkSelectionStrategy;
private final Optional<String> customSemanticChunkingRules;
private final Map<String, Object> additionalProperties;
private ExtractChunkingOptions(
Optional<ExtractChunkingOptionsChunkingStrategy> chunkingStrategy,
Optional<Integer> pageChunkSize,
Optional<ExtractChunkingOptionsChunkSelectionStrategy> chunkSelectionStrategy,
Optional<String> customSemanticChunkingRules,
Map<String, Object> additionalProperties) {
this.chunkingStrategy = chunkingStrategy;
this.pageChunkSize = pageChunkSize;
this.chunkSelectionStrategy = chunkSelectionStrategy;
this.customSemanticChunkingRules = customSemanticChunkingRules;
this.additionalProperties = additionalProperties;
}
/**
* @return The strategy to use for chunking the document.
*/
@JsonProperty("chunkingStrategy")
public Optional<ExtractChunkingOptionsChunkingStrategy> getChunkingStrategy() {
return chunkingStrategy;
}
/**
* @return The size of page chunks.
*/
@JsonProperty("pageChunkSize")
public Optional<Integer> getPageChunkSize() {
return pageChunkSize;
}
/**
* @return The strategy to use for selecting chunks.
*/
@JsonProperty("chunkSelectionStrategy")
public Optional<ExtractChunkingOptionsChunkSelectionStrategy> getChunkSelectionStrategy() {
return chunkSelectionStrategy;
}
/**
* @return Custom rules for semantic chunking.
*/
@JsonProperty("customSemanticChunkingRules")
public Optional<String> getCustomSemanticChunkingRules() {
return customSemanticChunkingRules;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractChunkingOptions && equalTo((ExtractChunkingOptions) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractChunkingOptions other) {
return chunkingStrategy.equals(other.chunkingStrategy)
&& pageChunkSize.equals(other.pageChunkSize)
&& chunkSelectionStrategy.equals(other.chunkSelectionStrategy)
&& customSemanticChunkingRules.equals(other.customSemanticChunkingRules);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.chunkingStrategy,
this.pageChunkSize,
this.chunkSelectionStrategy,
this.customSemanticChunkingRules);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<ExtractChunkingOptionsChunkingStrategy> chunkingStrategy = Optional.empty();
private Optional<Integer> pageChunkSize = Optional.empty();
private Optional<ExtractChunkingOptionsChunkSelectionStrategy> chunkSelectionStrategy = Optional.empty();
private Optional<String> customSemanticChunkingRules = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ExtractChunkingOptions other) {
chunkingStrategy(other.getChunkingStrategy());
pageChunkSize(other.getPageChunkSize());
chunkSelectionStrategy(other.getChunkSelectionStrategy());
customSemanticChunkingRules(other.getCustomSemanticChunkingRules());
return this;
}
/**
* <p>The strategy to use for chunking the document.</p>
*/
@JsonSetter(value = "chunkingStrategy", nulls = Nulls.SKIP)
public Builder chunkingStrategy(Optional<ExtractChunkingOptionsChunkingStrategy> chunkingStrategy) {
this.chunkingStrategy = chunkingStrategy;
return this;
}
public Builder chunkingStrategy(ExtractChunkingOptionsChunkingStrategy chunkingStrategy) {
this.chunkingStrategy = Optional.ofNullable(chunkingStrategy);
return this;
}
/**
* <p>The size of page chunks.</p>
*/
@JsonSetter(value = "pageChunkSize", nulls = Nulls.SKIP)
public Builder pageChunkSize(Optional<Integer> pageChunkSize) {
this.pageChunkSize = pageChunkSize;
return this;
}
public Builder pageChunkSize(Integer pageChunkSize) {
this.pageChunkSize = Optional.ofNullable(pageChunkSize);
return this;
}
/**
* <p>The strategy to use for selecting chunks.</p>
*/
@JsonSetter(value = "chunkSelectionStrategy", nulls = Nulls.SKIP)
public Builder chunkSelectionStrategy(
Optional<ExtractChunkingOptionsChunkSelectionStrategy> chunkSelectionStrategy) {
this.chunkSelectionStrategy = chunkSelectionStrategy;
return this;
}
public Builder chunkSelectionStrategy(ExtractChunkingOptionsChunkSelectionStrategy chunkSelectionStrategy) {
this.chunkSelectionStrategy = Optional.ofNullable(chunkSelectionStrategy);
return this;
}
/**
* <p>Custom rules for semantic chunking.</p>
*/
@JsonSetter(value = "customSemanticChunkingRules", nulls = Nulls.SKIP)
public Builder customSemanticChunkingRules(Optional<String> customSemanticChunkingRules) {
this.customSemanticChunkingRules = customSemanticChunkingRules;
return this;
}
public Builder customSemanticChunkingRules(String customSemanticChunkingRules) {
this.customSemanticChunkingRules = Optional.ofNullable(customSemanticChunkingRules);
return this;
}
public ExtractChunkingOptions build() {
return new ExtractChunkingOptions(
chunkingStrategy,
pageChunkSize,
chunkSelectionStrategy,
customSemanticChunkingRules,
additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractChunkingOptionsChunkSelectionStrategy.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ExtractChunkingOptionsChunkSelectionStrategy {
INTELLIGENT("intelligent"),
CONFIDENCE("confidence"),
TAKE_FIRST("take_first"),
TAKE_LAST("take_last");
private final String value;
ExtractChunkingOptionsChunkSelectionStrategy(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractChunkingOptionsChunkingStrategy.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ExtractChunkingOptionsChunkingStrategy {
STANDARD("standard"),
SEMANTIC("semantic");
private final String value;
ExtractChunkingOptionsChunkingStrategy(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractMetrics.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractMetrics.Builder.class)
public final class ExtractMetrics implements IBaseMetrics {
private final Optional<Double> numFiles;
private final Optional<Double> numPages;
private final Optional<Double> meanRunTimeMs;
private final Optional<String> type;
private final Optional<ExtractMetricsFieldMetrics> fieldMetrics;
private final Optional<Map<String, Object>> arrayCardinalityMetrics;
private final Map<String, Object> additionalProperties;
private ExtractMetrics(
Optional<Double> numFiles,
Optional<Double> numPages,
Optional<Double> meanRunTimeMs,
Optional<String> type,
Optional<ExtractMetricsFieldMetrics> fieldMetrics,
Optional<Map<String, Object>> arrayCardinalityMetrics,
Map<String, Object> additionalProperties) {
this.numFiles = numFiles;
this.numPages = numPages;
this.meanRunTimeMs = meanRunTimeMs;
this.type = type;
this.fieldMetrics = fieldMetrics;
this.arrayCardinalityMetrics = arrayCardinalityMetrics;
this.additionalProperties = additionalProperties;
}
/**
* @return The total number of files that were processed.
*/
@JsonProperty("numFiles")
@java.lang.Override
public Optional<Double> getNumFiles() {
return numFiles;
}
/**
* @return The total number of pages that were processed.
*/
@JsonProperty("numPages")
@java.lang.Override
public Optional<Double> getNumPages() {
return numPages;
}
/**
* @return The mean runtime in milliseconds per document.
*/
@JsonProperty("meanRunTimeMs")
@java.lang.Override
public Optional<Double> getMeanRunTimeMs() {
return meanRunTimeMs;
}
/**
* @return The type of metrics. Will always be <code>"EXTRACT"</code> for extraction processors.
*/
@JsonProperty("type")
public Optional<String> getType() {
return type;
}
/**
* @return Record mapping field names to their respective metrics.
*/
@JsonProperty("fieldMetrics")
public Optional<ExtractMetricsFieldMetrics> getFieldMetrics() {
return fieldMetrics;
}
/**
* @return Maps the root array field name to a number indicating how many times the array field has the correct number of rows extracted.
*/
@JsonProperty("arrayCardinalityMetrics")
public Optional<Map<String, Object>> getArrayCardinalityMetrics() {
return arrayCardinalityMetrics;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractMetrics && equalTo((ExtractMetrics) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractMetrics other) {
return numFiles.equals(other.numFiles)
&& numPages.equals(other.numPages)
&& meanRunTimeMs.equals(other.meanRunTimeMs)
&& type.equals(other.type)
&& fieldMetrics.equals(other.fieldMetrics)
&& arrayCardinalityMetrics.equals(other.arrayCardinalityMetrics);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.numFiles,
this.numPages,
this.meanRunTimeMs,
this.type,
this.fieldMetrics,
this.arrayCardinalityMetrics);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Double> numFiles = Optional.empty();
private Optional<Double> numPages = Optional.empty();
private Optional<Double> meanRunTimeMs = Optional.empty();
private Optional<String> type = Optional.empty();
private Optional<ExtractMetricsFieldMetrics> fieldMetrics = Optional.empty();
private Optional<Map<String, Object>> arrayCardinalityMetrics = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ExtractMetrics other) {
numFiles(other.getNumFiles());
numPages(other.getNumPages());
meanRunTimeMs(other.getMeanRunTimeMs());
type(other.getType());
fieldMetrics(other.getFieldMetrics());
arrayCardinalityMetrics(other.getArrayCardinalityMetrics());
return this;
}
/**
* <p>The total number of files that were processed.</p>
*/
@JsonSetter(value = "numFiles", nulls = Nulls.SKIP)
public Builder numFiles(Optional<Double> numFiles) {
this.numFiles = numFiles;
return this;
}
public Builder numFiles(Double numFiles) {
this.numFiles = Optional.ofNullable(numFiles);
return this;
}
/**
* <p>The total number of pages that were processed.</p>
*/
@JsonSetter(value = "numPages", nulls = Nulls.SKIP)
public Builder numPages(Optional<Double> numPages) {
this.numPages = numPages;
return this;
}
public Builder numPages(Double numPages) {
this.numPages = Optional.ofNullable(numPages);
return this;
}
/**
* <p>The mean runtime in milliseconds per document.</p>
*/
@JsonSetter(value = "meanRunTimeMs", nulls = Nulls.SKIP)
public Builder meanRunTimeMs(Optional<Double> meanRunTimeMs) {
this.meanRunTimeMs = meanRunTimeMs;
return this;
}
public Builder meanRunTimeMs(Double meanRunTimeMs) {
this.meanRunTimeMs = Optional.ofNullable(meanRunTimeMs);
return this;
}
/**
* <p>The type of metrics. Will always be <code>"EXTRACT"</code> for extraction processors.</p>
*/
@JsonSetter(value = "type", nulls = Nulls.SKIP)
public Builder type(Optional<String> type) {
this.type = type;
return this;
}
public Builder type(String type) {
this.type = Optional.ofNullable(type);
return this;
}
/**
* <p>Record mapping field names to their respective metrics.</p>
*/
@JsonSetter(value = "fieldMetrics", nulls = Nulls.SKIP)
public Builder fieldMetrics(Optional<ExtractMetricsFieldMetrics> fieldMetrics) {
this.fieldMetrics = fieldMetrics;
return this;
}
public Builder fieldMetrics(ExtractMetricsFieldMetrics fieldMetrics) {
this.fieldMetrics = Optional.ofNullable(fieldMetrics);
return this;
}
/**
* <p>Maps the root array field name to a number indicating how many times the array field has the correct number of rows extracted.</p>
*/
@JsonSetter(value = "arrayCardinalityMetrics", nulls = Nulls.SKIP)
public Builder arrayCardinalityMetrics(Optional<Map<String, Object>> arrayCardinalityMetrics) {
this.arrayCardinalityMetrics = arrayCardinalityMetrics;
return this;
}
public Builder arrayCardinalityMetrics(Map<String, Object> arrayCardinalityMetrics) {
this.arrayCardinalityMetrics = Optional.ofNullable(arrayCardinalityMetrics);
return this;
}
public ExtractMetrics build() {
return new ExtractMetrics(
numFiles,
numPages,
meanRunTimeMs,
type,
fieldMetrics,
arrayCardinalityMetrics,
additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractMetricsFieldMetrics.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractMetricsFieldMetrics.Builder.class)
public final class ExtractMetricsFieldMetrics {
private final Optional<Double> meanConfidence;
private final Optional<Double> recallPerc;
private final Optional<Double> precisionPerc;
private final Optional<Map<String, Object>> fieldMetrics;
private final Map<String, Object> additionalProperties;
private ExtractMetricsFieldMetrics(
Optional<Double> meanConfidence,
Optional<Double> recallPerc,
Optional<Double> precisionPerc,
Optional<Map<String, Object>> fieldMetrics,
Map<String, Object> additionalProperties) {
this.meanConfidence = meanConfidence;
this.recallPerc = recallPerc;
this.precisionPerc = precisionPerc;
this.fieldMetrics = fieldMetrics;
this.additionalProperties = additionalProperties;
}
/**
* @return The mean confidence score for this field across all documents.
*/
@JsonProperty("meanConfidence")
public Optional<Double> getMeanConfidence() {
return meanConfidence;
}
/**
* @return The recall percentage for this field, representing how many of the expected values were correctly extracted.
*/
@JsonProperty("recallPerc")
public Optional<Double> getRecallPerc() {
return recallPerc;
}
/**
* @return The precision percentage for this field, representing how many of the extracted values were correct.
*/
@JsonProperty("precisionPerc")
public Optional<Double> getPrecisionPerc() {
return precisionPerc;
}
/**
* @return For nested object fields, this contains metrics for the child fields. Has the same structure as the parent fieldMetrics.
*/
@JsonProperty("fieldMetrics")
public Optional<Map<String, Object>> getFieldMetrics() {
return fieldMetrics;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractMetricsFieldMetrics && equalTo((ExtractMetricsFieldMetrics) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractMetricsFieldMetrics other) {
return meanConfidence.equals(other.meanConfidence)
&& recallPerc.equals(other.recallPerc)
&& precisionPerc.equals(other.precisionPerc)
&& fieldMetrics.equals(other.fieldMetrics);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.meanConfidence, this.recallPerc, this.precisionPerc, this.fieldMetrics);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Double> meanConfidence = Optional.empty();
private Optional<Double> recallPerc = Optional.empty();
private Optional<Double> precisionPerc = Optional.empty();
private Optional<Map<String, Object>> fieldMetrics = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ExtractMetricsFieldMetrics other) {
meanConfidence(other.getMeanConfidence());
recallPerc(other.getRecallPerc());
precisionPerc(other.getPrecisionPerc());
fieldMetrics(other.getFieldMetrics());
return this;
}
/**
* <p>The mean confidence score for this field across all documents.</p>
*/
@JsonSetter(value = "meanConfidence", nulls = Nulls.SKIP)
public Builder meanConfidence(Optional<Double> meanConfidence) {
this.meanConfidence = meanConfidence;
return this;
}
public Builder meanConfidence(Double meanConfidence) {
this.meanConfidence = Optional.ofNullable(meanConfidence);
return this;
}
/**
* <p>The recall percentage for this field, representing how many of the expected values were correctly extracted.</p>
*/
@JsonSetter(value = "recallPerc", nulls = Nulls.SKIP)
public Builder recallPerc(Optional<Double> recallPerc) {
this.recallPerc = recallPerc;
return this;
}
public Builder recallPerc(Double recallPerc) {
this.recallPerc = Optional.ofNullable(recallPerc);
return this;
}
/**
* <p>The precision percentage for this field, representing how many of the extracted values were correct.</p>
*/
@JsonSetter(value = "precisionPerc", nulls = Nulls.SKIP)
public Builder precisionPerc(Optional<Double> precisionPerc) {
this.precisionPerc = precisionPerc;
return this;
}
public Builder precisionPerc(Double precisionPerc) {
this.precisionPerc = Optional.ofNullable(precisionPerc);
return this;
}
/**
* <p>For nested object fields, this contains metrics for the child fields. Has the same structure as the parent fieldMetrics.</p>
*/
@JsonSetter(value = "fieldMetrics", nulls = Nulls.SKIP)
public Builder fieldMetrics(Optional<Map<String, Object>> fieldMetrics) {
this.fieldMetrics = fieldMetrics;
return this;
}
public Builder fieldMetrics(Map<String, Object> fieldMetrics) {
this.fieldMetrics = Optional.ofNullable(fieldMetrics);
return this;
}
public ExtractMetricsFieldMetrics build() {
return new ExtractMetricsFieldMetrics(
meanConfidence, recallPerc, precisionPerc, fieldMetrics, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionAdvancedOptions.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractionAdvancedOptions.Builder.class)
public final class ExtractionAdvancedOptions {
private final Optional<String> documentKind;
private final Optional<String> keyDefinitions;
private final Optional<Boolean> modelReasoningInsightsEnabled;
private final Optional<Boolean> advancedMultimodalEnabled;
private final Optional<Boolean> citationsEnabled;
private final Optional<Boolean> advancedFigureParsingEnabled;
private final Optional<ExtractChunkingOptions> chunkingOptions;
private final Optional<Integer> fixedPageLimit;
private final Optional<List<PageRangesItem>> pageRanges;
private final Map<String, Object> additionalProperties;
private ExtractionAdvancedOptions(
Optional<String> documentKind,
Optional<String> keyDefinitions,
Optional<Boolean> modelReasoningInsightsEnabled,
Optional<Boolean> advancedMultimodalEnabled,
Optional<Boolean> citationsEnabled,
Optional<Boolean> advancedFigureParsingEnabled,
Optional<ExtractChunkingOptions> chunkingOptions,
Optional<Integer> fixedPageLimit,
Optional<List<PageRangesItem>> pageRanges,
Map<String, Object> additionalProperties) {
this.documentKind = documentKind;
this.keyDefinitions = keyDefinitions;
this.modelReasoningInsightsEnabled = modelReasoningInsightsEnabled;
this.advancedMultimodalEnabled = advancedMultimodalEnabled;
this.citationsEnabled = citationsEnabled;
this.advancedFigureParsingEnabled = advancedFigureParsingEnabled;
this.chunkingOptions = chunkingOptions;
this.fixedPageLimit = fixedPageLimit;
this.pageRanges = pageRanges;
this.additionalProperties = additionalProperties;
}
/**
* @return The kind of document being processed.
*/
@JsonProperty("documentKind")
public Optional<String> getDocumentKind() {
return documentKind;
}
/**
* @return Custom key definitions for extraction.
*/
@JsonProperty("keyDefinitions")
public Optional<String> getKeyDefinitions() {
return keyDefinitions;
}
/**
* @return Whether to enable model reasoning insights.
*/
@JsonProperty("modelReasoningInsightsEnabled")
public Optional<Boolean> getModelReasoningInsightsEnabled() {
return modelReasoningInsightsEnabled;
}
/**
* @return Whether to enable advanced multimodal features.
*/
@JsonProperty("advancedMultimodalEnabled")
public Optional<Boolean> getAdvancedMultimodalEnabled() {
return advancedMultimodalEnabled;
}
/**
* @return Whether to enable citations in the output.
*/
@JsonProperty("citationsEnabled")
public Optional<Boolean> getCitationsEnabled() {
return citationsEnabled;
}
/**
* @return Whether to enable advanced figure parsing.
*/
@JsonProperty("advancedFigureParsingEnabled")
public Optional<Boolean> getAdvancedFigureParsingEnabled() {
return advancedFigureParsingEnabled;
}
@JsonProperty("chunkingOptions")
public Optional<ExtractChunkingOptions> getChunkingOptions() {
return chunkingOptions;
}
/**
* @return Optional fixed limit on the number of pages to process. See <a href="/product/page-ranges">Page Ranges</a>.
*/
@JsonProperty("fixedPageLimit")
public Optional<Integer> getFixedPageLimit() {
return fixedPageLimit;
}
@JsonProperty("pageRanges")
public Optional<List<PageRangesItem>> getPageRanges() {
return pageRanges;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractionAdvancedOptions && equalTo((ExtractionAdvancedOptions) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractionAdvancedOptions other) {
return documentKind.equals(other.documentKind)
&& keyDefinitions.equals(other.keyDefinitions)
&& modelReasoningInsightsEnabled.equals(other.modelReasoningInsightsEnabled)
&& advancedMultimodalEnabled.equals(other.advancedMultimodalEnabled)
&& citationsEnabled.equals(other.citationsEnabled)
&& advancedFigureParsingEnabled.equals(other.advancedFigureParsingEnabled)
&& chunkingOptions.equals(other.chunkingOptions)
&& fixedPageLimit.equals(other.fixedPageLimit)
&& pageRanges.equals(other.pageRanges);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.documentKind,
this.keyDefinitions,
this.modelReasoningInsightsEnabled,
this.advancedMultimodalEnabled,
this.citationsEnabled,
this.advancedFigureParsingEnabled,
this.chunkingOptions,
this.fixedPageLimit,
this.pageRanges);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<String> documentKind = Optional.empty();
private Optional<String> keyDefinitions = Optional.empty();
private Optional<Boolean> modelReasoningInsightsEnabled = Optional.empty();
private Optional<Boolean> advancedMultimodalEnabled = Optional.empty();
private Optional<Boolean> citationsEnabled = Optional.empty();
private Optional<Boolean> advancedFigureParsingEnabled = Optional.empty();
private Optional<ExtractChunkingOptions> chunkingOptions = Optional.empty();
private Optional<Integer> fixedPageLimit = Optional.empty();
private Optional<List<PageRangesItem>> pageRanges = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ExtractionAdvancedOptions other) {
documentKind(other.getDocumentKind());
keyDefinitions(other.getKeyDefinitions());
modelReasoningInsightsEnabled(other.getModelReasoningInsightsEnabled());
advancedMultimodalEnabled(other.getAdvancedMultimodalEnabled());
citationsEnabled(other.getCitationsEnabled());
advancedFigureParsingEnabled(other.getAdvancedFigureParsingEnabled());
chunkingOptions(other.getChunkingOptions());
fixedPageLimit(other.getFixedPageLimit());
pageRanges(other.getPageRanges());
return this;
}
/**
* <p>The kind of document being processed.</p>
*/
@JsonSetter(value = "documentKind", nulls = Nulls.SKIP)
public Builder documentKind(Optional<String> documentKind) {
this.documentKind = documentKind;
return this;
}
public Builder documentKind(String documentKind) {
this.documentKind = Optional.ofNullable(documentKind);
return this;
}
/**
* <p>Custom key definitions for extraction.</p>
*/
@JsonSetter(value = "keyDefinitions", nulls = Nulls.SKIP)
public Builder keyDefinitions(Optional<String> keyDefinitions) {
this.keyDefinitions = keyDefinitions;
return this;
}
public Builder keyDefinitions(String keyDefinitions) {
this.keyDefinitions = Optional.ofNullable(keyDefinitions);
return this;
}
/**
* <p>Whether to enable model reasoning insights.</p>
*/
@JsonSetter(value = "modelReasoningInsightsEnabled", nulls = Nulls.SKIP)
public Builder modelReasoningInsightsEnabled(Optional<Boolean> modelReasoningInsightsEnabled) {
this.modelReasoningInsightsEnabled = modelReasoningInsightsEnabled;
return this;
}
public Builder modelReasoningInsightsEnabled(Boolean modelReasoningInsightsEnabled) {
this.modelReasoningInsightsEnabled = Optional.ofNullable(modelReasoningInsightsEnabled);
return this;
}
/**
* <p>Whether to enable advanced multimodal features.</p>
*/
@JsonSetter(value = "advancedMultimodalEnabled", nulls = Nulls.SKIP)
public Builder advancedMultimodalEnabled(Optional<Boolean> advancedMultimodalEnabled) {
this.advancedMultimodalEnabled = advancedMultimodalEnabled;
return this;
}
public Builder advancedMultimodalEnabled(Boolean advancedMultimodalEnabled) {
this.advancedMultimodalEnabled = Optional.ofNullable(advancedMultimodalEnabled);
return this;
}
/**
* <p>Whether to enable citations in the output.</p>
*/
@JsonSetter(value = "citationsEnabled", nulls = Nulls.SKIP)
public Builder citationsEnabled(Optional<Boolean> citationsEnabled) {
this.citationsEnabled = citationsEnabled;
return this;
}
public Builder citationsEnabled(Boolean citationsEnabled) {
this.citationsEnabled = Optional.ofNullable(citationsEnabled);
return this;
}
/**
* <p>Whether to enable advanced figure parsing.</p>
*/
@JsonSetter(value = "advancedFigureParsingEnabled", nulls = Nulls.SKIP)
public Builder advancedFigureParsingEnabled(Optional<Boolean> advancedFigureParsingEnabled) {
this.advancedFigureParsingEnabled = advancedFigureParsingEnabled;
return this;
}
public Builder advancedFigureParsingEnabled(Boolean advancedFigureParsingEnabled) {
this.advancedFigureParsingEnabled = Optional.ofNullable(advancedFigureParsingEnabled);
return this;
}
@JsonSetter(value = "chunkingOptions", nulls = Nulls.SKIP)
public Builder chunkingOptions(Optional<ExtractChunkingOptions> chunkingOptions) {
this.chunkingOptions = chunkingOptions;
return this;
}
public Builder chunkingOptions(ExtractChunkingOptions chunkingOptions) {
this.chunkingOptions = Optional.ofNullable(chunkingOptions);
return this;
}
/**
* <p>Optional fixed limit on the number of pages to process. See <a href="/product/page-ranges">Page Ranges</a>.</p>
*/
@JsonSetter(value = "fixedPageLimit", nulls = Nulls.SKIP)
public Builder fixedPageLimit(Optional<Integer> fixedPageLimit) {
this.fixedPageLimit = fixedPageLimit;
return this;
}
public Builder fixedPageLimit(Integer fixedPageLimit) {
this.fixedPageLimit = Optional.ofNullable(fixedPageLimit);
return this;
}
@JsonSetter(value = "pageRanges", nulls = Nulls.SKIP)
public Builder pageRanges(Optional<List<PageRangesItem>> pageRanges) {
this.pageRanges = pageRanges;
return this;
}
public Builder pageRanges(List<PageRangesItem> pageRanges) {
this.pageRanges = Optional.ofNullable(pageRanges);
return this;
}
public ExtractionAdvancedOptions build() {
return new ExtractionAdvancedOptions(
documentKind,
keyDefinitions,
modelReasoningInsightsEnabled,
advancedMultimodalEnabled,
citationsEnabled,
advancedFigureParsingEnabled,
chunkingOptions,
fixedPageLimit,
pageRanges,
additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionConfig.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractionConfig.Builder.class)
public final class ExtractionConfig {
private final Optional<ExtractionConfigBaseProcessor> baseProcessor;
private final Optional<String> baseVersion;
private final Optional<String> extractionRules;
private final Optional<Map<String, Object>> schema;
private final Optional<List<ExtractionField>> fields;
private final Optional<ExtractionAdvancedOptions> advancedOptions;
private final Optional<ParseConfig> parser;
private final Map<String, Object> additionalProperties;
private ExtractionConfig(
Optional<ExtractionConfigBaseProcessor> baseProcessor,
Optional<String> baseVersion,
Optional<String> extractionRules,
Optional<Map<String, Object>> schema,
Optional<List<ExtractionField>> fields,
Optional<ExtractionAdvancedOptions> advancedOptions,
Optional<ParseConfig> parser,
Map<String, Object> additionalProperties) {
this.baseProcessor = baseProcessor;
this.baseVersion = baseVersion;
this.extractionRules = extractionRules;
this.schema = schema;
this.fields = fields;
this.advancedOptions = advancedOptions;
this.parser = parser;
this.additionalProperties = additionalProperties;
}
/**
* @return The base processor to use. For extractors, this must be either <code>"extraction_performance"</code> or <code>"extraction_light"</code>. See <a href="/changelog/extraction/extraction-performance">Extraction Changelog</a> for more details.
*/
@JsonProperty("baseProcessor")
public Optional<ExtractionConfigBaseProcessor> getBaseProcessor() {
return baseProcessor;
}
/**
* @return The version of the <code>"extraction_performance"</code> or <code>"extraction_light"</code> processor to use. If this is provided, the <code>baseProcessor</code> must also be provided. See <a href="/changelog/extraction/extraction-performance">Extraction Changelog</a> for more details.
*/
@JsonProperty("baseVersion")
public Optional<String> getBaseVersion() {
return baseVersion;
}
/**
* @return Custom rules to guide the extraction process in natural language.
*/
@JsonProperty("extractionRules")
public Optional<String> getExtractionRules() {
return extractionRules;
}
/**
* @return JSON Schema definition of the data to extract. Either <code>fields</code> or <code>schema</code> must be provided.
* <p>See the <a href="/product/extraction/schema/json-schema">JSON Schema guide</a> for details and examples of schema configuration.</p>
*/
@JsonProperty("schema")
public Optional<Map<String, Object>> getSchema() {
return schema;
}
/**
* @return Array of fields to extract from the document. Either <code>fields</code> or <code>schema</code> must be provided.
* <p>We recommend using <code>schema</code> for new implementations.</p>
*/
@JsonProperty("fields")
public Optional<List<ExtractionField>> getFields() {
return fields;
}
/**
* @return Advanced configuration options.
*/
@JsonProperty("advancedOptions")
public Optional<ExtractionAdvancedOptions> getAdvancedOptions() {
return advancedOptions;
}
/**
* @return Configuration options for the parsing process.
*/
@JsonProperty("parser")
public Optional<ParseConfig> getParser() {
return parser;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractionConfig && equalTo((ExtractionConfig) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractionConfig other) {
return baseProcessor.equals(other.baseProcessor)
&& baseVersion.equals(other.baseVersion)
&& extractionRules.equals(other.extractionRules)
&& schema.equals(other.schema)
&& fields.equals(other.fields)
&& advancedOptions.equals(other.advancedOptions)
&& parser.equals(other.parser);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.baseProcessor,
this.baseVersion,
this.extractionRules,
this.schema,
this.fields,
this.advancedOptions,
this.parser);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<ExtractionConfigBaseProcessor> baseProcessor = Optional.empty();
private Optional<String> baseVersion = Optional.empty();
private Optional<String> extractionRules = Optional.empty();
private Optional<Map<String, Object>> schema = Optional.empty();
private Optional<List<ExtractionField>> fields = Optional.empty();
private Optional<ExtractionAdvancedOptions> advancedOptions = Optional.empty();
private Optional<ParseConfig> parser = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ExtractionConfig other) {
baseProcessor(other.getBaseProcessor());
baseVersion(other.getBaseVersion());
extractionRules(other.getExtractionRules());
schema(other.getSchema());
fields(other.getFields());
advancedOptions(other.getAdvancedOptions());
parser(other.getParser());
return this;
}
/**
* <p>The base processor to use. For extractors, this must be either <code>"extraction_performance"</code> or <code>"extraction_light"</code>. See <a href="/changelog/extraction/extraction-performance">Extraction Changelog</a> for more details.</p>
*/
@JsonSetter(value = "baseProcessor", nulls = Nulls.SKIP)
public Builder baseProcessor(Optional<ExtractionConfigBaseProcessor> baseProcessor) {
this.baseProcessor = baseProcessor;
return this;
}
public Builder baseProcessor(ExtractionConfigBaseProcessor baseProcessor) {
this.baseProcessor = Optional.ofNullable(baseProcessor);
return this;
}
/**
* <p>The version of the <code>"extraction_performance"</code> or <code>"extraction_light"</code> processor to use. If this is provided, the <code>baseProcessor</code> must also be provided. See <a href="/changelog/extraction/extraction-performance">Extraction Changelog</a> for more details.</p>
*/
@JsonSetter(value = "baseVersion", nulls = Nulls.SKIP)
public Builder baseVersion(Optional<String> baseVersion) {
this.baseVersion = baseVersion;
return this;
}
public Builder baseVersion(String baseVersion) {
this.baseVersion = Optional.ofNullable(baseVersion);
return this;
}
/**
* <p>Custom rules to guide the extraction process in natural language.</p>
*/
@JsonSetter(value = "extractionRules", nulls = Nulls.SKIP)
public Builder extractionRules(Optional<String> extractionRules) {
this.extractionRules = extractionRules;
return this;
}
public Builder extractionRules(String extractionRules) {
this.extractionRules = Optional.ofNullable(extractionRules);
return this;
}
/**
* <p>JSON Schema definition of the data to extract. Either <code>fields</code> or <code>schema</code> must be provided.</p>
* <p>See the <a href="/product/extraction/schema/json-schema">JSON Schema guide</a> for details and examples of schema configuration.</p>
*/
@JsonSetter(value = "schema", nulls = Nulls.SKIP)
public Builder schema(Optional<Map<String, Object>> schema) {
this.schema = schema;
return this;
}
public Builder schema(Map<String, Object> schema) {
this.schema = Optional.ofNullable(schema);
return this;
}
/**
* <p>Array of fields to extract from the document. Either <code>fields</code> or <code>schema</code> must be provided.</p>
* <p>We recommend using <code>schema</code> for new implementations.</p>
*/
@JsonSetter(value = "fields", nulls = Nulls.SKIP)
public Builder fields(Optional<List<ExtractionField>> fields) {
this.fields = fields;
return this;
}
public Builder fields(List<ExtractionField> fields) {
this.fields = Optional.ofNullable(fields);
return this;
}
/**
* <p>Advanced configuration options.</p>
*/
@JsonSetter(value = "advancedOptions", nulls = Nulls.SKIP)
public Builder advancedOptions(Optional<ExtractionAdvancedOptions> advancedOptions) {
this.advancedOptions = advancedOptions;
return this;
}
public Builder advancedOptions(ExtractionAdvancedOptions advancedOptions) {
this.advancedOptions = Optional.ofNullable(advancedOptions);
return this;
}
/**
* <p>Configuration options for the parsing process.</p>
*/
@JsonSetter(value = "parser", nulls = Nulls.SKIP)
public Builder parser(Optional<ParseConfig> parser) {
this.parser = parser;
return this;
}
public Builder parser(ParseConfig parser) {
this.parser = Optional.ofNullable(parser);
return this;
}
public ExtractionConfig build() {
return new ExtractionConfig(
baseProcessor,
baseVersion,
extractionRules,
schema,
fields,
advancedOptions,
parser,
additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionConfigBaseProcessor.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ExtractionConfigBaseProcessor {
EXTRACTION_PERFORMANCE("extraction_performance"),
EXTRACTION_LIGHT("extraction_light");
private final String value;
ExtractionConfigBaseProcessor(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionField.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractionField.Builder.class)
public final class ExtractionField {
private final String id;
private final String name;
private final ExtractionFieldType type;
private final String description;
private final Optional<List<ExtractionField>> schema;
private final Optional<List<Enum>> enum_;
private final Map<String, Object> additionalProperties;
private ExtractionField(
String id,
String name,
ExtractionFieldType type,
String description,
Optional<List<ExtractionField>> schema,
Optional<List<Enum>> enum_,
Map<String, Object> additionalProperties) {
this.id = id;
this.name = name;
this.type = type;
this.description = description;
this.schema = schema;
this.enum_ = enum_;
this.additionalProperties = additionalProperties;
}
/**
* @return Unique identifier for the field.
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return Human-readable name for the field.
*/
@JsonProperty("name")
public String getName() {
return name;
}
/**
* @return The type of the field.
*/
@JsonProperty("type")
public ExtractionFieldType getType() {
return type;
}
/**
* @return Detailed description of the field, including expected content and format.
*/
@JsonProperty("description")
public String getDescription() {
return description;
}
/**
* @return Required when type is "array" or "object". Contains nested field definitions.
*/
@JsonProperty("schema")
public Optional<List<ExtractionField>> getSchema() {
return schema;
}
/**
* @return Required when type is "enum". List of allowed values.
*/
@JsonProperty("enum")
public Optional<List<Enum>> getEnum() {
return enum_;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractionField && equalTo((ExtractionField) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractionField other) {
return id.equals(other.id)
&& name.equals(other.name)
&& type.equals(other.type)
&& description.equals(other.description)
&& schema.equals(other.schema)
&& enum_.equals(other.enum_);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.id, this.name, this.type, this.description, this.schema, this.enum_);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static IdStage builder() {
return new Builder();
}
public interface IdStage {
/**
* <p>Unique identifier for the field.</p>
*/
NameStage id(@NotNull String id);
Builder from(ExtractionField other);
}
public interface NameStage {
/**
* <p>Human-readable name for the field.</p>
*/
TypeStage name(@NotNull String name);
}
public interface TypeStage {
/**
* <p>The type of the field.</p>
*/
DescriptionStage type(@NotNull ExtractionFieldType type);
}
public interface DescriptionStage {
/**
* <p>Detailed description of the field, including expected content and format.</p>
*/
_FinalStage description(@NotNull String description);
}
public interface _FinalStage {
ExtractionField build();
/**
* <p>Required when type is "array" or "object". Contains nested field definitions.</p>
*/
_FinalStage schema(Optional<List<ExtractionField>> schema);
_FinalStage schema(List<ExtractionField> schema);
/**
* <p>Required when type is "enum". List of allowed values.</p>
*/
_FinalStage enum_(Optional<List<Enum>> enum_);
_FinalStage enum_(List<Enum> enum_);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements IdStage, NameStage, TypeStage, DescriptionStage, _FinalStage {
private String id;
private String name;
private ExtractionFieldType type;
private String description;
private Optional<List<Enum>> enum_ = Optional.empty();
private Optional<List<ExtractionField>> schema = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ExtractionField other) {
id(other.getId());
name(other.getName());
type(other.getType());
description(other.getDescription());
schema(other.getSchema());
enum_(other.getEnum());
return this;
}
/**
* <p>Unique identifier for the field.</p>
* <p>Unique identifier for the field.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public NameStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>Human-readable name for the field.</p>
* <p>Human-readable name for the field.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("name")
public TypeStage name(@NotNull String name) {
this.name = Objects.requireNonNull(name, "name must not be null");
return this;
}
/**
* <p>The type of the field.</p>
* <p>The type of the field.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("type")
public DescriptionStage type(@NotNull ExtractionFieldType type) {
this.type = Objects.requireNonNull(type, "type must not be null");
return this;
}
/**
* <p>Detailed description of the field, including expected content and format.</p>
* <p>Detailed description of the field, including expected content and format.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("description")
public _FinalStage description(@NotNull String description) {
this.description = Objects.requireNonNull(description, "description must not be null");
return this;
}
/**
* <p>Required when type is "enum". List of allowed values.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage enum_(List<Enum> enum_) {
this.enum_ = Optional.ofNullable(enum_);
return this;
}
/**
* <p>Required when type is "enum". List of allowed values.</p>
*/
@java.lang.Override
@JsonSetter(value = "enum", nulls = Nulls.SKIP)
public _FinalStage enum_(Optional<List<Enum>> enum_) {
this.enum_ = enum_;
return this;
}
/**
* <p>Required when type is "array" or "object". Contains nested field definitions.</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage schema(List<ExtractionField> schema) {
this.schema = Optional.ofNullable(schema);
return this;
}
/**
* <p>Required when type is "array" or "object". Contains nested field definitions.</p>
*/
@java.lang.Override
@JsonSetter(value = "schema", nulls = Nulls.SKIP)
public _FinalStage schema(Optional<List<ExtractionField>> schema) {
this.schema = schema;
return this;
}
@java.lang.Override
public ExtractionField build() {
return new ExtractionField(id, name, type, description, schema, enum_, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionFieldResult.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractionFieldResult.Builder.class)
public final class ExtractionFieldResult {
private final String id;
private final ExtractionFieldResultType type;
private final Object value;
private final Optional<Double> confidence;
private final Optional<List<ExtractionField>> schema;
private final Optional<List<Insight>> insights;
private final List<ExtractionFieldResultReference> references;
private final Optional<List<EnumOption>> enum_;
private final Map<String, Object> additionalProperties;
private ExtractionFieldResult(
String id,
ExtractionFieldResultType type,
Object value,
Optional<Double> confidence,
Optional<List<ExtractionField>> schema,
Optional<List<Insight>> insights,
List<ExtractionFieldResultReference> references,
Optional<List<EnumOption>> enum_,
Map<String, Object> additionalProperties) {
this.id = id;
this.type = type;
this.value = value;
this.confidence = confidence;
this.schema = schema;
this.insights = insights;
this.references = references;
this.enum_ = enum_;
this.additionalProperties = additionalProperties;
}
/**
* @return The unique identifier for this field
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return The type of the extracted field
*/
@JsonProperty("type")
public ExtractionFieldResultType getType() {
return type;
}
@JsonProperty("value")
public Object getValue() {
return value;
}
/**
* @return A value between 0 and 1 indicating confidence in the extraction
*/
@JsonProperty("confidence")
public Optional<Double> getConfidence() {
return confidence;
}
/**
* @return The field schema of nested fields
*/
@JsonProperty("schema")
public Optional<List<ExtractionField>> getSchema() {
return schema;
}
/**
* @return Reasoning and other insights from the model
*/
@JsonProperty("insights")
public Optional<List<Insight>> getInsights() {
return insights;
}
/**
* @return References for the extracted field
*/
@JsonProperty("references")
public List<ExtractionFieldResultReference> getReferences() {
return references;
}
/**
* @return The enum options for enum fields, only set when type=enum
*/
@JsonProperty("enum")
public Optional<List<EnumOption>> getEnum() {
return enum_;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractionFieldResult && equalTo((ExtractionFieldResult) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractionFieldResult other) {
return id.equals(other.id)
&& type.equals(other.type)
&& value.equals(other.value)
&& confidence.equals(other.confidence)
&& schema.equals(other.schema)
&& insights.equals(other.insights)
&& references.equals(other.references)
&& enum_.equals(other.enum_);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(
this.id,
this.type,
this.value,
this.confidence,
this.schema,
this.insights,
this.references,
this.enum_);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static IdStage builder() {
return new Builder();
}
public interface IdStage {
/**
* <p>The unique identifier for this field</p>
*/
TypeStage id(@NotNull String id);
Builder from(ExtractionFieldResult other);
}
public interface TypeStage {
/**
* <p>The type of the extracted field</p>
*/
ValueStage type(@NotNull ExtractionFieldResultType type);
}
public interface ValueStage {
_FinalStage value(Object value);
}
public interface _FinalStage {
ExtractionFieldResult build();
/**
* <p>A value between 0 and 1 indicating confidence in the extraction</p>
*/
_FinalStage confidence(Optional<Double> confidence);
_FinalStage confidence(Double confidence);
/**
* <p>The field schema of nested fields</p>
*/
_FinalStage schema(Optional<List<ExtractionField>> schema);
_FinalStage schema(List<ExtractionField> schema);
/**
* <p>Reasoning and other insights from the model</p>
*/
_FinalStage insights(Optional<List<Insight>> insights);
_FinalStage insights(List<Insight> insights);
/**
* <p>References for the extracted field</p>
*/
_FinalStage references(List<ExtractionFieldResultReference> references);
_FinalStage addReferences(ExtractionFieldResultReference references);
_FinalStage addAllReferences(List<ExtractionFieldResultReference> references);
/**
* <p>The enum options for enum fields, only set when type=enum</p>
*/
_FinalStage enum_(Optional<List<EnumOption>> enum_);
_FinalStage enum_(List<EnumOption> enum_);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements IdStage, TypeStage, ValueStage, _FinalStage {
private String id;
private ExtractionFieldResultType type;
private Object value;
private Optional<List<EnumOption>> enum_ = Optional.empty();
private List<ExtractionFieldResultReference> references = new ArrayList<>();
private Optional<List<Insight>> insights = Optional.empty();
private Optional<List<ExtractionField>> schema = Optional.empty();
private Optional<Double> confidence = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ExtractionFieldResult other) {
id(other.getId());
type(other.getType());
value(other.getValue());
confidence(other.getConfidence());
schema(other.getSchema());
insights(other.getInsights());
references(other.getReferences());
enum_(other.getEnum());
return this;
}
/**
* <p>The unique identifier for this field</p>
* <p>The unique identifier for this field</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public TypeStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>The type of the extracted field</p>
* <p>The type of the extracted field</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("type")
public ValueStage type(@NotNull ExtractionFieldResultType type) {
this.type = Objects.requireNonNull(type, "type must not be null");
return this;
}
@java.lang.Override
@JsonSetter("value")
public _FinalStage value(Object value) {
this.value = value;
return this;
}
/**
* <p>The enum options for enum fields, only set when type=enum</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage enum_(List<EnumOption> enum_) {
this.enum_ = Optional.ofNullable(enum_);
return this;
}
/**
* <p>The enum options for enum fields, only set when type=enum</p>
*/
@java.lang.Override
@JsonSetter(value = "enum", nulls = Nulls.SKIP)
public _FinalStage enum_(Optional<List<EnumOption>> enum_) {
this.enum_ = enum_;
return this;
}
/**
* <p>References for the extracted field</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addAllReferences(List<ExtractionFieldResultReference> references) {
this.references.addAll(references);
return this;
}
/**
* <p>References for the extracted field</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addReferences(ExtractionFieldResultReference references) {
this.references.add(references);
return this;
}
/**
* <p>References for the extracted field</p>
*/
@java.lang.Override
@JsonSetter(value = "references", nulls = Nulls.SKIP)
public _FinalStage references(List<ExtractionFieldResultReference> references) {
this.references.clear();
this.references.addAll(references);
return this;
}
/**
* <p>Reasoning and other insights from the model</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage insights(List<Insight> insights) {
this.insights = Optional.ofNullable(insights);
return this;
}
/**
* <p>Reasoning and other insights from the model</p>
*/
@java.lang.Override
@JsonSetter(value = "insights", nulls = Nulls.SKIP)
public _FinalStage insights(Optional<List<Insight>> insights) {
this.insights = insights;
return this;
}
/**
* <p>The field schema of nested fields</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage schema(List<ExtractionField> schema) {
this.schema = Optional.ofNullable(schema);
return this;
}
/**
* <p>The field schema of nested fields</p>
*/
@java.lang.Override
@JsonSetter(value = "schema", nulls = Nulls.SKIP)
public _FinalStage schema(Optional<List<ExtractionField>> schema) {
this.schema = schema;
return this;
}
/**
* <p>A value between 0 and 1 indicating confidence in the extraction</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage confidence(Double confidence) {
this.confidence = Optional.ofNullable(confidence);
return this;
}
/**
* <p>A value between 0 and 1 indicating confidence in the extraction</p>
*/
@java.lang.Override
@JsonSetter(value = "confidence", nulls = Nulls.SKIP)
public _FinalStage confidence(Optional<Double> confidence) {
this.confidence = confidence;
return this;
}
@java.lang.Override
public ExtractionFieldResult build() {
return new ExtractionFieldResult(
id, type, value, confidence, schema, insights, references, enum_, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionFieldResultReference.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractionFieldResultReference.Builder.class)
public final class ExtractionFieldResultReference {
private final String id;
private final String fieldName;
private final double page;
private final List<ExtractionFieldResultReferenceBoundingBoxesItem> boundingBoxes;
private final Map<String, Object> additionalProperties;
private ExtractionFieldResultReference(
String id,
String fieldName,
double page,
List<ExtractionFieldResultReferenceBoundingBoxesItem> boundingBoxes,
Map<String, Object> additionalProperties) {
this.id = id;
this.fieldName = fieldName;
this.page = page;
this.boundingBoxes = boundingBoxes;
this.additionalProperties = additionalProperties;
}
/**
* @return The unique identifier for this field
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* @return The name of the extracted field
*/
@JsonProperty("fieldName")
public String getFieldName() {
return fieldName;
}
/**
* @return The page number that this bounding box is from
*/
@JsonProperty("page")
public double getPage() {
return page;
}
/**
* @return The bounding boxes of the field
*/
@JsonProperty("boundingBoxes")
public List<ExtractionFieldResultReferenceBoundingBoxesItem> getBoundingBoxes() {
return boundingBoxes;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractionFieldResultReference && equalTo((ExtractionFieldResultReference) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractionFieldResultReference other) {
return id.equals(other.id)
&& fieldName.equals(other.fieldName)
&& page == other.page
&& boundingBoxes.equals(other.boundingBoxes);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.id, this.fieldName, this.page, this.boundingBoxes);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static IdStage builder() {
return new Builder();
}
public interface IdStage {
/**
* <p>The unique identifier for this field</p>
*/
FieldNameStage id(@NotNull String id);
Builder from(ExtractionFieldResultReference other);
}
public interface FieldNameStage {
/**
* <p>The name of the extracted field</p>
*/
PageStage fieldName(@NotNull String fieldName);
}
public interface PageStage {
/**
* <p>The page number that this bounding box is from</p>
*/
_FinalStage page(double page);
}
public interface _FinalStage {
ExtractionFieldResultReference build();
/**
* <p>The bounding boxes of the field</p>
*/
_FinalStage boundingBoxes(List<ExtractionFieldResultReferenceBoundingBoxesItem> boundingBoxes);
_FinalStage addBoundingBoxes(ExtractionFieldResultReferenceBoundingBoxesItem boundingBoxes);
_FinalStage addAllBoundingBoxes(List<ExtractionFieldResultReferenceBoundingBoxesItem> boundingBoxes);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements IdStage, FieldNameStage, PageStage, _FinalStage {
private String id;
private String fieldName;
private double page;
private List<ExtractionFieldResultReferenceBoundingBoxesItem> boundingBoxes = new ArrayList<>();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ExtractionFieldResultReference other) {
id(other.getId());
fieldName(other.getFieldName());
page(other.getPage());
boundingBoxes(other.getBoundingBoxes());
return this;
}
/**
* <p>The unique identifier for this field</p>
* <p>The unique identifier for this field</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("id")
public FieldNameStage id(@NotNull String id) {
this.id = Objects.requireNonNull(id, "id must not be null");
return this;
}
/**
* <p>The name of the extracted field</p>
* <p>The name of the extracted field</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("fieldName")
public PageStage fieldName(@NotNull String fieldName) {
this.fieldName = Objects.requireNonNull(fieldName, "fieldName must not be null");
return this;
}
/**
* <p>The page number that this bounding box is from</p>
* <p>The page number that this bounding box is from</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("page")
public _FinalStage page(double page) {
this.page = page;
return this;
}
/**
* <p>The bounding boxes of the field</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addAllBoundingBoxes(List<ExtractionFieldResultReferenceBoundingBoxesItem> boundingBoxes) {
this.boundingBoxes.addAll(boundingBoxes);
return this;
}
/**
* <p>The bounding boxes of the field</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
public _FinalStage addBoundingBoxes(ExtractionFieldResultReferenceBoundingBoxesItem boundingBoxes) {
this.boundingBoxes.add(boundingBoxes);
return this;
}
/**
* <p>The bounding boxes of the field</p>
*/
@java.lang.Override
@JsonSetter(value = "boundingBoxes", nulls = Nulls.SKIP)
public _FinalStage boundingBoxes(List<ExtractionFieldResultReferenceBoundingBoxesItem> boundingBoxes) {
this.boundingBoxes.clear();
this.boundingBoxes.addAll(boundingBoxes);
return this;
}
@java.lang.Override
public ExtractionFieldResultReference build() {
return new ExtractionFieldResultReference(id, fieldName, page, boundingBoxes, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionFieldResultReferenceBoundingBoxesItem.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractionFieldResultReferenceBoundingBoxesItem.Builder.class)
public final class ExtractionFieldResultReferenceBoundingBoxesItem {
private final double top;
private final double left;
private final double bottom;
private final double right;
private final Map<String, Object> additionalProperties;
private ExtractionFieldResultReferenceBoundingBoxesItem(
double top, double left, double bottom, double right, Map<String, Object> additionalProperties) {
this.top = top;
this.left = left;
this.bottom = bottom;
this.right = right;
this.additionalProperties = additionalProperties;
}
/**
* @return The top coordinate of the bounding box
*/
@JsonProperty("top")
public double getTop() {
return top;
}
/**
* @return The left coordinate of the bounding box
*/
@JsonProperty("left")
public double getLeft() {
return left;
}
/**
* @return The bottom coordinate of the bounding box
*/
@JsonProperty("bottom")
public double getBottom() {
return bottom;
}
/**
* @return The right coordinate of the bounding box
*/
@JsonProperty("right")
public double getRight() {
return right;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractionFieldResultReferenceBoundingBoxesItem
&& equalTo((ExtractionFieldResultReferenceBoundingBoxesItem) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractionFieldResultReferenceBoundingBoxesItem other) {
return top == other.top && left == other.left && bottom == other.bottom && right == other.right;
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.top, this.left, this.bottom, this.right);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static TopStage builder() {
return new Builder();
}
public interface TopStage {
/**
* <p>The top coordinate of the bounding box</p>
*/
LeftStage top(double top);
Builder from(ExtractionFieldResultReferenceBoundingBoxesItem other);
}
public interface LeftStage {
/**
* <p>The left coordinate of the bounding box</p>
*/
BottomStage left(double left);
}
public interface BottomStage {
/**
* <p>The bottom coordinate of the bounding box</p>
*/
RightStage bottom(double bottom);
}
public interface RightStage {
/**
* <p>The right coordinate of the bounding box</p>
*/
_FinalStage right(double right);
}
public interface _FinalStage {
ExtractionFieldResultReferenceBoundingBoxesItem build();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements TopStage, LeftStage, BottomStage, RightStage, _FinalStage {
private double top;
private double left;
private double bottom;
private double right;
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
@java.lang.Override
public Builder from(ExtractionFieldResultReferenceBoundingBoxesItem other) {
top(other.getTop());
left(other.getLeft());
bottom(other.getBottom());
right(other.getRight());
return this;
}
/**
* <p>The top coordinate of the bounding box</p>
* <p>The top coordinate of the bounding box</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("top")
public LeftStage top(double top) {
this.top = top;
return this;
}
/**
* <p>The left coordinate of the bounding box</p>
* <p>The left coordinate of the bounding box</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("left")
public BottomStage left(double left) {
this.left = left;
return this;
}
/**
* <p>The bottom coordinate of the bounding box</p>
* <p>The bottom coordinate of the bounding box</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("bottom")
public RightStage bottom(double bottom) {
this.bottom = bottom;
return this;
}
/**
* <p>The right coordinate of the bounding box</p>
* <p>The right coordinate of the bounding box</p>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@java.lang.Override
@JsonSetter("right")
public _FinalStage right(double right) {
this.right = right;
return this;
}
@java.lang.Override
public ExtractionFieldResultReferenceBoundingBoxesItem build() {
return new ExtractionFieldResultReferenceBoundingBoxesItem(top, left, bottom, right, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionFieldResultType.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ExtractionFieldResultType {
STRING("string"),
NUMBER("number"),
CURRENCY("currency"),
BOOLEAN("boolean"),
DATE("date"),
ENUM("enum"),
ARRAY("array"),
OBJECT("object"),
SIGNATURE("signature");
private final String value;
ExtractionFieldResultType(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionFieldType.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum ExtractionFieldType {
STRING("string"),
NUMBER("number"),
CURRENCY("currency"),
BOOLEAN("boolean"),
DATE("date"),
ARRAY("array"),
ENUM("enum"),
OBJECT("object"),
SIGNATURE("signature");
private final String value;
ExtractionFieldType(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionOutput.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
@JsonDeserialize(using = ExtractionOutput.Deserializer.class)
public final class ExtractionOutput {
private final Object value;
private final int type;
private ExtractionOutput(Object value, int type) {
this.value = value;
this.type = type;
}
@JsonValue
public Object get() {
return this.value;
}
@SuppressWarnings("unchecked")
public <T> T visit(Visitor<T> visitor) {
if (this.type == 0) {
return visitor.visit((JsonOutput) this.value);
} else if (this.type == 1) {
return visitor.visit((Map<String, ExtractionFieldResult>) this.value);
}
throw new IllegalStateException("Failed to visit value. This should never happen.");
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractionOutput && equalTo((ExtractionOutput) other);
}
private boolean equalTo(ExtractionOutput other) {
return value.equals(other.value);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.value);
}
@java.lang.Override
public String toString() {
return this.value.toString();
}
public static ExtractionOutput of(JsonOutput value) {
return new ExtractionOutput(value, 0);
}
public static ExtractionOutput of(Map<String, ExtractionFieldResult> value) {
return new ExtractionOutput(value, 1);
}
public interface Visitor<T> {
T visit(JsonOutput value);
T visit(Map<String, ExtractionFieldResult> value);
}
static final class Deserializer extends StdDeserializer<ExtractionOutput> {
Deserializer() {
super(ExtractionOutput.class);
}
@java.lang.Override
public ExtractionOutput deserialize(JsonParser p, DeserializationContext context) throws IOException {
Object value = p.readValueAs(Object.class);
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(value, JsonOutput.class));
} catch (RuntimeException e) {
}
try {
return of(ObjectMappers.JSON_MAPPER.convertValue(
value, new TypeReference<Map<String, ExtractionFieldResult>>() {}));
} catch (RuntimeException e) {
}
throw new JsonParseException(p, "Failed to deserialize");
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/ExtractionOutputEdits.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = ExtractionOutputEdits.Builder.class)
public final class ExtractionOutputEdits {
private final Optional<Object> originalValue;
private final Optional<Object> editedValue;
private final Optional<String> notes;
private final Optional<Double> page;
private final Optional<String> fieldType;
private final Map<String, Object> additionalProperties;
private ExtractionOutputEdits(
Optional<Object> originalValue,
Optional<Object> editedValue,
Optional<String> notes,
Optional<Double> page,
Optional<String> fieldType,
Map<String, Object> additionalProperties) {
this.originalValue = originalValue;
this.editedValue = editedValue;
this.notes = notes;
this.page = page;
this.fieldType = fieldType;
this.additionalProperties = additionalProperties;
}
@JsonProperty("originalValue")
public Optional<Object> getOriginalValue() {
return originalValue;
}
@JsonProperty("editedValue")
public Optional<Object> getEditedValue() {
return editedValue;
}
/**
* @return Any notes added during editing.
*/
@JsonProperty("notes")
public Optional<String> getNotes() {
return notes;
}
/**
* @return The page number where the edit was made.
*/
@JsonProperty("page")
public Optional<Double> getPage() {
return page;
}
/**
* @return The type of the edited field.
*/
@JsonProperty("fieldType")
public Optional<String> getFieldType() {
return fieldType;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof ExtractionOutputEdits && equalTo((ExtractionOutputEdits) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(ExtractionOutputEdits other) {
return originalValue.equals(other.originalValue)
&& editedValue.equals(other.editedValue)
&& notes.equals(other.notes)
&& page.equals(other.page)
&& fieldType.equals(other.fieldType);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.originalValue, this.editedValue, this.notes, this.page, this.fieldType);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<Object> originalValue = Optional.empty();
private Optional<Object> editedValue = Optional.empty();
private Optional<String> notes = Optional.empty();
private Optional<Double> page = Optional.empty();
private Optional<String> fieldType = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(ExtractionOutputEdits other) {
originalValue(other.getOriginalValue());
editedValue(other.getEditedValue());
notes(other.getNotes());
page(other.getPage());
fieldType(other.getFieldType());
return this;
}
@JsonSetter(value = "originalValue", nulls = Nulls.SKIP)
public Builder originalValue(Optional<Object> originalValue) {
this.originalValue = originalValue;
return this;
}
public Builder originalValue(Object originalValue) {
this.originalValue = Optional.ofNullable(originalValue);
return this;
}
@JsonSetter(value = "editedValue", nulls = Nulls.SKIP)
public Builder editedValue(Optional<Object> editedValue) {
this.editedValue = editedValue;
return this;
}
public Builder editedValue(Object editedValue) {
this.editedValue = Optional.ofNullable(editedValue);
return this;
}
/**
* <p>Any notes added during editing.</p>
*/
@JsonSetter(value = "notes", nulls = Nulls.SKIP)
public Builder notes(Optional<String> notes) {
this.notes = notes;
return this;
}
public Builder notes(String notes) {
this.notes = Optional.ofNullable(notes);
return this;
}
/**
* <p>The page number where the edit was made.</p>
*/
@JsonSetter(value = "page", nulls = Nulls.SKIP)
public Builder page(Optional<Double> page) {
this.page = page;
return this;
}
public Builder page(Double page) {
this.page = Optional.ofNullable(page);
return this;
}
/**
* <p>The type of the edited field.</p>
*/
@JsonSetter(value = "fieldType", nulls = Nulls.SKIP)
public Builder fieldType(Optional<String> fieldType) {
this.fieldType = fieldType;
return this;
}
public Builder fieldType(String fieldType) {
this.fieldType = Optional.ofNullable(fieldType);
return this;
}
public ExtractionOutputEdits build() {
return new ExtractionOutputEdits(originalValue, editedValue, notes, page, fieldType, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/FigureDetails.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import ai.extend.core.ObjectMappers;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_ABSENT)
@JsonDeserialize(builder = FigureDetails.Builder.class)
public final class FigureDetails {
private final Optional<String> imageUrl;
private final Optional<FigureDetailsFigureType> figureType;
private final Map<String, Object> additionalProperties;
private FigureDetails(
Optional<String> imageUrl,
Optional<FigureDetailsFigureType> figureType,
Map<String, Object> additionalProperties) {
this.imageUrl = imageUrl;
this.figureType = figureType;
this.additionalProperties = additionalProperties;
}
/**
* @return Indicates this is a figure details object
*/
@JsonProperty("type")
public String getType() {
return "figure_details";
}
/**
* @return URL to the clipped/segmented figure image. Only set if the option <code>figureImageClippingEnabled</code> in the input is <code>true</code>, which it is by default.
*/
@JsonProperty("imageUrl")
public Optional<String> getImageUrl() {
return imageUrl;
}
/**
* @return The refined type of figure - only set when figure classification and summarization is enabled. Possible values:
* <ul>
* <li><code>image</code>: A photographic image</li>
* <li><code>chart</code>: A data chart or graph</li>
* <li><code>diagram</code>: A schematic or diagram</li>
* <li><code>logo</code>: A company or brand logo</li>
* <li><code>other</code>: Any other type of figure</li>
* </ul>
*/
@JsonProperty("figureType")
public Optional<FigureDetailsFigureType> getFigureType() {
return figureType;
}
@java.lang.Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof FigureDetails && equalTo((FigureDetails) other);
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(FigureDetails other) {
return imageUrl.equals(other.imageUrl) && figureType.equals(other.figureType);
}
@java.lang.Override
public int hashCode() {
return Objects.hash(this.imageUrl, this.figureType);
}
@java.lang.Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static Builder builder() {
return new Builder();
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder {
private Optional<String> imageUrl = Optional.empty();
private Optional<FigureDetailsFigureType> figureType = Optional.empty();
@JsonAnySetter
private Map<String, Object> additionalProperties = new HashMap<>();
private Builder() {}
public Builder from(FigureDetails other) {
imageUrl(other.getImageUrl());
figureType(other.getFigureType());
return this;
}
/**
* <p>URL to the clipped/segmented figure image. Only set if the option <code>figureImageClippingEnabled</code> in the input is <code>true</code>, which it is by default.</p>
*/
@JsonSetter(value = "imageUrl", nulls = Nulls.SKIP)
public Builder imageUrl(Optional<String> imageUrl) {
this.imageUrl = imageUrl;
return this;
}
public Builder imageUrl(String imageUrl) {
this.imageUrl = Optional.ofNullable(imageUrl);
return this;
}
/**
* <p>The refined type of figure - only set when figure classification and summarization is enabled. Possible values:</p>
* <ul>
* <li><code>image</code>: A photographic image</li>
* <li><code>chart</code>: A data chart or graph</li>
* <li><code>diagram</code>: A schematic or diagram</li>
* <li><code>logo</code>: A company or brand logo</li>
* <li><code>other</code>: Any other type of figure</li>
* </ul>
*/
@JsonSetter(value = "figureType", nulls = Nulls.SKIP)
public Builder figureType(Optional<FigureDetailsFigureType> figureType) {
this.figureType = figureType;
return this;
}
public Builder figureType(FigureDetailsFigureType figureType) {
this.figureType = Optional.ofNullable(figureType);
return this;
}
public FigureDetails build() {
return new FigureDetails(imageUrl, figureType, additionalProperties);
}
}
}
|
0
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend
|
java-sources/ai/extend/extend-java-sdk/0.0.3-beta/ai/extend/types/FigureDetailsFigureType.java
|
/**
* This file was auto-generated by Fern from our API Definition.
*/
package ai.extend.types;
import com.fasterxml.jackson.annotation.JsonValue;
public enum FigureDetailsFigureType {
OTHER("other"),
CHART("chart"),
IMAGE("image"),
DIAGRAM("diagram"),
LOGO("logo");
private final String value;
FigureDetailsFigureType(String value) {
this.value = value;
}
@JsonValue
@java.lang.Override
public String toString() {
return this.value;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.