From ea70eaf2902caefc103b73a8b02253b00e9514e2 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 18 Jun 2026 18:54:34 +0000 Subject: [PATCH 1/3] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 3.34.8 --- .fern/metadata.json | 9 +- build.gradle | 4 +- sample-app/src/main/java/sample/App.java | 2 +- ...Client.java => AsyncExtendClientBase.java} | 14 ++-- ...java => AsyncExtendClientBaseBuilder.java} | 22 ++--- ...ent.java => AsyncRawExtendClientBase.java} | 46 +++++----- ...xtendClient.java => ExtendClientBase.java} | 14 ++-- ...lder.java => ExtendClientBaseBuilder.java} | 22 ++--- ...ndClient.java => RawExtendClientBase.java} | 36 ++++---- .../java/ai/extend/core/ClientOptions.java | 4 +- ...java => ExtendClientBaseHttpResponse.java} | 4 +- .../AsyncRawBatchProcessorRunClient.java | 15 ++-- .../RawBatchProcessorRunClient.java | 13 +-- .../batchruns/AsyncRawBatchRunsClient.java | 10 +-- .../batchruns/RawBatchRunsClient.java | 8 +- .../AsyncRawClassifiersClient.java | 51 ++++++----- .../classifiers/RawClassifiersClient.java | 38 ++++----- .../AsyncRawClassifierVersionsClient.java | 35 ++++---- .../RawClassifierVersionsClient.java | 28 +++---- .../AsyncRawClassifyRunsClient.java | 71 ++++++++-------- .../classifyruns/RawClassifyRunsClient.java | 55 ++++++------ .../editruns/AsyncRawEditRunsClient.java | 35 ++++---- .../resources/editruns/RawEditRunsClient.java | 28 +++---- .../AsyncRawEditSchemasClient.java | 11 +-- .../editschemas/RawEditSchemasClient.java | 8 +- .../AsyncRawEditTemplatesClient.java | 14 ++-- .../edittemplates/RawEditTemplatesClient.java | 12 +-- .../AsyncRawEvaluationSetItemsClient.java | 56 +++++++------ .../RawEvaluationSetItemsClient.java | 45 +++++----- .../AsyncRawEvaluationSetRunsClient.java | 22 ++--- .../RawEvaluationSetRunsClient.java | 19 +++-- .../AsyncRawEvaluationSetsClient.java | 35 ++++---- .../RawEvaluationSetsClient.java | 28 +++---- .../extractors/AsyncRawExtractorsClient.java | 48 ++++++----- .../extractors/RawExtractorsClient.java | 39 ++++----- .../AsyncRawExtractorVersionsClient.java | 35 ++++---- .../RawExtractorVersionsClient.java | 28 +++---- .../AsyncRawExtractRunsClient.java | 72 ++++++++-------- .../extractruns/RawExtractRunsClient.java | 54 ++++++------ .../resources/files/AsyncRawFilesClient.java | 46 +++++----- .../resources/files/RawFilesClient.java | 39 ++++----- .../parseruns/AsyncRawParseRunsClient.java | 68 +++++++-------- .../parseruns/RawParseRunsClient.java | 55 ++++++------ .../processor/AsyncRawProcessorClient.java | 36 ++++---- .../processor/RawProcessorClient.java | 28 +++---- .../AsyncRawProcessorRunClient.java | 60 ++++++------- .../processorrun/RawProcessorRunClient.java | 50 +++++------ .../AsyncRawProcessorVersionClient.java | 36 ++++---- .../RawProcessorVersionClient.java | 30 +++---- .../splitruns/AsyncRawSplitRunsClient.java | 68 +++++++-------- .../splitruns/RawSplitRunsClient.java | 55 ++++++------ .../splitters/AsyncRawSplittersClient.java | 48 ++++++----- .../splitters/RawSplittersClient.java | 39 ++++----- .../AsyncRawSplitterVersionsClient.java | 36 ++++---- .../RawSplitterVersionsClient.java | 29 +++---- .../AsyncRawWebhookEndpointsClient.java | 60 ++++++------- .../RawWebhookEndpointsClient.java | 49 +++++------ .../AsyncRawWebhookSubscriptionsClient.java | 54 ++++++------ .../RawWebhookSubscriptionsClient.java | 46 +++++----- .../AsyncRawWorkflowRunsClient.java | 84 ++++++++++--------- .../workflowruns/RawWorkflowRunsClient.java | 65 +++++++------- .../workflows/AsyncRawWorkflowsClient.java | 43 +++++----- .../workflows/RawWorkflowsClient.java | 35 ++++---- .../AsyncRawWorkflowVersionsClient.java | 35 ++++---- .../RawWorkflowVersionsClient.java | 29 +++---- 65 files changed, 1193 insertions(+), 1120 deletions(-) rename src/main/java/ai/extend/{AsyncExtendClient.java => AsyncExtendClientBase.java} (98%) rename src/main/java/ai/extend/{AsyncExtendClientBuilder.java => AsyncExtendClientBaseBuilder.java} (90%) rename src/main/java/ai/extend/{AsyncRawExtendClient.java => AsyncRawExtendClientBase.java} (95%) rename src/main/java/ai/extend/{ExtendClient.java => ExtendClientBase.java} (98%) rename src/main/java/ai/extend/{ExtendClientBuilder.java => ExtendClientBaseBuilder.java} (91%) rename src/main/java/ai/extend/{RawExtendClient.java => RawExtendClientBase.java} (95%) rename src/main/java/ai/extend/core/{ExtendClientHttpResponse.java => ExtendClientBaseHttpResponse.java} (86%) diff --git a/.fern/metadata.json b/.fern/metadata.json index 9c2139c..d1da544 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -4,7 +4,10 @@ "generatorVersion": "3.34.8", "generatorConfig": { "publish-to": "central", - "client-class-name": "ExtendClient", + "client-class-name": "ExtendClientBase", + "exported-client-class-name": "ExtendClient", + "base-api-exception-class-name": "ExtendClientApiException", + "base-exception-class-name": "ExtendClientException", "package-prefix": "ai.extend", "enable-inline-types": false, "inline-file-properties": false, @@ -15,6 +18,6 @@ "testImplementation org.mockito:mockito-inline:4.11.0" ] }, - "originGitCommit": "3d99f65f34686b0f1567dcfce79ac4204c0634da", - "sdkVersion": "1.14.0" + "originGitCommit": "6dd03f55fc737ec02dbc158904c7274a58de36e7", + "sdkVersion": "1.15.0" } \ No newline at end of file diff --git a/build.gradle b/build.gradle index c995b37..59bbf74 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,7 @@ java { group = 'ai.extend' -version = '1.14.0' +version = '1.15.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -81,7 +81,7 @@ publishing { maven(MavenPublication) { groupId = 'ai.extend' artifactId = 'extend-java-sdk' - version = '1.14.0' + version = '1.15.0' from components.java pom { name = 'Extend.ai' diff --git a/sample-app/src/main/java/sample/App.java b/sample-app/src/main/java/sample/App.java index db4c403..2710605 100644 --- a/sample-app/src/main/java/sample/App.java +++ b/sample-app/src/main/java/sample/App.java @@ -8,6 +8,6 @@ public final class App { public static void main(String[] args) { - // import ai.extend.AsyncExtendClient + // import ai.extend.AsyncExtendClientBase } } diff --git a/src/main/java/ai/extend/AsyncExtendClient.java b/src/main/java/ai/extend/AsyncExtendClientBase.java similarity index 98% rename from src/main/java/ai/extend/AsyncExtendClient.java rename to src/main/java/ai/extend/AsyncExtendClientBase.java index 67e4bfd..d1d5df8 100644 --- a/src/main/java/ai/extend/AsyncExtendClient.java +++ b/src/main/java/ai/extend/AsyncExtendClientBase.java @@ -46,10 +46,10 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Supplier; -public class AsyncExtendClient { +public class AsyncExtendClientBase { protected final ClientOptions clientOptions; - private final AsyncRawExtendClient rawClient; + private final AsyncRawExtendClientBase rawClient; protected final Supplier filesClient; @@ -105,9 +105,9 @@ public class AsyncExtendClient { protected final Supplier webhookSubscriptionsClient; - public AsyncExtendClient(ClientOptions clientOptions) { + public AsyncExtendClientBase(ClientOptions clientOptions) { this.clientOptions = clientOptions; - this.rawClient = new AsyncRawExtendClient(clientOptions); + this.rawClient = new AsyncRawExtendClientBase(clientOptions); this.filesClient = Suppliers.memoize(() -> new AsyncFilesClient(clientOptions)); this.parseRunsClient = Suppliers.memoize(() -> new AsyncParseRunsClient(clientOptions)); this.editRunsClient = Suppliers.memoize(() -> new AsyncEditRunsClient(clientOptions)); @@ -140,7 +140,7 @@ public AsyncExtendClient(ClientOptions clientOptions) { /** * Get responses with HTTP metadata like headers */ - public AsyncRawExtendClient withRawResponse() { + public AsyncRawExtendClientBase withRawResponse() { return this.rawClient; } @@ -352,7 +352,7 @@ public AsyncWebhookSubscriptionsClient webhookSubscriptions() { return this.webhookSubscriptionsClient.get(); } - public static AsyncExtendClientBuilder builder() { - return new AsyncExtendClientBuilder(); + public static AsyncExtendClientBaseBuilder builder() { + return new AsyncExtendClientBaseBuilder(); } } diff --git a/src/main/java/ai/extend/AsyncExtendClientBuilder.java b/src/main/java/ai/extend/AsyncExtendClientBaseBuilder.java similarity index 90% rename from src/main/java/ai/extend/AsyncExtendClientBuilder.java rename to src/main/java/ai/extend/AsyncExtendClientBaseBuilder.java index 689c277..ada8119 100644 --- a/src/main/java/ai/extend/AsyncExtendClientBuilder.java +++ b/src/main/java/ai/extend/AsyncExtendClientBaseBuilder.java @@ -10,7 +10,7 @@ import java.util.Optional; import okhttp3.OkHttpClient; -public class AsyncExtendClientBuilder { +public class AsyncExtendClientBaseBuilder { private Optional timeout = Optional.empty(); private Optional maxRetries = Optional.empty(); @@ -29,7 +29,7 @@ public class AsyncExtendClientBuilder { * Sets token. * Defaults to the EXTEND_API_KEY environment variable. */ - public AsyncExtendClientBuilder token(String token) { + public AsyncExtendClientBaseBuilder token(String token) { this.token = token; return this; } @@ -37,17 +37,17 @@ public AsyncExtendClientBuilder token(String token) { /** * Sets extendApiVersion */ - public AsyncExtendClientBuilder extendApiVersion(String extendApiVersion) { + public AsyncExtendClientBaseBuilder extendApiVersion(String extendApiVersion) { this.extendApiVersion = extendApiVersion; return this; } - public AsyncExtendClientBuilder environment(Environment environment) { + public AsyncExtendClientBaseBuilder environment(Environment environment) { this.environment = environment; return this; } - public AsyncExtendClientBuilder url(String url) { + public AsyncExtendClientBaseBuilder url(String url) { this.environment = Environment.custom(url); return this; } @@ -55,7 +55,7 @@ public AsyncExtendClientBuilder url(String url) { /** * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. */ - public AsyncExtendClientBuilder timeout(int timeout) { + public AsyncExtendClientBaseBuilder timeout(int timeout) { this.timeout = Optional.of(timeout); return this; } @@ -63,7 +63,7 @@ public AsyncExtendClientBuilder timeout(int timeout) { /** * Sets the maximum number of retries for the client. Defaults to 2 retries. */ - public AsyncExtendClientBuilder maxRetries(int maxRetries) { + public AsyncExtendClientBaseBuilder maxRetries(int maxRetries) { this.maxRetries = Optional.of(maxRetries); return this; } @@ -71,7 +71,7 @@ public AsyncExtendClientBuilder maxRetries(int maxRetries) { /** * Sets the underlying OkHttp client */ - public AsyncExtendClientBuilder httpClient(OkHttpClient httpClient) { + public AsyncExtendClientBaseBuilder httpClient(OkHttpClient httpClient) { this.httpClient = httpClient; return this; } @@ -84,7 +84,7 @@ public AsyncExtendClientBuilder httpClient(OkHttpClient httpClient) { * @param value The header value * @return This builder for method chaining */ - public AsyncExtendClientBuilder addHeader(String name, String value) { + public AsyncExtendClientBaseBuilder addHeader(String name, String value) { this.customHeaders.put(name, value); return this; } @@ -226,11 +226,11 @@ protected void setAdditional(ClientOptions.Builder builder) {} */ protected void validateConfiguration() {} - public AsyncExtendClient build() { + public AsyncExtendClientBase build() { if (token == null) { throw new RuntimeException("Please provide token or set the EXTEND_API_KEY environment variable."); } validateConfiguration(); - return new AsyncExtendClient(buildClientOptions()); + return new AsyncExtendClientBase(buildClientOptions()); } } diff --git a/src/main/java/ai/extend/AsyncRawExtendClient.java b/src/main/java/ai/extend/AsyncRawExtendClientBase.java similarity index 95% rename from src/main/java/ai/extend/AsyncRawExtendClient.java rename to src/main/java/ai/extend/AsyncRawExtendClientBase.java index 79f040b..5445092 100644 --- a/src/main/java/ai/extend/AsyncRawExtendClient.java +++ b/src/main/java/ai/extend/AsyncRawExtendClientBase.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -44,10 +44,10 @@ import okhttp3.ResponseBody; import org.jetbrains.annotations.NotNull; -public class AsyncRawExtendClient { +public class AsyncRawExtendClientBase { protected final ClientOptions clientOptions; - public AsyncRawExtendClient(ClientOptions clientOptions) { + public AsyncRawExtendClientBase(ClientOptions clientOptions) { this.clientOptions = clientOptions; } @@ -57,7 +57,7 @@ public AsyncRawExtendClient(ClientOptions clientOptions) { *

The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.

*

For more details, see the Parse File guide.

*/ - public CompletableFuture> parse(ParseRequest request) { + public CompletableFuture> parse(ParseRequest request) { return parse(request, null); } @@ -67,7 +67,7 @@ public CompletableFuture> parse(ParseRequest *

The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.

*

For more details, see the Parse File guide.

*/ - public CompletableFuture> parse( + public CompletableFuture> parse( ParseRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -103,14 +103,14 @@ public CompletableFuture> parse( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRun.class), response)); return; } @@ -183,7 +183,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

The Edit endpoint allows you to detect and fill form fields in PDF documents.

*

For more details, see the Edit File guide.

*/ - public CompletableFuture> edit(EditRequest request) { + public CompletableFuture> edit(EditRequest request) { return edit(request, null); } @@ -193,7 +193,7 @@ public CompletableFuture> edit(EditRequest req *

The Edit endpoint allows you to detect and fill form fields in PDF documents.

*

For more details, see the Edit File guide.

*/ - public CompletableFuture> edit( + public CompletableFuture> edit( EditRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -221,14 +221,14 @@ public CompletableFuture> edit( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditRun.class), response)); return; } @@ -301,7 +301,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.

*

For more details, see the Extract File guide.

*/ - public CompletableFuture> extract(ExtractRequest request) { + public CompletableFuture> extract(ExtractRequest request) { return extract(request, null); } @@ -311,7 +311,7 @@ public CompletableFuture> extract(ExtractRe *

The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.

*

For more details, see the Extract File guide.

*/ - public CompletableFuture> extract( + public CompletableFuture> extract( ExtractRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -339,14 +339,14 @@ public CompletableFuture> extract( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRun.class), response)); return; } @@ -419,7 +419,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

The Classify endpoint allows you to classify documents using an existing classifier or an inline configuration.

*

For more details, see the Classify File guide.

*/ - public CompletableFuture> classify(ClassifyRequest request) { + public CompletableFuture> classify(ClassifyRequest request) { return classify(request, null); } @@ -429,7 +429,7 @@ public CompletableFuture> classify(Classif *

The Classify endpoint allows you to classify documents using an existing classifier or an inline configuration.

*

For more details, see the Classify File guide.

*/ - public CompletableFuture> classify( + public CompletableFuture> classify( ClassifyRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -457,14 +457,14 @@ public CompletableFuture> classify( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRun.class), response)); return; } @@ -537,7 +537,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

The Split endpoint allows you to split documents into multiple parts using an existing splitter or an inline configuration.

*

For more details, see the Split File guide.

*/ - public CompletableFuture> split(SplitRequest request) { + public CompletableFuture> split(SplitRequest request) { return split(request, null); } @@ -547,7 +547,7 @@ public CompletableFuture> split(SplitRequest *

The Split endpoint allows you to split documents into multiple parts using an existing splitter or an inline configuration.

*

For more details, see the Split File guide.

*/ - public CompletableFuture> split( + public CompletableFuture> split( SplitRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -575,14 +575,14 @@ public CompletableFuture> split( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRun.class), response)); return; } diff --git a/src/main/java/ai/extend/ExtendClient.java b/src/main/java/ai/extend/ExtendClientBase.java similarity index 98% rename from src/main/java/ai/extend/ExtendClient.java rename to src/main/java/ai/extend/ExtendClientBase.java index 9a3477d..2d25be1 100644 --- a/src/main/java/ai/extend/ExtendClient.java +++ b/src/main/java/ai/extend/ExtendClientBase.java @@ -45,10 +45,10 @@ import ai.extend.types.SplitRun; import java.util.function.Supplier; -public class ExtendClient { +public class ExtendClientBase { protected final ClientOptions clientOptions; - private final RawExtendClient rawClient; + private final RawExtendClientBase rawClient; protected final Supplier filesClient; @@ -104,9 +104,9 @@ public class ExtendClient { protected final Supplier webhookSubscriptionsClient; - public ExtendClient(ClientOptions clientOptions) { + public ExtendClientBase(ClientOptions clientOptions) { this.clientOptions = clientOptions; - this.rawClient = new RawExtendClient(clientOptions); + this.rawClient = new RawExtendClientBase(clientOptions); this.filesClient = Suppliers.memoize(() -> new FilesClient(clientOptions)); this.parseRunsClient = Suppliers.memoize(() -> new ParseRunsClient(clientOptions)); this.editRunsClient = Suppliers.memoize(() -> new EditRunsClient(clientOptions)); @@ -139,7 +139,7 @@ public ExtendClient(ClientOptions clientOptions) { /** * Get responses with HTTP metadata like headers */ - public RawExtendClient withRawResponse() { + public RawExtendClientBase withRawResponse() { return this.rawClient; } @@ -351,7 +351,7 @@ public WebhookSubscriptionsClient webhookSubscriptions() { return this.webhookSubscriptionsClient.get(); } - public static ExtendClientBuilder builder() { - return new ExtendClientBuilder(); + public static ExtendClientBaseBuilder builder() { + return new ExtendClientBaseBuilder(); } } diff --git a/src/main/java/ai/extend/ExtendClientBuilder.java b/src/main/java/ai/extend/ExtendClientBaseBuilder.java similarity index 91% rename from src/main/java/ai/extend/ExtendClientBuilder.java rename to src/main/java/ai/extend/ExtendClientBaseBuilder.java index cca4eb8..1fbbb95 100644 --- a/src/main/java/ai/extend/ExtendClientBuilder.java +++ b/src/main/java/ai/extend/ExtendClientBaseBuilder.java @@ -10,7 +10,7 @@ import java.util.Optional; import okhttp3.OkHttpClient; -public class ExtendClientBuilder { +public class ExtendClientBaseBuilder { private Optional timeout = Optional.empty(); private Optional maxRetries = Optional.empty(); @@ -29,7 +29,7 @@ public class ExtendClientBuilder { * Sets token. * Defaults to the EXTEND_API_KEY environment variable. */ - public ExtendClientBuilder token(String token) { + public ExtendClientBaseBuilder token(String token) { this.token = token; return this; } @@ -37,17 +37,17 @@ public ExtendClientBuilder token(String token) { /** * Sets extendApiVersion */ - public ExtendClientBuilder extendApiVersion(String extendApiVersion) { + public ExtendClientBaseBuilder extendApiVersion(String extendApiVersion) { this.extendApiVersion = extendApiVersion; return this; } - public ExtendClientBuilder environment(Environment environment) { + public ExtendClientBaseBuilder environment(Environment environment) { this.environment = environment; return this; } - public ExtendClientBuilder url(String url) { + public ExtendClientBaseBuilder url(String url) { this.environment = Environment.custom(url); return this; } @@ -55,7 +55,7 @@ public ExtendClientBuilder url(String url) { /** * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. */ - public ExtendClientBuilder timeout(int timeout) { + public ExtendClientBaseBuilder timeout(int timeout) { this.timeout = Optional.of(timeout); return this; } @@ -63,7 +63,7 @@ public ExtendClientBuilder timeout(int timeout) { /** * Sets the maximum number of retries for the client. Defaults to 2 retries. */ - public ExtendClientBuilder maxRetries(int maxRetries) { + public ExtendClientBaseBuilder maxRetries(int maxRetries) { this.maxRetries = Optional.of(maxRetries); return this; } @@ -71,7 +71,7 @@ public ExtendClientBuilder maxRetries(int maxRetries) { /** * Sets the underlying OkHttp client */ - public ExtendClientBuilder httpClient(OkHttpClient httpClient) { + public ExtendClientBaseBuilder httpClient(OkHttpClient httpClient) { this.httpClient = httpClient; return this; } @@ -84,7 +84,7 @@ public ExtendClientBuilder httpClient(OkHttpClient httpClient) { * @param value The header value * @return This builder for method chaining */ - public ExtendClientBuilder addHeader(String name, String value) { + public ExtendClientBaseBuilder addHeader(String name, String value) { this.customHeaders.put(name, value); return this; } @@ -226,11 +226,11 @@ protected void setAdditional(ClientOptions.Builder builder) {} */ protected void validateConfiguration() {} - public ExtendClient build() { + public ExtendClientBase build() { if (token == null) { throw new RuntimeException("Please provide token or set the EXTEND_API_KEY environment variable."); } validateConfiguration(); - return new ExtendClient(buildClientOptions()); + return new ExtendClientBase(buildClientOptions()); } } diff --git a/src/main/java/ai/extend/RawExtendClient.java b/src/main/java/ai/extend/RawExtendClientBase.java similarity index 95% rename from src/main/java/ai/extend/RawExtendClient.java rename to src/main/java/ai/extend/RawExtendClientBase.java index 9fb092a..25c6de6 100644 --- a/src/main/java/ai/extend/RawExtendClient.java +++ b/src/main/java/ai/extend/RawExtendClientBase.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -40,10 +40,10 @@ import okhttp3.Response; import okhttp3.ResponseBody; -public class RawExtendClient { +public class RawExtendClientBase { protected final ClientOptions clientOptions; - public RawExtendClient(ClientOptions clientOptions) { + public RawExtendClientBase(ClientOptions clientOptions) { this.clientOptions = clientOptions; } @@ -53,7 +53,7 @@ public RawExtendClient(ClientOptions clientOptions) { *

The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.

*

For more details, see the Parse File guide.

*/ - public ExtendClientHttpResponse parse(ParseRequest request) { + public ExtendClientBaseHttpResponse parse(ParseRequest request) { return parse(request, null); } @@ -63,7 +63,7 @@ public ExtendClientHttpResponse parse(ParseRequest request) { *

The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.

*

For more details, see the Parse File guide.

*/ - public ExtendClientHttpResponse parse(ParseRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse parse(ParseRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("parse"); @@ -102,7 +102,7 @@ public ExtendClientHttpResponse parse(ParseRequest request, RequestOpt ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRun.class), response); } try { @@ -149,7 +149,7 @@ public ExtendClientHttpResponse parse(ParseRequest request, RequestOpt *

The Edit endpoint allows you to detect and fill form fields in PDF documents.

*

For more details, see the Edit File guide.

*/ - public ExtendClientHttpResponse edit(EditRequest request) { + public ExtendClientBaseHttpResponse edit(EditRequest request) { return edit(request, null); } @@ -159,7 +159,7 @@ public ExtendClientHttpResponse edit(EditRequest request) { *

The Edit endpoint allows you to detect and fill form fields in PDF documents.

*

For more details, see the Edit File guide.

*/ - public ExtendClientHttpResponse edit(EditRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse edit(EditRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("edit"); @@ -190,7 +190,7 @@ public ExtendClientHttpResponse edit(EditRequest request, RequestOption ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditRun.class), response); } try { @@ -237,7 +237,7 @@ public ExtendClientHttpResponse edit(EditRequest request, RequestOption *

The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.

*

For more details, see the Extract File guide.

*/ - public ExtendClientHttpResponse extract(ExtractRequest request) { + public ExtendClientBaseHttpResponse extract(ExtractRequest request) { return extract(request, null); } @@ -247,7 +247,7 @@ public ExtendClientHttpResponse extract(ExtractRequest request) { *

The Extract endpoint allows you to extract structured data from files using an existing extractor, an inline configuration, or no configuration at all. When neither is provided, Extend automatically infers a schema from the document before extraction — no extractor or schema is required.

*

For more details, see the Extract File guide.

*/ - public ExtendClientHttpResponse extract(ExtractRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse extract(ExtractRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("extract"); @@ -278,7 +278,7 @@ public ExtendClientHttpResponse extract(ExtractRequest request, Requ ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRun.class), response); } try { @@ -325,7 +325,7 @@ public ExtendClientHttpResponse extract(ExtractRequest request, Requ *

The Classify endpoint allows you to classify documents using an existing classifier or an inline configuration.

*

For more details, see the Classify File guide.

*/ - public ExtendClientHttpResponse classify(ClassifyRequest request) { + public ExtendClientBaseHttpResponse classify(ClassifyRequest request) { return classify(request, null); } @@ -335,7 +335,7 @@ public ExtendClientHttpResponse classify(ClassifyRequest request) { *

The Classify endpoint allows you to classify documents using an existing classifier or an inline configuration.

*

For more details, see the Classify File guide.

*/ - public ExtendClientHttpResponse classify(ClassifyRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse classify(ClassifyRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("classify"); @@ -366,7 +366,7 @@ public ExtendClientHttpResponse classify(ClassifyRequest request, R ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRun.class), response); } try { @@ -413,7 +413,7 @@ public ExtendClientHttpResponse classify(ClassifyRequest request, R *

The Split endpoint allows you to split documents into multiple parts using an existing splitter or an inline configuration.

*

For more details, see the Split File guide.

*/ - public ExtendClientHttpResponse split(SplitRequest request) { + public ExtendClientBaseHttpResponse split(SplitRequest request) { return split(request, null); } @@ -423,7 +423,7 @@ public ExtendClientHttpResponse split(SplitRequest request) { *

The Split endpoint allows you to split documents into multiple parts using an existing splitter or an inline configuration.

*

For more details, see the Split File guide.

*/ - public ExtendClientHttpResponse split(SplitRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse split(SplitRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("split"); @@ -454,7 +454,7 @@ public ExtendClientHttpResponse split(SplitRequest request, RequestOpt ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRun.class), response); } try { diff --git a/src/main/java/ai/extend/core/ClientOptions.java b/src/main/java/ai/extend/core/ClientOptions.java index 184887a..91452a0 100644 --- a/src/main/java/ai/extend/core/ClientOptions.java +++ b/src/main/java/ai/extend/core/ClientOptions.java @@ -35,10 +35,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "ai.extend:extend-java-sdk/1.14.0"); + put("User-Agent", "ai.extend:extend-java-sdk/1.15.0"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.extendconfig.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.14.0"); + put("X-Fern-SDK-Version", "1.15.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/ai/extend/core/ExtendClientHttpResponse.java b/src/main/java/ai/extend/core/ExtendClientBaseHttpResponse.java similarity index 86% rename from src/main/java/ai/extend/core/ExtendClientHttpResponse.java rename to src/main/java/ai/extend/core/ExtendClientBaseHttpResponse.java index 7ee211d..185acc9 100644 --- a/src/main/java/ai/extend/core/ExtendClientHttpResponse.java +++ b/src/main/java/ai/extend/core/ExtendClientBaseHttpResponse.java @@ -9,13 +9,13 @@ import java.util.Map; import okhttp3.Response; -public final class ExtendClientHttpResponse { +public final class ExtendClientBaseHttpResponse { private final T body; private final Map> headers; - public ExtendClientHttpResponse(T body, Response rawResponse) { + public ExtendClientBaseHttpResponse(T body, Response rawResponse) { this.body = body; Map> headers = new HashMap<>(); diff --git a/src/main/java/ai/extend/resources/batchprocessorrun/AsyncRawBatchProcessorRunClient.java b/src/main/java/ai/extend/resources/batchprocessorrun/AsyncRawBatchProcessorRunClient.java index e6cd5ea..c45569b 100644 --- a/src/main/java/ai/extend/resources/batchprocessorrun/AsyncRawBatchProcessorRunClient.java +++ b/src/main/java/ai/extend/resources/batchprocessorrun/AsyncRawBatchProcessorRunClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; import ai.extend.core.ExtendClientException; -import ai.extend.core.ExtendClientHttpResponse; import ai.extend.core.ObjectMappers; import ai.extend.core.RequestOptions; import ai.extend.errors.BadRequestError; @@ -38,7 +38,7 @@ public AsyncRawBatchProcessorRunClient(ClientOptions clientOptions) { * Retrieve details about a batch processor run, including evaluation runs. *

Deprecated: This endpoint is maintained for backwards compatibility only and will be replaced in a future API version. Use Get Evaluation Set Run for interacting with evaluation set runs.

*/ - public CompletableFuture> get(String id) { + public CompletableFuture> get(String id) { return get(id, BatchProcessorRunGetRequest.builder().build()); } @@ -46,7 +46,7 @@ public CompletableFuture> * Retrieve details about a batch processor run, including evaluation runs. *

Deprecated: This endpoint is maintained for backwards compatibility only and will be replaced in a future API version. Use Get Evaluation Set Run for interacting with evaluation set runs.

*/ - public CompletableFuture> get( + public CompletableFuture> get( String id, RequestOptions requestOptions) { return get(id, BatchProcessorRunGetRequest.builder().build(), requestOptions); } @@ -55,7 +55,7 @@ public CompletableFuture> * Retrieve details about a batch processor run, including evaluation runs. *

Deprecated: This endpoint is maintained for backwards compatibility only and will be replaced in a future API version. Use Get Evaluation Set Run for interacting with evaluation set runs.

*/ - public CompletableFuture> get( + public CompletableFuture> get( String id, BatchProcessorRunGetRequest request) { return get(id, request, null); } @@ -64,7 +64,7 @@ public CompletableFuture> * Retrieve details about a batch processor run, including evaluation runs. *

Deprecated: This endpoint is maintained for backwards compatibility only and will be replaced in a future API version. Use Get Evaluation Set Run for interacting with evaluation set runs.

*/ - public CompletableFuture> get( + public CompletableFuture> get( String id, BatchProcessorRunGetRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -89,14 +89,15 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, BatchProcessorRunGetResponse.class), response)); diff --git a/src/main/java/ai/extend/resources/batchprocessorrun/RawBatchProcessorRunClient.java b/src/main/java/ai/extend/resources/batchprocessorrun/RawBatchProcessorRunClient.java index 0e2cd16..6e1837e 100644 --- a/src/main/java/ai/extend/resources/batchprocessorrun/RawBatchProcessorRunClient.java +++ b/src/main/java/ai/extend/resources/batchprocessorrun/RawBatchProcessorRunClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; import ai.extend.core.ExtendClientException; -import ai.extend.core.ExtendClientHttpResponse; import ai.extend.core.ObjectMappers; import ai.extend.core.RequestOptions; import ai.extend.errors.BadRequestError; @@ -34,7 +34,7 @@ public RawBatchProcessorRunClient(ClientOptions clientOptions) { * Retrieve details about a batch processor run, including evaluation runs. *

Deprecated: This endpoint is maintained for backwards compatibility only and will be replaced in a future API version. Use Get Evaluation Set Run for interacting with evaluation set runs.

*/ - public ExtendClientHttpResponse get(String id) { + public ExtendClientBaseHttpResponse get(String id) { return get(id, BatchProcessorRunGetRequest.builder().build()); } @@ -42,7 +42,7 @@ public ExtendClientHttpResponse get(String id) { * Retrieve details about a batch processor run, including evaluation runs. *

Deprecated: This endpoint is maintained for backwards compatibility only and will be replaced in a future API version. Use Get Evaluation Set Run for interacting with evaluation set runs.

*/ - public ExtendClientHttpResponse get(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse get(String id, RequestOptions requestOptions) { return get(id, BatchProcessorRunGetRequest.builder().build(), requestOptions); } @@ -50,7 +50,8 @@ public ExtendClientHttpResponse get(String id, Req * Retrieve details about a batch processor run, including evaluation runs. *

Deprecated: This endpoint is maintained for backwards compatibility only and will be replaced in a future API version. Use Get Evaluation Set Run for interacting with evaluation set runs.

*/ - public ExtendClientHttpResponse get(String id, BatchProcessorRunGetRequest request) { + public ExtendClientBaseHttpResponse get( + String id, BatchProcessorRunGetRequest request) { return get(id, request, null); } @@ -58,7 +59,7 @@ public ExtendClientHttpResponse get(String id, Bat * Retrieve details about a batch processor run, including evaluation runs. *

Deprecated: This endpoint is maintained for backwards compatibility only and will be replaced in a future API version. Use Get Evaluation Set Run for interacting with evaluation set runs.

*/ - public ExtendClientHttpResponse get( + public ExtendClientBaseHttpResponse get( String id, BatchProcessorRunGetRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -87,7 +88,7 @@ public ExtendClientHttpResponse get( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchProcessorRunGetResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/batchruns/AsyncRawBatchRunsClient.java b/src/main/java/ai/extend/resources/batchruns/AsyncRawBatchRunsClient.java index 391e34f..956355e 100644 --- a/src/main/java/ai/extend/resources/batchruns/AsyncRawBatchRunsClient.java +++ b/src/main/java/ai/extend/resources/batchruns/AsyncRawBatchRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; import ai.extend.core.ExtendClientException; -import ai.extend.core.ExtendClientHttpResponse; import ai.extend.core.ObjectMappers; import ai.extend.core.RequestOptions; import ai.extend.errors.BadRequestError; @@ -56,7 +56,7 @@ public AsyncRawBatchRunsClient(ClientOptions clientOptions) { *
  • GET /split_runs?batchId={id}
  • * */ - public CompletableFuture> get(String id) { + public CompletableFuture> get(String id) { return get(id, null); } @@ -78,7 +78,7 @@ public CompletableFuture> get(String id) { *
  • GET /split_runs?batchId={id}
  • * */ - public CompletableFuture> get(String id, RequestOptions requestOptions) { + public CompletableFuture> get(String id, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("batch_runs") @@ -98,14 +98,14 @@ public CompletableFuture> get(String id, Requ if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/batchruns/RawBatchRunsClient.java b/src/main/java/ai/extend/resources/batchruns/RawBatchRunsClient.java index 09575c5..f41071a 100644 --- a/src/main/java/ai/extend/resources/batchruns/RawBatchRunsClient.java +++ b/src/main/java/ai/extend/resources/batchruns/RawBatchRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; import ai.extend.core.ExtendClientException; -import ai.extend.core.ExtendClientHttpResponse; import ai.extend.core.ObjectMappers; import ai.extend.core.RequestOptions; import ai.extend.errors.BadRequestError; @@ -52,7 +52,7 @@ public RawBatchRunsClient(ClientOptions clientOptions) { *
  • GET /split_runs?batchId={id}
  • * */ - public ExtendClientHttpResponse get(String id) { + public ExtendClientBaseHttpResponse get(String id) { return get(id, null); } @@ -74,7 +74,7 @@ public ExtendClientHttpResponse get(String id) { *
  • GET /split_runs?batchId={id}
  • * */ - public ExtendClientHttpResponse get(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse get(String id, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("batch_runs") @@ -98,7 +98,7 @@ public ExtendClientHttpResponse get(String id, RequestOptions requestO ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response); } try { diff --git a/src/main/java/ai/extend/resources/classifiers/AsyncRawClassifiersClient.java b/src/main/java/ai/extend/resources/classifiers/AsyncRawClassifiersClient.java index 2584e1f..5896ef8 100644 --- a/src/main/java/ai/extend/resources/classifiers/AsyncRawClassifiersClient.java +++ b/src/main/java/ai/extend/resources/classifiers/AsyncRawClassifiersClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -51,7 +51,7 @@ public AsyncRawClassifiersClient(ClientOptions clientOptions) { * List all classifiers. *

    Returns a summary of each classifier. Use GET /classifiers/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(ClassifiersListRequest.builder().build()); } @@ -59,7 +59,8 @@ public CompletableFuture> list * List all classifiers. *

    Returns a summary of each classifier. Use GET /classifiers/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list( + RequestOptions requestOptions) { return list(ClassifiersListRequest.builder().build(), requestOptions); } @@ -67,7 +68,8 @@ public CompletableFuture> list * List all classifiers. *

    Returns a summary of each classifier. Use GET /classifiers/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list(ClassifiersListRequest request) { + public CompletableFuture> list( + ClassifiersListRequest request) { return list(request, null); } @@ -75,7 +77,7 @@ public CompletableFuture> list * List all classifiers. *

    Returns a summary of each classifier. Use GET /classifiers/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list( + public CompletableFuture> list( ClassifiersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -115,14 +117,14 @@ public CompletableFuture> list if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifiersListResponse.class), response)); return; @@ -193,14 +195,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Create a new classifier. */ - public CompletableFuture> create(ClassifiersCreateRequest request) { + public CompletableFuture> create(ClassifiersCreateRequest request) { return create(request, null); } /** * Create a new classifier. */ - public CompletableFuture> create( + public CompletableFuture> create( ClassifiersCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -228,14 +230,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Classifier.class), response)); return; } @@ -305,21 +307,22 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Get details of a classifier. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, ClassifiersRetrieveRequest.builder().build()); } /** * Get details of a classifier. */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { return retrieve(id, ClassifiersRetrieveRequest.builder().build(), requestOptions); } /** * Get details of a classifier. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ClassifiersRetrieveRequest request) { return retrieve(id, request, null); } @@ -327,7 +330,7 @@ public CompletableFuture> retrieve( /** * Get details of a classifier. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ClassifiersRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -352,14 +355,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Classifier.class), response)); return; } @@ -429,28 +432,30 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Update an existing classifier. */ - public CompletableFuture> update(String id) { + public CompletableFuture> update(String id) { return update(id, ClassifiersUpdateRequest.builder().build()); } /** * Update an existing classifier. */ - public CompletableFuture> update(String id, RequestOptions requestOptions) { + public CompletableFuture> update( + String id, RequestOptions requestOptions) { return update(id, ClassifiersUpdateRequest.builder().build(), requestOptions); } /** * Update an existing classifier. */ - public CompletableFuture> update(String id, ClassifiersUpdateRequest request) { + public CompletableFuture> update( + String id, ClassifiersUpdateRequest request) { return update(id, request, null); } /** * Update an existing classifier. */ - public CompletableFuture> update( + public CompletableFuture> update( String id, ClassifiersUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -483,14 +488,14 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Classifier.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/classifiers/RawClassifiersClient.java b/src/main/java/ai/extend/resources/classifiers/RawClassifiersClient.java index 6c218d2..bc52df6 100644 --- a/src/main/java/ai/extend/resources/classifiers/RawClassifiersClient.java +++ b/src/main/java/ai/extend/resources/classifiers/RawClassifiersClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -47,7 +47,7 @@ public RawClassifiersClient(ClientOptions clientOptions) { * List all classifiers. *

    Returns a summary of each classifier. Use GET /classifiers/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(ClassifiersListRequest.builder().build()); } @@ -55,7 +55,7 @@ public ExtendClientHttpResponse list() { * List all classifiers. *

    Returns a summary of each classifier. Use GET /classifiers/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(ClassifiersListRequest.builder().build(), requestOptions); } @@ -63,7 +63,7 @@ public ExtendClientHttpResponse list(RequestOptions req * List all classifiers. *

    Returns a summary of each classifier. Use GET /classifiers/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list(ClassifiersListRequest request) { + public ExtendClientBaseHttpResponse list(ClassifiersListRequest request) { return list(request, null); } @@ -71,7 +71,7 @@ public ExtendClientHttpResponse list(ClassifiersListReq * List all classifiers. *

    Returns a summary of each classifier. Use GET /classifiers/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( ClassifiersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -115,7 +115,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifiersListResponse.class), response); } @@ -160,14 +160,14 @@ public ExtendClientHttpResponse list( /** * Create a new classifier. */ - public ExtendClientHttpResponse create(ClassifiersCreateRequest request) { + public ExtendClientBaseHttpResponse create(ClassifiersCreateRequest request) { return create(request, null); } /** * Create a new classifier. */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( ClassifiersCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -199,7 +199,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Classifier.class), response); } try { @@ -243,28 +243,28 @@ public ExtendClientHttpResponse create( /** * Get details of a classifier. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, ClassifiersRetrieveRequest.builder().build()); } /** * Get details of a classifier. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, ClassifiersRetrieveRequest.builder().build(), requestOptions); } /** * Get details of a classifier. */ - public ExtendClientHttpResponse retrieve(String id, ClassifiersRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, ClassifiersRetrieveRequest request) { return retrieve(id, request, null); } /** * Get details of a classifier. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, ClassifiersRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -293,7 +293,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Classifier.class), response); } try { @@ -337,28 +337,28 @@ public ExtendClientHttpResponse retrieve( /** * Update an existing classifier. */ - public ExtendClientHttpResponse update(String id) { + public ExtendClientBaseHttpResponse update(String id) { return update(id, ClassifiersUpdateRequest.builder().build()); } /** * Update an existing classifier. */ - public ExtendClientHttpResponse update(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse update(String id, RequestOptions requestOptions) { return update(id, ClassifiersUpdateRequest.builder().build(), requestOptions); } /** * Update an existing classifier. */ - public ExtendClientHttpResponse update(String id, ClassifiersUpdateRequest request) { + public ExtendClientBaseHttpResponse update(String id, ClassifiersUpdateRequest request) { return update(id, request, null); } /** * Update an existing classifier. */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String id, ClassifiersUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -395,7 +395,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Classifier.class), response); } try { diff --git a/src/main/java/ai/extend/resources/classifierversions/AsyncRawClassifierVersionsClient.java b/src/main/java/ai/extend/resources/classifierversions/AsyncRawClassifierVersionsClient.java index 77e377e..e02db33 100644 --- a/src/main/java/ai/extend/resources/classifierversions/AsyncRawClassifierVersionsClient.java +++ b/src/main/java/ai/extend/resources/classifierversions/AsyncRawClassifierVersionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -50,7 +50,7 @@ public AsyncRawClassifierVersionsClient(ClientOptions clientOptions) { * This endpoint allows you to fetch all versions of a given classifier, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the classifier, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list(String classifierId) { + public CompletableFuture> list(String classifierId) { return list(classifierId, ClassifierVersionsListRequest.builder().build()); } @@ -58,7 +58,7 @@ public CompletableFuturedraft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the classifier, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String classifierId, RequestOptions requestOptions) { return list(classifierId, ClassifierVersionsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public CompletableFuturedraft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the classifier, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String classifierId, ClassifierVersionsListRequest request) { return list(classifierId, request, null); } @@ -76,7 +76,7 @@ public CompletableFuturedraft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the classifier, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String classifierId, ClassifierVersionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,14 +114,15 @@ public CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ClassifierVersionsListResponse.class), response)); @@ -194,7 +195,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * This endpoint allows you to publish a new version of an existing classifier. Publishing a new version creates a snapshot of the classifier's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this classifier. You may need to manually update workflows to use the new version if desired.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String classifierId, ClassifierVersionsCreateRequest request) { return create(classifierId, request, null); } @@ -203,7 +204,7 @@ public CompletableFuture> create( * This endpoint allows you to publish a new version of an existing classifier. Publishing a new version creates a snapshot of the classifier's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this classifier. You may need to manually update workflows to use the new version if desired.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String classifierId, ClassifierVersionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -237,14 +238,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifierVersion.class), response)); return; @@ -315,7 +316,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Retrieve a specific version of a classifier in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String classifierId, String versionId) { return retrieve( classifierId, @@ -326,7 +327,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific version of a classifier in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String classifierId, String versionId, RequestOptions requestOptions) { return retrieve( classifierId, @@ -338,7 +339,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific version of a classifier in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String classifierId, String versionId, ClassifierVersionsRetrieveRequest request) { return retrieve(classifierId, versionId, request, null); } @@ -346,7 +347,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific version of a classifier in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String classifierId, String versionId, ClassifierVersionsRetrieveRequest request, @@ -376,14 +377,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifierVersion.class), response)); return; diff --git a/src/main/java/ai/extend/resources/classifierversions/RawClassifierVersionsClient.java b/src/main/java/ai/extend/resources/classifierversions/RawClassifierVersionsClient.java index 61d9d11..34cfed2 100644 --- a/src/main/java/ai/extend/resources/classifierversions/RawClassifierVersionsClient.java +++ b/src/main/java/ai/extend/resources/classifierversions/RawClassifierVersionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -46,7 +46,7 @@ public RawClassifierVersionsClient(ClientOptions clientOptions) { * This endpoint allows you to fetch all versions of a given classifier, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the classifier, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list(String classifierId) { + public ExtendClientBaseHttpResponse list(String classifierId) { return list(classifierId, ClassifierVersionsListRequest.builder().build()); } @@ -54,7 +54,7 @@ public ExtendClientHttpResponse list(String clas * This endpoint allows you to fetch all versions of a given classifier, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the classifier, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String classifierId, RequestOptions requestOptions) { return list(classifierId, ClassifierVersionsListRequest.builder().build(), requestOptions); } @@ -63,7 +63,7 @@ public ExtendClientHttpResponse list( * This endpoint allows you to fetch all versions of a given classifier, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the classifier, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String classifierId, ClassifierVersionsListRequest request) { return list(classifierId, request, null); } @@ -72,7 +72,7 @@ public ExtendClientHttpResponse list( * This endpoint allows you to fetch all versions of a given classifier, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the classifier, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String classifierId, ClassifierVersionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,7 +114,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifierVersionsListResponse.class), response); } @@ -160,7 +160,7 @@ public ExtendClientHttpResponse list( * This endpoint allows you to publish a new version of an existing classifier. Publishing a new version creates a snapshot of the classifier's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this classifier. You may need to manually update workflows to use the new version if desired.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String classifierId, ClassifierVersionsCreateRequest request) { return create(classifierId, request, null); } @@ -169,7 +169,7 @@ public ExtendClientHttpResponse create( * This endpoint allows you to publish a new version of an existing classifier. Publishing a new version creates a snapshot of the classifier's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this classifier. You may need to manually update workflows to use the new version if desired.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String classifierId, ClassifierVersionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -207,7 +207,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifierVersion.class), response); } try { @@ -251,7 +251,7 @@ public ExtendClientHttpResponse create( /** * Retrieve a specific version of a classifier in Extend */ - public ExtendClientHttpResponse retrieve(String classifierId, String versionId) { + public ExtendClientBaseHttpResponse retrieve(String classifierId, String versionId) { return retrieve( classifierId, versionId, @@ -261,7 +261,7 @@ public ExtendClientHttpResponse retrieve(String classifierId, /** * Retrieve a specific version of a classifier in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String classifierId, String versionId, RequestOptions requestOptions) { return retrieve( classifierId, @@ -273,7 +273,7 @@ public ExtendClientHttpResponse retrieve( /** * Retrieve a specific version of a classifier in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String classifierId, String versionId, ClassifierVersionsRetrieveRequest request) { return retrieve(classifierId, versionId, request, null); } @@ -281,7 +281,7 @@ public ExtendClientHttpResponse retrieve( /** * Retrieve a specific version of a classifier in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String classifierId, String versionId, ClassifierVersionsRetrieveRequest request, @@ -315,7 +315,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifierVersion.class), response); } try { diff --git a/src/main/java/ai/extend/resources/classifyruns/AsyncRawClassifyRunsClient.java b/src/main/java/ai/extend/resources/classifyruns/AsyncRawClassifyRunsClient.java index 37e1302..19a9eaa 100644 --- a/src/main/java/ai/extend/resources/classifyruns/AsyncRawClassifyRunsClient.java +++ b/src/main/java/ai/extend/resources/classifyruns/AsyncRawClassifyRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -55,7 +55,7 @@ public AsyncRawClassifyRunsClient(ClientOptions clientOptions) { * List all classify runs. *

    Returns a summary of each run. Use GET /classify_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(ClassifyRunsListRequest.builder().build()); } @@ -63,7 +63,8 @@ public CompletableFuture> lis * List all classify runs. *

    Returns a summary of each run. Use GET /classify_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list( + RequestOptions requestOptions) { return list(ClassifyRunsListRequest.builder().build(), requestOptions); } @@ -71,7 +72,8 @@ public CompletableFuture> lis * List all classify runs. *

    Returns a summary of each run. Use GET /classify_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list(ClassifyRunsListRequest request) { + public CompletableFuture> list( + ClassifyRunsListRequest request) { return list(request, null); } @@ -79,7 +81,7 @@ public CompletableFuture> lis * List all classify runs. *

    Returns a summary of each run. Use GET /classify_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list( + public CompletableFuture> list( ClassifyRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -143,14 +145,14 @@ public CompletableFuture> lis if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRunsListResponse.class), response)); return; @@ -222,7 +224,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Classify a document using an existing classifier or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Classify Run endpoint for results.

    */ - public CompletableFuture> create(ClassifyRunsCreateRequest request) { + public CompletableFuture> create(ClassifyRunsCreateRequest request) { return create(request, null); } @@ -230,7 +232,7 @@ public CompletableFuture> create(ClassifyR * Classify a document using an existing classifier or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Classify Run endpoint for results.

    */ - public CompletableFuture> create( + public CompletableFuture> create( ClassifyRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -258,14 +260,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRun.class), response)); return; } @@ -336,7 +338,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Retrieve details about a specific classify run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a classify run when using the Create Classify Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, ClassifyRunsRetrieveRequest.builder().build()); } @@ -344,7 +346,8 @@ public CompletableFuture> retrieve(String * Retrieve details about a specific classify run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a classify run when using the Create Classify Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { return retrieve(id, ClassifyRunsRetrieveRequest.builder().build(), requestOptions); } @@ -352,7 +355,7 @@ public CompletableFuture> retrieve(String * Retrieve details about a specific classify run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a classify run when using the Create Classify Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ClassifyRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -361,7 +364,7 @@ public CompletableFuture> retrieve( * Retrieve details about a specific classify run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a classify run when using the Create Classify Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ClassifyRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -386,14 +389,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRun.class), response)); return; } @@ -464,7 +467,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Delete a classify run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, ClassifyRunsDeleteRequest.builder().build()); } @@ -472,7 +475,7 @@ public CompletableFuture> d * Delete a classify run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, ClassifyRunsDeleteRequest.builder().build(), requestOptions); } @@ -481,7 +484,7 @@ public CompletableFuture> d * Delete a classify run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, ClassifyRunsDeleteRequest request) { return delete(id, request, null); } @@ -490,7 +493,7 @@ public CompletableFuture> d * Delete a classify run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, ClassifyRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -515,14 +518,14 @@ public CompletableFuture> d if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ClassifyRunsDeleteResponse.class), response)); @@ -595,7 +598,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Cancel an in-progress classify run. *

    Note: Only classify runs with a status of "PROCESSING" can be cancelled. Classifier runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id) { + public CompletableFuture> cancel(String id) { return cancel(id, ClassifyRunsCancelRequest.builder().build()); } @@ -603,7 +606,8 @@ public CompletableFuture> cancel(String id * Cancel an in-progress classify run. *

    Note: Only classify runs with a status of "PROCESSING" can be cancelled. Classifier runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id, RequestOptions requestOptions) { + public CompletableFuture> cancel( + String id, RequestOptions requestOptions) { return cancel(id, ClassifyRunsCancelRequest.builder().build(), requestOptions); } @@ -611,7 +615,7 @@ public CompletableFuture> cancel(String id * Cancel an in-progress classify run. *

    Note: Only classify runs with a status of "PROCESSING" can be cancelled. Classifier runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, ClassifyRunsCancelRequest request) { return cancel(id, request, null); } @@ -620,7 +624,7 @@ public CompletableFuture> cancel( * Cancel an in-progress classify run. *

    Note: Only classify runs with a status of "PROCESSING" can be cancelled. Classifier runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, ClassifyRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -646,14 +650,14 @@ public CompletableFuture> cancel( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRun.class), response)); return; } @@ -735,7 +739,8 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *
  • All inputs in a batch use the same classifier version and override config.
  • * */ - public CompletableFuture> createBatch(ClassifyRunsCreateBatchRequest request) { + public CompletableFuture> createBatch( + ClassifyRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -754,7 +759,7 @@ public CompletableFuture> createBatch(Classif *
  • All inputs in a batch use the same classifier version and override config.
  • * */ - public CompletableFuture> createBatch( + public CompletableFuture> createBatch( ClassifyRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -782,14 +787,14 @@ public CompletableFuture> createBatch( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/classifyruns/RawClassifyRunsClient.java b/src/main/java/ai/extend/resources/classifyruns/RawClassifyRunsClient.java index 1180bb6..afb1bda 100644 --- a/src/main/java/ai/extend/resources/classifyruns/RawClassifyRunsClient.java +++ b/src/main/java/ai/extend/resources/classifyruns/RawClassifyRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -51,7 +51,7 @@ public RawClassifyRunsClient(ClientOptions clientOptions) { * List all classify runs. *

    Returns a summary of each run. Use GET /classify_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(ClassifyRunsListRequest.builder().build()); } @@ -59,7 +59,7 @@ public ExtendClientHttpResponse list() { * List all classify runs. *

    Returns a summary of each run. Use GET /classify_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(ClassifyRunsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public ExtendClientHttpResponse list(RequestOptions re * List all classify runs. *

    Returns a summary of each run. Use GET /classify_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list(ClassifyRunsListRequest request) { + public ExtendClientBaseHttpResponse list(ClassifyRunsListRequest request) { return list(request, null); } @@ -75,7 +75,7 @@ public ExtendClientHttpResponse list(ClassifyRunsListR * List all classify runs. *

    Returns a summary of each run. Use GET /classify_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( ClassifyRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -143,7 +143,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRunsListResponse.class), response); } @@ -189,7 +189,7 @@ public ExtendClientHttpResponse list( * Classify a document using an existing classifier or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Classify Run endpoint for results.

    */ - public ExtendClientHttpResponse create(ClassifyRunsCreateRequest request) { + public ExtendClientBaseHttpResponse create(ClassifyRunsCreateRequest request) { return create(request, null); } @@ -197,7 +197,7 @@ public ExtendClientHttpResponse create(ClassifyRunsCreateRequest re * Classify a document using an existing classifier or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Classify Run endpoint for results.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( ClassifyRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -229,7 +229,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRun.class), response); } try { @@ -274,7 +274,7 @@ public ExtendClientHttpResponse create( * Retrieve details about a specific classify run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a classify run when using the Create Classify Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, ClassifyRunsRetrieveRequest.builder().build()); } @@ -282,7 +282,7 @@ public ExtendClientHttpResponse retrieve(String id) { * Retrieve details about a specific classify run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a classify run when using the Create Classify Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, ClassifyRunsRetrieveRequest.builder().build(), requestOptions); } @@ -290,7 +290,7 @@ public ExtendClientHttpResponse retrieve(String id, RequestOptions * Retrieve details about a specific classify run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a classify run when using the Create Classify Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id, ClassifyRunsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, ClassifyRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -298,7 +298,7 @@ public ExtendClientHttpResponse retrieve(String id, ClassifyRunsRet * Retrieve details about a specific classify run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a classify run when using the Create Classify Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, ClassifyRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -327,7 +327,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRun.class), response); } try { @@ -372,7 +372,7 @@ public ExtendClientHttpResponse retrieve( * Delete a classify run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, ClassifyRunsDeleteRequest.builder().build()); } @@ -380,7 +380,7 @@ public ExtendClientHttpResponse delete(String id) { * Delete a classify run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete(String id, RequestOptions requestOptions) { return delete(id, ClassifyRunsDeleteRequest.builder().build(), requestOptions); } @@ -388,7 +388,8 @@ public ExtendClientHttpResponse delete(String id, Re * Delete a classify run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, ClassifyRunsDeleteRequest request) { + public ExtendClientBaseHttpResponse delete( + String id, ClassifyRunsDeleteRequest request) { return delete(id, request, null); } @@ -396,7 +397,7 @@ public ExtendClientHttpResponse delete(String id, Cl * Delete a classify run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, ClassifyRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -425,7 +426,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRunsDeleteResponse.class), response); } @@ -471,7 +472,7 @@ public ExtendClientHttpResponse delete( * Cancel an in-progress classify run. *

    Note: Only classify runs with a status of "PROCESSING" can be cancelled. Classifier runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id) { + public ExtendClientBaseHttpResponse cancel(String id) { return cancel(id, ClassifyRunsCancelRequest.builder().build()); } @@ -479,7 +480,7 @@ public ExtendClientHttpResponse cancel(String id) { * Cancel an in-progress classify run. *

    Note: Only classify runs with a status of "PROCESSING" can be cancelled. Classifier runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse cancel(String id, RequestOptions requestOptions) { return cancel(id, ClassifyRunsCancelRequest.builder().build(), requestOptions); } @@ -487,7 +488,7 @@ public ExtendClientHttpResponse cancel(String id, RequestOptions re * Cancel an in-progress classify run. *

    Note: Only classify runs with a status of "PROCESSING" can be cancelled. Classifier runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, ClassifyRunsCancelRequest request) { + public ExtendClientBaseHttpResponse cancel(String id, ClassifyRunsCancelRequest request) { return cancel(id, request, null); } @@ -495,7 +496,7 @@ public ExtendClientHttpResponse cancel(String id, ClassifyRunsCance * Cancel an in-progress classify run. *

    Note: Only classify runs with a status of "PROCESSING" can be cancelled. Classifier runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel( + public ExtendClientBaseHttpResponse cancel( String id, ClassifyRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -525,7 +526,7 @@ public ExtendClientHttpResponse cancel( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ClassifyRun.class), response); } try { @@ -581,7 +582,7 @@ public ExtendClientHttpResponse cancel( *
  • All inputs in a batch use the same classifier version and override config.
  • * */ - public ExtendClientHttpResponse createBatch(ClassifyRunsCreateBatchRequest request) { + public ExtendClientBaseHttpResponse createBatch(ClassifyRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -600,7 +601,7 @@ public ExtendClientHttpResponse createBatch(ClassifyRunsCreateBatchReq *
  • All inputs in a batch use the same classifier version and override config.
  • * */ - public ExtendClientHttpResponse createBatch( + public ExtendClientBaseHttpResponse createBatch( ClassifyRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -632,7 +633,7 @@ public ExtendClientHttpResponse createBatch( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response); } try { diff --git a/src/main/java/ai/extend/resources/editruns/AsyncRawEditRunsClient.java b/src/main/java/ai/extend/resources/editruns/AsyncRawEditRunsClient.java index 62e42df..25a652b 100644 --- a/src/main/java/ai/extend/resources/editruns/AsyncRawEditRunsClient.java +++ b/src/main/java/ai/extend/resources/editruns/AsyncRawEditRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -50,7 +50,7 @@ public AsyncRawEditRunsClient(ClientOptions clientOptions) { *

    The Edit Runs endpoint allows you to convert and edit documents and get an edit run ID that can be used to check status and retrieve results with the Get Edit Run endpoint.

    *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Edit Run endpoint for results.

    */ - public CompletableFuture> create(EditRunsCreateRequest request) { + public CompletableFuture> create(EditRunsCreateRequest request) { return create(request, null); } @@ -59,7 +59,7 @@ public CompletableFuture> create(EditRunsCreat *

    The Edit Runs endpoint allows you to convert and edit documents and get an edit run ID that can be used to check status and retrieve results with the Get Edit Run endpoint.

    *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Edit Run endpoint for results.

    */ - public CompletableFuture> create( + public CompletableFuture> create( EditRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -87,14 +87,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditRun.class), response)); return; } @@ -165,7 +165,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Retrieve the status and results of an edit run. *

    Use this endpoint to get results for an edit run that has already completed, or to check on the status of an edit run initiated via the Create Edit Run endpoint.

    */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, EditRunsRetrieveRequest.builder().build()); } @@ -173,7 +173,7 @@ public CompletableFuture> retrieve(String id) * Retrieve the status and results of an edit run. *

    Use this endpoint to get results for an edit run that has already completed, or to check on the status of an edit run initiated via the Create Edit Run endpoint.

    */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { return retrieve(id, EditRunsRetrieveRequest.builder().build(), requestOptions); } @@ -181,7 +181,8 @@ public CompletableFuture> retrieve(String id, * Retrieve the status and results of an edit run. *

    Use this endpoint to get results for an edit run that has already completed, or to check on the status of an edit run initiated via the Create Edit Run endpoint.

    */ - public CompletableFuture> retrieve(String id, EditRunsRetrieveRequest request) { + public CompletableFuture> retrieve( + String id, EditRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -189,7 +190,7 @@ public CompletableFuture> retrieve(String id, * Retrieve the status and results of an edit run. *

    Use this endpoint to get results for an edit run that has already completed, or to check on the status of an edit run initiated via the Create Edit Run endpoint.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, EditRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -214,14 +215,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditRun.class), response)); return; } @@ -292,7 +293,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Delete an edit run and all associated data from Extend. This operation is permanent and cannot be undone. *

    This endpoint can be used if you'd like to manage data retention on your own rather than relying on automated data retention policies, or to make one-off deletions for your downstream customers.

    */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, EditRunsDeleteRequest.builder().build()); } @@ -300,7 +301,7 @@ public CompletableFuture> delet * Delete an edit run and all associated data from Extend. This operation is permanent and cannot be undone. *

    This endpoint can be used if you'd like to manage data retention on your own rather than relying on automated data retention policies, or to make one-off deletions for your downstream customers.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, EditRunsDeleteRequest.builder().build(), requestOptions); } @@ -309,7 +310,7 @@ public CompletableFuture> delet * Delete an edit run and all associated data from Extend. This operation is permanent and cannot be undone. *

    This endpoint can be used if you'd like to manage data retention on your own rather than relying on automated data retention policies, or to make one-off deletions for your downstream customers.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, EditRunsDeleteRequest request) { return delete(id, request, null); } @@ -318,7 +319,7 @@ public CompletableFuture> delet * Delete an edit run and all associated data from Extend. This operation is permanent and cannot be undone. *

    This endpoint can be used if you'd like to manage data retention on your own rather than relying on automated data retention policies, or to make one-off deletions for your downstream customers.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, EditRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -343,14 +344,14 @@ public CompletableFuture> delet if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditRunsDeleteResponse.class), response)); return; diff --git a/src/main/java/ai/extend/resources/editruns/RawEditRunsClient.java b/src/main/java/ai/extend/resources/editruns/RawEditRunsClient.java index d60e9d2..f60be9b 100644 --- a/src/main/java/ai/extend/resources/editruns/RawEditRunsClient.java +++ b/src/main/java/ai/extend/resources/editruns/RawEditRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -46,7 +46,7 @@ public RawEditRunsClient(ClientOptions clientOptions) { *

    The Edit Runs endpoint allows you to convert and edit documents and get an edit run ID that can be used to check status and retrieve results with the Get Edit Run endpoint.

    *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Edit Run endpoint for results.

    */ - public ExtendClientHttpResponse create(EditRunsCreateRequest request) { + public ExtendClientBaseHttpResponse create(EditRunsCreateRequest request) { return create(request, null); } @@ -55,7 +55,7 @@ public ExtendClientHttpResponse create(EditRunsCreateRequest request) { *

    The Edit Runs endpoint allows you to convert and edit documents and get an edit run ID that can be used to check status and retrieve results with the Get Edit Run endpoint.

    *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Edit Run endpoint for results.

    */ - public ExtendClientHttpResponse create(EditRunsCreateRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse create(EditRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("edit_runs"); @@ -86,7 +86,7 @@ public ExtendClientHttpResponse create(EditRunsCreateRequest request, R ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditRun.class), response); } try { @@ -131,7 +131,7 @@ public ExtendClientHttpResponse create(EditRunsCreateRequest request, R * Retrieve the status and results of an edit run. *

    Use this endpoint to get results for an edit run that has already completed, or to check on the status of an edit run initiated via the Create Edit Run endpoint.

    */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, EditRunsRetrieveRequest.builder().build()); } @@ -139,7 +139,7 @@ public ExtendClientHttpResponse retrieve(String id) { * Retrieve the status and results of an edit run. *

    Use this endpoint to get results for an edit run that has already completed, or to check on the status of an edit run initiated via the Create Edit Run endpoint.

    */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, EditRunsRetrieveRequest.builder().build(), requestOptions); } @@ -147,7 +147,7 @@ public ExtendClientHttpResponse retrieve(String id, RequestOptions requ * Retrieve the status and results of an edit run. *

    Use this endpoint to get results for an edit run that has already completed, or to check on the status of an edit run initiated via the Create Edit Run endpoint.

    */ - public ExtendClientHttpResponse retrieve(String id, EditRunsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, EditRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -155,7 +155,7 @@ public ExtendClientHttpResponse retrieve(String id, EditRunsRetrieveReq * Retrieve the status and results of an edit run. *

    Use this endpoint to get results for an edit run that has already completed, or to check on the status of an edit run initiated via the Create Edit Run endpoint.

    */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, EditRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -184,7 +184,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditRun.class), response); } try { @@ -229,7 +229,7 @@ public ExtendClientHttpResponse retrieve( * Delete an edit run and all associated data from Extend. This operation is permanent and cannot be undone. *

    This endpoint can be used if you'd like to manage data retention on your own rather than relying on automated data retention policies, or to make one-off deletions for your downstream customers.

    */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, EditRunsDeleteRequest.builder().build()); } @@ -237,7 +237,7 @@ public ExtendClientHttpResponse delete(String id) { * Delete an edit run and all associated data from Extend. This operation is permanent and cannot be undone. *

    This endpoint can be used if you'd like to manage data retention on your own rather than relying on automated data retention policies, or to make one-off deletions for your downstream customers.

    */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete(String id, RequestOptions requestOptions) { return delete(id, EditRunsDeleteRequest.builder().build(), requestOptions); } @@ -245,7 +245,7 @@ public ExtendClientHttpResponse delete(String id, Reques * Delete an edit run and all associated data from Extend. This operation is permanent and cannot be undone. *

    This endpoint can be used if you'd like to manage data retention on your own rather than relying on automated data retention policies, or to make one-off deletions for your downstream customers.

    */ - public ExtendClientHttpResponse delete(String id, EditRunsDeleteRequest request) { + public ExtendClientBaseHttpResponse delete(String id, EditRunsDeleteRequest request) { return delete(id, request, null); } @@ -253,7 +253,7 @@ public ExtendClientHttpResponse delete(String id, EditRu * Delete an edit run and all associated data from Extend. This operation is permanent and cannot be undone. *

    This endpoint can be used if you'd like to manage data retention on your own rather than relying on automated data retention policies, or to make one-off deletions for your downstream customers.

    */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, EditRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -282,7 +282,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditRunsDeleteResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/editschemas/AsyncRawEditSchemasClient.java b/src/main/java/ai/extend/resources/editschemas/AsyncRawEditSchemasClient.java index 934f322..04fd355 100644 --- a/src/main/java/ai/extend/resources/editschemas/AsyncRawEditSchemasClient.java +++ b/src/main/java/ai/extend/resources/editschemas/AsyncRawEditSchemasClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -48,7 +48,7 @@ public AsyncRawEditSchemasClient(ClientOptions clientOptions) { *

    This endpoint returns the generated schema directly. There are no schema generation run resources to poll or delete.

    *

    For more details, see the Generate Edit Schema guide and the Edit File guide.

    */ - public CompletableFuture> generate( + public CompletableFuture> generate( EditSchemasGenerateRequest request) { return generate(request, null); } @@ -59,7 +59,7 @@ public CompletableFuture> *

    This endpoint returns the generated schema directly. There are no schema generation run resources to poll or delete.

    *

    For more details, see the Generate Edit Schema guide and the Edit File guide.

    */ - public CompletableFuture> generate( + public CompletableFuture> generate( EditSchemasGenerateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -87,14 +87,15 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, EditSchemaGenerationResponse.class), response)); diff --git a/src/main/java/ai/extend/resources/editschemas/RawEditSchemasClient.java b/src/main/java/ai/extend/resources/editschemas/RawEditSchemasClient.java index 4f65c8b..1f5bbab 100644 --- a/src/main/java/ai/extend/resources/editschemas/RawEditSchemasClient.java +++ b/src/main/java/ai/extend/resources/editschemas/RawEditSchemasClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -44,7 +44,7 @@ public RawEditSchemasClient(ClientOptions clientOptions) { *

    This endpoint returns the generated schema directly. There are no schema generation run resources to poll or delete.

    *

    For more details, see the Generate Edit Schema guide and the Edit File guide.

    */ - public ExtendClientHttpResponse generate(EditSchemasGenerateRequest request) { + public ExtendClientBaseHttpResponse generate(EditSchemasGenerateRequest request) { return generate(request, null); } @@ -54,7 +54,7 @@ public ExtendClientHttpResponse generate(EditSchem *

    This endpoint returns the generated schema directly. There are no schema generation run resources to poll or delete.

    *

    For more details, see the Generate Edit Schema guide and the Edit File guide.

    */ - public ExtendClientHttpResponse generate( + public ExtendClientBaseHttpResponse generate( EditSchemasGenerateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -86,7 +86,7 @@ public ExtendClientHttpResponse generate( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditSchemaGenerationResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/edittemplates/AsyncRawEditTemplatesClient.java b/src/main/java/ai/extend/resources/edittemplates/AsyncRawEditTemplatesClient.java index b9ca6d9..a65fe86 100644 --- a/src/main/java/ai/extend/resources/edittemplates/AsyncRawEditTemplatesClient.java +++ b/src/main/java/ai/extend/resources/edittemplates/AsyncRawEditTemplatesClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; import ai.extend.core.ExtendClientException; -import ai.extend.core.ExtendClientHttpResponse; import ai.extend.core.ObjectMappers; import ai.extend.core.RequestOptions; import ai.extend.errors.BadRequestError; @@ -44,7 +44,7 @@ public AsyncRawEditTemplatesClient(ClientOptions clientOptions) { * Retrieve a saved edit template by ID. *

    Use this endpoint to inspect the source file, default edit configuration, and optional schema generation configuration saved on an edit template. You can reuse the returned config with POST /edit or POST /edit_runs, and reuse schemaConfig with POST /edit_schemas/generate.

    */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, EditTemplatesRetrieveRequest.builder().build()); } @@ -52,7 +52,7 @@ public CompletableFuture> retrieve(String * Retrieve a saved edit template by ID. *

    Use this endpoint to inspect the source file, default edit configuration, and optional schema generation configuration saved on an edit template. You can reuse the returned config with POST /edit or POST /edit_runs, and reuse schemaConfig with POST /edit_schemas/generate.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, RequestOptions requestOptions) { return retrieve(id, EditTemplatesRetrieveRequest.builder().build(), requestOptions); } @@ -61,7 +61,7 @@ public CompletableFuture> retrieve( * Retrieve a saved edit template by ID. *

    Use this endpoint to inspect the source file, default edit configuration, and optional schema generation configuration saved on an edit template. You can reuse the returned config with POST /edit or POST /edit_runs, and reuse schemaConfig with POST /edit_schemas/generate.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, EditTemplatesRetrieveRequest request) { return retrieve(id, request, null); } @@ -70,7 +70,7 @@ public CompletableFuture> retrieve( * Retrieve a saved edit template by ID. *

    Use this endpoint to inspect the source file, default edit configuration, and optional schema generation configuration saved on an edit template. You can reuse the returned config with POST /edit or POST /edit_runs, and reuse schemaConfig with POST /edit_schemas/generate.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, EditTemplatesRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -95,14 +95,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditTemplate.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/edittemplates/RawEditTemplatesClient.java b/src/main/java/ai/extend/resources/edittemplates/RawEditTemplatesClient.java index 6d67f7b..f5fe64c 100644 --- a/src/main/java/ai/extend/resources/edittemplates/RawEditTemplatesClient.java +++ b/src/main/java/ai/extend/resources/edittemplates/RawEditTemplatesClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; import ai.extend.core.ExtendClientException; -import ai.extend.core.ExtendClientHttpResponse; import ai.extend.core.ObjectMappers; import ai.extend.core.RequestOptions; import ai.extend.errors.BadRequestError; @@ -40,7 +40,7 @@ public RawEditTemplatesClient(ClientOptions clientOptions) { * Retrieve a saved edit template by ID. *

    Use this endpoint to inspect the source file, default edit configuration, and optional schema generation configuration saved on an edit template. You can reuse the returned config with POST /edit or POST /edit_runs, and reuse schemaConfig with POST /edit_schemas/generate.

    */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, EditTemplatesRetrieveRequest.builder().build()); } @@ -48,7 +48,7 @@ public ExtendClientHttpResponse retrieve(String id) { * Retrieve a saved edit template by ID. *

    Use this endpoint to inspect the source file, default edit configuration, and optional schema generation configuration saved on an edit template. You can reuse the returned config with POST /edit or POST /edit_runs, and reuse schemaConfig with POST /edit_schemas/generate.

    */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, EditTemplatesRetrieveRequest.builder().build(), requestOptions); } @@ -56,7 +56,7 @@ public ExtendClientHttpResponse retrieve(String id, RequestOptions * Retrieve a saved edit template by ID. *

    Use this endpoint to inspect the source file, default edit configuration, and optional schema generation configuration saved on an edit template. You can reuse the returned config with POST /edit or POST /edit_runs, and reuse schemaConfig with POST /edit_schemas/generate.

    */ - public ExtendClientHttpResponse retrieve(String id, EditTemplatesRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, EditTemplatesRetrieveRequest request) { return retrieve(id, request, null); } @@ -64,7 +64,7 @@ public ExtendClientHttpResponse retrieve(String id, EditTemplatesR * Retrieve a saved edit template by ID. *

    Use this endpoint to inspect the source file, default edit configuration, and optional schema generation configuration saved on an edit template. You can reuse the returned config with POST /edit or POST /edit_runs, and reuse schemaConfig with POST /edit_schemas/generate.

    */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, EditTemplatesRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -93,7 +93,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EditTemplate.class), response); } try { diff --git a/src/main/java/ai/extend/resources/evaluationsetitems/AsyncRawEvaluationSetItemsClient.java b/src/main/java/ai/extend/resources/evaluationsetitems/AsyncRawEvaluationSetItemsClient.java index 6935ffc..37606dd 100644 --- a/src/main/java/ai/extend/resources/evaluationsetitems/AsyncRawEvaluationSetItemsClient.java +++ b/src/main/java/ai/extend/resources/evaluationsetitems/AsyncRawEvaluationSetItemsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -54,7 +54,8 @@ public AsyncRawEvaluationSetItemsClient(ClientOptions clientOptions) { * List items in a specific evaluation set. *

    Returns a summary of each evaluation set item. Use the Get Evaluation Set Item endpoint to get the full details of an evaluation set item.

    */ - public CompletableFuture> list(String evaluationSetId) { + public CompletableFuture> list( + String evaluationSetId) { return list(evaluationSetId, EvaluationSetItemsListRequest.builder().build()); } @@ -62,7 +63,7 @@ public CompletableFutureReturns a summary of each evaluation set item. Use the Get Evaluation Set Item endpoint to get the full details of an evaluation set item.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String evaluationSetId, RequestOptions requestOptions) { return list(evaluationSetId, EvaluationSetItemsListRequest.builder().build(), requestOptions); } @@ -71,7 +72,7 @@ public CompletableFutureReturns a summary of each evaluation set item. Use the Get Evaluation Set Item endpoint to get the full details of an evaluation set item.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String evaluationSetId, EvaluationSetItemsListRequest request) { return list(evaluationSetId, request, null); } @@ -80,7 +81,7 @@ public CompletableFutureReturns a summary of each evaluation set item. Use the Get Evaluation Set Item endpoint to get the full details of an evaluation set item.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String evaluationSetId, EvaluationSetItemsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -122,14 +123,15 @@ public CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, EvaluationSetItemsListResponse.class), response)); @@ -203,7 +205,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

    Limit: You can create up to 100 items at a time.

    *

    Learn more about how to create evaluation set items in the Evaluation Sets product page.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String evaluationSetId, EvaluationSetItemsCreateRequest request) { return create(evaluationSetId, request, null); } @@ -213,7 +215,7 @@ public CompletableFutureLimit: You can create up to 100 items at a time.

    *

    Learn more about how to create evaluation set items in the Evaluation Sets product page.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String evaluationSetId, EvaluationSetItemsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -247,7 +249,7 @@ public CompletableFuture> future = + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -255,7 +257,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO try (ResponseBody responseBody = response.body()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, EvaluationSetItemsCreateResponse.class), response)); @@ -327,7 +329,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Get details of an evaluation set item. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String evaluationSetId, String itemId) { return retrieve( evaluationSetId, @@ -338,7 +340,7 @@ public CompletableFuture> retrieve( /** * Get details of an evaluation set item. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String evaluationSetId, String itemId, RequestOptions requestOptions) { return retrieve( evaluationSetId, @@ -350,7 +352,7 @@ public CompletableFuture> retrieve( /** * Get details of an evaluation set item. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String evaluationSetId, String itemId, EvaluationSetItemsRetrieveRequest request) { return retrieve(evaluationSetId, itemId, request, null); } @@ -358,7 +360,7 @@ public CompletableFuture> retrieve( /** * Get details of an evaluation set item. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String evaluationSetId, String itemId, EvaluationSetItemsRetrieveRequest request, @@ -388,14 +390,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetItem.class), response)); return; @@ -466,7 +468,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * If you need to change the expected output for a given evaluation set item, you can use this endpoint to update the item. This can be useful if you need to correct an error in the expected output or if the output of the extractor, classifier, or splitter has changed. */ - public CompletableFuture> update( + public CompletableFuture> update( String evaluationSetId, String itemId, EvaluationSetItemsUpdateRequest request) { return update(evaluationSetId, itemId, request, null); } @@ -474,7 +476,7 @@ public CompletableFuture> update( /** * If you need to change the expected output for a given evaluation set item, you can use this endpoint to update the item. This can be useful if you need to correct an error in the expected output or if the output of the extractor, classifier, or splitter has changed. */ - public CompletableFuture> update( + public CompletableFuture> update( String evaluationSetId, String itemId, EvaluationSetItemsUpdateRequest request, @@ -512,14 +514,14 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetItem.class), response)); return; @@ -590,7 +592,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Delete an evaluation set item. */ - public CompletableFuture> delete( + public CompletableFuture> delete( String evaluationSetId, String itemId) { return delete( evaluationSetId, @@ -601,7 +603,7 @@ public CompletableFuture> delete( + public CompletableFuture> delete( String evaluationSetId, String itemId, RequestOptions requestOptions) { return delete( evaluationSetId, @@ -613,7 +615,7 @@ public CompletableFuture> delete( + public CompletableFuture> delete( String evaluationSetId, String itemId, EvaluationSetItemsDeleteRequest request) { return delete(evaluationSetId, itemId, request, null); } @@ -621,7 +623,7 @@ public CompletableFuture> delete( + public CompletableFuture> delete( String evaluationSetId, String itemId, EvaluationSetItemsDeleteRequest request, @@ -651,7 +653,7 @@ public CompletableFuture> future = + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -659,7 +661,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO try (ResponseBody responseBody = response.body()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, EvaluationSetItemsDeleteResponse.class), response)); diff --git a/src/main/java/ai/extend/resources/evaluationsetitems/RawEvaluationSetItemsClient.java b/src/main/java/ai/extend/resources/evaluationsetitems/RawEvaluationSetItemsClient.java index 6d05dd5..65334c9 100644 --- a/src/main/java/ai/extend/resources/evaluationsetitems/RawEvaluationSetItemsClient.java +++ b/src/main/java/ai/extend/resources/evaluationsetitems/RawEvaluationSetItemsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -50,7 +50,7 @@ public RawEvaluationSetItemsClient(ClientOptions clientOptions) { * List items in a specific evaluation set. *

    Returns a summary of each evaluation set item. Use the Get Evaluation Set Item endpoint to get the full details of an evaluation set item.

    */ - public ExtendClientHttpResponse list(String evaluationSetId) { + public ExtendClientBaseHttpResponse list(String evaluationSetId) { return list(evaluationSetId, EvaluationSetItemsListRequest.builder().build()); } @@ -58,7 +58,7 @@ public ExtendClientHttpResponse list(String eval * List items in a specific evaluation set. *

    Returns a summary of each evaluation set item. Use the Get Evaluation Set Item endpoint to get the full details of an evaluation set item.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String evaluationSetId, RequestOptions requestOptions) { return list(evaluationSetId, EvaluationSetItemsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public ExtendClientHttpResponse list( * List items in a specific evaluation set. *

    Returns a summary of each evaluation set item. Use the Get Evaluation Set Item endpoint to get the full details of an evaluation set item.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String evaluationSetId, EvaluationSetItemsListRequest request) { return list(evaluationSetId, request, null); } @@ -76,7 +76,7 @@ public ExtendClientHttpResponse list( * List items in a specific evaluation set. *

    Returns a summary of each evaluation set item. Use the Get Evaluation Set Item endpoint to get the full details of an evaluation set item.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String evaluationSetId, EvaluationSetItemsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -122,7 +122,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetItemsListResponse.class), response); } @@ -169,7 +169,7 @@ public ExtendClientHttpResponse list( *

    Limit: You can create up to 100 items at a time.

    *

    Learn more about how to create evaluation set items in the Evaluation Sets product page.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String evaluationSetId, EvaluationSetItemsCreateRequest request) { return create(evaluationSetId, request, null); } @@ -179,7 +179,7 @@ public ExtendClientHttpResponse create( *

    Limit: You can create up to 100 items at a time.

    *

    Learn more about how to create evaluation set items in the Evaluation Sets product page.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String evaluationSetId, EvaluationSetItemsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -217,7 +217,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetItemsCreateResponse.class), response); } @@ -262,7 +262,7 @@ public ExtendClientHttpResponse create( /** * Get details of an evaluation set item. */ - public ExtendClientHttpResponse retrieve(String evaluationSetId, String itemId) { + public ExtendClientBaseHttpResponse retrieve(String evaluationSetId, String itemId) { return retrieve( evaluationSetId, itemId, @@ -272,7 +272,7 @@ public ExtendClientHttpResponse retrieve(String evaluationSet /** * Get details of an evaluation set item. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String evaluationSetId, String itemId, RequestOptions requestOptions) { return retrieve( evaluationSetId, @@ -284,7 +284,7 @@ public ExtendClientHttpResponse retrieve( /** * Get details of an evaluation set item. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String evaluationSetId, String itemId, EvaluationSetItemsRetrieveRequest request) { return retrieve(evaluationSetId, itemId, request, null); } @@ -292,7 +292,7 @@ public ExtendClientHttpResponse retrieve( /** * Get details of an evaluation set item. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String evaluationSetId, String itemId, EvaluationSetItemsRetrieveRequest request, @@ -326,7 +326,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetItem.class), response); } try { @@ -370,7 +370,7 @@ public ExtendClientHttpResponse retrieve( /** * If you need to change the expected output for a given evaluation set item, you can use this endpoint to update the item. This can be useful if you need to correct an error in the expected output or if the output of the extractor, classifier, or splitter has changed. */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String evaluationSetId, String itemId, EvaluationSetItemsUpdateRequest request) { return update(evaluationSetId, itemId, request, null); } @@ -378,7 +378,7 @@ public ExtendClientHttpResponse update( /** * If you need to change the expected output for a given evaluation set item, you can use this endpoint to update the item. This can be useful if you need to correct an error in the expected output or if the output of the extractor, classifier, or splitter has changed. */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String evaluationSetId, String itemId, EvaluationSetItemsUpdateRequest request, @@ -420,7 +420,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetItem.class), response); } try { @@ -464,7 +464,8 @@ public ExtendClientHttpResponse update( /** * Delete an evaluation set item. */ - public ExtendClientHttpResponse delete(String evaluationSetId, String itemId) { + public ExtendClientBaseHttpResponse delete( + String evaluationSetId, String itemId) { return delete( evaluationSetId, itemId, @@ -474,7 +475,7 @@ public ExtendClientHttpResponse delete(String /** * Delete an evaluation set item. */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String evaluationSetId, String itemId, RequestOptions requestOptions) { return delete( evaluationSetId, @@ -486,7 +487,7 @@ public ExtendClientHttpResponse delete( /** * Delete an evaluation set item. */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String evaluationSetId, String itemId, EvaluationSetItemsDeleteRequest request) { return delete(evaluationSetId, itemId, request, null); } @@ -494,7 +495,7 @@ public ExtendClientHttpResponse delete( /** * Delete an evaluation set item. */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String evaluationSetId, String itemId, EvaluationSetItemsDeleteRequest request, @@ -528,7 +529,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetItemsDeleteResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/evaluationsetruns/AsyncRawEvaluationSetRunsClient.java b/src/main/java/ai/extend/resources/evaluationsetruns/AsyncRawEvaluationSetRunsClient.java index 9b0ab14..2bf7a94 100644 --- a/src/main/java/ai/extend/resources/evaluationsetruns/AsyncRawEvaluationSetRunsClient.java +++ b/src/main/java/ai/extend/resources/evaluationsetruns/AsyncRawEvaluationSetRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -47,7 +47,7 @@ public AsyncRawEvaluationSetRunsClient(ClientOptions clientOptions) { * Create and start an async evaluation set run. The response returns the evaluation set run object with its initial status; use GET /evaluation_set_runs/{id} to poll for completion. *

    Evaluation set runs are currently supported for document processor evaluation sets.

    */ - public CompletableFuture> create( + public CompletableFuture> create( EvaluationSetRunsCreateRequest request) { return create(request, null); } @@ -56,7 +56,7 @@ public CompletableFuture> create( * Create and start an async evaluation set run. The response returns the evaluation set run object with its initial status; use GET /evaluation_set_runs/{id} to poll for completion. *

    Evaluation set runs are currently supported for document processor evaluation sets.

    */ - public CompletableFuture> create( + public CompletableFuture> create( EvaluationSetRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -88,14 +88,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetRun.class), response)); return; @@ -166,14 +166,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Get details of an evaluation set run. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, EvaluationSetRunsRetrieveRequest.builder().build()); } /** * Get details of an evaluation set run. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, RequestOptions requestOptions) { return retrieve(id, EvaluationSetRunsRetrieveRequest.builder().build(), requestOptions); } @@ -181,7 +181,7 @@ public CompletableFuture> retrieve( /** * Get details of an evaluation set run. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, EvaluationSetRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -189,7 +189,7 @@ public CompletableFuture> retrieve( /** * Get details of an evaluation set run. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, EvaluationSetRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -214,14 +214,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetRun.class), response)); return; diff --git a/src/main/java/ai/extend/resources/evaluationsetruns/RawEvaluationSetRunsClient.java b/src/main/java/ai/extend/resources/evaluationsetruns/RawEvaluationSetRunsClient.java index 62ede6a..d0f9587 100644 --- a/src/main/java/ai/extend/resources/evaluationsetruns/RawEvaluationSetRunsClient.java +++ b/src/main/java/ai/extend/resources/evaluationsetruns/RawEvaluationSetRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -43,7 +43,7 @@ public RawEvaluationSetRunsClient(ClientOptions clientOptions) { * Create and start an async evaluation set run. The response returns the evaluation set run object with its initial status; use GET /evaluation_set_runs/{id} to poll for completion. *

    Evaluation set runs are currently supported for document processor evaluation sets.

    */ - public ExtendClientHttpResponse create(EvaluationSetRunsCreateRequest request) { + public ExtendClientBaseHttpResponse create(EvaluationSetRunsCreateRequest request) { return create(request, null); } @@ -51,7 +51,7 @@ public ExtendClientHttpResponse create(EvaluationSetRunsCreate * Create and start an async evaluation set run. The response returns the evaluation set run object with its initial status; use GET /evaluation_set_runs/{id} to poll for completion. *

    Evaluation set runs are currently supported for document processor evaluation sets.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( EvaluationSetRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -87,7 +87,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetRun.class), response); } try { @@ -131,28 +131,29 @@ public ExtendClientHttpResponse create( /** * Get details of an evaluation set run. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, EvaluationSetRunsRetrieveRequest.builder().build()); } /** * Get details of an evaluation set run. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, EvaluationSetRunsRetrieveRequest.builder().build(), requestOptions); } /** * Get details of an evaluation set run. */ - public ExtendClientHttpResponse retrieve(String id, EvaluationSetRunsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve( + String id, EvaluationSetRunsRetrieveRequest request) { return retrieve(id, request, null); } /** * Get details of an evaluation set run. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, EvaluationSetRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -181,7 +182,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetRun.class), response); } try { diff --git a/src/main/java/ai/extend/resources/evaluationsets/AsyncRawEvaluationSetsClient.java b/src/main/java/ai/extend/resources/evaluationsets/AsyncRawEvaluationSetsClient.java index ebaf0b6..b5d5d13 100644 --- a/src/main/java/ai/extend/resources/evaluationsets/AsyncRawEvaluationSetsClient.java +++ b/src/main/java/ai/extend/resources/evaluationsets/AsyncRawEvaluationSetsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -49,21 +49,22 @@ public AsyncRawEvaluationSetsClient(ClientOptions clientOptions) { /** * List evaluation sets in your account. */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(EvaluationSetsListRequest.builder().build()); } /** * List evaluation sets in your account. */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list( + RequestOptions requestOptions) { return list(EvaluationSetsListRequest.builder().build(), requestOptions); } /** * List evaluation sets in your account. */ - public CompletableFuture> list( + public CompletableFuture> list( EvaluationSetsListRequest request) { return list(request, null); } @@ -71,7 +72,7 @@ public CompletableFuture> l /** * List evaluation sets in your account. */ - public CompletableFuture> list( + public CompletableFuture> list( EvaluationSetsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -115,14 +116,14 @@ public CompletableFuture> l if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, EvaluationSetsListResponse.class), response)); @@ -195,7 +196,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Evaluation sets are collections of files and expected outputs that are used to evaluate the performance of a given extractor, classifier, or splitter. This endpoint will create a new evaluation set, which items can be added to using the Create Evaluation Set Item endpoint. *

    Note: It is not necessary to create an evaluation set via API. You can also create an evaluation set via the Extend dashboard and take the ID from there. To learn more about how to create evaluation sets, see the Evaluation Sets product page.

    */ - public CompletableFuture> create(EvaluationSetsCreateRequest request) { + public CompletableFuture> create(EvaluationSetsCreateRequest request) { return create(request, null); } @@ -203,7 +204,7 @@ public CompletableFuture> create(Evaluat * Evaluation sets are collections of files and expected outputs that are used to evaluate the performance of a given extractor, classifier, or splitter. This endpoint will create a new evaluation set, which items can be added to using the Create Evaluation Set Item endpoint. *

    Note: It is not necessary to create an evaluation set via API. You can also create an evaluation set via the Extend dashboard and take the ID from there. To learn more about how to create evaluation sets, see the Evaluation Sets product page.

    */ - public CompletableFuture> create( + public CompletableFuture> create( EvaluationSetsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -231,14 +232,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSet.class), response)); return; @@ -309,14 +310,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Retrieve a specific evaluation set by ID. This returns an evaluation set object, but does not include the items in the evaluation set. You can use the List Evaluation Set Items endpoint to get the items in an evaluation set. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, EvaluationSetsRetrieveRequest.builder().build()); } /** * Retrieve a specific evaluation set by ID. This returns an evaluation set object, but does not include the items in the evaluation set. You can use the List Evaluation Set Items endpoint to get the items in an evaluation set. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, RequestOptions requestOptions) { return retrieve(id, EvaluationSetsRetrieveRequest.builder().build(), requestOptions); } @@ -324,7 +325,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific evaluation set by ID. This returns an evaluation set object, but does not include the items in the evaluation set. You can use the List Evaluation Set Items endpoint to get the items in an evaluation set. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, EvaluationSetsRetrieveRequest request) { return retrieve(id, request, null); } @@ -332,7 +333,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific evaluation set by ID. This returns an evaluation set object, but does not include the items in the evaluation set. You can use the List Evaluation Set Items endpoint to get the items in an evaluation set. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, EvaluationSetsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -357,14 +358,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSet.class), response)); return; diff --git a/src/main/java/ai/extend/resources/evaluationsets/RawEvaluationSetsClient.java b/src/main/java/ai/extend/resources/evaluationsets/RawEvaluationSetsClient.java index 11c339d..63664dc 100644 --- a/src/main/java/ai/extend/resources/evaluationsets/RawEvaluationSetsClient.java +++ b/src/main/java/ai/extend/resources/evaluationsets/RawEvaluationSetsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -45,28 +45,28 @@ public RawEvaluationSetsClient(ClientOptions clientOptions) { /** * List evaluation sets in your account. */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(EvaluationSetsListRequest.builder().build()); } /** * List evaluation sets in your account. */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(EvaluationSetsListRequest.builder().build(), requestOptions); } /** * List evaluation sets in your account. */ - public ExtendClientHttpResponse list(EvaluationSetsListRequest request) { + public ExtendClientBaseHttpResponse list(EvaluationSetsListRequest request) { return list(request, null); } /** * List evaluation sets in your account. */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( EvaluationSetsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,7 +114,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSetsListResponse.class), response); } @@ -160,7 +160,7 @@ public ExtendClientHttpResponse list( * Evaluation sets are collections of files and expected outputs that are used to evaluate the performance of a given extractor, classifier, or splitter. This endpoint will create a new evaluation set, which items can be added to using the Create Evaluation Set Item endpoint. *

    Note: It is not necessary to create an evaluation set via API. You can also create an evaluation set via the Extend dashboard and take the ID from there. To learn more about how to create evaluation sets, see the Evaluation Sets product page.

    */ - public ExtendClientHttpResponse create(EvaluationSetsCreateRequest request) { + public ExtendClientBaseHttpResponse create(EvaluationSetsCreateRequest request) { return create(request, null); } @@ -168,7 +168,7 @@ public ExtendClientHttpResponse create(EvaluationSetsCreateReques * Evaluation sets are collections of files and expected outputs that are used to evaluate the performance of a given extractor, classifier, or splitter. This endpoint will create a new evaluation set, which items can be added to using the Create Evaluation Set Item endpoint. *

    Note: It is not necessary to create an evaluation set via API. You can also create an evaluation set via the Extend dashboard and take the ID from there. To learn more about how to create evaluation sets, see the Evaluation Sets product page.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( EvaluationSetsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -200,7 +200,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSet.class), response); } try { @@ -244,28 +244,28 @@ public ExtendClientHttpResponse create( /** * Retrieve a specific evaluation set by ID. This returns an evaluation set object, but does not include the items in the evaluation set. You can use the List Evaluation Set Items endpoint to get the items in an evaluation set. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, EvaluationSetsRetrieveRequest.builder().build()); } /** * Retrieve a specific evaluation set by ID. This returns an evaluation set object, but does not include the items in the evaluation set. You can use the List Evaluation Set Items endpoint to get the items in an evaluation set. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, EvaluationSetsRetrieveRequest.builder().build(), requestOptions); } /** * Retrieve a specific evaluation set by ID. This returns an evaluation set object, but does not include the items in the evaluation set. You can use the List Evaluation Set Items endpoint to get the items in an evaluation set. */ - public ExtendClientHttpResponse retrieve(String id, EvaluationSetsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, EvaluationSetsRetrieveRequest request) { return retrieve(id, request, null); } /** * Retrieve a specific evaluation set by ID. This returns an evaluation set object, but does not include the items in the evaluation set. You can use the List Evaluation Set Items endpoint to get the items in an evaluation set. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, EvaluationSetsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -294,7 +294,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, EvaluationSet.class), response); } try { diff --git a/src/main/java/ai/extend/resources/extractors/AsyncRawExtractorsClient.java b/src/main/java/ai/extend/resources/extractors/AsyncRawExtractorsClient.java index 81c66e6..5fb92ee 100644 --- a/src/main/java/ai/extend/resources/extractors/AsyncRawExtractorsClient.java +++ b/src/main/java/ai/extend/resources/extractors/AsyncRawExtractorsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -51,7 +51,7 @@ public AsyncRawExtractorsClient(ClientOptions clientOptions) { * List all extractors. *

    Returns a summary of each extractor. Use GET /extractors/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(ExtractorsListRequest.builder().build()); } @@ -59,7 +59,7 @@ public CompletableFuture> list( * List all extractors. *

    Returns a summary of each extractor. Use GET /extractors/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list(RequestOptions requestOptions) { return list(ExtractorsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public CompletableFuture> list( * List all extractors. *

    Returns a summary of each extractor. Use GET /extractors/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list(ExtractorsListRequest request) { + public CompletableFuture> list(ExtractorsListRequest request) { return list(request, null); } @@ -75,7 +75,7 @@ public CompletableFuture> list( * List all extractors. *

    Returns a summary of each extractor. Use GET /extractors/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list( + public CompletableFuture> list( ExtractorsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -115,14 +115,14 @@ public CompletableFuture> list( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractorsListResponse.class), response)); return; @@ -194,7 +194,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Create a new extractor. *

    You can optionally provide a generate object to automatically generate an extraction schema from sample documents using AI. generate is mutually exclusive with config and cloneExtractorId.

    */ - public CompletableFuture> create(ExtractorsCreateRequest request) { + public CompletableFuture> create(ExtractorsCreateRequest request) { return create(request, null); } @@ -202,7 +202,7 @@ public CompletableFuture> create(ExtractorsC * Create a new extractor. *

    You can optionally provide a generate object to automatically generate an extraction schema from sample documents using AI. generate is mutually exclusive with config and cloneExtractorId.

    */ - public CompletableFuture> create( + public CompletableFuture> create( ExtractorsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -230,14 +230,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Extractor.class), response)); return; } @@ -307,21 +307,22 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Get details of an extractor. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, ExtractorsRetrieveRequest.builder().build()); } /** * Get details of an extractor. */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { return retrieve(id, ExtractorsRetrieveRequest.builder().build(), requestOptions); } /** * Get details of an extractor. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ExtractorsRetrieveRequest request) { return retrieve(id, request, null); } @@ -329,7 +330,7 @@ public CompletableFuture> retrieve( /** * Get details of an extractor. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ExtractorsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -354,14 +355,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Extractor.class), response)); return; } @@ -431,28 +432,29 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Update an existing extractor. */ - public CompletableFuture> update(String id) { + public CompletableFuture> update(String id) { return update(id, ExtractorsUpdateRequest.builder().build()); } /** * Update an existing extractor. */ - public CompletableFuture> update(String id, RequestOptions requestOptions) { + public CompletableFuture> update(String id, RequestOptions requestOptions) { return update(id, ExtractorsUpdateRequest.builder().build(), requestOptions); } /** * Update an existing extractor. */ - public CompletableFuture> update(String id, ExtractorsUpdateRequest request) { + public CompletableFuture> update( + String id, ExtractorsUpdateRequest request) { return update(id, request, null); } /** * Update an existing extractor. */ - public CompletableFuture> update( + public CompletableFuture> update( String id, ExtractorsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -485,14 +487,14 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Extractor.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/extractors/RawExtractorsClient.java b/src/main/java/ai/extend/resources/extractors/RawExtractorsClient.java index fa9a06c..419dbf7 100644 --- a/src/main/java/ai/extend/resources/extractors/RawExtractorsClient.java +++ b/src/main/java/ai/extend/resources/extractors/RawExtractorsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -47,7 +47,7 @@ public RawExtractorsClient(ClientOptions clientOptions) { * List all extractors. *

    Returns a summary of each extractor. Use GET /extractors/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(ExtractorsListRequest.builder().build()); } @@ -55,7 +55,7 @@ public ExtendClientHttpResponse list() { * List all extractors. *

    Returns a summary of each extractor. Use GET /extractors/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(ExtractorsListRequest.builder().build(), requestOptions); } @@ -63,7 +63,7 @@ public ExtendClientHttpResponse list(RequestOptions requ * List all extractors. *

    Returns a summary of each extractor. Use GET /extractors/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list(ExtractorsListRequest request) { + public ExtendClientBaseHttpResponse list(ExtractorsListRequest request) { return list(request, null); } @@ -71,7 +71,7 @@ public ExtendClientHttpResponse list(ExtractorsListReque * List all extractors. *

    Returns a summary of each extractor. Use GET /extractors/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( ExtractorsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -115,7 +115,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractorsListResponse.class), response); } @@ -161,7 +161,7 @@ public ExtendClientHttpResponse list( * Create a new extractor. *

    You can optionally provide a generate object to automatically generate an extraction schema from sample documents using AI. generate is mutually exclusive with config and cloneExtractorId.

    */ - public ExtendClientHttpResponse create(ExtractorsCreateRequest request) { + public ExtendClientBaseHttpResponse create(ExtractorsCreateRequest request) { return create(request, null); } @@ -169,7 +169,8 @@ public ExtendClientHttpResponse create(ExtractorsCreateRequest reques * Create a new extractor. *

    You can optionally provide a generate object to automatically generate an extraction schema from sample documents using AI. generate is mutually exclusive with config and cloneExtractorId.

    */ - public ExtendClientHttpResponse create(ExtractorsCreateRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse create( + ExtractorsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("extractors"); @@ -200,7 +201,7 @@ public ExtendClientHttpResponse create(ExtractorsCreateRequest reques ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Extractor.class), response); } try { @@ -244,28 +245,28 @@ public ExtendClientHttpResponse create(ExtractorsCreateRequest reques /** * Get details of an extractor. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, ExtractorsRetrieveRequest.builder().build()); } /** * Get details of an extractor. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, ExtractorsRetrieveRequest.builder().build(), requestOptions); } /** * Get details of an extractor. */ - public ExtendClientHttpResponse retrieve(String id, ExtractorsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, ExtractorsRetrieveRequest request) { return retrieve(id, request, null); } /** * Get details of an extractor. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, ExtractorsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -294,7 +295,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Extractor.class), response); } try { @@ -338,28 +339,28 @@ public ExtendClientHttpResponse retrieve( /** * Update an existing extractor. */ - public ExtendClientHttpResponse update(String id) { + public ExtendClientBaseHttpResponse update(String id) { return update(id, ExtractorsUpdateRequest.builder().build()); } /** * Update an existing extractor. */ - public ExtendClientHttpResponse update(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse update(String id, RequestOptions requestOptions) { return update(id, ExtractorsUpdateRequest.builder().build(), requestOptions); } /** * Update an existing extractor. */ - public ExtendClientHttpResponse update(String id, ExtractorsUpdateRequest request) { + public ExtendClientBaseHttpResponse update(String id, ExtractorsUpdateRequest request) { return update(id, request, null); } /** * Update an existing extractor. */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String id, ExtractorsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -396,7 +397,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Extractor.class), response); } try { diff --git a/src/main/java/ai/extend/resources/extractorversions/AsyncRawExtractorVersionsClient.java b/src/main/java/ai/extend/resources/extractorversions/AsyncRawExtractorVersionsClient.java index 31f5940..5173cb3 100644 --- a/src/main/java/ai/extend/resources/extractorversions/AsyncRawExtractorVersionsClient.java +++ b/src/main/java/ai/extend/resources/extractorversions/AsyncRawExtractorVersionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -50,7 +50,7 @@ public AsyncRawExtractorVersionsClient(ClientOptions clientOptions) { * This endpoint allows you to fetch all versions of a given extractor, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the extractor, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list(String extractorId) { + public CompletableFuture> list(String extractorId) { return list(extractorId, ExtractorVersionsListRequest.builder().build()); } @@ -58,7 +58,7 @@ public CompletableFuture * This endpoint allows you to fetch all versions of a given extractor, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the extractor, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String extractorId, RequestOptions requestOptions) { return list(extractorId, ExtractorVersionsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public CompletableFuture * This endpoint allows you to fetch all versions of a given extractor, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the extractor, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String extractorId, ExtractorVersionsListRequest request) { return list(extractorId, request, null); } @@ -76,7 +76,7 @@ public CompletableFuture * This endpoint allows you to fetch all versions of a given extractor, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the extractor, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String extractorId, ExtractorVersionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,14 +114,15 @@ public CompletableFuture if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ExtractorVersionsListResponse.class), response)); @@ -194,7 +195,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * This endpoint allows you to publish a new version of an existing extractor. Publishing a new version creates a snapshot of the extractor's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this extractor. You may need to manually update workflows to use the new version if desired.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String extractorId, ExtractorVersionsCreateRequest request) { return create(extractorId, request, null); } @@ -203,7 +204,7 @@ public CompletableFuture> create( * This endpoint allows you to publish a new version of an existing extractor. Publishing a new version creates a snapshot of the extractor's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this extractor. You may need to manually update workflows to use the new version if desired.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String extractorId, ExtractorVersionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -237,14 +238,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractorVersion.class), response)); return; @@ -315,7 +316,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Retrieve a specific version of an extractor in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String extractorId, String versionId) { return retrieve( extractorId, @@ -326,7 +327,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific version of an extractor in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String extractorId, String versionId, RequestOptions requestOptions) { return retrieve( extractorId, @@ -338,7 +339,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific version of an extractor in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String extractorId, String versionId, ExtractorVersionsRetrieveRequest request) { return retrieve(extractorId, versionId, request, null); } @@ -346,7 +347,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific version of an extractor in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String extractorId, String versionId, ExtractorVersionsRetrieveRequest request, @@ -376,14 +377,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractorVersion.class), response)); return; diff --git a/src/main/java/ai/extend/resources/extractorversions/RawExtractorVersionsClient.java b/src/main/java/ai/extend/resources/extractorversions/RawExtractorVersionsClient.java index 8003148..c40513d 100644 --- a/src/main/java/ai/extend/resources/extractorversions/RawExtractorVersionsClient.java +++ b/src/main/java/ai/extend/resources/extractorversions/RawExtractorVersionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -46,7 +46,7 @@ public RawExtractorVersionsClient(ClientOptions clientOptions) { * This endpoint allows you to fetch all versions of a given extractor, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the extractor, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list(String extractorId) { + public ExtendClientBaseHttpResponse list(String extractorId) { return list(extractorId, ExtractorVersionsListRequest.builder().build()); } @@ -54,7 +54,7 @@ public ExtendClientHttpResponse list(String extra * This endpoint allows you to fetch all versions of a given extractor, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the extractor, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String extractorId, RequestOptions requestOptions) { return list(extractorId, ExtractorVersionsListRequest.builder().build(), requestOptions); } @@ -63,7 +63,7 @@ public ExtendClientHttpResponse list( * This endpoint allows you to fetch all versions of a given extractor, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the extractor, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String extractorId, ExtractorVersionsListRequest request) { return list(extractorId, request, null); } @@ -72,7 +72,7 @@ public ExtendClientHttpResponse list( * This endpoint allows you to fetch all versions of a given extractor, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the extractor, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String extractorId, ExtractorVersionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,7 +114,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractorVersionsListResponse.class), response); } @@ -160,7 +160,7 @@ public ExtendClientHttpResponse list( * This endpoint allows you to publish a new version of an existing extractor. Publishing a new version creates a snapshot of the extractor's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this extractor. You may need to manually update workflows to use the new version if desired.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String extractorId, ExtractorVersionsCreateRequest request) { return create(extractorId, request, null); } @@ -169,7 +169,7 @@ public ExtendClientHttpResponse create( * This endpoint allows you to publish a new version of an existing extractor. Publishing a new version creates a snapshot of the extractor's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this extractor. You may need to manually update workflows to use the new version if desired.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String extractorId, ExtractorVersionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -207,7 +207,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractorVersion.class), response); } try { @@ -251,7 +251,7 @@ public ExtendClientHttpResponse create( /** * Retrieve a specific version of an extractor in Extend */ - public ExtendClientHttpResponse retrieve(String extractorId, String versionId) { + public ExtendClientBaseHttpResponse retrieve(String extractorId, String versionId) { return retrieve( extractorId, versionId, @@ -261,7 +261,7 @@ public ExtendClientHttpResponse retrieve(String extractorId, S /** * Retrieve a specific version of an extractor in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String extractorId, String versionId, RequestOptions requestOptions) { return retrieve( extractorId, @@ -273,7 +273,7 @@ public ExtendClientHttpResponse retrieve( /** * Retrieve a specific version of an extractor in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String extractorId, String versionId, ExtractorVersionsRetrieveRequest request) { return retrieve(extractorId, versionId, request, null); } @@ -281,7 +281,7 @@ public ExtendClientHttpResponse retrieve( /** * Retrieve a specific version of an extractor in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String extractorId, String versionId, ExtractorVersionsRetrieveRequest request, @@ -315,7 +315,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractorVersion.class), response); } try { diff --git a/src/main/java/ai/extend/resources/extractruns/AsyncRawExtractRunsClient.java b/src/main/java/ai/extend/resources/extractruns/AsyncRawExtractRunsClient.java index 30a6463..cde3cf1 100644 --- a/src/main/java/ai/extend/resources/extractruns/AsyncRawExtractRunsClient.java +++ b/src/main/java/ai/extend/resources/extractruns/AsyncRawExtractRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -55,7 +55,7 @@ public AsyncRawExtractRunsClient(ClientOptions clientOptions) { * List all extract runs. *

    Returns a summary of each run. Use GET /extract_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(ExtractRunsListRequest.builder().build()); } @@ -63,7 +63,8 @@ public CompletableFuture> list * List all extract runs. *

    Returns a summary of each run. Use GET /extract_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list( + RequestOptions requestOptions) { return list(ExtractRunsListRequest.builder().build(), requestOptions); } @@ -71,7 +72,8 @@ public CompletableFuture> list * List all extract runs. *

    Returns a summary of each run. Use GET /extract_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list(ExtractRunsListRequest request) { + public CompletableFuture> list( + ExtractRunsListRequest request) { return list(request, null); } @@ -79,7 +81,7 @@ public CompletableFuture> list * List all extract runs. *

    Returns a summary of each run. Use GET /extract_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list( + public CompletableFuture> list( ExtractRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -143,14 +145,14 @@ public CompletableFuture> list if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRunsListResponse.class), response)); return; @@ -222,7 +224,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Extract structured data from a file using an existing extractor or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Extract Run endpoint for results.

    */ - public CompletableFuture> create(ExtractRunsCreateRequest request) { + public CompletableFuture> create(ExtractRunsCreateRequest request) { return create(request, null); } @@ -230,7 +232,7 @@ public CompletableFuture> create(ExtractRun * Extract structured data from a file using an existing extractor or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Extract Run endpoint for results.

    */ - public CompletableFuture> create( + public CompletableFuture> create( ExtractRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -258,14 +260,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRun.class), response)); return; } @@ -336,7 +338,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Retrieve details about a specific extract run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an extract run when using the Create Extract Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, ExtractRunsRetrieveRequest.builder().build()); } @@ -344,7 +346,8 @@ public CompletableFuture> retrieve(String i * Retrieve details about a specific extract run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an extract run when using the Create Extract Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { return retrieve(id, ExtractRunsRetrieveRequest.builder().build(), requestOptions); } @@ -352,7 +355,7 @@ public CompletableFuture> retrieve(String i * Retrieve details about a specific extract run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an extract run when using the Create Extract Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ExtractRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -361,7 +364,7 @@ public CompletableFuture> retrieve( * Retrieve details about a specific extract run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an extract run when using the Create Extract Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ExtractRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -386,14 +389,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRun.class), response)); return; } @@ -464,7 +467,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Delete an extract run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, ExtractRunsDeleteRequest.builder().build()); } @@ -472,7 +475,7 @@ public CompletableFuture> de * Delete an extract run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, ExtractRunsDeleteRequest.builder().build(), requestOptions); } @@ -481,7 +484,7 @@ public CompletableFuture> de * Delete an extract run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, ExtractRunsDeleteRequest request) { return delete(id, request, null); } @@ -490,7 +493,7 @@ public CompletableFuture> de * Delete an extract run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, ExtractRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -515,14 +518,14 @@ public CompletableFuture> de if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ExtractRunsDeleteResponse.class), response)); @@ -595,7 +598,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Cancel an in-progress extract run. *

    Note: Only extract runs with a status of "PROCESSING" can be cancelled. Extractor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id) { + public CompletableFuture> cancel(String id) { return cancel(id, ExtractRunsCancelRequest.builder().build()); } @@ -603,7 +606,8 @@ public CompletableFuture> cancel(String id) * Cancel an in-progress extract run. *

    Note: Only extract runs with a status of "PROCESSING" can be cancelled. Extractor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id, RequestOptions requestOptions) { + public CompletableFuture> cancel( + String id, RequestOptions requestOptions) { return cancel(id, ExtractRunsCancelRequest.builder().build(), requestOptions); } @@ -611,7 +615,8 @@ public CompletableFuture> cancel(String id, * Cancel an in-progress extract run. *

    Note: Only extract runs with a status of "PROCESSING" can be cancelled. Extractor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id, ExtractRunsCancelRequest request) { + public CompletableFuture> cancel( + String id, ExtractRunsCancelRequest request) { return cancel(id, request, null); } @@ -619,7 +624,7 @@ public CompletableFuture> cancel(String id, * Cancel an in-progress extract run. *

    Note: Only extract runs with a status of "PROCESSING" can be cancelled. Extractor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, ExtractRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -645,14 +650,14 @@ public CompletableFuture> cancel( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRun.class), response)); return; } @@ -734,7 +739,8 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *
  • All inputs in a batch use the same extractor version and override config.
  • * */ - public CompletableFuture> createBatch(ExtractRunsCreateBatchRequest request) { + public CompletableFuture> createBatch( + ExtractRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -753,7 +759,7 @@ public CompletableFuture> createBatch(Extract *
  • All inputs in a batch use the same extractor version and override config.
  • * */ - public CompletableFuture> createBatch( + public CompletableFuture> createBatch( ExtractRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -781,14 +787,14 @@ public CompletableFuture> createBatch( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/extractruns/RawExtractRunsClient.java b/src/main/java/ai/extend/resources/extractruns/RawExtractRunsClient.java index c2a814f..ed9c1a9 100644 --- a/src/main/java/ai/extend/resources/extractruns/RawExtractRunsClient.java +++ b/src/main/java/ai/extend/resources/extractruns/RawExtractRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -51,7 +51,7 @@ public RawExtractRunsClient(ClientOptions clientOptions) { * List all extract runs. *

    Returns a summary of each run. Use GET /extract_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(ExtractRunsListRequest.builder().build()); } @@ -59,7 +59,7 @@ public ExtendClientHttpResponse list() { * List all extract runs. *

    Returns a summary of each run. Use GET /extract_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(ExtractRunsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public ExtendClientHttpResponse list(RequestOptions req * List all extract runs. *

    Returns a summary of each run. Use GET /extract_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list(ExtractRunsListRequest request) { + public ExtendClientBaseHttpResponse list(ExtractRunsListRequest request) { return list(request, null); } @@ -75,7 +75,7 @@ public ExtendClientHttpResponse list(ExtractRunsListReq * List all extract runs. *

    Returns a summary of each run. Use GET /extract_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( ExtractRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -143,7 +143,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRunsListResponse.class), response); } @@ -189,7 +189,7 @@ public ExtendClientHttpResponse list( * Extract structured data from a file using an existing extractor or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Extract Run endpoint for results.

    */ - public ExtendClientHttpResponse create(ExtractRunsCreateRequest request) { + public ExtendClientBaseHttpResponse create(ExtractRunsCreateRequest request) { return create(request, null); } @@ -197,7 +197,7 @@ public ExtendClientHttpResponse create(ExtractRunsCreateRequest requ * Extract structured data from a file using an existing extractor or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Extract Run endpoint for results.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( ExtractRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -229,7 +229,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRun.class), response); } try { @@ -274,7 +274,7 @@ public ExtendClientHttpResponse create( * Retrieve details about a specific extract run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an extract run when using the Create Extract Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, ExtractRunsRetrieveRequest.builder().build()); } @@ -282,7 +282,7 @@ public ExtendClientHttpResponse retrieve(String id) { * Retrieve details about a specific extract run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an extract run when using the Create Extract Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, ExtractRunsRetrieveRequest.builder().build(), requestOptions); } @@ -290,7 +290,7 @@ public ExtendClientHttpResponse retrieve(String id, RequestOptions r * Retrieve details about a specific extract run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an extract run when using the Create Extract Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id, ExtractRunsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, ExtractRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -298,7 +298,7 @@ public ExtendClientHttpResponse retrieve(String id, ExtractRunsRetri * Retrieve details about a specific extract run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an extract run when using the Create Extract Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, ExtractRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -327,7 +327,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRun.class), response); } try { @@ -372,7 +372,7 @@ public ExtendClientHttpResponse retrieve( * Delete an extract run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, ExtractRunsDeleteRequest.builder().build()); } @@ -380,7 +380,7 @@ public ExtendClientHttpResponse delete(String id) { * Delete an extract run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete(String id, RequestOptions requestOptions) { return delete(id, ExtractRunsDeleteRequest.builder().build(), requestOptions); } @@ -388,7 +388,7 @@ public ExtendClientHttpResponse delete(String id, Req * Delete an extract run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, ExtractRunsDeleteRequest request) { + public ExtendClientBaseHttpResponse delete(String id, ExtractRunsDeleteRequest request) { return delete(id, request, null); } @@ -396,7 +396,7 @@ public ExtendClientHttpResponse delete(String id, Ext * Delete an extract run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, ExtractRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -425,7 +425,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRunsDeleteResponse.class), response); } @@ -471,7 +471,7 @@ public ExtendClientHttpResponse delete( * Cancel an in-progress extract run. *

    Note: Only extract runs with a status of "PROCESSING" can be cancelled. Extractor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id) { + public ExtendClientBaseHttpResponse cancel(String id) { return cancel(id, ExtractRunsCancelRequest.builder().build()); } @@ -479,7 +479,7 @@ public ExtendClientHttpResponse cancel(String id) { * Cancel an in-progress extract run. *

    Note: Only extract runs with a status of "PROCESSING" can be cancelled. Extractor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse cancel(String id, RequestOptions requestOptions) { return cancel(id, ExtractRunsCancelRequest.builder().build(), requestOptions); } @@ -487,7 +487,7 @@ public ExtendClientHttpResponse cancel(String id, RequestOptions req * Cancel an in-progress extract run. *

    Note: Only extract runs with a status of "PROCESSING" can be cancelled. Extractor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, ExtractRunsCancelRequest request) { + public ExtendClientBaseHttpResponse cancel(String id, ExtractRunsCancelRequest request) { return cancel(id, request, null); } @@ -495,7 +495,7 @@ public ExtendClientHttpResponse cancel(String id, ExtractRunsCancelR * Cancel an in-progress extract run. *

    Note: Only extract runs with a status of "PROCESSING" can be cancelled. Extractor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel( + public ExtendClientBaseHttpResponse cancel( String id, ExtractRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -525,7 +525,7 @@ public ExtendClientHttpResponse cancel( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ExtractRun.class), response); } try { @@ -581,7 +581,7 @@ public ExtendClientHttpResponse cancel( *
  • All inputs in a batch use the same extractor version and override config.
  • * */ - public ExtendClientHttpResponse createBatch(ExtractRunsCreateBatchRequest request) { + public ExtendClientBaseHttpResponse createBatch(ExtractRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -600,7 +600,7 @@ public ExtendClientHttpResponse createBatch(ExtractRunsCreateBatchRequ *
  • All inputs in a batch use the same extractor version and override config.
  • * */ - public ExtendClientHttpResponse createBatch( + public ExtendClientBaseHttpResponse createBatch( ExtractRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -632,7 +632,7 @@ public ExtendClientHttpResponse createBatch( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response); } try { diff --git a/src/main/java/ai/extend/resources/files/AsyncRawFilesClient.java b/src/main/java/ai/extend/resources/files/AsyncRawFilesClient.java index 29ec5a6..4cda711 100644 --- a/src/main/java/ai/extend/resources/files/AsyncRawFilesClient.java +++ b/src/main/java/ai/extend/resources/files/AsyncRawFilesClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; import ai.extend.core.ExtendClientException; -import ai.extend.core.ExtendClientHttpResponse; import ai.extend.core.ObjectMappers; import ai.extend.core.QueryStringMapper; import ai.extend.core.RequestOptions; @@ -53,28 +53,28 @@ public AsyncRawFilesClient(ClientOptions clientOptions) { /** * List files. */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(FilesListRequest.builder().build()); } /** * List files. */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list(RequestOptions requestOptions) { return list(FilesListRequest.builder().build(), requestOptions); } /** * List files. */ - public CompletableFuture> list(FilesListRequest request) { + public CompletableFuture> list(FilesListRequest request) { return list(request, null); } /** * List files. */ - public CompletableFuture> list( + public CompletableFuture> list( FilesListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,14 +114,14 @@ public CompletableFuture> list( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FilesListResponse.class), response)); return; @@ -192,28 +192,28 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Fetch a file by its ID. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, FilesRetrieveRequest.builder().build()); } /** * Fetch a file by its ID. */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { return retrieve(id, FilesRetrieveRequest.builder().build(), requestOptions); } /** * Fetch a file by its ID. */ - public CompletableFuture> retrieve(String id, FilesRetrieveRequest request) { + public CompletableFuture> retrieve(String id, FilesRetrieveRequest request) { return retrieve(id, request, null); } /** * Fetch a file by its ID. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, FilesRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -250,14 +250,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, File.class), response)); return; } @@ -328,7 +328,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Delete a file and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, FilesDeleteRequest.builder().build()); } @@ -336,7 +336,7 @@ public CompletableFuture> delete(S * Delete a file and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, FilesDeleteRequest.builder().build(), requestOptions); } @@ -345,7 +345,7 @@ public CompletableFuture> delete( * Delete a file and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, FilesDeleteRequest request) { return delete(id, request, null); } @@ -354,7 +354,7 @@ public CompletableFuture> delete( * Delete a file and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, FilesDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -379,14 +379,14 @@ public CompletableFuture> delete( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FilesDeleteResponse.class), response)); return; @@ -461,7 +461,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

    Supported file types can be found here.

    *

    This endpoint requires multipart form encoding. Most HTTP clients will handle this encoding automatically (see the examples).

    */ - public CompletableFuture> upload(java.io.File file, FilesUploadRequest request) { + public CompletableFuture> upload(java.io.File file, FilesUploadRequest request) { return upload(file, request, null); } @@ -472,7 +472,7 @@ public CompletableFuture> upload(java.io.File fil *

    Supported file types can be found here.

    *

    This endpoint requires multipart form encoding. Most HTTP clients will handle this encoding automatically (see the examples).

    */ - public CompletableFuture> upload( + public CompletableFuture> upload( java.io.File file, FilesUploadRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -515,14 +515,14 @@ public CompletableFuture> upload( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, File.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/files/RawFilesClient.java b/src/main/java/ai/extend/resources/files/RawFilesClient.java index 365f25c..bad48c8 100644 --- a/src/main/java/ai/extend/resources/files/RawFilesClient.java +++ b/src/main/java/ai/extend/resources/files/RawFilesClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; import ai.extend.core.ExtendClientException; -import ai.extend.core.ExtendClientHttpResponse; import ai.extend.core.ObjectMappers; import ai.extend.core.QueryStringMapper; import ai.extend.core.RequestOptions; @@ -49,28 +49,29 @@ public RawFilesClient(ClientOptions clientOptions) { /** * List files. */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(FilesListRequest.builder().build()); } /** * List files. */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(FilesListRequest.builder().build(), requestOptions); } /** * List files. */ - public ExtendClientHttpResponse list(FilesListRequest request) { + public ExtendClientBaseHttpResponse list(FilesListRequest request) { return list(request, null); } /** * List files. */ - public ExtendClientHttpResponse list(FilesListRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list( + FilesListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("files"); @@ -113,7 +114,7 @@ public ExtendClientHttpResponse list(FilesListRequest request ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FilesListResponse.class), response); } try { @@ -157,28 +158,28 @@ public ExtendClientHttpResponse list(FilesListRequest request /** * Fetch a file by its ID. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, FilesRetrieveRequest.builder().build()); } /** * Fetch a file by its ID. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, FilesRetrieveRequest.builder().build(), requestOptions); } /** * Fetch a file by its ID. */ - public ExtendClientHttpResponse retrieve(String id, FilesRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, FilesRetrieveRequest request) { return retrieve(id, request, null); } /** * Fetch a file by its ID. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, FilesRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -219,7 +220,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, File.class), response); } try { @@ -264,7 +265,7 @@ public ExtendClientHttpResponse retrieve( * Delete a file and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, FilesDeleteRequest.builder().build()); } @@ -272,7 +273,7 @@ public ExtendClientHttpResponse delete(String id) { * Delete a file and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete(String id, RequestOptions requestOptions) { return delete(id, FilesDeleteRequest.builder().build(), requestOptions); } @@ -280,7 +281,7 @@ public ExtendClientHttpResponse delete(String id, RequestOp * Delete a file and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, FilesDeleteRequest request) { + public ExtendClientBaseHttpResponse delete(String id, FilesDeleteRequest request) { return delete(id, request, null); } @@ -288,7 +289,7 @@ public ExtendClientHttpResponse delete(String id, FilesDele * Delete a file and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, FilesDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -317,7 +318,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, FilesDeleteResponse.class), response); } try { @@ -365,7 +366,7 @@ public ExtendClientHttpResponse delete( *

    Supported file types can be found here.

    *

    This endpoint requires multipart form encoding. Most HTTP clients will handle this encoding automatically (see the examples).

    */ - public ExtendClientHttpResponse upload(java.io.File file, FilesUploadRequest request) { + public ExtendClientBaseHttpResponse upload(java.io.File file, FilesUploadRequest request) { return upload(file, request, null); } @@ -376,7 +377,7 @@ public ExtendClientHttpResponse upload(java.io.File file, FilesUploadReque *

    Supported file types can be found here.

    *

    This endpoint requires multipart form encoding. Most HTTP clients will handle this encoding automatically (see the examples).

    */ - public ExtendClientHttpResponse upload( + public ExtendClientBaseHttpResponse upload( java.io.File file, FilesUploadRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -423,7 +424,7 @@ public ExtendClientHttpResponse upload( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, File.class), response); } try { diff --git a/src/main/java/ai/extend/resources/parseruns/AsyncRawParseRunsClient.java b/src/main/java/ai/extend/resources/parseruns/AsyncRawParseRunsClient.java index 9b41ec6..7f6bb71 100644 --- a/src/main/java/ai/extend/resources/parseruns/AsyncRawParseRunsClient.java +++ b/src/main/java/ai/extend/resources/parseruns/AsyncRawParseRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -55,7 +55,7 @@ public AsyncRawParseRunsClient(ClientOptions clientOptions) { * List parse runs, with optional filters for status, batch ID, source, and file name. *

    Returns a paginated list of parse runs. Use GET /parse_runs/{id} to retrieve the full result including output for a specific run.

    */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(ParseRunsListRequest.builder().build()); } @@ -63,7 +63,7 @@ public CompletableFuture> list() * List parse runs, with optional filters for status, batch ID, source, and file name. *

    Returns a paginated list of parse runs. Use GET /parse_runs/{id} to retrieve the full result including output for a specific run.

    */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list(RequestOptions requestOptions) { return list(ParseRunsListRequest.builder().build(), requestOptions); } @@ -71,7 +71,7 @@ public CompletableFuture> list(R * List parse runs, with optional filters for status, batch ID, source, and file name. *

    Returns a paginated list of parse runs. Use GET /parse_runs/{id} to retrieve the full result including output for a specific run.

    */ - public CompletableFuture> list(ParseRunsListRequest request) { + public CompletableFuture> list(ParseRunsListRequest request) { return list(request, null); } @@ -79,7 +79,7 @@ public CompletableFuture> list(P * List parse runs, with optional filters for status, batch ID, source, and file name. *

    Returns a paginated list of parse runs. Use GET /parse_runs/{id} to retrieve the full result including output for a specific run.

    */ - public CompletableFuture> list( + public CompletableFuture> list( ParseRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -131,14 +131,14 @@ public CompletableFuture> list( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRunsListResponse.class), response)); return; @@ -211,7 +211,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

    The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.

    *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Parse Run endpoint for results.

    */ - public CompletableFuture> create(ParseRunsCreateRequest request) { + public CompletableFuture> create(ParseRunsCreateRequest request) { return create(request, null); } @@ -220,7 +220,7 @@ public CompletableFuture> create(ParseRunsCre *

    The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.

    *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Parse Run endpoint for results.

    */ - public CompletableFuture> create( + public CompletableFuture> create( ParseRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -248,14 +248,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRun.class), response)); return; } @@ -326,7 +326,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Retrieve the status and results of a parse run. *

    Use this endpoint to get results for a parse run that has already completed, or to check on the status of a parse run initiated by the Create Parse Run endpoint.

    */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, ParseRunsRetrieveRequest.builder().build()); } @@ -334,7 +334,8 @@ public CompletableFuture> retrieve(String id) * Retrieve the status and results of a parse run. *

    Use this endpoint to get results for a parse run that has already completed, or to check on the status of a parse run initiated by the Create Parse Run endpoint.

    */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { return retrieve(id, ParseRunsRetrieveRequest.builder().build(), requestOptions); } @@ -342,7 +343,8 @@ public CompletableFuture> retrieve(String id, * Retrieve the status and results of a parse run. *

    Use this endpoint to get results for a parse run that has already completed, or to check on the status of a parse run initiated by the Create Parse Run endpoint.

    */ - public CompletableFuture> retrieve(String id, ParseRunsRetrieveRequest request) { + public CompletableFuture> retrieve( + String id, ParseRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -350,7 +352,7 @@ public CompletableFuture> retrieve(String id, * Retrieve the status and results of a parse run. *

    Use this endpoint to get results for a parse run that has already completed, or to check on the status of a parse run initiated by the Create Parse Run endpoint.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, ParseRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -379,14 +381,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRun.class), response)); return; } @@ -457,7 +459,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Delete a parse run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, ParseRunsDeleteRequest.builder().build()); } @@ -465,7 +467,7 @@ public CompletableFuture> dele * Delete a parse run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, ParseRunsDeleteRequest.builder().build(), requestOptions); } @@ -474,7 +476,7 @@ public CompletableFuture> dele * Delete a parse run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, ParseRunsDeleteRequest request) { return delete(id, request, null); } @@ -483,7 +485,7 @@ public CompletableFuture> dele * Delete a parse run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, ParseRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -508,14 +510,14 @@ public CompletableFuture> dele if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRunsDeleteResponse.class), response)); return; @@ -587,7 +589,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Cancel an in-progress parse run. *

    Note: Only parse runs with a status of "PROCESSING" can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id) { + public CompletableFuture> cancel(String id) { return cancel(id, ParseRunsCancelRequest.builder().build()); } @@ -595,7 +597,7 @@ public CompletableFuture> cancel(String id) { * Cancel an in-progress parse run. *

    Note: Only parse runs with a status of "PROCESSING" can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id, RequestOptions requestOptions) { + public CompletableFuture> cancel(String id, RequestOptions requestOptions) { return cancel(id, ParseRunsCancelRequest.builder().build(), requestOptions); } @@ -603,7 +605,7 @@ public CompletableFuture> cancel(String id, R * Cancel an in-progress parse run. *

    Note: Only parse runs with a status of "PROCESSING" can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id, ParseRunsCancelRequest request) { + public CompletableFuture> cancel(String id, ParseRunsCancelRequest request) { return cancel(id, request, null); } @@ -611,7 +613,7 @@ public CompletableFuture> cancel(String id, P * Cancel an in-progress parse run. *

    Note: Only parse runs with a status of "PROCESSING" can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, ParseRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -637,14 +639,14 @@ public CompletableFuture> cancel( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRun.class), response)); return; } @@ -725,7 +727,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *
  • File input supports URLs, Extend file IDs, and raw text strings.
  • * */ - public CompletableFuture> createBatch(ParseRunsCreateBatchRequest request) { + public CompletableFuture> createBatch(ParseRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -743,7 +745,7 @@ public CompletableFuture> createBatch(ParseRu *
  • File input supports URLs, Extend file IDs, and raw text strings.
  • * */ - public CompletableFuture> createBatch( + public CompletableFuture> createBatch( ParseRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -771,14 +773,14 @@ public CompletableFuture> createBatch( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/parseruns/RawParseRunsClient.java b/src/main/java/ai/extend/resources/parseruns/RawParseRunsClient.java index 4541f6f..4519067 100644 --- a/src/main/java/ai/extend/resources/parseruns/RawParseRunsClient.java +++ b/src/main/java/ai/extend/resources/parseruns/RawParseRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -51,7 +51,7 @@ public RawParseRunsClient(ClientOptions clientOptions) { * List parse runs, with optional filters for status, batch ID, source, and file name. *

    Returns a paginated list of parse runs. Use GET /parse_runs/{id} to retrieve the full result including output for a specific run.

    */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(ParseRunsListRequest.builder().build()); } @@ -59,7 +59,7 @@ public ExtendClientHttpResponse list() { * List parse runs, with optional filters for status, batch ID, source, and file name. *

    Returns a paginated list of parse runs. Use GET /parse_runs/{id} to retrieve the full result including output for a specific run.

    */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(ParseRunsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public ExtendClientHttpResponse list(RequestOptions reque * List parse runs, with optional filters for status, batch ID, source, and file name. *

    Returns a paginated list of parse runs. Use GET /parse_runs/{id} to retrieve the full result including output for a specific run.

    */ - public ExtendClientHttpResponse list(ParseRunsListRequest request) { + public ExtendClientBaseHttpResponse list(ParseRunsListRequest request) { return list(request, null); } @@ -75,7 +75,7 @@ public ExtendClientHttpResponse list(ParseRunsListRequest * List parse runs, with optional filters for status, batch ID, source, and file name. *

    Returns a paginated list of parse runs. Use GET /parse_runs/{id} to retrieve the full result including output for a specific run.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( ParseRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -131,7 +131,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRunsListResponse.class), response); } try { @@ -177,7 +177,7 @@ public ExtendClientHttpResponse list( *

    The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.

    *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Parse Run endpoint for results.

    */ - public ExtendClientHttpResponse create(ParseRunsCreateRequest request) { + public ExtendClientBaseHttpResponse create(ParseRunsCreateRequest request) { return create(request, null); } @@ -186,7 +186,8 @@ public ExtendClientHttpResponse create(ParseRunsCreateRequest request) *

    The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.

    *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Parse Run endpoint for results.

    */ - public ExtendClientHttpResponse create(ParseRunsCreateRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse create( + ParseRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("parse_runs"); @@ -217,7 +218,7 @@ public ExtendClientHttpResponse create(ParseRunsCreateRequest request, ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRun.class), response); } try { @@ -262,7 +263,7 @@ public ExtendClientHttpResponse create(ParseRunsCreateRequest request, * Retrieve the status and results of a parse run. *

    Use this endpoint to get results for a parse run that has already completed, or to check on the status of a parse run initiated by the Create Parse Run endpoint.

    */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, ParseRunsRetrieveRequest.builder().build()); } @@ -270,7 +271,7 @@ public ExtendClientHttpResponse retrieve(String id) { * Retrieve the status and results of a parse run. *

    Use this endpoint to get results for a parse run that has already completed, or to check on the status of a parse run initiated by the Create Parse Run endpoint.

    */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, ParseRunsRetrieveRequest.builder().build(), requestOptions); } @@ -278,7 +279,7 @@ public ExtendClientHttpResponse retrieve(String id, RequestOptions req * Retrieve the status and results of a parse run. *

    Use this endpoint to get results for a parse run that has already completed, or to check on the status of a parse run initiated by the Create Parse Run endpoint.

    */ - public ExtendClientHttpResponse retrieve(String id, ParseRunsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, ParseRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -286,7 +287,7 @@ public ExtendClientHttpResponse retrieve(String id, ParseRunsRetrieveR * Retrieve the status and results of a parse run. *

    Use this endpoint to get results for a parse run that has already completed, or to check on the status of a parse run initiated by the Create Parse Run endpoint.

    */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, ParseRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -319,7 +320,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRun.class), response); } try { @@ -364,7 +365,7 @@ public ExtendClientHttpResponse retrieve( * Delete a parse run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, ParseRunsDeleteRequest.builder().build()); } @@ -372,7 +373,7 @@ public ExtendClientHttpResponse delete(String id) { * Delete a parse run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete(String id, RequestOptions requestOptions) { return delete(id, ParseRunsDeleteRequest.builder().build(), requestOptions); } @@ -380,7 +381,7 @@ public ExtendClientHttpResponse delete(String id, Reque * Delete a parse run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, ParseRunsDeleteRequest request) { + public ExtendClientBaseHttpResponse delete(String id, ParseRunsDeleteRequest request) { return delete(id, request, null); } @@ -388,7 +389,7 @@ public ExtendClientHttpResponse delete(String id, Parse * Delete a parse run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, ParseRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -417,7 +418,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRunsDeleteResponse.class), response); } @@ -463,7 +464,7 @@ public ExtendClientHttpResponse delete( * Cancel an in-progress parse run. *

    Note: Only parse runs with a status of "PROCESSING" can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id) { + public ExtendClientBaseHttpResponse cancel(String id) { return cancel(id, ParseRunsCancelRequest.builder().build()); } @@ -471,7 +472,7 @@ public ExtendClientHttpResponse cancel(String id) { * Cancel an in-progress parse run. *

    Note: Only parse runs with a status of "PROCESSING" can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse cancel(String id, RequestOptions requestOptions) { return cancel(id, ParseRunsCancelRequest.builder().build(), requestOptions); } @@ -479,7 +480,7 @@ public ExtendClientHttpResponse cancel(String id, RequestOptions reque * Cancel an in-progress parse run. *

    Note: Only parse runs with a status of "PROCESSING" can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, ParseRunsCancelRequest request) { + public ExtendClientBaseHttpResponse cancel(String id, ParseRunsCancelRequest request) { return cancel(id, request, null); } @@ -487,7 +488,7 @@ public ExtendClientHttpResponse cancel(String id, ParseRunsCancelReque * Cancel an in-progress parse run. *

    Note: Only parse runs with a status of "PROCESSING" can be cancelled. Parse runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel( + public ExtendClientBaseHttpResponse cancel( String id, ParseRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -517,7 +518,7 @@ public ExtendClientHttpResponse cancel( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ParseRun.class), response); } try { @@ -572,7 +573,7 @@ public ExtendClientHttpResponse cancel( *
  • File input supports URLs, Extend file IDs, and raw text strings.
  • * */ - public ExtendClientHttpResponse createBatch(ParseRunsCreateBatchRequest request) { + public ExtendClientBaseHttpResponse createBatch(ParseRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -590,7 +591,7 @@ public ExtendClientHttpResponse createBatch(ParseRunsCreateBatchReques *
  • File input supports URLs, Extend file IDs, and raw text strings.
  • * */ - public ExtendClientHttpResponse createBatch( + public ExtendClientBaseHttpResponse createBatch( ParseRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -622,7 +623,7 @@ public ExtendClientHttpResponse createBatch( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response); } try { diff --git a/src/main/java/ai/extend/resources/processor/AsyncRawProcessorClient.java b/src/main/java/ai/extend/resources/processor/AsyncRawProcessorClient.java index fd2cba0..b541e3f 100644 --- a/src/main/java/ai/extend/resources/processor/AsyncRawProcessorClient.java +++ b/src/main/java/ai/extend/resources/processor/AsyncRawProcessorClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -46,14 +46,14 @@ public AsyncRawProcessorClient(ClientOptions clientOptions) { /** * List all processors in your organization */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(ProcessorListRequest.builder().build()); } /** * List all processors in your organization */ - public CompletableFuture> list( + public CompletableFuture> list( RequestOptions requestOptions) { return list(ProcessorListRequest.builder().build(), requestOptions); } @@ -61,7 +61,7 @@ public CompletableFuture> /** * List all processors in your organization */ - public CompletableFuture> list( + public CompletableFuture> list( ProcessorListRequest request) { return list(request, null); } @@ -69,7 +69,7 @@ public CompletableFuture> /** * List all processors in your organization */ - public CompletableFuture> list( + public CompletableFuture> list( ProcessorListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -113,14 +113,15 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, LegacyListProcessorsResponse.class), response)); @@ -172,14 +173,15 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Create a new processor in Extend, optionally cloning from an existing processor */ - public CompletableFuture> create(ProcessorCreateRequest request) { + public CompletableFuture> create( + ProcessorCreateRequest request) { return create(request, null); } /** * Create a new processor in Extend, optionally cloning from an existing processor */ - public CompletableFuture> create( + public CompletableFuture> create( ProcessorCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -207,14 +209,14 @@ public CompletableFuture> crea if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorCreateResponse.class), response)); return; @@ -260,14 +262,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Update an existing processor in Extend */ - public CompletableFuture> update(String id) { + public CompletableFuture> update(String id) { return update(id, ProcessorUpdateRequest.builder().build()); } /** * Update an existing processor in Extend */ - public CompletableFuture> update( + public CompletableFuture> update( String id, RequestOptions requestOptions) { return update(id, ProcessorUpdateRequest.builder().build(), requestOptions); } @@ -275,7 +277,7 @@ public CompletableFuture> upda /** * Update an existing processor in Extend */ - public CompletableFuture> update( + public CompletableFuture> update( String id, ProcessorUpdateRequest request) { return update(id, request, null); } @@ -283,7 +285,7 @@ public CompletableFuture> upda /** * Update an existing processor in Extend */ - public CompletableFuture> update( + public CompletableFuture> update( String id, ProcessorUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -316,14 +318,14 @@ public CompletableFuture> upda if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorUpdateResponse.class), response)); return; diff --git a/src/main/java/ai/extend/resources/processor/RawProcessorClient.java b/src/main/java/ai/extend/resources/processor/RawProcessorClient.java index 8232225..1b09a71 100644 --- a/src/main/java/ai/extend/resources/processor/RawProcessorClient.java +++ b/src/main/java/ai/extend/resources/processor/RawProcessorClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -42,28 +42,28 @@ public RawProcessorClient(ClientOptions clientOptions) { /** * List all processors in your organization */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(ProcessorListRequest.builder().build()); } /** * List all processors in your organization */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(ProcessorListRequest.builder().build(), requestOptions); } /** * List all processors in your organization */ - public ExtendClientHttpResponse list(ProcessorListRequest request) { + public ExtendClientBaseHttpResponse list(ProcessorListRequest request) { return list(request, null); } /** * List all processors in your organization */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( ProcessorListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -111,7 +111,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LegacyListProcessorsResponse.class), response); } @@ -144,14 +144,14 @@ public ExtendClientHttpResponse list( /** * Create a new processor in Extend, optionally cloning from an existing processor */ - public ExtendClientHttpResponse create(ProcessorCreateRequest request) { + public ExtendClientBaseHttpResponse create(ProcessorCreateRequest request) { return create(request, null); } /** * Create a new processor in Extend, optionally cloning from an existing processor */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( ProcessorCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -183,7 +183,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorCreateResponse.class), response); } @@ -213,28 +213,28 @@ public ExtendClientHttpResponse create( /** * Update an existing processor in Extend */ - public ExtendClientHttpResponse update(String id) { + public ExtendClientBaseHttpResponse update(String id) { return update(id, ProcessorUpdateRequest.builder().build()); } /** * Update an existing processor in Extend */ - public ExtendClientHttpResponse update(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse update(String id, RequestOptions requestOptions) { return update(id, ProcessorUpdateRequest.builder().build(), requestOptions); } /** * Update an existing processor in Extend */ - public ExtendClientHttpResponse update(String id, ProcessorUpdateRequest request) { + public ExtendClientBaseHttpResponse update(String id, ProcessorUpdateRequest request) { return update(id, request, null); } /** * Update an existing processor in Extend */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String id, ProcessorUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -271,7 +271,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorUpdateResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/processorrun/AsyncRawProcessorRunClient.java b/src/main/java/ai/extend/resources/processorrun/AsyncRawProcessorRunClient.java index 543e0df..da1d750 100644 --- a/src/main/java/ai/extend/resources/processorrun/AsyncRawProcessorRunClient.java +++ b/src/main/java/ai/extend/resources/processorrun/AsyncRawProcessorRunClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -50,28 +50,30 @@ public AsyncRawProcessorRunClient(ClientOptions clientOptions) { /** * List runs of a Processor. A ProcessorRun represents a single execution of a processor against a file. */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(ProcessorRunListRequest.builder().build()); } /** * List runs of a Processor. A ProcessorRun represents a single execution of a processor against a file. */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list( + RequestOptions requestOptions) { return list(ProcessorRunListRequest.builder().build(), requestOptions); } /** * List runs of a Processor. A ProcessorRun represents a single execution of a processor against a file. */ - public CompletableFuture> list(ProcessorRunListRequest request) { + public CompletableFuture> list( + ProcessorRunListRequest request) { return list(request, null); } /** * List runs of a Processor. A ProcessorRun represents a single execution of a processor against a file. */ - public CompletableFuture> list( + public CompletableFuture> list( ProcessorRunListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -135,14 +137,14 @@ public CompletableFuture> lis if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorRunListResponse.class), response)); return; @@ -193,7 +195,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *
  • Or you can poll the get endpoint for updates on the status of the processor run.
  • * */ - public CompletableFuture> create( + public CompletableFuture> create( ProcessorRunCreateRequest request) { return create(request, null); } @@ -211,7 +213,7 @@ public CompletableFuture> c *
  • Or you can poll the get endpoint for updates on the status of the processor run.
  • * */ - public CompletableFuture> create( + public CompletableFuture> create( ProcessorRunCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -239,14 +241,14 @@ public CompletableFuture> c if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ProcessorRunCreateResponse.class), response)); @@ -299,7 +301,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Retrieve details about a specific processor run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an async processor run when using the Run Processor endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> get(String id) { + public CompletableFuture> get(String id) { return get(id, ProcessorRunGetRequest.builder().build()); } @@ -307,7 +309,7 @@ public CompletableFuture> get( * Retrieve details about a specific processor run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an async processor run when using the Run Processor endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> get( + public CompletableFuture> get( String id, RequestOptions requestOptions) { return get(id, ProcessorRunGetRequest.builder().build(), requestOptions); } @@ -316,7 +318,7 @@ public CompletableFuture> get( * Retrieve details about a specific processor run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an async processor run when using the Run Processor endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> get( + public CompletableFuture> get( String id, ProcessorRunGetRequest request) { return get(id, request, null); } @@ -325,7 +327,7 @@ public CompletableFuture> get( * Retrieve details about a specific processor run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an async processor run when using the Run Processor endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> get( + public CompletableFuture> get( String id, ProcessorRunGetRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -350,14 +352,14 @@ public CompletableFuture> get( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorRunGetResponse.class), response)); return; @@ -404,7 +406,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, ProcessorRunDeleteRequest.builder().build()); } @@ -412,7 +414,7 @@ public CompletableFuture> d * Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, ProcessorRunDeleteRequest.builder().build(), requestOptions); } @@ -421,7 +423,7 @@ public CompletableFuture> d * Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, ProcessorRunDeleteRequest request) { return delete(id, request, null); } @@ -430,7 +432,7 @@ public CompletableFuture> d * Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, ProcessorRunDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -455,14 +457,14 @@ public CompletableFuture> d if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ProcessorRunDeleteResponse.class), response)); @@ -505,7 +507,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress. *

    Note: Only processor runs with a status of "PROCESSING" can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id) { + public CompletableFuture> cancel(String id) { return cancel(id, ProcessorRunCancelRequest.builder().build()); } @@ -513,7 +515,7 @@ public CompletableFuture> c * Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress. *

    Note: Only processor runs with a status of "PROCESSING" can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, RequestOptions requestOptions) { return cancel(id, ProcessorRunCancelRequest.builder().build(), requestOptions); } @@ -522,7 +524,7 @@ public CompletableFuture> c * Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress. *

    Note: Only processor runs with a status of "PROCESSING" can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, ProcessorRunCancelRequest request) { return cancel(id, request, null); } @@ -531,7 +533,7 @@ public CompletableFuture> c * Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress. *

    Note: Only processor runs with a status of "PROCESSING" can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, ProcessorRunCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -557,14 +559,14 @@ public CompletableFuture> c if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ProcessorRunCancelResponse.class), response)); diff --git a/src/main/java/ai/extend/resources/processorrun/RawProcessorRunClient.java b/src/main/java/ai/extend/resources/processorrun/RawProcessorRunClient.java index de2451c..73bd160 100644 --- a/src/main/java/ai/extend/resources/processorrun/RawProcessorRunClient.java +++ b/src/main/java/ai/extend/resources/processorrun/RawProcessorRunClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -46,28 +46,28 @@ public RawProcessorRunClient(ClientOptions clientOptions) { /** * List runs of a Processor. A ProcessorRun represents a single execution of a processor against a file. */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(ProcessorRunListRequest.builder().build()); } /** * List runs of a Processor. A ProcessorRun represents a single execution of a processor against a file. */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(ProcessorRunListRequest.builder().build(), requestOptions); } /** * List runs of a Processor. A ProcessorRun represents a single execution of a processor against a file. */ - public ExtendClientHttpResponse list(ProcessorRunListRequest request) { + public ExtendClientBaseHttpResponse list(ProcessorRunListRequest request) { return list(request, null); } /** * List runs of a Processor. A ProcessorRun represents a single execution of a processor against a file. */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( ProcessorRunListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -135,7 +135,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorRunListResponse.class), response); } @@ -172,7 +172,7 @@ public ExtendClientHttpResponse list( *
  • Or you can poll the get endpoint for updates on the status of the processor run.
  • * */ - public ExtendClientHttpResponse create(ProcessorRunCreateRequest request) { + public ExtendClientBaseHttpResponse create(ProcessorRunCreateRequest request) { return create(request, null); } @@ -189,7 +189,7 @@ public ExtendClientHttpResponse create(ProcessorRunC *
  • Or you can poll the get endpoint for updates on the status of the processor run.
  • * */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( ProcessorRunCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -221,7 +221,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorRunCreateResponse.class), response); } @@ -255,7 +255,7 @@ public ExtendClientHttpResponse create( * Retrieve details about a specific processor run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an async processor run when using the Run Processor endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse get(String id) { + public ExtendClientBaseHttpResponse get(String id) { return get(id, ProcessorRunGetRequest.builder().build()); } @@ -263,7 +263,7 @@ public ExtendClientHttpResponse get(String id) { * Retrieve details about a specific processor run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an async processor run when using the Run Processor endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse get(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse get(String id, RequestOptions requestOptions) { return get(id, ProcessorRunGetRequest.builder().build(), requestOptions); } @@ -271,7 +271,7 @@ public ExtendClientHttpResponse get(String id, RequestO * Retrieve details about a specific processor run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an async processor run when using the Run Processor endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse get(String id, ProcessorRunGetRequest request) { + public ExtendClientBaseHttpResponse get(String id, ProcessorRunGetRequest request) { return get(id, request, null); } @@ -279,7 +279,7 @@ public ExtendClientHttpResponse get(String id, Processo * Retrieve details about a specific processor run, including its status, outputs, and any edits made during review. *

    A common use case for this endpoint is to poll for the status and final output of an async processor run when using the Run Processor endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse get( + public ExtendClientBaseHttpResponse get( String id, ProcessorRunGetRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -308,7 +308,7 @@ public ExtendClientHttpResponse get( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorRunGetResponse.class), response); } @@ -339,7 +339,7 @@ public ExtendClientHttpResponse get( * Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, ProcessorRunDeleteRequest.builder().build()); } @@ -347,7 +347,7 @@ public ExtendClientHttpResponse delete(String id) { * Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete(String id, RequestOptions requestOptions) { return delete(id, ProcessorRunDeleteRequest.builder().build(), requestOptions); } @@ -355,7 +355,8 @@ public ExtendClientHttpResponse delete(String id, Re * Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, ProcessorRunDeleteRequest request) { + public ExtendClientBaseHttpResponse delete( + String id, ProcessorRunDeleteRequest request) { return delete(id, request, null); } @@ -363,7 +364,7 @@ public ExtendClientHttpResponse delete(String id, Pr * Delete a processor run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, ProcessorRunDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -392,7 +393,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorRunDeleteResponse.class), response); } @@ -420,7 +421,7 @@ public ExtendClientHttpResponse delete( * Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress. *

    Note: Only processor runs with a status of "PROCESSING" can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id) { + public ExtendClientBaseHttpResponse cancel(String id) { return cancel(id, ProcessorRunCancelRequest.builder().build()); } @@ -428,7 +429,7 @@ public ExtendClientHttpResponse cancel(String id) { * Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress. *

    Note: Only processor runs with a status of "PROCESSING" can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse cancel(String id, RequestOptions requestOptions) { return cancel(id, ProcessorRunCancelRequest.builder().build(), requestOptions); } @@ -436,7 +437,8 @@ public ExtendClientHttpResponse cancel(String id, Re * Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress. *

    Note: Only processor runs with a status of "PROCESSING" can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, ProcessorRunCancelRequest request) { + public ExtendClientBaseHttpResponse cancel( + String id, ProcessorRunCancelRequest request) { return cancel(id, request, null); } @@ -444,7 +446,7 @@ public ExtendClientHttpResponse cancel(String id, Pr * Cancel a running processor run by its ID. This endpoint allows you to stop a processor run that is currently in progress. *

    Note: Only processor runs with a status of "PROCESSING" can be cancelled. Processor runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel( + public ExtendClientBaseHttpResponse cancel( String id, ProcessorRunCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -474,7 +476,7 @@ public ExtendClientHttpResponse cancel( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorRunCancelResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/processorversion/AsyncRawProcessorVersionClient.java b/src/main/java/ai/extend/resources/processorversion/AsyncRawProcessorVersionClient.java index e8110dc..3b13b9f 100644 --- a/src/main/java/ai/extend/resources/processorversion/AsyncRawProcessorVersionClient.java +++ b/src/main/java/ai/extend/resources/processorversion/AsyncRawProcessorVersionClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -45,7 +45,7 @@ public AsyncRawProcessorVersionClient(ClientOptions clientOptions) { *

    Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation. * The draft 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.

    */ - public CompletableFuture> list(String id) { + public CompletableFuture> list(String id) { return list(id, ProcessorVersionListRequest.builder().build()); } @@ -54,7 +54,7 @@ public CompletableFuture> *

    Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation. * The draft 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.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String id, RequestOptions requestOptions) { return list(id, ProcessorVersionListRequest.builder().build(), requestOptions); } @@ -64,7 +64,7 @@ public CompletableFuture> *

    Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation. * The draft 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.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String id, ProcessorVersionListRequest request) { return list(id, request, null); } @@ -74,7 +74,7 @@ public CompletableFuture> *

    Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation. * The draft 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.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String id, ProcessorVersionListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -100,14 +100,15 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ProcessorVersionListResponse.class), response)); @@ -155,7 +156,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException 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. *

    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.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String id, ProcessorVersionCreateRequest request) { return create(id, request, null); } @@ -164,7 +165,7 @@ public CompletableFuturePublishing 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.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String id, ProcessorVersionCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -198,14 +199,15 @@ public CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ProcessorVersionCreateResponse.class), response)); @@ -247,7 +249,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Retrieve a specific version of a processor in Extend */ - public CompletableFuture> get( + public CompletableFuture> get( String processorId, String processorVersionId) { return get( processorId, @@ -258,7 +260,7 @@ public CompletableFuture> /** * Retrieve a specific version of a processor in Extend */ - public CompletableFuture> get( + public CompletableFuture> get( String processorId, String processorVersionId, RequestOptions requestOptions) { return get( processorId, @@ -270,7 +272,7 @@ public CompletableFuture> /** * Retrieve a specific version of a processor in Extend */ - public CompletableFuture> get( + public CompletableFuture> get( String processorId, String processorVersionId, ProcessorVersionGetRequest request) { return get(processorId, processorVersionId, request, null); } @@ -278,7 +280,7 @@ public CompletableFuture> /** * Retrieve a specific version of a processor in Extend */ - public CompletableFuture> get( + public CompletableFuture> get( String processorId, String processorVersionId, ProcessorVersionGetRequest request, @@ -308,14 +310,14 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, ProcessorVersionGetResponse.class), response)); diff --git a/src/main/java/ai/extend/resources/processorversion/RawProcessorVersionClient.java b/src/main/java/ai/extend/resources/processorversion/RawProcessorVersionClient.java index efc38c6..6fbc52e 100644 --- a/src/main/java/ai/extend/resources/processorversion/RawProcessorVersionClient.java +++ b/src/main/java/ai/extend/resources/processorversion/RawProcessorVersionClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -41,7 +41,7 @@ public RawProcessorVersionClient(ClientOptions clientOptions) { *

    Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation. * The draft 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.

    */ - public ExtendClientHttpResponse list(String id) { + public ExtendClientBaseHttpResponse list(String id) { return list(id, ProcessorVersionListRequest.builder().build()); } @@ -50,7 +50,7 @@ public ExtendClientHttpResponse list(String id) { *

    Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation. * The draft 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.

    */ - public ExtendClientHttpResponse list(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(String id, RequestOptions requestOptions) { return list(id, ProcessorVersionListRequest.builder().build(), requestOptions); } @@ -59,7 +59,8 @@ public ExtendClientHttpResponse list(String id, Re *

    Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation. * The draft 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.

    */ - public ExtendClientHttpResponse list(String id, ProcessorVersionListRequest request) { + public ExtendClientBaseHttpResponse list( + String id, ProcessorVersionListRequest request) { return list(id, request, null); } @@ -68,7 +69,7 @@ public ExtendClientHttpResponse list(String id, Pr *

    Versions are typically returned in descending order of creation (newest first), but this should be confirmed in the actual implementation. * The draft 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.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String id, ProcessorVersionListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -98,7 +99,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorVersionListResponse.class), response); } @@ -129,7 +130,7 @@ public ExtendClientHttpResponse list( * 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. *

    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.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String id, ProcessorVersionCreateRequest request) { return create(id, request, null); } @@ -138,7 +139,7 @@ public ExtendClientHttpResponse create( * 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. *

    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.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String id, ProcessorVersionCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -176,7 +177,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorVersionCreateResponse.class), response); } @@ -203,7 +204,8 @@ public ExtendClientHttpResponse create( /** * Retrieve a specific version of a processor in Extend */ - public ExtendClientHttpResponse get(String processorId, String processorVersionId) { + public ExtendClientBaseHttpResponse get( + String processorId, String processorVersionId) { return get( processorId, processorVersionId, @@ -213,7 +215,7 @@ public ExtendClientHttpResponse get(String processo /** * Retrieve a specific version of a processor in Extend */ - public ExtendClientHttpResponse get( + public ExtendClientBaseHttpResponse get( String processorId, String processorVersionId, RequestOptions requestOptions) { return get( processorId, @@ -225,7 +227,7 @@ public ExtendClientHttpResponse get( /** * Retrieve a specific version of a processor in Extend */ - public ExtendClientHttpResponse get( + public ExtendClientBaseHttpResponse get( String processorId, String processorVersionId, ProcessorVersionGetRequest request) { return get(processorId, processorVersionId, request, null); } @@ -233,7 +235,7 @@ public ExtendClientHttpResponse get( /** * Retrieve a specific version of a processor in Extend */ - public ExtendClientHttpResponse get( + public ExtendClientBaseHttpResponse get( String processorId, String processorVersionId, ProcessorVersionGetRequest request, @@ -267,7 +269,7 @@ public ExtendClientHttpResponse get( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ProcessorVersionGetResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/splitruns/AsyncRawSplitRunsClient.java b/src/main/java/ai/extend/resources/splitruns/AsyncRawSplitRunsClient.java index 4de6459..8f995c9 100644 --- a/src/main/java/ai/extend/resources/splitruns/AsyncRawSplitRunsClient.java +++ b/src/main/java/ai/extend/resources/splitruns/AsyncRawSplitRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -55,7 +55,7 @@ public AsyncRawSplitRunsClient(ClientOptions clientOptions) { * List all split runs. *

    Returns a summary of each run. Use GET /split_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(SplitRunsListRequest.builder().build()); } @@ -63,7 +63,7 @@ public CompletableFuture> list() * List all split runs. *

    Returns a summary of each run. Use GET /split_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list(RequestOptions requestOptions) { return list(SplitRunsListRequest.builder().build(), requestOptions); } @@ -71,7 +71,7 @@ public CompletableFuture> list(R * List all split runs. *

    Returns a summary of each run. Use GET /split_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list(SplitRunsListRequest request) { + public CompletableFuture> list(SplitRunsListRequest request) { return list(request, null); } @@ -79,7 +79,7 @@ public CompletableFuture> list(S * List all split runs. *

    Returns a summary of each run. Use GET /split_runs/{id} to retrieve the full object including output and config.

    */ - public CompletableFuture> list( + public CompletableFuture> list( SplitRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -143,14 +143,14 @@ public CompletableFuture> list( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRunsListResponse.class), response)); return; @@ -222,7 +222,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Split a document into multiple parts using an existing splitter or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Split Run endpoint for results.

    */ - public CompletableFuture> create(SplitRunsCreateRequest request) { + public CompletableFuture> create(SplitRunsCreateRequest request) { return create(request, null); } @@ -230,7 +230,7 @@ public CompletableFuture> create(SplitRunsCre * Split a document into multiple parts using an existing splitter or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Split Run endpoint for results.

    */ - public CompletableFuture> create( + public CompletableFuture> create( SplitRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -258,14 +258,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRun.class), response)); return; } @@ -336,7 +336,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Retrieve details about a specific split run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a split run when using the Create Split Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, SplitRunsRetrieveRequest.builder().build()); } @@ -344,7 +344,8 @@ public CompletableFuture> retrieve(String id) * Retrieve details about a specific split run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a split run when using the Create Split Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { return retrieve(id, SplitRunsRetrieveRequest.builder().build(), requestOptions); } @@ -352,7 +353,8 @@ public CompletableFuture> retrieve(String id, * Retrieve details about a specific split run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a split run when using the Create Split Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve(String id, SplitRunsRetrieveRequest request) { + public CompletableFuture> retrieve( + String id, SplitRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -360,7 +362,7 @@ public CompletableFuture> retrieve(String id, * Retrieve details about a specific split run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a split run when using the Create Split Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, SplitRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -385,14 +387,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRun.class), response)); return; } @@ -463,7 +465,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Delete a split run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, SplitRunsDeleteRequest.builder().build()); } @@ -471,7 +473,7 @@ public CompletableFuture> dele * Delete a split run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, SplitRunsDeleteRequest.builder().build(), requestOptions); } @@ -480,7 +482,7 @@ public CompletableFuture> dele * Delete a split run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, SplitRunsDeleteRequest request) { return delete(id, request, null); } @@ -489,7 +491,7 @@ public CompletableFuture> dele * Delete a split run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, SplitRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -514,14 +516,14 @@ public CompletableFuture> dele if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRunsDeleteResponse.class), response)); return; @@ -593,7 +595,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Cancel an in-progress split run. *

    Note: Only split runs with a status of "PROCESSING" can be cancelled. Splitter runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id) { + public CompletableFuture> cancel(String id) { return cancel(id, SplitRunsCancelRequest.builder().build()); } @@ -601,7 +603,7 @@ public CompletableFuture> cancel(String id) { * Cancel an in-progress split run. *

    Note: Only split runs with a status of "PROCESSING" can be cancelled. Splitter runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id, RequestOptions requestOptions) { + public CompletableFuture> cancel(String id, RequestOptions requestOptions) { return cancel(id, SplitRunsCancelRequest.builder().build(), requestOptions); } @@ -609,7 +611,7 @@ public CompletableFuture> cancel(String id, R * Cancel an in-progress split run. *

    Note: Only split runs with a status of "PROCESSING" can be cancelled. Splitter runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel(String id, SplitRunsCancelRequest request) { + public CompletableFuture> cancel(String id, SplitRunsCancelRequest request) { return cancel(id, request, null); } @@ -617,7 +619,7 @@ public CompletableFuture> cancel(String id, S * Cancel an in-progress split run. *

    Note: Only split runs with a status of "PROCESSING" can be cancelled. Splitter runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, SplitRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -643,14 +645,14 @@ public CompletableFuture> cancel( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRun.class), response)); return; } @@ -733,7 +735,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *
  • Raw text input (FileFromText) is not supported for split runs. Use a URL or file ID.
  • * */ - public CompletableFuture> createBatch(SplitRunsCreateBatchRequest request) { + public CompletableFuture> createBatch(SplitRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -753,7 +755,7 @@ public CompletableFuture> createBatch(SplitRu *
  • Raw text input (FileFromText) is not supported for split runs. Use a URL or file ID.
  • * */ - public CompletableFuture> createBatch( + public CompletableFuture> createBatch( SplitRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -781,14 +783,14 @@ public CompletableFuture> createBatch( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/splitruns/RawSplitRunsClient.java b/src/main/java/ai/extend/resources/splitruns/RawSplitRunsClient.java index faada83..132ffdd 100644 --- a/src/main/java/ai/extend/resources/splitruns/RawSplitRunsClient.java +++ b/src/main/java/ai/extend/resources/splitruns/RawSplitRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -51,7 +51,7 @@ public RawSplitRunsClient(ClientOptions clientOptions) { * List all split runs. *

    Returns a summary of each run. Use GET /split_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(SplitRunsListRequest.builder().build()); } @@ -59,7 +59,7 @@ public ExtendClientHttpResponse list() { * List all split runs. *

    Returns a summary of each run. Use GET /split_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(SplitRunsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public ExtendClientHttpResponse list(RequestOptions reque * List all split runs. *

    Returns a summary of each run. Use GET /split_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list(SplitRunsListRequest request) { + public ExtendClientBaseHttpResponse list(SplitRunsListRequest request) { return list(request, null); } @@ -75,7 +75,7 @@ public ExtendClientHttpResponse list(SplitRunsListRequest * List all split runs. *

    Returns a summary of each run. Use GET /split_runs/{id} to retrieve the full object including output and config.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( SplitRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -143,7 +143,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRunsListResponse.class), response); } try { @@ -188,7 +188,7 @@ public ExtendClientHttpResponse list( * Split a document into multiple parts using an existing splitter or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Split Run endpoint for results.

    */ - public ExtendClientHttpResponse create(SplitRunsCreateRequest request) { + public ExtendClientBaseHttpResponse create(SplitRunsCreateRequest request) { return create(request, null); } @@ -196,7 +196,8 @@ public ExtendClientHttpResponse create(SplitRunsCreateRequest request) * Split a document into multiple parts using an existing splitter or an inline configuration. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Split Run endpoint for results.

    */ - public ExtendClientHttpResponse create(SplitRunsCreateRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse create( + SplitRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("split_runs"); @@ -227,7 +228,7 @@ public ExtendClientHttpResponse create(SplitRunsCreateRequest request, ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRun.class), response); } try { @@ -272,7 +273,7 @@ public ExtendClientHttpResponse create(SplitRunsCreateRequest request, * Retrieve details about a specific split run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a split run when using the Create Split Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, SplitRunsRetrieveRequest.builder().build()); } @@ -280,7 +281,7 @@ public ExtendClientHttpResponse retrieve(String id) { * Retrieve details about a specific split run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a split run when using the Create Split Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, SplitRunsRetrieveRequest.builder().build(), requestOptions); } @@ -288,7 +289,7 @@ public ExtendClientHttpResponse retrieve(String id, RequestOptions req * Retrieve details about a specific split run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a split run when using the Create Split Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve(String id, SplitRunsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, SplitRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -296,7 +297,7 @@ public ExtendClientHttpResponse retrieve(String id, SplitRunsRetrieveR * Retrieve details about a specific split run, including its status and outputs. *

    A common use case for this endpoint is to poll for the status and final output of a split run when using the Create Split Run endpoint. For instance, if you do not want to not configure webhooks to receive the output via completion/failure events.

    */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, SplitRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -325,7 +326,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRun.class), response); } try { @@ -370,7 +371,7 @@ public ExtendClientHttpResponse retrieve( * Delete a split run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, SplitRunsDeleteRequest.builder().build()); } @@ -378,7 +379,7 @@ public ExtendClientHttpResponse delete(String id) { * Delete a split run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete(String id, RequestOptions requestOptions) { return delete(id, SplitRunsDeleteRequest.builder().build(), requestOptions); } @@ -386,7 +387,7 @@ public ExtendClientHttpResponse delete(String id, Reque * Delete a split run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, SplitRunsDeleteRequest request) { + public ExtendClientBaseHttpResponse delete(String id, SplitRunsDeleteRequest request) { return delete(id, request, null); } @@ -394,7 +395,7 @@ public ExtendClientHttpResponse delete(String id, Split * Delete a split run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, SplitRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -423,7 +424,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRunsDeleteResponse.class), response); } @@ -469,7 +470,7 @@ public ExtendClientHttpResponse delete( * Cancel an in-progress split run. *

    Note: Only split runs with a status of "PROCESSING" can be cancelled. Splitter runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id) { + public ExtendClientBaseHttpResponse cancel(String id) { return cancel(id, SplitRunsCancelRequest.builder().build()); } @@ -477,7 +478,7 @@ public ExtendClientHttpResponse cancel(String id) { * Cancel an in-progress split run. *

    Note: Only split runs with a status of "PROCESSING" can be cancelled. Splitter runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse cancel(String id, RequestOptions requestOptions) { return cancel(id, SplitRunsCancelRequest.builder().build(), requestOptions); } @@ -485,7 +486,7 @@ public ExtendClientHttpResponse cancel(String id, RequestOptions reque * Cancel an in-progress split run. *

    Note: Only split runs with a status of "PROCESSING" can be cancelled. Splitter runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel(String id, SplitRunsCancelRequest request) { + public ExtendClientBaseHttpResponse cancel(String id, SplitRunsCancelRequest request) { return cancel(id, request, null); } @@ -493,7 +494,7 @@ public ExtendClientHttpResponse cancel(String id, SplitRunsCancelReque * Cancel an in-progress split run. *

    Note: Only split runs with a status of "PROCESSING" can be cancelled. Splitter runs that have already completed, failed, or been cancelled cannot be cancelled again.

    */ - public ExtendClientHttpResponse cancel( + public ExtendClientBaseHttpResponse cancel( String id, SplitRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -523,7 +524,7 @@ public ExtendClientHttpResponse cancel( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitRun.class), response); } try { @@ -580,7 +581,7 @@ public ExtendClientHttpResponse cancel( *
  • Raw text input (FileFromText) is not supported for split runs. Use a URL or file ID.
  • * */ - public ExtendClientHttpResponse createBatch(SplitRunsCreateBatchRequest request) { + public ExtendClientBaseHttpResponse createBatch(SplitRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -600,7 +601,7 @@ public ExtendClientHttpResponse createBatch(SplitRunsCreateBatchReques *
  • Raw text input (FileFromText) is not supported for split runs. Use a URL or file ID.
  • * */ - public ExtendClientHttpResponse createBatch( + public ExtendClientBaseHttpResponse createBatch( SplitRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -632,7 +633,7 @@ public ExtendClientHttpResponse createBatch( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BatchRun.class), response); } try { diff --git a/src/main/java/ai/extend/resources/splitters/AsyncRawSplittersClient.java b/src/main/java/ai/extend/resources/splitters/AsyncRawSplittersClient.java index 6d2745e..b62afd5 100644 --- a/src/main/java/ai/extend/resources/splitters/AsyncRawSplittersClient.java +++ b/src/main/java/ai/extend/resources/splitters/AsyncRawSplittersClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -51,7 +51,7 @@ public AsyncRawSplittersClient(ClientOptions clientOptions) { * List all splitters. *

    Returns a summary of each splitter. Use GET /splitters/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(SplittersListRequest.builder().build()); } @@ -59,7 +59,7 @@ public CompletableFuture> list() * List all splitters. *

    Returns a summary of each splitter. Use GET /splitters/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list(RequestOptions requestOptions) { return list(SplittersListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public CompletableFuture> list(R * List all splitters. *

    Returns a summary of each splitter. Use GET /splitters/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list(SplittersListRequest request) { + public CompletableFuture> list(SplittersListRequest request) { return list(request, null); } @@ -75,7 +75,7 @@ public CompletableFuture> list(S * List all splitters. *

    Returns a summary of each splitter. Use GET /splitters/{id} to retrieve the full object including draftVersion.

    */ - public CompletableFuture> list( + public CompletableFuture> list( SplittersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -115,14 +115,14 @@ public CompletableFuture> list( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplittersListResponse.class), response)); return; @@ -193,14 +193,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Create a new splitter. */ - public CompletableFuture> create(SplittersCreateRequest request) { + public CompletableFuture> create(SplittersCreateRequest request) { return create(request, null); } /** * Create a new splitter. */ - public CompletableFuture> create( + public CompletableFuture> create( SplittersCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -228,14 +228,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Splitter.class), response)); return; } @@ -305,28 +305,30 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Get details of a splitter. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, SplittersRetrieveRequest.builder().build()); } /** * Get details of a splitter. */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { return retrieve(id, SplittersRetrieveRequest.builder().build(), requestOptions); } /** * Get details of a splitter. */ - public CompletableFuture> retrieve(String id, SplittersRetrieveRequest request) { + public CompletableFuture> retrieve( + String id, SplittersRetrieveRequest request) { return retrieve(id, request, null); } /** * Get details of a splitter. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, SplittersRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -351,14 +353,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Splitter.class), response)); return; } @@ -428,28 +430,28 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Update an existing splitter. */ - public CompletableFuture> update(String id) { + public CompletableFuture> update(String id) { return update(id, SplittersUpdateRequest.builder().build()); } /** * Update an existing splitter. */ - public CompletableFuture> update(String id, RequestOptions requestOptions) { + public CompletableFuture> update(String id, RequestOptions requestOptions) { return update(id, SplittersUpdateRequest.builder().build(), requestOptions); } /** * Update an existing splitter. */ - public CompletableFuture> update(String id, SplittersUpdateRequest request) { + public CompletableFuture> update(String id, SplittersUpdateRequest request) { return update(id, request, null); } /** * Update an existing splitter. */ - public CompletableFuture> update( + public CompletableFuture> update( String id, SplittersUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -482,14 +484,14 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Splitter.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/splitters/RawSplittersClient.java b/src/main/java/ai/extend/resources/splitters/RawSplittersClient.java index 69aa896..3def0c6 100644 --- a/src/main/java/ai/extend/resources/splitters/RawSplittersClient.java +++ b/src/main/java/ai/extend/resources/splitters/RawSplittersClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -47,7 +47,7 @@ public RawSplittersClient(ClientOptions clientOptions) { * List all splitters. *

    Returns a summary of each splitter. Use GET /splitters/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(SplittersListRequest.builder().build()); } @@ -55,7 +55,7 @@ public ExtendClientHttpResponse list() { * List all splitters. *

    Returns a summary of each splitter. Use GET /splitters/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(SplittersListRequest.builder().build(), requestOptions); } @@ -63,7 +63,7 @@ public ExtendClientHttpResponse list(RequestOptions reque * List all splitters. *

    Returns a summary of each splitter. Use GET /splitters/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list(SplittersListRequest request) { + public ExtendClientBaseHttpResponse list(SplittersListRequest request) { return list(request, null); } @@ -71,7 +71,7 @@ public ExtendClientHttpResponse list(SplittersListRequest * List all splitters. *

    Returns a summary of each splitter. Use GET /splitters/{id} to retrieve the full object including draftVersion.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( SplittersListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -115,7 +115,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplittersListResponse.class), response); } try { @@ -159,14 +159,15 @@ public ExtendClientHttpResponse list( /** * Create a new splitter. */ - public ExtendClientHttpResponse create(SplittersCreateRequest request) { + public ExtendClientBaseHttpResponse create(SplittersCreateRequest request) { return create(request, null); } /** * Create a new splitter. */ - public ExtendClientHttpResponse create(SplittersCreateRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse create( + SplittersCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("splitters"); @@ -197,7 +198,7 @@ public ExtendClientHttpResponse create(SplittersCreateRequest request, ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Splitter.class), response); } try { @@ -241,28 +242,28 @@ public ExtendClientHttpResponse create(SplittersCreateRequest request, /** * Get details of a splitter. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, SplittersRetrieveRequest.builder().build()); } /** * Get details of a splitter. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, SplittersRetrieveRequest.builder().build(), requestOptions); } /** * Get details of a splitter. */ - public ExtendClientHttpResponse retrieve(String id, SplittersRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, SplittersRetrieveRequest request) { return retrieve(id, request, null); } /** * Get details of a splitter. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, SplittersRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -291,7 +292,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Splitter.class), response); } try { @@ -335,28 +336,28 @@ public ExtendClientHttpResponse retrieve( /** * Update an existing splitter. */ - public ExtendClientHttpResponse update(String id) { + public ExtendClientBaseHttpResponse update(String id) { return update(id, SplittersUpdateRequest.builder().build()); } /** * Update an existing splitter. */ - public ExtendClientHttpResponse update(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse update(String id, RequestOptions requestOptions) { return update(id, SplittersUpdateRequest.builder().build(), requestOptions); } /** * Update an existing splitter. */ - public ExtendClientHttpResponse update(String id, SplittersUpdateRequest request) { + public ExtendClientBaseHttpResponse update(String id, SplittersUpdateRequest request) { return update(id, request, null); } /** * Update an existing splitter. */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String id, SplittersUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -393,7 +394,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Splitter.class), response); } try { diff --git a/src/main/java/ai/extend/resources/splitterversions/AsyncRawSplitterVersionsClient.java b/src/main/java/ai/extend/resources/splitterversions/AsyncRawSplitterVersionsClient.java index 0e8c45b..cb3ce39 100644 --- a/src/main/java/ai/extend/resources/splitterversions/AsyncRawSplitterVersionsClient.java +++ b/src/main/java/ai/extend/resources/splitterversions/AsyncRawSplitterVersionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -50,7 +50,7 @@ public AsyncRawSplitterVersionsClient(ClientOptions clientOptions) { * This endpoint allows you to fetch all versions of a given splitter, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the splitter, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list(String splitterId) { + public CompletableFuture> list(String splitterId) { return list(splitterId, SplitterVersionsListRequest.builder().build()); } @@ -58,7 +58,7 @@ public CompletableFuture> * This endpoint allows you to fetch all versions of a given splitter, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the splitter, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String splitterId, RequestOptions requestOptions) { return list(splitterId, SplitterVersionsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public CompletableFuture> * This endpoint allows you to fetch all versions of a given splitter, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the splitter, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String splitterId, SplitterVersionsListRequest request) { return list(splitterId, request, null); } @@ -76,7 +76,7 @@ public CompletableFuture> * This endpoint allows you to fetch all versions of a given splitter, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the splitter, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public CompletableFuture> list( + public CompletableFuture> list( String splitterId, SplitterVersionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,14 +114,15 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, SplitterVersionsListResponse.class), response)); @@ -194,7 +195,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * This endpoint allows you to publish a new version of an existing splitter. Publishing a new version creates a snapshot of the splitter's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this splitter. You may need to manually update workflows to use the new version if desired.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String splitterId, SplitterVersionsCreateRequest request) { return create(splitterId, request, null); } @@ -203,7 +204,7 @@ public CompletableFuture> create( * This endpoint allows you to publish a new version of an existing splitter. Publishing a new version creates a snapshot of the splitter's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this splitter. You may need to manually update workflows to use the new version if desired.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String splitterId, SplitterVersionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -237,14 +238,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitterVersion.class), response)); return; @@ -315,7 +316,8 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Retrieve a specific version of a splitter in Extend */ - public CompletableFuture> retrieve(String splitterId, String versionId) { + public CompletableFuture> retrieve( + String splitterId, String versionId) { return retrieve( splitterId, versionId, SplitterVersionsRetrieveRequest.builder().build()); } @@ -323,7 +325,7 @@ public CompletableFuture> retrieve(Str /** * Retrieve a specific version of a splitter in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String splitterId, String versionId, RequestOptions requestOptions) { return retrieve( splitterId, versionId, SplitterVersionsRetrieveRequest.builder().build(), requestOptions); @@ -332,7 +334,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific version of a splitter in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String splitterId, String versionId, SplitterVersionsRetrieveRequest request) { return retrieve(splitterId, versionId, request, null); } @@ -340,7 +342,7 @@ public CompletableFuture> retrieve( /** * Retrieve a specific version of a splitter in Extend */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String splitterId, String versionId, SplitterVersionsRetrieveRequest request, @@ -370,14 +372,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitterVersion.class), response)); return; diff --git a/src/main/java/ai/extend/resources/splitterversions/RawSplitterVersionsClient.java b/src/main/java/ai/extend/resources/splitterversions/RawSplitterVersionsClient.java index 52362f2..2cc6099 100644 --- a/src/main/java/ai/extend/resources/splitterversions/RawSplitterVersionsClient.java +++ b/src/main/java/ai/extend/resources/splitterversions/RawSplitterVersionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -46,7 +46,7 @@ public RawSplitterVersionsClient(ClientOptions clientOptions) { * This endpoint allows you to fetch all versions of a given splitter, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the splitter, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list(String splitterId) { + public ExtendClientBaseHttpResponse list(String splitterId) { return list(splitterId, SplitterVersionsListRequest.builder().build()); } @@ -54,7 +54,7 @@ public ExtendClientHttpResponse list(String splitt * This endpoint allows you to fetch all versions of a given splitter, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the splitter, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String splitterId, RequestOptions requestOptions) { return list(splitterId, SplitterVersionsListRequest.builder().build(), requestOptions); } @@ -63,7 +63,7 @@ public ExtendClientHttpResponse list( * This endpoint allows you to fetch all versions of a given splitter, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the splitter, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String splitterId, SplitterVersionsListRequest request) { return list(splitterId, request, null); } @@ -72,7 +72,7 @@ public ExtendClientHttpResponse list( * This endpoint allows you to fetch all versions of a given splitter, including the current draft version. *

    Versions are returned in descending order of creation (newest first) with the draft version first. The draft version is the latest unpublished version of the splitter, which can be published to create a new version. It might not have any changes from the last published version.

    */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String splitterId, SplitterVersionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,7 +114,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitterVersionsListResponse.class), response); } @@ -160,7 +160,8 @@ public ExtendClientHttpResponse list( * This endpoint allows you to publish a new version of an existing splitter. Publishing a new version creates a snapshot of the splitter's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this splitter. You may need to manually update workflows to use the new version if desired.

    */ - public ExtendClientHttpResponse create(String splitterId, SplitterVersionsCreateRequest request) { + public ExtendClientBaseHttpResponse create( + String splitterId, SplitterVersionsCreateRequest request) { return create(splitterId, request, null); } @@ -168,7 +169,7 @@ public ExtendClientHttpResponse create(String splitterId, Split * This endpoint allows you to publish a new version of an existing splitter. Publishing a new version creates a snapshot of the splitter's current configuration and makes it available for use in workflows. *

    Publishing a new version does not automatically update existing workflows using this splitter. You may need to manually update workflows to use the new version if desired.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String splitterId, SplitterVersionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -206,7 +207,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitterVersion.class), response); } try { @@ -250,7 +251,7 @@ public ExtendClientHttpResponse create( /** * Retrieve a specific version of a splitter in Extend */ - public ExtendClientHttpResponse retrieve(String splitterId, String versionId) { + public ExtendClientBaseHttpResponse retrieve(String splitterId, String versionId) { return retrieve( splitterId, versionId, SplitterVersionsRetrieveRequest.builder().build()); } @@ -258,7 +259,7 @@ public ExtendClientHttpResponse retrieve(String splitterId, Str /** * Retrieve a specific version of a splitter in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String splitterId, String versionId, RequestOptions requestOptions) { return retrieve( splitterId, versionId, SplitterVersionsRetrieveRequest.builder().build(), requestOptions); @@ -267,7 +268,7 @@ public ExtendClientHttpResponse retrieve( /** * Retrieve a specific version of a splitter in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String splitterId, String versionId, SplitterVersionsRetrieveRequest request) { return retrieve(splitterId, versionId, request, null); } @@ -275,7 +276,7 @@ public ExtendClientHttpResponse retrieve( /** * Retrieve a specific version of a splitter in Extend */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String splitterId, String versionId, SplitterVersionsRetrieveRequest request, @@ -309,7 +310,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SplitterVersion.class), response); } try { diff --git a/src/main/java/ai/extend/resources/webhookendpoints/AsyncRawWebhookEndpointsClient.java b/src/main/java/ai/extend/resources/webhookendpoints/AsyncRawWebhookEndpointsClient.java index 62d7d50..31555f4 100644 --- a/src/main/java/ai/extend/resources/webhookendpoints/AsyncRawWebhookEndpointsClient.java +++ b/src/main/java/ai/extend/resources/webhookendpoints/AsyncRawWebhookEndpointsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -53,14 +53,14 @@ public AsyncRawWebhookEndpointsClient(ClientOptions clientOptions) { /** * List all webhook endpoints. */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(WebhookEndpointsListRequest.builder().build()); } /** * List all webhook endpoints. */ - public CompletableFuture> list( + public CompletableFuture> list( RequestOptions requestOptions) { return list(WebhookEndpointsListRequest.builder().build(), requestOptions); } @@ -68,7 +68,7 @@ public CompletableFuture> /** * List all webhook endpoints. */ - public CompletableFuture> list( + public CompletableFuture> list( WebhookEndpointsListRequest request) { return list(request, null); } @@ -76,7 +76,7 @@ public CompletableFuture> /** * List all webhook endpoints. */ - public CompletableFuture> list( + public CompletableFuture> list( WebhookEndpointsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -116,14 +116,15 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, WebhookEndpointsListResponse.class), response)); @@ -197,7 +198,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

    The enabledEvents array specifies which global event types this endpoint should receive. Use the Webhook Events reference to see available event types.

    *

    To subscribe to events scoped to a specific resource (e.g., a single extractor or workflow), use Create Webhook Subscription after creating the endpoint.

    */ - public CompletableFuture> create( + public CompletableFuture> create( WebhookEndpointsCreateRequest request) { return create(request, null); } @@ -207,7 +208,7 @@ public CompletableFuture> create *

    The enabledEvents array specifies which global event types this endpoint should receive. Use the Webhook Events reference to see available event types.

    *

    To subscribe to events scoped to a specific resource (e.g., a single extractor or workflow), use Create Webhook Subscription after creating the endpoint.

    */ - public CompletableFuture> create( + public CompletableFuture> create( WebhookEndpointsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -235,14 +236,14 @@ public CompletableFuture> create if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookEndpointCreate.class), response)); return; @@ -313,14 +314,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Retrieve a webhook endpoint by ID. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, WebhookEndpointsRetrieveRequest.builder().build()); } /** * Retrieve a webhook endpoint by ID. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, RequestOptions requestOptions) { return retrieve(id, WebhookEndpointsRetrieveRequest.builder().build(), requestOptions); } @@ -328,7 +329,7 @@ public CompletableFuture> retrieve( /** * Retrieve a webhook endpoint by ID. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, WebhookEndpointsRetrieveRequest request) { return retrieve(id, request, null); } @@ -336,7 +337,7 @@ public CompletableFuture> retrieve( /** * Retrieve a webhook endpoint by ID. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, WebhookEndpointsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -361,14 +362,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookEndpoint.class), response)); return; @@ -440,7 +441,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Update a webhook endpoint. Only the fields you include in the request body will be updated; omitted fields remain unchanged. *

    The apiVersion of a webhook endpoint cannot be changed after creation.

    */ - public CompletableFuture> update(String id) { + public CompletableFuture> update(String id) { return update(id, WebhookEndpointsUpdateRequest.builder().build()); } @@ -448,7 +449,7 @@ public CompletableFuture> update(Strin * Update a webhook endpoint. Only the fields you include in the request body will be updated; omitted fields remain unchanged. *

    The apiVersion of a webhook endpoint cannot be changed after creation.

    */ - public CompletableFuture> update( + public CompletableFuture> update( String id, RequestOptions requestOptions) { return update(id, WebhookEndpointsUpdateRequest.builder().build(), requestOptions); } @@ -457,7 +458,7 @@ public CompletableFuture> update( * Update a webhook endpoint. Only the fields you include in the request body will be updated; omitted fields remain unchanged. *

    The apiVersion of a webhook endpoint cannot be changed after creation.

    */ - public CompletableFuture> update( + public CompletableFuture> update( String id, WebhookEndpointsUpdateRequest request) { return update(id, request, null); } @@ -466,7 +467,7 @@ public CompletableFuture> update( * Update a webhook endpoint. Only the fields you include in the request body will be updated; omitted fields remain unchanged. *

    The apiVersion of a webhook endpoint cannot be changed after creation.

    */ - public CompletableFuture> update( + public CompletableFuture> update( String id, WebhookEndpointsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -499,14 +500,14 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookEndpoint.class), response)); return; @@ -577,14 +578,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Delete a webhook endpoint and all of its subscriptions. This operation is permanent and cannot be undone. */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, WebhookEndpointsDeleteRequest.builder().build()); } /** * Delete a webhook endpoint and all of its subscriptions. This operation is permanent and cannot be undone. */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, WebhookEndpointsDeleteRequest.builder().build(), requestOptions); } @@ -592,7 +593,7 @@ public CompletableFuture> delete( + public CompletableFuture> delete( String id, WebhookEndpointsDeleteRequest request) { return delete(id, request, null); } @@ -600,7 +601,7 @@ public CompletableFuture> delete( + public CompletableFuture> delete( String id, WebhookEndpointsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -625,14 +626,15 @@ public CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, WebhookEndpointsDeleteResponse.class), response)); diff --git a/src/main/java/ai/extend/resources/webhookendpoints/RawWebhookEndpointsClient.java b/src/main/java/ai/extend/resources/webhookendpoints/RawWebhookEndpointsClient.java index da44c32..b65362c 100644 --- a/src/main/java/ai/extend/resources/webhookendpoints/RawWebhookEndpointsClient.java +++ b/src/main/java/ai/extend/resources/webhookendpoints/RawWebhookEndpointsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -49,28 +49,28 @@ public RawWebhookEndpointsClient(ClientOptions clientOptions) { /** * List all webhook endpoints. */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(WebhookEndpointsListRequest.builder().build()); } /** * List all webhook endpoints. */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(WebhookEndpointsListRequest.builder().build(), requestOptions); } /** * List all webhook endpoints. */ - public ExtendClientHttpResponse list(WebhookEndpointsListRequest request) { + public ExtendClientBaseHttpResponse list(WebhookEndpointsListRequest request) { return list(request, null); } /** * List all webhook endpoints. */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( WebhookEndpointsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -114,7 +114,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookEndpointsListResponse.class), response); } @@ -161,7 +161,7 @@ public ExtendClientHttpResponse list( *

    The enabledEvents array specifies which global event types this endpoint should receive. Use the Webhook Events reference to see available event types.

    *

    To subscribe to events scoped to a specific resource (e.g., a single extractor or workflow), use Create Webhook Subscription after creating the endpoint.

    */ - public ExtendClientHttpResponse create(WebhookEndpointsCreateRequest request) { + public ExtendClientBaseHttpResponse create(WebhookEndpointsCreateRequest request) { return create(request, null); } @@ -170,7 +170,7 @@ public ExtendClientHttpResponse create(WebhookEndpointsCr *

    The enabledEvents array specifies which global event types this endpoint should receive. Use the Webhook Events reference to see available event types.

    *

    To subscribe to events scoped to a specific resource (e.g., a single extractor or workflow), use Create Webhook Subscription after creating the endpoint.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( WebhookEndpointsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -202,7 +202,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookEndpointCreate.class), response); } try { @@ -246,28 +246,28 @@ public ExtendClientHttpResponse create( /** * Retrieve a webhook endpoint by ID. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, WebhookEndpointsRetrieveRequest.builder().build()); } /** * Retrieve a webhook endpoint by ID. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, WebhookEndpointsRetrieveRequest.builder().build(), requestOptions); } /** * Retrieve a webhook endpoint by ID. */ - public ExtendClientHttpResponse retrieve(String id, WebhookEndpointsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, WebhookEndpointsRetrieveRequest request) { return retrieve(id, request, null); } /** * Retrieve a webhook endpoint by ID. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, WebhookEndpointsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -296,7 +296,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookEndpoint.class), response); } try { @@ -341,7 +341,7 @@ public ExtendClientHttpResponse retrieve( * Update a webhook endpoint. Only the fields you include in the request body will be updated; omitted fields remain unchanged. *

    The apiVersion of a webhook endpoint cannot be changed after creation.

    */ - public ExtendClientHttpResponse update(String id) { + public ExtendClientBaseHttpResponse update(String id) { return update(id, WebhookEndpointsUpdateRequest.builder().build()); } @@ -349,7 +349,7 @@ public ExtendClientHttpResponse update(String id) { * Update a webhook endpoint. Only the fields you include in the request body will be updated; omitted fields remain unchanged. *

    The apiVersion of a webhook endpoint cannot be changed after creation.

    */ - public ExtendClientHttpResponse update(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse update(String id, RequestOptions requestOptions) { return update(id, WebhookEndpointsUpdateRequest.builder().build(), requestOptions); } @@ -357,7 +357,7 @@ public ExtendClientHttpResponse update(String id, RequestOption * Update a webhook endpoint. Only the fields you include in the request body will be updated; omitted fields remain unchanged. *

    The apiVersion of a webhook endpoint cannot be changed after creation.

    */ - public ExtendClientHttpResponse update(String id, WebhookEndpointsUpdateRequest request) { + public ExtendClientBaseHttpResponse update(String id, WebhookEndpointsUpdateRequest request) { return update(id, request, null); } @@ -365,7 +365,7 @@ public ExtendClientHttpResponse update(String id, WebhookEndpoi * Update a webhook endpoint. Only the fields you include in the request body will be updated; omitted fields remain unchanged. *

    The apiVersion of a webhook endpoint cannot be changed after creation.

    */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String id, WebhookEndpointsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -402,7 +402,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookEndpoint.class), response); } try { @@ -446,21 +446,22 @@ public ExtendClientHttpResponse update( /** * Delete a webhook endpoint and all of its subscriptions. This operation is permanent and cannot be undone. */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, WebhookEndpointsDeleteRequest.builder().build()); } /** * Delete a webhook endpoint and all of its subscriptions. This operation is permanent and cannot be undone. */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete( + String id, RequestOptions requestOptions) { return delete(id, WebhookEndpointsDeleteRequest.builder().build(), requestOptions); } /** * Delete a webhook endpoint and all of its subscriptions. This operation is permanent and cannot be undone. */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, WebhookEndpointsDeleteRequest request) { return delete(id, request, null); } @@ -468,7 +469,7 @@ public ExtendClientHttpResponse delete( /** * Delete a webhook endpoint and all of its subscriptions. This operation is permanent and cannot be undone. */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, WebhookEndpointsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -497,7 +498,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookEndpointsDeleteResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/webhooksubscriptions/AsyncRawWebhookSubscriptionsClient.java b/src/main/java/ai/extend/resources/webhooksubscriptions/AsyncRawWebhookSubscriptionsClient.java index d03218c..c121328 100644 --- a/src/main/java/ai/extend/resources/webhooksubscriptions/AsyncRawWebhookSubscriptionsClient.java +++ b/src/main/java/ai/extend/resources/webhooksubscriptions/AsyncRawWebhookSubscriptionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -52,14 +52,14 @@ public AsyncRawWebhookSubscriptionsClient(ClientOptions clientOptions) { /** * List webhook subscriptions. You can filter by webhookEndpointId to see all subscriptions for a given endpoint, or by resourceId to see all subscriptions for a given resource. */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(WebhookSubscriptionsListRequest.builder().build()); } /** * List webhook subscriptions. You can filter by webhookEndpointId to see all subscriptions for a given endpoint, or by resourceId to see all subscriptions for a given resource. */ - public CompletableFuture> list( + public CompletableFuture> list( RequestOptions requestOptions) { return list(WebhookSubscriptionsListRequest.builder().build(), requestOptions); } @@ -67,7 +67,7 @@ public CompletableFuturewebhookEndpointId to see all subscriptions for a given endpoint, or by resourceId to see all subscriptions for a given resource. */ - public CompletableFuture> list( + public CompletableFuture> list( WebhookSubscriptionsListRequest request) { return list(request, null); } @@ -75,7 +75,7 @@ public CompletableFuturewebhookEndpointId to see all subscriptions for a given endpoint, or by resourceId to see all subscriptions for a given resource. */ - public CompletableFuture> list( + public CompletableFuture> list( WebhookSubscriptionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -119,7 +119,7 @@ public CompletableFuture> future = + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -127,7 +127,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO try (ResponseBody responseBody = response.body()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, WebhookSubscriptionsListResponse.class), response)); @@ -201,7 +201,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

    Subscriptions let you receive events for a specific resource (e.g., a single extractor or workflow) rather than all resources of that type. The enabledEvents must be valid for the given resourceType and the endpoint's apiVersion.

    *

    If a subscription already exists for the same endpoint and resource, it will be updated with the new enabledEvents instead of creating a duplicate.

    */ - public CompletableFuture> create( + public CompletableFuture> create( WebhookSubscriptionsCreateRequest request) { return create(request, null); } @@ -211,7 +211,7 @@ public CompletableFuture> create( *

    Subscriptions let you receive events for a specific resource (e.g., a single extractor or workflow) rather than all resources of that type. The enabledEvents must be valid for the given resourceType and the endpoint's apiVersion.

    *

    If a subscription already exists for the same endpoint and resource, it will be updated with the new enabledEvents instead of creating a duplicate.

    */ - public CompletableFuture> create( + public CompletableFuture> create( WebhookSubscriptionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -239,14 +239,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookSubscription.class), response)); return; @@ -317,14 +317,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Retrieve a webhook subscription by ID. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, WebhookSubscriptionsRetrieveRequest.builder().build()); } /** * Retrieve a webhook subscription by ID. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, RequestOptions requestOptions) { return retrieve(id, WebhookSubscriptionsRetrieveRequest.builder().build(), requestOptions); } @@ -332,7 +332,7 @@ public CompletableFuture> retrieve /** * Retrieve a webhook subscription by ID. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, WebhookSubscriptionsRetrieveRequest request) { return retrieve(id, request, null); } @@ -340,7 +340,7 @@ public CompletableFuture> retrieve /** * Retrieve a webhook subscription by ID. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, WebhookSubscriptionsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -365,14 +365,14 @@ public CompletableFuture> retrieve if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookSubscription.class), response)); return; @@ -443,7 +443,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Update the enabled events on a webhook subscription. */ - public CompletableFuture> update( + public CompletableFuture> update( String id, WebhookSubscriptionsUpdateRequest request) { return update(id, request, null); } @@ -451,7 +451,7 @@ public CompletableFuture> update( /** * Update the enabled events on a webhook subscription. */ - public CompletableFuture> update( + public CompletableFuture> update( String id, WebhookSubscriptionsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -484,14 +484,14 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookSubscription.class), response)); return; @@ -562,14 +562,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Delete a webhook subscription. This operation is permanent and cannot be undone. */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, WebhookSubscriptionsDeleteRequest.builder().build()); } /** * Delete a webhook subscription. This operation is permanent and cannot be undone. */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, WebhookSubscriptionsDeleteRequest.builder().build(), requestOptions); } @@ -577,7 +577,7 @@ public CompletableFuture> delete( + public CompletableFuture> delete( String id, WebhookSubscriptionsDeleteRequest request) { return delete(id, request, null); } @@ -585,7 +585,7 @@ public CompletableFuture> delete( + public CompletableFuture> delete( String id, WebhookSubscriptionsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -610,7 +610,7 @@ public CompletableFuture> future = + CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -618,7 +618,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO try (ResponseBody responseBody = response.body()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, WebhookSubscriptionsDeleteResponse.class), response)); diff --git a/src/main/java/ai/extend/resources/webhooksubscriptions/RawWebhookSubscriptionsClient.java b/src/main/java/ai/extend/resources/webhooksubscriptions/RawWebhookSubscriptionsClient.java index 41767ef..310b580 100644 --- a/src/main/java/ai/extend/resources/webhooksubscriptions/RawWebhookSubscriptionsClient.java +++ b/src/main/java/ai/extend/resources/webhooksubscriptions/RawWebhookSubscriptionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -48,28 +48,29 @@ public RawWebhookSubscriptionsClient(ClientOptions clientOptions) { /** * List webhook subscriptions. You can filter by webhookEndpointId to see all subscriptions for a given endpoint, or by resourceId to see all subscriptions for a given resource. */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(WebhookSubscriptionsListRequest.builder().build()); } /** * List webhook subscriptions. You can filter by webhookEndpointId to see all subscriptions for a given endpoint, or by resourceId to see all subscriptions for a given resource. */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(WebhookSubscriptionsListRequest.builder().build(), requestOptions); } /** * List webhook subscriptions. You can filter by webhookEndpointId to see all subscriptions for a given endpoint, or by resourceId to see all subscriptions for a given resource. */ - public ExtendClientHttpResponse list(WebhookSubscriptionsListRequest request) { + public ExtendClientBaseHttpResponse list( + WebhookSubscriptionsListRequest request) { return list(request, null); } /** * List webhook subscriptions. You can filter by webhookEndpointId to see all subscriptions for a given endpoint, or by resourceId to see all subscriptions for a given resource. */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( WebhookSubscriptionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -117,7 +118,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookSubscriptionsListResponse.class), response); } @@ -164,7 +165,7 @@ public ExtendClientHttpResponse list( *

    Subscriptions let you receive events for a specific resource (e.g., a single extractor or workflow) rather than all resources of that type. The enabledEvents must be valid for the given resourceType and the endpoint's apiVersion.

    *

    If a subscription already exists for the same endpoint and resource, it will be updated with the new enabledEvents instead of creating a duplicate.

    */ - public ExtendClientHttpResponse create(WebhookSubscriptionsCreateRequest request) { + public ExtendClientBaseHttpResponse create(WebhookSubscriptionsCreateRequest request) { return create(request, null); } @@ -173,7 +174,7 @@ public ExtendClientHttpResponse create(WebhookSubscriptions *

    Subscriptions let you receive events for a specific resource (e.g., a single extractor or workflow) rather than all resources of that type. The enabledEvents must be valid for the given resourceType and the endpoint's apiVersion.

    *

    If a subscription already exists for the same endpoint and resource, it will be updated with the new enabledEvents instead of creating a duplicate.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( WebhookSubscriptionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -205,7 +206,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookSubscription.class), response); } try { @@ -249,21 +250,21 @@ public ExtendClientHttpResponse create( /** * Retrieve a webhook subscription by ID. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, WebhookSubscriptionsRetrieveRequest.builder().build()); } /** * Retrieve a webhook subscription by ID. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, WebhookSubscriptionsRetrieveRequest.builder().build(), requestOptions); } /** * Retrieve a webhook subscription by ID. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, WebhookSubscriptionsRetrieveRequest request) { return retrieve(id, request, null); } @@ -271,7 +272,7 @@ public ExtendClientHttpResponse retrieve( /** * Retrieve a webhook subscription by ID. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, WebhookSubscriptionsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -300,7 +301,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookSubscription.class), response); } try { @@ -344,14 +345,15 @@ public ExtendClientHttpResponse retrieve( /** * Update the enabled events on a webhook subscription. */ - public ExtendClientHttpResponse update(String id, WebhookSubscriptionsUpdateRequest request) { + public ExtendClientBaseHttpResponse update( + String id, WebhookSubscriptionsUpdateRequest request) { return update(id, request, null); } /** * Update the enabled events on a webhook subscription. */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String id, WebhookSubscriptionsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -388,7 +390,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WebhookSubscription.class), response); } try { @@ -432,14 +434,14 @@ public ExtendClientHttpResponse update( /** * Delete a webhook subscription. This operation is permanent and cannot be undone. */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, WebhookSubscriptionsDeleteRequest.builder().build()); } /** * Delete a webhook subscription. This operation is permanent and cannot be undone. */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, RequestOptions requestOptions) { return delete(id, WebhookSubscriptionsDeleteRequest.builder().build(), requestOptions); } @@ -447,7 +449,7 @@ public ExtendClientHttpResponse delete( /** * Delete a webhook subscription. This operation is permanent and cannot be undone. */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, WebhookSubscriptionsDeleteRequest request) { return delete(id, request, null); } @@ -455,7 +457,7 @@ public ExtendClientHttpResponse delete( /** * Delete a webhook subscription. This operation is permanent and cannot be undone. */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, WebhookSubscriptionsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -484,7 +486,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, WebhookSubscriptionsDeleteResponse.class), response); diff --git a/src/main/java/ai/extend/resources/workflowruns/AsyncRawWorkflowRunsClient.java b/src/main/java/ai/extend/resources/workflowruns/AsyncRawWorkflowRunsClient.java index 1f891db..8218d71 100644 --- a/src/main/java/ai/extend/resources/workflowruns/AsyncRawWorkflowRunsClient.java +++ b/src/main/java/ai/extend/resources/workflowruns/AsyncRawWorkflowRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -55,28 +55,30 @@ public AsyncRawWorkflowRunsClient(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> list() { + public CompletableFuture> list() { return list(WorkflowRunsListRequest.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> list(RequestOptions requestOptions) { + public CompletableFuture> list( + RequestOptions requestOptions) { return list(WorkflowRunsListRequest.builder().build(), requestOptions); } /** * 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> list(WorkflowRunsListRequest request) { + public CompletableFuture> list( + WorkflowRunsListRequest 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> list( + public CompletableFuture> list( WorkflowRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -132,14 +134,14 @@ public CompletableFuture> lis if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRunsListResponse.class), response)); return; @@ -211,7 +213,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

    */ - public CompletableFuture> create(WorkflowRunsCreateRequest request) { + public CompletableFuture> create(WorkflowRunsCreateRequest request) { return create(request, null); } @@ -219,7 +221,7 @@ public CompletableFuture> create(WorkflowR * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

    */ - public CompletableFuture> create( + public CompletableFuture> create( WorkflowRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -247,14 +249,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRun.class), response)); return; } @@ -324,21 +326,22 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Once a workflow has been run, you can check the status and output of a specific WorkflowRun. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, WorkflowRunsRetrieveRequest.builder().build()); } /** * Once a workflow has been run, you can check the status and output of a specific WorkflowRun. */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { return retrieve(id, WorkflowRunsRetrieveRequest.builder().build(), requestOptions); } /** * Once a workflow has been run, you can check the status and output of a specific WorkflowRun. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, WorkflowRunsRetrieveRequest request) { return retrieve(id, request, null); } @@ -346,7 +349,7 @@ public CompletableFuture> retrieve( /** * Once a workflow has been run, you can check the status and output of a specific WorkflowRun. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, WorkflowRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -371,14 +374,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRun.class), response)); return; } @@ -448,21 +451,22 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint. */ - public CompletableFuture> update(String id) { + public CompletableFuture> update(String id) { return update(id, WorkflowRunsUpdateRequest.builder().build()); } /** * You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint. */ - public CompletableFuture> update(String id, RequestOptions requestOptions) { + public CompletableFuture> update( + String id, RequestOptions requestOptions) { return update(id, WorkflowRunsUpdateRequest.builder().build(), requestOptions); } /** * You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint. */ - public CompletableFuture> update( + public CompletableFuture> update( String id, WorkflowRunsUpdateRequest request) { return update(id, request, null); } @@ -470,7 +474,7 @@ public CompletableFuture> update( /** * You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint. */ - public CompletableFuture> update( + public CompletableFuture> update( String id, WorkflowRunsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -503,14 +507,14 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRun.class), response)); return; } @@ -581,7 +585,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete(String id) { + public CompletableFuture> delete(String id) { return delete(id, WorkflowRunsDeleteRequest.builder().build()); } @@ -589,7 +593,7 @@ public CompletableFuture> d * Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, RequestOptions requestOptions) { return delete(id, WorkflowRunsDeleteRequest.builder().build(), requestOptions); } @@ -598,7 +602,7 @@ public CompletableFuture> d * Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, WorkflowRunsDeleteRequest request) { return delete(id, request, null); } @@ -607,7 +611,7 @@ public CompletableFuture> d * Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public CompletableFuture> delete( + public CompletableFuture> delete( String id, WorkflowRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -632,14 +636,14 @@ public CompletableFuture> d if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, WorkflowRunsDeleteResponse.class), response)); @@ -712,7 +716,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress. *

    Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

    */ - public CompletableFuture> cancel(String id) { + public CompletableFuture> cancel(String id) { return cancel(id, WorkflowRunsCancelRequest.builder().build()); } @@ -720,7 +724,8 @@ public CompletableFuture> cancel(String id * Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress. *

    Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

    */ - public CompletableFuture> cancel(String id, RequestOptions requestOptions) { + public CompletableFuture> cancel( + String id, RequestOptions requestOptions) { return cancel(id, WorkflowRunsCancelRequest.builder().build(), requestOptions); } @@ -728,7 +733,7 @@ public CompletableFuture> cancel(String id * Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress. *

    Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, WorkflowRunsCancelRequest request) { return cancel(id, request, null); } @@ -737,7 +742,7 @@ public CompletableFuture> cancel( * Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress. *

    Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

    */ - public CompletableFuture> cancel( + public CompletableFuture> cancel( String id, WorkflowRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -763,14 +768,14 @@ public CompletableFuture> cancel( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRun.class), response)); return; } @@ -849,7 +854,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *
  • Fetching Results: You can also use the List Workflow Runs endpoint and filter using the batchId query param.
  • * */ - public CompletableFuture> createBatch( + public CompletableFuture> createBatch( WorkflowRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -866,7 +871,7 @@ public CompletableFutureFetching Results: You can also use the List Workflow Runs endpoint and filter using the batchId query param. * */ - public CompletableFuture> createBatch( + public CompletableFuture> createBatch( WorkflowRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -894,14 +899,15 @@ public CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, WorkflowRunsCreateBatchResponse.class), response)); diff --git a/src/main/java/ai/extend/resources/workflowruns/RawWorkflowRunsClient.java b/src/main/java/ai/extend/resources/workflowruns/RawWorkflowRunsClient.java index 3b14326..478d185 100644 --- a/src/main/java/ai/extend/resources/workflowruns/RawWorkflowRunsClient.java +++ b/src/main/java/ai/extend/resources/workflowruns/RawWorkflowRunsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -51,28 +51,28 @@ public RawWorkflowRunsClient(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 list() { + public ExtendClientBaseHttpResponse list() { return list(WorkflowRunsListRequest.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 list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(WorkflowRunsListRequest.builder().build(), requestOptions); } /** * 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 list(WorkflowRunsListRequest request) { + public ExtendClientBaseHttpResponse list(WorkflowRunsListRequest 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 list( + public ExtendClientBaseHttpResponse list( WorkflowRunsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -132,7 +132,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRunsListResponse.class), response); } @@ -178,7 +178,7 @@ public ExtendClientHttpResponse list( * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

    */ - public ExtendClientHttpResponse create(WorkflowRunsCreateRequest request) { + public ExtendClientBaseHttpResponse create(WorkflowRunsCreateRequest request) { return create(request, null); } @@ -186,7 +186,7 @@ public ExtendClientHttpResponse create(WorkflowRunsCreateRequest re * Run a workflow with a file. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome. *

    The request returns immediately with a PROCESSING status. Use webhooks or poll the Get Workflow Run endpoint for results.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( WorkflowRunsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -218,7 +218,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRun.class), response); } try { @@ -262,28 +262,28 @@ public ExtendClientHttpResponse create( /** * Once a workflow has been run, you can check the status and output of a specific WorkflowRun. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, WorkflowRunsRetrieveRequest.builder().build()); } /** * Once a workflow has been run, you can check the status and output of a specific WorkflowRun. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { return retrieve(id, WorkflowRunsRetrieveRequest.builder().build(), requestOptions); } /** * Once a workflow has been run, you can check the status and output of a specific WorkflowRun. */ - public ExtendClientHttpResponse retrieve(String id, WorkflowRunsRetrieveRequest request) { + public ExtendClientBaseHttpResponse retrieve(String id, WorkflowRunsRetrieveRequest request) { return retrieve(id, request, null); } /** * Once a workflow has been run, you can check the status and output of a specific WorkflowRun. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, WorkflowRunsRetrieveRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -312,7 +312,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRun.class), response); } try { @@ -356,28 +356,28 @@ public ExtendClientHttpResponse retrieve( /** * You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint. */ - public ExtendClientHttpResponse update(String id) { + public ExtendClientBaseHttpResponse update(String id) { return update(id, WorkflowRunsUpdateRequest.builder().build()); } /** * You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint. */ - public ExtendClientHttpResponse update(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse update(String id, RequestOptions requestOptions) { return update(id, WorkflowRunsUpdateRequest.builder().build(), requestOptions); } /** * You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint. */ - public ExtendClientHttpResponse update(String id, WorkflowRunsUpdateRequest request) { + public ExtendClientBaseHttpResponse update(String id, WorkflowRunsUpdateRequest request) { return update(id, request, null); } /** * You can update the name and metadata of an in progress WorkflowRun at any time using this endpoint. */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String id, WorkflowRunsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -414,7 +414,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRun.class), response); } try { @@ -459,7 +459,7 @@ public ExtendClientHttpResponse update( * Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id) { + public ExtendClientBaseHttpResponse delete(String id) { return delete(id, WorkflowRunsDeleteRequest.builder().build()); } @@ -467,7 +467,7 @@ public ExtendClientHttpResponse delete(String id) { * Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse delete(String id, RequestOptions requestOptions) { return delete(id, WorkflowRunsDeleteRequest.builder().build(), requestOptions); } @@ -475,7 +475,8 @@ public ExtendClientHttpResponse delete(String id, Re * Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete(String id, WorkflowRunsDeleteRequest request) { + public ExtendClientBaseHttpResponse delete( + String id, WorkflowRunsDeleteRequest request) { return delete(id, request, null); } @@ -483,7 +484,7 @@ public ExtendClientHttpResponse delete(String id, Wo * Delete a workflow run and all associated data from Extend. This operation is permanent and cannot be undone. *

    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.

    */ - public ExtendClientHttpResponse delete( + public ExtendClientBaseHttpResponse delete( String id, WorkflowRunsDeleteRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -512,7 +513,7 @@ public ExtendClientHttpResponse delete( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRunsDeleteResponse.class), response); } @@ -558,7 +559,7 @@ public ExtendClientHttpResponse delete( * Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress. *

    Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

    */ - public ExtendClientHttpResponse cancel(String id) { + public ExtendClientBaseHttpResponse cancel(String id) { return cancel(id, WorkflowRunsCancelRequest.builder().build()); } @@ -566,7 +567,7 @@ public ExtendClientHttpResponse cancel(String id) { * Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress. *

    Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

    */ - public ExtendClientHttpResponse cancel(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse cancel(String id, RequestOptions requestOptions) { return cancel(id, WorkflowRunsCancelRequest.builder().build(), requestOptions); } @@ -574,7 +575,7 @@ public ExtendClientHttpResponse cancel(String id, RequestOptions re * Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress. *

    Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

    */ - public ExtendClientHttpResponse cancel(String id, WorkflowRunsCancelRequest request) { + public ExtendClientBaseHttpResponse cancel(String id, WorkflowRunsCancelRequest request) { return cancel(id, request, null); } @@ -582,7 +583,7 @@ public ExtendClientHttpResponse cancel(String id, WorkflowRunsCance * Cancel a running workflow run by its ID. This endpoint allows you to stop a workflow run that is currently in progress. *

    Note: Only workflow runs with a status of PROCESSING or PENDING can be cancelled. Workflow runs that are completed, failed, in review, rejected, or already cancelled cannot be cancelled.

    */ - public ExtendClientHttpResponse cancel( + public ExtendClientBaseHttpResponse cancel( String id, WorkflowRunsCancelRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -612,7 +613,7 @@ public ExtendClientHttpResponse cancel( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRun.class), response); } try { @@ -665,7 +666,7 @@ public ExtendClientHttpResponse cancel( *
  • Fetching Results: You can also use the List Workflow Runs endpoint and filter using the batchId query param.
  • * */ - public ExtendClientHttpResponse createBatch( + public ExtendClientBaseHttpResponse createBatch( WorkflowRunsCreateBatchRequest request) { return createBatch(request, null); } @@ -682,7 +683,7 @@ public ExtendClientHttpResponse createBatch( *
  • Fetching Results: You can also use the List Workflow Runs endpoint and filter using the batchId query param.
  • * */ - public ExtendClientHttpResponse createBatch( + public ExtendClientBaseHttpResponse createBatch( WorkflowRunsCreateBatchRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -714,7 +715,7 @@ public ExtendClientHttpResponse createBatch( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowRunsCreateBatchResponse.class), response); } diff --git a/src/main/java/ai/extend/resources/workflows/AsyncRawWorkflowsClient.java b/src/main/java/ai/extend/resources/workflows/AsyncRawWorkflowsClient.java index 98f835f..16c2b45 100644 --- a/src/main/java/ai/extend/resources/workflows/AsyncRawWorkflowsClient.java +++ b/src/main/java/ai/extend/resources/workflows/AsyncRawWorkflowsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -49,28 +49,28 @@ public AsyncRawWorkflowsClient(ClientOptions clientOptions) { /** * List all workflows. Returns a paginated list of workflow summaries. */ - public CompletableFuture> list() { + public CompletableFuture> list() { return list(WorkflowsListRequest.builder().build()); } /** * List all workflows. Returns a paginated list of workflow summaries. */ - public CompletableFuture> list(RequestOptions requestOptions) { + public CompletableFuture> list(RequestOptions requestOptions) { return list(WorkflowsListRequest.builder().build(), requestOptions); } /** * List all workflows. Returns a paginated list of workflow summaries. */ - public CompletableFuture> list(WorkflowsListRequest request) { + public CompletableFuture> list(WorkflowsListRequest request) { return list(request, null); } /** * List all workflows. Returns a paginated list of workflow summaries. */ - public CompletableFuture> list( + public CompletableFuture> list( WorkflowsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -106,14 +106,14 @@ public CompletableFuture> list( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowsListResponse.class), response)); return; @@ -186,7 +186,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { *

    When steps is omitted, the workflow is created with default steps (TRIGGERPARSE). When steps is provided, the step graph is validated and the draft version is populated with the given steps.

    *

    Note: The default steps may change in the future. If your integration depends on a specific step graph, provide steps explicitly.

    */ - public CompletableFuture> create(WorkflowsCreateRequest request) { + public CompletableFuture> create(WorkflowsCreateRequest request) { return create(request, null); } @@ -195,7 +195,7 @@ public CompletableFuture> create(WorkflowsCre *

    When steps is omitted, the workflow is created with default steps (TRIGGERPARSE). When steps is provided, the step graph is validated and the draft version is populated with the given steps.

    *

    Note: The default steps may change in the future. If your integration depends on a specific step graph, provide steps explicitly.

    */ - public CompletableFuture> create( + public CompletableFuture> create( WorkflowsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -223,14 +223,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Workflow.class), response)); return; } @@ -300,14 +300,15 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Get details of a workflow, including its draft version and steps. */ - public CompletableFuture> retrieve(String id) { + public CompletableFuture> retrieve(String id) { return retrieve(id, null); } /** * Get details of a workflow, including its draft version and steps. */ - public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + public CompletableFuture> retrieve( + String id, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("workflows") @@ -327,14 +328,14 @@ public CompletableFuture> retrieve(String id, if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Workflow.class), response)); return; } @@ -405,7 +406,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Update a workflow's draft. You can update the name, the steps, or both. *

    When steps is provided, the draft version's steps are replaced with the new set. Steps with matching names from the previous draft preserve their internal identity.

    */ - public CompletableFuture> update(String id) { + public CompletableFuture> update(String id) { return update(id, WorkflowsUpdateRequest.builder().build()); } @@ -413,7 +414,7 @@ public CompletableFuture> update(String id) { * Update a workflow's draft. You can update the name, the steps, or both. *

    When steps is provided, the draft version's steps are replaced with the new set. Steps with matching names from the previous draft preserve their internal identity.

    */ - public CompletableFuture> update(String id, RequestOptions requestOptions) { + public CompletableFuture> update(String id, RequestOptions requestOptions) { return update(id, WorkflowsUpdateRequest.builder().build(), requestOptions); } @@ -421,7 +422,7 @@ public CompletableFuture> update(String id, R * Update a workflow's draft. You can update the name, the steps, or both. *

    When steps is provided, the draft version's steps are replaced with the new set. Steps with matching names from the previous draft preserve their internal identity.

    */ - public CompletableFuture> update(String id, WorkflowsUpdateRequest request) { + public CompletableFuture> update(String id, WorkflowsUpdateRequest request) { return update(id, request, null); } @@ -429,7 +430,7 @@ public CompletableFuture> update(String id, W * Update a workflow's draft. You can update the name, the steps, or both. *

    When steps is provided, the draft version's steps are replaced with the new set. Steps with matching names from the previous draft preserve their internal identity.

    */ - public CompletableFuture> update( + public CompletableFuture> update( String id, WorkflowsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -458,14 +459,14 @@ public CompletableFuture> update( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Workflow.class), response)); return; } diff --git a/src/main/java/ai/extend/resources/workflows/RawWorkflowsClient.java b/src/main/java/ai/extend/resources/workflows/RawWorkflowsClient.java index 2924410..df3c360 100644 --- a/src/main/java/ai/extend/resources/workflows/RawWorkflowsClient.java +++ b/src/main/java/ai/extend/resources/workflows/RawWorkflowsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -45,28 +45,28 @@ public RawWorkflowsClient(ClientOptions clientOptions) { /** * List all workflows. Returns a paginated list of workflow summaries. */ - public ExtendClientHttpResponse list() { + public ExtendClientBaseHttpResponse list() { return list(WorkflowsListRequest.builder().build()); } /** * List all workflows. Returns a paginated list of workflow summaries. */ - public ExtendClientHttpResponse list(RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(RequestOptions requestOptions) { return list(WorkflowsListRequest.builder().build(), requestOptions); } /** * List all workflows. Returns a paginated list of workflow summaries. */ - public ExtendClientHttpResponse list(WorkflowsListRequest request) { + public ExtendClientBaseHttpResponse list(WorkflowsListRequest request) { return list(request, null); } /** * List all workflows. Returns a paginated list of workflow summaries. */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( WorkflowsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -106,7 +106,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowsListResponse.class), response); } try { @@ -152,7 +152,7 @@ public ExtendClientHttpResponse list( *

    When steps is omitted, the workflow is created with default steps (TRIGGERPARSE). When steps is provided, the step graph is validated and the draft version is populated with the given steps.

    *

    Note: The default steps may change in the future. If your integration depends on a specific step graph, provide steps explicitly.

    */ - public ExtendClientHttpResponse create(WorkflowsCreateRequest request) { + public ExtendClientBaseHttpResponse create(WorkflowsCreateRequest request) { return create(request, null); } @@ -161,7 +161,8 @@ public ExtendClientHttpResponse create(WorkflowsCreateRequest request) *

    When steps is omitted, the workflow is created with default steps (TRIGGERPARSE). When steps is provided, the step graph is validated and the draft version is populated with the given steps.

    *

    Note: The default steps may change in the future. If your integration depends on a specific step graph, provide steps explicitly.

    */ - public ExtendClientHttpResponse create(WorkflowsCreateRequest request, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse create( + WorkflowsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("workflows"); @@ -192,7 +193,7 @@ public ExtendClientHttpResponse create(WorkflowsCreateRequest request, ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Workflow.class), response); } try { @@ -236,14 +237,14 @@ public ExtendClientHttpResponse create(WorkflowsCreateRequest request, /** * Get details of a workflow, including its draft version and steps. */ - public ExtendClientHttpResponse retrieve(String id) { + public ExtendClientBaseHttpResponse retrieve(String id) { return retrieve(id, null); } /** * Get details of a workflow, including its draft version and steps. */ - public ExtendClientHttpResponse retrieve(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse retrieve(String id, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() .addPathSegments("workflows") @@ -267,7 +268,7 @@ public ExtendClientHttpResponse retrieve(String id, RequestOptions req ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Workflow.class), response); } try { @@ -312,7 +313,7 @@ public ExtendClientHttpResponse retrieve(String id, RequestOptions req * Update a workflow's draft. You can update the name, the steps, or both. *

    When steps is provided, the draft version's steps are replaced with the new set. Steps with matching names from the previous draft preserve their internal identity.

    */ - public ExtendClientHttpResponse update(String id) { + public ExtendClientBaseHttpResponse update(String id) { return update(id, WorkflowsUpdateRequest.builder().build()); } @@ -320,7 +321,7 @@ public ExtendClientHttpResponse update(String id) { * Update a workflow's draft. You can update the name, the steps, or both. *

    When steps is provided, the draft version's steps are replaced with the new set. Steps with matching names from the previous draft preserve their internal identity.

    */ - public ExtendClientHttpResponse update(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse update(String id, RequestOptions requestOptions) { return update(id, WorkflowsUpdateRequest.builder().build(), requestOptions); } @@ -328,7 +329,7 @@ public ExtendClientHttpResponse update(String id, RequestOptions reque * Update a workflow's draft. You can update the name, the steps, or both. *

    When steps is provided, the draft version's steps are replaced with the new set. Steps with matching names from the previous draft preserve their internal identity.

    */ - public ExtendClientHttpResponse update(String id, WorkflowsUpdateRequest request) { + public ExtendClientBaseHttpResponse update(String id, WorkflowsUpdateRequest request) { return update(id, request, null); } @@ -336,7 +337,7 @@ public ExtendClientHttpResponse update(String id, WorkflowsUpdateReque * Update a workflow's draft. You can update the name, the steps, or both. *

    When steps is provided, the draft version's steps are replaced with the new set. Steps with matching names from the previous draft preserve their internal identity.

    */ - public ExtendClientHttpResponse update( + public ExtendClientBaseHttpResponse update( String id, WorkflowsUpdateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -369,7 +370,7 @@ public ExtendClientHttpResponse update( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Workflow.class), response); } try { diff --git a/src/main/java/ai/extend/resources/workflowversions/AsyncRawWorkflowVersionsClient.java b/src/main/java/ai/extend/resources/workflowversions/AsyncRawWorkflowVersionsClient.java index f6c3fa2..e817187 100644 --- a/src/main/java/ai/extend/resources/workflowversions/AsyncRawWorkflowVersionsClient.java +++ b/src/main/java/ai/extend/resources/workflowversions/AsyncRawWorkflowVersionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -48,14 +48,14 @@ public AsyncRawWorkflowVersionsClient(ClientOptions clientOptions) { /** * List all versions of a workflow, including the draft version. Returns a paginated list of version summaries. */ - public CompletableFuture> list(String id) { + public CompletableFuture> list(String id) { return list(id, WorkflowVersionsListRequest.builder().build()); } /** * List all versions of a workflow, including the draft version. Returns a paginated list of version summaries. */ - public CompletableFuture> list( + public CompletableFuture> list( String id, RequestOptions requestOptions) { return list(id, WorkflowVersionsListRequest.builder().build(), requestOptions); } @@ -63,7 +63,7 @@ public CompletableFuture> /** * List all versions of a workflow, including the draft version. Returns a paginated list of version summaries. */ - public CompletableFuture> list( + public CompletableFuture> list( String id, WorkflowVersionsListRequest request) { return list(id, request, null); } @@ -71,7 +71,7 @@ public CompletableFuture> /** * List all versions of a workflow, including the draft version. Returns a paginated list of version summaries. */ - public CompletableFuture> list( + public CompletableFuture> list( String id, WorkflowVersionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -105,14 +105,15 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue( responseBodyString, WorkflowVersionsListResponse.class), response)); @@ -185,7 +186,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { * Deploy a new version of a workflow. The deployed version becomes available for running workflow runs. *

    When steps is omitted, the current draft is deployed as-is. When steps is provided, the given steps are deployed directly without modifying the draft.

    */ - public CompletableFuture> create(String id) { + public CompletableFuture> create(String id) { return create(id, WorkflowVersionsCreateRequest.builder().build()); } @@ -193,7 +194,7 @@ public CompletableFuture> create(Strin * Deploy a new version of a workflow. The deployed version becomes available for running workflow runs. *

    When steps is omitted, the current draft is deployed as-is. When steps is provided, the given steps are deployed directly without modifying the draft.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String id, RequestOptions requestOptions) { return create(id, WorkflowVersionsCreateRequest.builder().build(), requestOptions); } @@ -202,7 +203,7 @@ public CompletableFuture> create( * Deploy a new version of a workflow. The deployed version becomes available for running workflow runs. *

    When steps is omitted, the current draft is deployed as-is. When steps is provided, the given steps are deployed directly without modifying the draft.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String id, WorkflowVersionsCreateRequest request) { return create(id, request, null); } @@ -211,7 +212,7 @@ public CompletableFuture> create( * Deploy a new version of a workflow. The deployed version becomes available for running workflow runs. *

    When steps is omitted, the current draft is deployed as-is. When steps is provided, the given steps are deployed directly without modifying the draft.

    */ - public CompletableFuture> create( + public CompletableFuture> create( String id, WorkflowVersionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -241,14 +242,14 @@ public CompletableFuture> create( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowVersion.class), response)); return; @@ -319,14 +320,14 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Get a specific version of a workflow, including its step definitions. */ - public CompletableFuture> retrieve(String id, String versionId) { + public CompletableFuture> retrieve(String id, String versionId) { return retrieve(id, versionId, null); } /** * Get a specific version of a workflow, including its step definitions. */ - public CompletableFuture> retrieve( + public CompletableFuture> retrieve( String id, String versionId, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -349,14 +350,14 @@ public CompletableFuture> retrieve( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } - CompletableFuture> future = new CompletableFuture<>(); + CompletableFuture> 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()) { String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - future.complete(new ExtendClientHttpResponse<>( + future.complete(new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowVersion.class), response)); return; diff --git a/src/main/java/ai/extend/resources/workflowversions/RawWorkflowVersionsClient.java b/src/main/java/ai/extend/resources/workflowversions/RawWorkflowVersionsClient.java index d94e8aa..63ec2eb 100644 --- a/src/main/java/ai/extend/resources/workflowversions/RawWorkflowVersionsClient.java +++ b/src/main/java/ai/extend/resources/workflowversions/RawWorkflowVersionsClient.java @@ -5,8 +5,8 @@ import ai.extend.core.ClientOptions; import ai.extend.core.ExtendClientApiException; +import ai.extend.core.ExtendClientBaseHttpResponse; 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; @@ -44,28 +44,29 @@ public RawWorkflowVersionsClient(ClientOptions clientOptions) { /** * List all versions of a workflow, including the draft version. Returns a paginated list of version summaries. */ - public ExtendClientHttpResponse list(String id) { + public ExtendClientBaseHttpResponse list(String id) { return list(id, WorkflowVersionsListRequest.builder().build()); } /** * List all versions of a workflow, including the draft version. Returns a paginated list of version summaries. */ - public ExtendClientHttpResponse list(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse list(String id, RequestOptions requestOptions) { return list(id, WorkflowVersionsListRequest.builder().build(), requestOptions); } /** * List all versions of a workflow, including the draft version. Returns a paginated list of version summaries. */ - public ExtendClientHttpResponse list(String id, WorkflowVersionsListRequest request) { + public ExtendClientBaseHttpResponse list( + String id, WorkflowVersionsListRequest request) { return list(id, request, null); } /** * List all versions of a workflow, including the draft version. Returns a paginated list of version summaries. */ - public ExtendClientHttpResponse list( + public ExtendClientBaseHttpResponse list( String id, WorkflowVersionsListRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -103,7 +104,7 @@ public ExtendClientHttpResponse list( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowVersionsListResponse.class), response); } @@ -149,7 +150,7 @@ public ExtendClientHttpResponse list( * Deploy a new version of a workflow. The deployed version becomes available for running workflow runs. *

    When steps is omitted, the current draft is deployed as-is. When steps is provided, the given steps are deployed directly without modifying the draft.

    */ - public ExtendClientHttpResponse create(String id) { + public ExtendClientBaseHttpResponse create(String id) { return create(id, WorkflowVersionsCreateRequest.builder().build()); } @@ -157,7 +158,7 @@ public ExtendClientHttpResponse create(String id) { * Deploy a new version of a workflow. The deployed version becomes available for running workflow runs. *

    When steps is omitted, the current draft is deployed as-is. When steps is provided, the given steps are deployed directly without modifying the draft.

    */ - public ExtendClientHttpResponse create(String id, RequestOptions requestOptions) { + public ExtendClientBaseHttpResponse create(String id, RequestOptions requestOptions) { return create(id, WorkflowVersionsCreateRequest.builder().build(), requestOptions); } @@ -165,7 +166,7 @@ public ExtendClientHttpResponse create(String id, RequestOption * Deploy a new version of a workflow. The deployed version becomes available for running workflow runs. *

    When steps is omitted, the current draft is deployed as-is. When steps is provided, the given steps are deployed directly without modifying the draft.

    */ - public ExtendClientHttpResponse create(String id, WorkflowVersionsCreateRequest request) { + public ExtendClientBaseHttpResponse create(String id, WorkflowVersionsCreateRequest request) { return create(id, request, null); } @@ -173,7 +174,7 @@ public ExtendClientHttpResponse create(String id, WorkflowVersi * Deploy a new version of a workflow. The deployed version becomes available for running workflow runs. *

    When steps is omitted, the current draft is deployed as-is. When steps is provided, the given steps are deployed directly without modifying the draft.

    */ - public ExtendClientHttpResponse create( + public ExtendClientBaseHttpResponse create( String id, WorkflowVersionsCreateRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -207,7 +208,7 @@ public ExtendClientHttpResponse create( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowVersion.class), response); } try { @@ -251,14 +252,14 @@ public ExtendClientHttpResponse create( /** * Get a specific version of a workflow, including its step definitions. */ - public ExtendClientHttpResponse retrieve(String id, String versionId) { + public ExtendClientBaseHttpResponse retrieve(String id, String versionId) { return retrieve(id, versionId, null); } /** * Get a specific version of a workflow, including its step definitions. */ - public ExtendClientHttpResponse retrieve( + public ExtendClientBaseHttpResponse retrieve( String id, String versionId, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -285,7 +286,7 @@ public ExtendClientHttpResponse retrieve( ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new ExtendClientHttpResponse<>( + return new ExtendClientBaseHttpResponse<>( ObjectMappers.JSON_MAPPER.readValue(responseBodyString, WorkflowVersion.class), response); } try { From e38cc0f434f9845ed3281321143baa0184f4b486 Mon Sep 17 00:00:00 2001 From: jordan-extend Date: Thu, 18 Jun 2026 15:03:32 -0400 Subject: [PATCH 2/3] Add hand-written ExtendClient compatibility layer The SDK regeneration renamed the generated top-level clients to *Base (client-class-name: ExtendClientBase, exported-client-class-name: ExtendClient). This adds the hand-written public classes that keep the historical type names so customer code compiles unchanged: - ExtendClient / ExtendClientBuilder (extend *Base, carry polling + webhooks) - AsyncExtendClient / AsyncExtendClientBuilder, RawExtendClient, AsyncRawExtendClient - ExtendClientWrapper is now a @Deprecated thin subclass of ExtendClient - .fernignore protects the hand-written classes from future regeneration Builder setters use covariant return types so fluent chains and build() keep returning the concrete types. Exception names stay ExtendClient*Exception. --- .fernignore | 11 + .../java/ai/extend/AsyncExtendClient.java | 35 +++ .../ai/extend/AsyncExtendClientBuilder.java | 87 ++++++++ .../java/ai/extend/AsyncRawExtendClient.java | 20 ++ src/main/java/ai/extend/ExtendClient.java | 171 +++++++++++++++ .../java/ai/extend/ExtendClientBuilder.java | 90 ++++++++ src/main/java/ai/extend/RawExtendClient.java | 19 ++ .../extend/wrapper/ExtendClientWrapper.java | 205 ++++++------------ 8 files changed, 502 insertions(+), 136 deletions(-) create mode 100644 src/main/java/ai/extend/AsyncExtendClient.java create mode 100644 src/main/java/ai/extend/AsyncExtendClientBuilder.java create mode 100644 src/main/java/ai/extend/AsyncRawExtendClient.java create mode 100644 src/main/java/ai/extend/ExtendClient.java create mode 100644 src/main/java/ai/extend/ExtendClientBuilder.java create mode 100644 src/main/java/ai/extend/RawExtendClient.java diff --git a/.fernignore b/.fernignore index 582c6f4..b8de7b7 100644 --- a/.fernignore +++ b/.fernignore @@ -9,6 +9,17 @@ README.md # Protect custom wrapper code src/main/java/ai/extend/wrapper/ +# Protect hand-written client classes (the customer-facing ExtendClient and its +# builder, plus the async/raw aliases). Fern generates the *Base versions of these +# (ExtendClientBase, AsyncExtendClientBase, etc.); these subclasses keep the +# historical public type names so upgrades don't break customer code. +src/main/java/ai/extend/ExtendClient.java +src/main/java/ai/extend/ExtendClientBuilder.java +src/main/java/ai/extend/AsyncExtendClient.java +src/main/java/ai/extend/AsyncExtendClientBuilder.java +src/main/java/ai/extend/RawExtendClient.java +src/main/java/ai/extend/AsyncRawExtendClient.java + # Protect custom tests src/test/java/ai/extend/wrapper/ .fern/replay.lock diff --git a/src/main/java/ai/extend/AsyncExtendClient.java b/src/main/java/ai/extend/AsyncExtendClient.java new file mode 100644 index 0000000..986572c --- /dev/null +++ b/src/main/java/ai/extend/AsyncExtendClient.java @@ -0,0 +1,35 @@ +/** + * Asynchronous Extend API client - not auto-generated by Fern. + * + *

    Fern generates {@link AsyncExtendClientBase}; this hand-written subclass preserves the + * historical {@code AsyncExtendClient} type name and builder return types.

    + */ +package ai.extend; + +import ai.extend.core.ClientOptions; + +/** + * Asynchronous (CompletableFuture-based) Extend API client. + */ +public class AsyncExtendClient extends AsyncExtendClientBase { + + public AsyncExtendClient(ClientOptions clientOptions) { + super(clientOptions); + } + + /** + * Returns the raw-response client. Preserves the historical {@link AsyncRawExtendClient} + * return type so existing {@code AsyncRawExtendClient raw = client.withRawResponse();} keeps compiling. + */ + @Override + public AsyncRawExtendClient withRawResponse() { + return new AsyncRawExtendClient(this.clientOptions); + } + + /** + * Creates a new builder for {@link AsyncExtendClient}. + */ + public static AsyncExtendClientBuilder builder() { + return new AsyncExtendClientBuilder(); + } +} diff --git a/src/main/java/ai/extend/AsyncExtendClientBuilder.java b/src/main/java/ai/extend/AsyncExtendClientBuilder.java new file mode 100644 index 0000000..53269d9 --- /dev/null +++ b/src/main/java/ai/extend/AsyncExtendClientBuilder.java @@ -0,0 +1,87 @@ +/** + * Builder for {@link AsyncExtendClient} - not auto-generated by Fern. + * + *

    Fern generates {@link AsyncExtendClientBaseBuilder}; this hand-written builder keeps the + * historical {@code AsyncExtendClientBuilder} type name and overrides every setter with a + * covariant return type so fluent chains keep returning {@code AsyncExtendClientBuilder} and + * {@link #build()} keeps returning {@link AsyncExtendClient}.

    + */ +package ai.extend; + +import ai.extend.core.Environment; +import okhttp3.OkHttpClient; + +/** + * Builder for {@link AsyncExtendClient}. + */ +public class AsyncExtendClientBuilder extends AsyncExtendClientBaseBuilder { + + /** + * Sets the API key (convenience alias for {@link #token(String)}). + */ + public AsyncExtendClientBuilder apiKey(String apiKey) { + super.token(apiKey); + return this; + } + + /** + * Sets a custom base URL (convenience alias for {@link #url(String)}). + */ + public AsyncExtendClientBuilder baseUrl(String baseUrl) { + super.url(baseUrl); + return this; + } + + @Override + public AsyncExtendClientBuilder token(String token) { + super.token(token); + return this; + } + + @Override + public AsyncExtendClientBuilder extendApiVersion(String extendApiVersion) { + super.extendApiVersion(extendApiVersion); + return this; + } + + @Override + public AsyncExtendClientBuilder environment(Environment environment) { + super.environment(environment); + return this; + } + + @Override + public AsyncExtendClientBuilder url(String url) { + super.url(url); + return this; + } + + @Override + public AsyncExtendClientBuilder timeout(int timeout) { + super.timeout(timeout); + return this; + } + + @Override + public AsyncExtendClientBuilder maxRetries(int maxRetries) { + super.maxRetries(maxRetries); + return this; + } + + @Override + public AsyncExtendClientBuilder httpClient(OkHttpClient httpClient) { + super.httpClient(httpClient); + return this; + } + + @Override + public AsyncExtendClientBuilder addHeader(String name, String value) { + super.addHeader(name, value); + return this; + } + + @Override + public AsyncExtendClient build() { + return new AsyncExtendClient(buildClientOptions()); + } +} diff --git a/src/main/java/ai/extend/AsyncRawExtendClient.java b/src/main/java/ai/extend/AsyncRawExtendClient.java new file mode 100644 index 0000000..a1c0f32 --- /dev/null +++ b/src/main/java/ai/extend/AsyncRawExtendClient.java @@ -0,0 +1,20 @@ +/** + * Async raw-response Extend client - not auto-generated by Fern. + * + *

    Fern generates {@link AsyncRawExtendClientBase}; this hand-written subclass preserves the + * historical {@code AsyncRawExtendClient} type name (returned by {@link AsyncExtendClient#withRawResponse()}).

    + */ +package ai.extend; + +import ai.extend.core.ClientOptions; + +/** + * Provides access to raw HTTP responses (status code, headers) alongside the deserialized body, + * with asynchronous (CompletableFuture) method signatures. + */ +public class AsyncRawExtendClient extends AsyncRawExtendClientBase { + + public AsyncRawExtendClient(ClientOptions clientOptions) { + super(clientOptions); + } +} diff --git a/src/main/java/ai/extend/ExtendClient.java b/src/main/java/ai/extend/ExtendClient.java new file mode 100644 index 0000000..2f42311 --- /dev/null +++ b/src/main/java/ai/extend/ExtendClient.java @@ -0,0 +1,171 @@ +/** + * Customer-facing Extend API client - not auto-generated by Fern. + * + *

    This is the hand-written client that customers use. It extends the generated + * {@link ExtendClientBase} (configured via {@code exported-client-class-name: ExtendClient} + * in the SDK's generators.yml) and layers on polling + webhook helpers.

    + */ +package ai.extend; + +import ai.extend.core.ClientOptions; +import ai.extend.core.Environment; +import ai.extend.core.Suppliers; +import ai.extend.wrapper.resources.ClassifyRunsClient; +import ai.extend.wrapper.resources.EditRunsClient; +import ai.extend.wrapper.resources.ExtractRunsClient; +import ai.extend.wrapper.resources.ParseRunsClient; +import ai.extend.wrapper.resources.SplitRunsClient; +import ai.extend.wrapper.resources.WorkflowRunsClient; +import ai.extend.wrapper.webhooks.Webhooks; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +/** + * The Extend API client, with additional polling and webhook utilities. + * + *

    Extends the generated {@link ExtendClientBase}, so all generated methods (parse, edit, + * extract, classify, split, files, extractors, classifiers, splitters, workflows, + * evaluation sets, etc.) are available directly.

    + * + *

    Additionally provides:

    + *
      + *
    • {@code createAndPoll} on all run resources (extractRuns, classifyRuns, etc.)
    • + *
    • {@code webhooks()} for signature verification
    • + *
    + * + *

    Basic Usage

    + *
    {@code
    + * // Reads EXTEND_API_KEY from the environment automatically
    + * ExtendClient client = ExtendClient.builder().build();
    + *
    + * // ...or set the key explicitly
    + * ExtendClient client = ExtendClient.builder()
    + *     .apiKey("your-api-key")
    + *     .build();
    + *
    + * // Synchronous convenience methods (inherited from ExtendClientBase)
    + * ParseRun parseResult = client.parse(ParseRequest.builder().file(...).build());
    + * ExtractRun extractResult = client.extract(ExtractRequest.builder().file(...).build());
    + *
    + * // Create and poll an extract run
    + * ExtractRun response = client.extractRuns().createAndPoll(
    + *     ExtractRunsCreateRequest.builder()
    + *         .file(...)
    + *         .extractor(...)
    + *         .build()
    + * );
    + * }
    + * + *

    Webhook Verification

    + *
    {@code
    + * Map event = client.webhooks().verifyAndParse(
    + *     requestBody,
    + *     requestHeaders,
    + *     signingSecret
    + * );
    + * }
    + */ +public class ExtendClient extends ExtendClientBase { + + private final Webhooks webhooks; + + // Lazy-initialized run clients that override the generated client accessors + private final Supplier extractRunsClient; + private final Supplier classifyRunsClient; + private final Supplier splitRunsClient; + private final Supplier parseRunsClient; + private final Supplier editRunsClient; + private final Supplier workflowRunsClient; + + public ExtendClient(ClientOptions clientOptions) { + super(clientOptions); + this.webhooks = new Webhooks(); + + // Lazy initialization of clients + this.extractRunsClient = Suppliers.memoize(() -> new ExtractRunsClient(clientOptions)); + this.classifyRunsClient = Suppliers.memoize(() -> new ClassifyRunsClient(clientOptions)); + this.splitRunsClient = Suppliers.memoize(() -> new SplitRunsClient(clientOptions)); + this.parseRunsClient = Suppliers.memoize(() -> new ParseRunsClient(clientOptions)); + this.editRunsClient = Suppliers.memoize(() -> new EditRunsClient(clientOptions)); + this.workflowRunsClient = Suppliers.memoize(() -> new WorkflowRunsClient(clientOptions)); + } + + /** + * Returns the webhook utilities for signature verification. + */ + public Webhooks webhooks() { + return webhooks; + } + + // ========== Override run accessors to return clients with createAndPoll ========== + + /** + * Returns the extract runs client with createAndPoll support. + * All standard methods (create, list, retrieve, delete, cancel) are also available. + */ + @Override + public ExtractRunsClient extractRuns() { + return extractRunsClient.get(); + } + + /** + * Returns the classify runs client with createAndPoll support. + * All standard methods (create, list, retrieve, delete, cancel) are also available. + */ + @Override + public ClassifyRunsClient classifyRuns() { + return classifyRunsClient.get(); + } + + /** + * Returns the split runs client with createAndPoll support. + * All standard methods (create, list, retrieve, delete, cancel) are also available. + */ + @Override + public SplitRunsClient splitRuns() { + return splitRunsClient.get(); + } + + /** + * Returns the parse runs client with createAndPoll support. + * All standard methods (create, retrieve, delete) are also available. + */ + @Override + public ParseRunsClient parseRuns() { + return parseRunsClient.get(); + } + + /** + * Returns the edit runs client with createAndPoll support. + * All standard methods (create, retrieve, delete) are also available. + */ + @Override + public EditRunsClient editRuns() { + return editRunsClient.get(); + } + + /** + * Returns the workflow runs client with createAndPoll support. + * All standard methods (create, list, retrieve, update, delete, cancel, createBatch) are also available. + */ + @Override + public WorkflowRunsClient workflowRuns() { + return workflowRunsClient.get(); + } + + /** + * Returns the raw-response client. Preserves the historical {@link RawExtendClient} + * return type so existing {@code RawExtendClient raw = client.withRawResponse();} keeps compiling. + */ + @Override + public RawExtendClient withRawResponse() { + return new RawExtendClient(this.clientOptions); + } + + /** + * Creates a new builder for {@link ExtendClient}. + */ + public static ExtendClientBuilder builder() { + return new ExtendClientBuilder(); + } +} diff --git a/src/main/java/ai/extend/ExtendClientBuilder.java b/src/main/java/ai/extend/ExtendClientBuilder.java new file mode 100644 index 0000000..6597d2f --- /dev/null +++ b/src/main/java/ai/extend/ExtendClientBuilder.java @@ -0,0 +1,90 @@ +/** + * Builder for {@link ExtendClient} - not auto-generated by Fern. + * + *

    Fern generates {@link ExtendClientBaseBuilder}; this hand-written builder keeps the + * historical {@code ExtendClientBuilder} type name and overrides every setter with a + * covariant return type so fluent chains keep returning {@code ExtendClientBuilder} and + * {@link #build()} keeps returning {@link ExtendClient}.

    + */ +package ai.extend; + +import ai.extend.core.Environment; +import okhttp3.OkHttpClient; + +/** + * Builder for {@link ExtendClient}. + * + *

    Exposes all standard options (token, environment, url, timeout, maxRetries, etc.) plus + * the {@code apiKey} / {@code baseUrl} convenience aliases.

    + */ +public class ExtendClientBuilder extends ExtendClientBaseBuilder { + + /** + * Sets the API key (convenience alias for {@link #token(String)}). + */ + public ExtendClientBuilder apiKey(String apiKey) { + super.token(apiKey); + return this; + } + + /** + * Sets a custom base URL (convenience alias for {@link #url(String)}). + */ + public ExtendClientBuilder baseUrl(String baseUrl) { + super.url(baseUrl); + return this; + } + + @Override + public ExtendClientBuilder token(String token) { + super.token(token); + return this; + } + + @Override + public ExtendClientBuilder extendApiVersion(String extendApiVersion) { + super.extendApiVersion(extendApiVersion); + return this; + } + + @Override + public ExtendClientBuilder environment(Environment environment) { + super.environment(environment); + return this; + } + + @Override + public ExtendClientBuilder url(String url) { + super.url(url); + return this; + } + + @Override + public ExtendClientBuilder timeout(int timeout) { + super.timeout(timeout); + return this; + } + + @Override + public ExtendClientBuilder maxRetries(int maxRetries) { + super.maxRetries(maxRetries); + return this; + } + + @Override + public ExtendClientBuilder httpClient(OkHttpClient httpClient) { + super.httpClient(httpClient); + return this; + } + + @Override + public ExtendClientBuilder addHeader(String name, String value) { + super.addHeader(name, value); + return this; + } + + @Override + public ExtendClient build() { + return new ExtendClient(buildClientOptions()); + } +} diff --git a/src/main/java/ai/extend/RawExtendClient.java b/src/main/java/ai/extend/RawExtendClient.java new file mode 100644 index 0000000..8b26703 --- /dev/null +++ b/src/main/java/ai/extend/RawExtendClient.java @@ -0,0 +1,19 @@ +/** + * Raw-response Extend client - not auto-generated by Fern. + * + *

    Fern generates {@link RawExtendClientBase}; this hand-written subclass preserves the + * historical {@code RawExtendClient} type name (returned by {@link ExtendClient#withRawResponse()}).

    + */ +package ai.extend; + +import ai.extend.core.ClientOptions; + +/** + * Provides access to raw HTTP responses (status code, headers) alongside the deserialized body. + */ +public class RawExtendClient extends RawExtendClientBase { + + public RawExtendClient(ClientOptions clientOptions) { + super(clientOptions); + } +} diff --git a/src/main/java/ai/extend/wrapper/ExtendClientWrapper.java b/src/main/java/ai/extend/wrapper/ExtendClientWrapper.java index 26a539c..306076b 100644 --- a/src/main/java/ai/extend/wrapper/ExtendClientWrapper.java +++ b/src/main/java/ai/extend/wrapper/ExtendClientWrapper.java @@ -6,172 +6,105 @@ import ai.extend.ExtendClient; import ai.extend.ExtendClientBuilder; import ai.extend.core.ClientOptions; -import ai.extend.core.Suppliers; -import ai.extend.wrapper.resources.ClassifyRunsClient; -import ai.extend.wrapper.resources.EditRunsClient; -import ai.extend.wrapper.resources.ExtractRunsClient; -import ai.extend.wrapper.resources.ParseRunsClient; -import ai.extend.wrapper.resources.SplitRunsClient; -import ai.extend.wrapper.resources.WorkflowRunsClient; -import ai.extend.wrapper.webhooks.Webhooks; -import java.util.function.Supplier; +import ai.extend.core.Environment; +import okhttp3.OkHttpClient; /** - * Wrapper for the Extend API client with additional polling and webhook utilities. + * @deprecated Renamed to {@link ai.extend.ExtendClient}. This class is now a thin, + * fully backwards-compatible alias and will be removed in a future major release. + * Replace {@code import ai.extend.wrapper.ExtendClientWrapper;} with + * {@code import ai.extend.ExtendClient;} and {@code ExtendClientWrapper} with + * {@code ExtendClient}. All methods, builder options, and behavior are identical. * - *

    Extends the generated {@link ExtendClient}, so all generated methods (parse, edit, - * extract, classify, split, files, extractors, classifiers, splitters, workflows, - * evaluation sets, etc.) are available directly.

    - * - *

    Additionally provides:

    - *
      - *
    • {@code createAndPoll} on all run resources (extractRuns, classifyRuns, etc.)
    • - *
    • {@code webhooks()} for signature verification
    • - *
    - * - *

    Basic Usage

    *
    {@code
    - * ExtendClientWrapper client = ExtendClientWrapper.builder()
    - *     .token("your-api-key")
    - *     .build();
    - *
    - * // Synchronous convenience methods (inherited from ExtendClient)
    - * ParseRun parseResult = client.parse(ParseRequest.builder().file(...).build());
    - * ExtractRun extractResult = client.extract(ExtractRequest.builder().file(...).build());
    + * // Before
    + * ExtendClientWrapper client = ExtendClientWrapper.builder().apiKey("...").build();
      *
    - * // Create and poll an extract run
    - * ExtractRun response = client.extractRuns().createAndPoll(
    - *     ExtractRunsCreateRequest.builder()
    - *         .file(...)
    - *         .extractor(...)
    - *         .build()
    - * );
    - * }
    - * - *

    Webhook Verification

    - *
    {@code
    - * Map event = client.webhooks().verifyAndParse(
    - *     requestBody,
    - *     requestHeaders,
    - *     signingSecret
    - * );
    + * // After
    + * ExtendClient client = ExtendClient.builder().apiKey("...").build();
      * }
    */ +@Deprecated public class ExtendClientWrapper extends ExtendClient { - private final Webhooks webhooks; - - // Lazy-initialized run clients that override the generated client accessors - private final Supplier extractRunsClient; - private final Supplier classifyRunsClient; - private final Supplier splitRunsClient; - private final Supplier parseRunsClient; - private final Supplier editRunsClient; - private final Supplier workflowRunsClient; - public ExtendClientWrapper(ClientOptions clientOptions) { super(clientOptions); - this.webhooks = new Webhooks(); - - // Lazy initialization of clients - this.extractRunsClient = Suppliers.memoize(() -> new ExtractRunsClient(clientOptions)); - this.classifyRunsClient = Suppliers.memoize(() -> new ClassifyRunsClient(clientOptions)); - this.splitRunsClient = Suppliers.memoize(() -> new SplitRunsClient(clientOptions)); - this.parseRunsClient = Suppliers.memoize(() -> new ParseRunsClient(clientOptions)); - this.editRunsClient = Suppliers.memoize(() -> new EditRunsClient(clientOptions)); - this.workflowRunsClient = Suppliers.memoize(() -> new WorkflowRunsClient(clientOptions)); } /** - * Returns the webhook utilities for signature verification. + * Creates a new builder for ExtendClientWrapper. + * + * @deprecated Use {@link ExtendClient#builder()} instead. */ - public Webhooks webhooks() { - return webhooks; + @Deprecated + public static Builder builder() { + return new Builder(); } - // ========== Override run accessors to return clients with createAndPoll ========== - /** - * Returns the extract runs client with createAndPoll support. - * All standard methods (create, list, retrieve, delete, cancel) are also available. + * @deprecated Use {@link ExtendClientBuilder} (via {@link ExtendClient#builder()}) instead. + * Retained so existing {@code ExtendClientWrapper.Builder} references keep compiling. */ - @Override - public ExtractRunsClient extractRuns() { - return extractRunsClient.get(); - } + @Deprecated + public static class Builder extends ExtendClientBuilder { - /** - * Returns the classify runs client with createAndPoll support. - * All standard methods (create, list, retrieve, delete, cancel) are also available. - */ - @Override - public ClassifyRunsClient classifyRuns() { - return classifyRunsClient.get(); - } + @Override + public Builder apiKey(String apiKey) { + super.apiKey(apiKey); + return this; + } - /** - * Returns the split runs client with createAndPoll support. - * All standard methods (create, list, retrieve, delete, cancel) are also available. - */ - @Override - public SplitRunsClient splitRuns() { - return splitRunsClient.get(); - } + @Override + public Builder baseUrl(String baseUrl) { + super.baseUrl(baseUrl); + return this; + } - /** - * Returns the parse runs client with createAndPoll support. - * All standard methods (create, retrieve, delete) are also available. - */ - @Override - public ParseRunsClient parseRuns() { - return parseRunsClient.get(); - } + @Override + public Builder token(String token) { + super.token(token); + return this; + } - /** - * Returns the edit runs client with createAndPoll support. - * All standard methods (create, retrieve, delete) are also available. - */ - @Override - public EditRunsClient editRuns() { - return editRunsClient.get(); - } + @Override + public Builder extendApiVersion(String extendApiVersion) { + super.extendApiVersion(extendApiVersion); + return this; + } - /** - * Returns the workflow runs client with createAndPoll support. - * All standard methods (create, list, retrieve, update, delete, cancel, createBatch) are also available. - */ - @Override - public WorkflowRunsClient workflowRuns() { - return workflowRunsClient.get(); - } + @Override + public Builder environment(Environment environment) { + super.environment(environment); + return this; + } - /** - * Creates a new builder for ExtendClientWrapper. - */ - public static Builder builder() { - return new Builder(); - } + @Override + public Builder url(String url) { + super.url(url); + return this; + } - /** - * Builder for {@link ExtendClientWrapper}. - * Extends the generated {@link ExtendClientBuilder} so all standard options - * (token, environment, url, timeout, maxRetries, etc.) are available. - */ - public static class Builder extends ExtendClientBuilder { + @Override + public Builder timeout(int timeout) { + super.timeout(timeout); + return this; + } - /** - * Sets the API key (convenience alias for {@link #token(String)}). - */ - public Builder apiKey(String apiKey) { - super.token(apiKey); + @Override + public Builder maxRetries(int maxRetries) { + super.maxRetries(maxRetries); return this; } - /** - * Sets a custom base URL (convenience alias for {@link #url(String)}). - */ - public Builder baseUrl(String baseUrl) { - super.url(baseUrl); + @Override + public Builder httpClient(OkHttpClient httpClient) { + super.httpClient(httpClient); + return this; + } + + @Override + public Builder addHeader(String name, String value) { + super.addHeader(name, value); return this; } From 8c377f91a9880a0abaeb6ca904eef840b3e9c313 Mon Sep 17 00:00:00 2001 From: jordan-extend Date: Thu, 18 Jun 2026 16:00:15 -0400 Subject: [PATCH 3/3] Address review: restore builder token fail-fast, memoize raw client - ExtendClientBuilder/AsyncExtendClientBuilder: the overridden build() bypassed the base builder's null-token check + validateConfiguration() (token is private in the base). Track a shadow token (initialized from EXTEND_API_KEY) and re-run the same fail-fast + validation, so missing-credential construction fails with the helpful message instead of a later opaque 401. - ExtendClient/AsyncExtendClient: memoize the RawExtendClient returned by withRawResponse() to match the base client's cached-instance behavior. - ExtendClient: drop unused Environment/OkHttpClient imports (spotless-clean). --- src/main/java/ai/extend/AsyncExtendClient.java | 7 ++++++- src/main/java/ai/extend/AsyncExtendClientBuilder.java | 10 ++++++++++ src/main/java/ai/extend/ExtendClient.java | 6 +++--- src/main/java/ai/extend/ExtendClientBuilder.java | 10 ++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/main/java/ai/extend/AsyncExtendClient.java b/src/main/java/ai/extend/AsyncExtendClient.java index 986572c..c916e6e 100644 --- a/src/main/java/ai/extend/AsyncExtendClient.java +++ b/src/main/java/ai/extend/AsyncExtendClient.java @@ -7,14 +7,19 @@ package ai.extend; import ai.extend.core.ClientOptions; +import ai.extend.core.Suppliers; +import java.util.function.Supplier; /** * Asynchronous (CompletableFuture-based) Extend API client. */ public class AsyncExtendClient extends AsyncExtendClientBase { + private final Supplier rawClient; + public AsyncExtendClient(ClientOptions clientOptions) { super(clientOptions); + this.rawClient = Suppliers.memoize(() -> new AsyncRawExtendClient(clientOptions)); } /** @@ -23,7 +28,7 @@ public AsyncExtendClient(ClientOptions clientOptions) { */ @Override public AsyncRawExtendClient withRawResponse() { - return new AsyncRawExtendClient(this.clientOptions); + return rawClient.get(); } /** diff --git a/src/main/java/ai/extend/AsyncExtendClientBuilder.java b/src/main/java/ai/extend/AsyncExtendClientBuilder.java index 53269d9..36149d5 100644 --- a/src/main/java/ai/extend/AsyncExtendClientBuilder.java +++ b/src/main/java/ai/extend/AsyncExtendClientBuilder.java @@ -16,10 +16,15 @@ */ public class AsyncExtendClientBuilder extends AsyncExtendClientBaseBuilder { + // Shadows the (private) token in AsyncExtendClientBaseBuilder so the overridden build() + // below can re-run the same fail-fast check the base builder performs. + private String token = System.getenv("EXTEND_API_KEY"); + /** * Sets the API key (convenience alias for {@link #token(String)}). */ public AsyncExtendClientBuilder apiKey(String apiKey) { + this.token = apiKey; super.token(apiKey); return this; } @@ -34,6 +39,7 @@ public AsyncExtendClientBuilder baseUrl(String baseUrl) { @Override public AsyncExtendClientBuilder token(String token) { + this.token = token; super.token(token); return this; } @@ -82,6 +88,10 @@ public AsyncExtendClientBuilder addHeader(String name, String value) { @Override public AsyncExtendClient build() { + if (token == null) { + throw new RuntimeException("Please provide token or set the EXTEND_API_KEY environment variable."); + } + validateConfiguration(); return new AsyncExtendClient(buildClientOptions()); } } diff --git a/src/main/java/ai/extend/ExtendClient.java b/src/main/java/ai/extend/ExtendClient.java index 2f42311..cfb50a6 100644 --- a/src/main/java/ai/extend/ExtendClient.java +++ b/src/main/java/ai/extend/ExtendClient.java @@ -8,7 +8,6 @@ package ai.extend; import ai.extend.core.ClientOptions; -import ai.extend.core.Environment; import ai.extend.core.Suppliers; import ai.extend.wrapper.resources.ClassifyRunsClient; import ai.extend.wrapper.resources.EditRunsClient; @@ -18,7 +17,6 @@ import ai.extend.wrapper.resources.WorkflowRunsClient; import ai.extend.wrapper.webhooks.Webhooks; import java.util.function.Supplier; -import okhttp3.OkHttpClient; /** * The Extend API client, with additional polling and webhook utilities. @@ -76,6 +74,7 @@ public class ExtendClient extends ExtendClientBase { private final Supplier parseRunsClient; private final Supplier editRunsClient; private final Supplier workflowRunsClient; + private final Supplier rawClient; public ExtendClient(ClientOptions clientOptions) { super(clientOptions); @@ -88,6 +87,7 @@ public ExtendClient(ClientOptions clientOptions) { this.parseRunsClient = Suppliers.memoize(() -> new ParseRunsClient(clientOptions)); this.editRunsClient = Suppliers.memoize(() -> new EditRunsClient(clientOptions)); this.workflowRunsClient = Suppliers.memoize(() -> new WorkflowRunsClient(clientOptions)); + this.rawClient = Suppliers.memoize(() -> new RawExtendClient(clientOptions)); } /** @@ -159,7 +159,7 @@ public WorkflowRunsClient workflowRuns() { */ @Override public RawExtendClient withRawResponse() { - return new RawExtendClient(this.clientOptions); + return rawClient.get(); } /** diff --git a/src/main/java/ai/extend/ExtendClientBuilder.java b/src/main/java/ai/extend/ExtendClientBuilder.java index 6597d2f..bea2955 100644 --- a/src/main/java/ai/extend/ExtendClientBuilder.java +++ b/src/main/java/ai/extend/ExtendClientBuilder.java @@ -19,10 +19,15 @@ */ public class ExtendClientBuilder extends ExtendClientBaseBuilder { + // Shadows the (private) token in ExtendClientBaseBuilder so the overridden build() + // below can re-run the same fail-fast check the base builder performs. + private String token = System.getenv("EXTEND_API_KEY"); + /** * Sets the API key (convenience alias for {@link #token(String)}). */ public ExtendClientBuilder apiKey(String apiKey) { + this.token = apiKey; super.token(apiKey); return this; } @@ -37,6 +42,7 @@ public ExtendClientBuilder baseUrl(String baseUrl) { @Override public ExtendClientBuilder token(String token) { + this.token = token; super.token(token); return this; } @@ -85,6 +91,10 @@ public ExtendClientBuilder addHeader(String name, String value) { @Override public ExtendClient build() { + if (token == null) { + throw new RuntimeException("Please provide token or set the EXTEND_API_KEY environment variable."); + } + validateConfiguration(); return new ExtendClient(buildClientOptions()); } }