From 813b952b4530051c7ed3b758c5f38e889fcdfad8 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 09:48:48 +0000 Subject: [PATCH 1/2] [fern-generated] Update SDK Generated by Fern CLI Version: unknown Generators: - fernapi/fern-java-sdk: 4.11.1 --- .fern/metadata.json | 8 +- README.md | 5 +- build.gradle | 46 ++-- reference.md | 125 ++++++++- .../catchall/core/ClientOptions.java | 4 +- .../catchall/core/DateTimeDeserializer.java | 15 +- .../catchall/core/RequestOptions.java | 16 ++ .../catchall/core/RetryInterceptor.java | 33 ++- .../datasets/AsyncDatasetsClient.java | 14 +- .../datasets/AsyncRawDatasetsClient.java | 207 ++++++++++++++- .../resources/datasets/DatasetsClient.java | 14 +- .../resources/datasets/RawDatasetsClient.java | 188 +++++++++++++- .../requests/CreateDatasetFromCsvRequest.java | 1 - .../requests/CreateDatasetRequest.java | 1 - .../entities/AsyncEntitiesClient.java | 12 +- .../entities/AsyncRawEntitiesClient.java | 85 +++++- .../resources/entities/EntitiesClient.java | 12 +- .../resources/entities/RawEntitiesClient.java | 79 +++++- .../resources/jobs/AsyncRawJobsClient.java | 109 ++++++++ .../resources/jobs/RawJobsClient.java | 100 +++++++ .../jobs/requests/ContinueRequestDto.java | 1 - .../jobs/requests/SubmitRequestDto.java | 24 +- .../requests/ValidateQueryRequestDto.java | 1 - .../resources/meta/AsyncRawMetaClient.java | 37 +++ .../resources/meta/RawMetaClient.java | 34 +++ .../monitors/AsyncRawMonitorsClient.java | 121 +++++++++ .../resources/monitors/RawMonitorsClient.java | 111 ++++++++ .../requests/CreateMonitorRequestDto.java | 3 - .../types/DisableMonitorResponse.java | 3 - .../monitors/types/EnableMonitorResponse.java | 3 - .../types/ListMonitorJobsResponse.java | 3 - .../projects/AsyncRawProjectsClient.java | 109 ++++++++ .../resources/projects/RawProjectsClient.java | 100 +++++++ .../requests/CreateProjectRequestDto.java | 1 - .../webhooks/AsyncRawWebhooksClient.java | 244 ++++++++++++++++++ .../webhooks/AsyncWebhooksClient.java | 30 +++ .../resources/webhooks/RawWebhooksClient.java | 213 +++++++++++++++ .../resources/webhooks/WebhooksClient.java | 29 +++ .../AssignWebhookResourceRequestDto.java | 2 - .../requests/CreateWebhookRequestDto.java | 43 ++- .../GetWebhookDeliveryHistoryRequest.java | 2 - .../requests/TriggerWebhookRequest.java | 179 +++++++++++++ .../requests/UpdateWebhookRequestDto.java | 21 +- .../types/AddResourceResponseDto.java | 2 - .../catchall/types/ApiKeyAuthDto.java | 2 - .../AssignWebhookResourceResponseDto.java | 1 - .../catchall/types/BaseRecord.java | 5 - .../catchall/types/BasicAuthDto.java | 2 - .../catchall/types/BearerAuthDto.java | 1 - .../newscatcher/catchall/types/Citation.java | 3 - .../catchall/types/CompanyAttributes.java | 54 +--- .../types/CompanyEnrichmentOutput.java | 2 - .../CompanyEnrichmentOutputMetadata.java | 1 - .../catchall/types/ConnectedDataset.java | 2 - .../catchall/types/ConnectedEntity.java | 11 - .../catchall/types/ContinueResponseDto.java | 3 - .../types/CreateDatasetCsvResponse.java | 3 - .../types/CreateEntitiesBatchResponse.java | 1 - .../catchall/types/CreateEntityRequest.java | 9 +- .../catchall/types/CreateEntityResponse.java | 2 - .../types/CreateMonitorResponseDto.java | 1 - .../types/CreateProjectResponseDto.java | 4 - .../types/CreateWebhookResponseDto.java | 2 - .../types/DatasetEntityListResponse.java | 3 - .../catchall/types/DatasetListResponse.java | 3 - .../catchall/types/DatasetResponse.java | 150 ++++++++++- .../types/DatasetStatusHistoryResponse.java | 1 - .../catchall/types/DeleteJobResponseDto.java | 1 - .../types/DeleteMonitorResponseDto.java | 1 - .../types/DeliveryHistoryItemDto.java | 8 - .../types/DeliveryHistoryResponseDto.java | 6 - .../catchall/types/EnrichmentSchema.java | 2 - .../catchall/types/EntityListResponse.java | 3 - .../catchall/types/EntityResponse.java | 3 - .../catchall/types/EntitySummary.java | 2 - .../types/EntityValidationErrorBody.java | 4 - .../catchall/types/FormatterConfigDto.java | 180 +++++++++++++ .../catchall/types/GetWebhookResponseDto.java | 2 - .../catchall/types/InitializeResponseDto.java | 26 +- .../newscatcher/catchall/types/JobStep.java | 2 - .../types/ListMonitorsResponseDto.java | 4 - .../types/ListUserJobsResponseDto.java | 4 - .../ListWebhookResourcesResponseDto.java | 4 - .../types/ListWebhooksResponseDto.java | 4 - .../types/ManageEntitiesResponse.java | 2 - .../catchall/types/MonitorCitation.java | 6 - .../catchall/types/MonitorJobItem.java | 3 - .../catchall/types/MonitorListItemDto.java | 4 - .../catchall/types/MonitorRecord.java | 5 - .../catchall/types/MonitorStatusEntry.java | 13 - .../MonitorStatusHistoryResponseDto.java | 1 - .../catchall/types/PlanFeature.java | 2 - .../types/ProjectListResponseDto.java | 4 - .../types/ProjectOverviewResponseDto.java | 2 - .../catchall/types/ProjectResourceDto.java | 1 - .../types/ProjectResourceListResponseDto.java | 4 - .../catchall/types/ProjectResponseDto.java | 4 - .../catchall/types/ProjectSummaryDto.java | 2 - .../catchall/types/PullJobResponseDto.java | 1 - .../types/PullMonitorResponseDto.java | 2 - .../newscatcher/catchall/types/Record.java | 5 - .../types/RemoveResourceResponseDto.java | 2 - .../catchall/types/ResourceItemDto.java | 1 - .../catchall/types/ResourceResultDto.java | 4 - .../catchall/types/SharingInfo.java | 4 - .../catchall/types/SkippedRow.java | 3 - .../catchall/types/StatusResponseDto.java | 1 - .../catchall/types/SubmitResponseDto.java | 1 - .../catchall/types/Suggestion.java | 2 - .../types/TestWebhookResponseDto.java | 2 - .../types/UpdateMonitorResponseDto.java | 2 - .../types/UpdateProjectResponseDto.java | 3 - .../types/UpdateWebhookResponseDto.java | 2 - .../types/UploadCsvToDatasetResponse.java | 2 - .../newscatcher/catchall/types/UserJob.java | 4 - .../types/ValidateQueryResponseDto.java | 3 - .../catchall/types/ValidationReport.java | 4 - .../catchall/types/ValidatorSchema.java | 2 - .../catchall/types/WebhookDto.java | 1 - .../WebhookResourceMappingResponseDto.java | 4 - .../catchall/types/WebhookResponseDto.java | 36 ++- 121 files changed, 2605 insertions(+), 451 deletions(-) create mode 100644 src/main/java/com/newscatcher/catchall/resources/webhooks/requests/TriggerWebhookRequest.java create mode 100644 src/main/java/com/newscatcher/catchall/types/FormatterConfigDto.java diff --git a/.fern/metadata.json b/.fern/metadata.json index 31605b2..71d9bf1 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,16 +1,16 @@ { - "cliVersion": "5.50.6", + "cliVersion": "5.66.0", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.10.16", + "generatorVersion": "4.11.1", "generatorConfig": { "publish-to": "central", "client-class-name": "CatchAllApi", "package-prefix": "com.newscatcher.catchall" }, - "originGitCommit": "f9a7ba07dda24e9d9936bb543686bc542355479e", + "originGitCommit": "1e66c85a387d0d844162c965656c6a0d36334c11", "originGitCommitIsDirty": true, "invokedBy": "ci", "requestedVersion": "AUTO", "ciProvider": "unknown", - "sdkVersion": "3.0.2" + "sdkVersion": "0.0.0-fern-placeholder" } \ No newline at end of file diff --git a/README.md b/README.md index f5d0480..677483a 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Add the dependency in your `build.gradle` file: ```groovy dependencies { - implementation 'com.newscatcherapi:newscatcher-catchall-sdk:3.0.2' + implementation 'com.newscatcherapi:newscatcher-catchall-sdk:0.0.0-fern-placeholder' } ``` @@ -47,7 +47,7 @@ Add the dependency in your `pom.xml` file: com.newscatcherapi newscatcher-catchall-sdk - 3.0.2 + 0.0.0-fern-placeholder ``` @@ -265,3 +265,4 @@ On the other hand, contributions to the README are always very welcome! + diff --git a/build.gradle b/build.gradle index 45412c6..50f8a68 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,19 @@ +buildscript { + repositories { + gradlePluginPortal() + } + dependencies { + if (JavaVersion.current().isJava11Compatible()) { + classpath 'cl.franciscosolis:SonatypeCentralUpload:1.0.3' + } + } +} + plugins { id 'java-library' id 'maven-publish' id 'com.diffplug.spotless' version '6.11.0' id 'signing' - id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3' } repositories { @@ -47,7 +57,7 @@ java { group = 'com.newscatcherapi' -version = '3.0.2' +version = '0.0.0-fern-placeholder' jar { dependsOn(":generatePomFileForMavenPublication") @@ -78,7 +88,7 @@ publishing { maven(MavenPublication) { groupId = 'com.newscatcherapi' artifactId = 'newscatcher-catchall-sdk' - version = '3.0.2' + version = '0.0.0-fern-placeholder' from components.java pom { name = 'newscatcher' @@ -105,19 +115,25 @@ publishing { } } -sonatypeCentralUpload { - username = "$System.env.MAVEN_USERNAME" - password = "$System.env.MAVEN_PASSWORD" +if (JavaVersion.current().isJava11Compatible()) { + apply plugin: 'cl.franciscosolis.sonatype-central-upload' - archives = files( - "$buildDir/libs/newscatcher-catchall-sdk-" + version + ".jar", - "$buildDir/libs/newscatcher-catchall-sdk-" + version + "-sources.jar", - "$buildDir/libs/newscatcher-catchall-sdk-" + version + "-javadoc.jar" - ) + sonatypeCentralUpload { + username = "$System.env.MAVEN_USERNAME" + password = "$System.env.MAVEN_PASSWORD" - pom = file("$buildDir/publications/maven/pom-default.xml") - signingKey = "$System.env.MAVEN_SIGNATURE_SECRET_KEY" - signingKeyPassphrase = "$System.env.MAVEN_SIGNATURE_PASSWORD" + archives = files( + "$buildDir/libs/newscatcher-catchall-sdk-" + version + ".jar", + "$buildDir/libs/newscatcher-catchall-sdk-" + version + "-sources.jar", + "$buildDir/libs/newscatcher-catchall-sdk-" + version + "-javadoc.jar" + ) + + pom = file("$buildDir/publications/maven/pom-default.xml") + signingKey = "$System.env.MAVEN_SIGNATURE_SECRET_KEY" + signingKeyPassphrase = "$System.env.MAVEN_SIGNATURE_PASSWORD" + } + + sonatypeCentralUpload.dependsOn build } signing { @@ -127,5 +143,3 @@ signing { useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) sign publishing.publications.maven } - -sonatypeCentralUpload.dependsOn build diff --git a/reference.md b/reference.md index b3fd070..889b3fc 100644 --- a/reference.md +++ b/reference.md @@ -336,6 +336,10 @@ client.jobs().createJob( Custom validators for filtering web page clusters. If not provided, validators are generated automatically based on the query. +The system may also inject validators during the `analyzing` stage — for +example, converting a relative time qualifier into an explicit event-date +gate. The returned `validators[]` in the job status shows the complete +applied set, including any system-added ones. @@ -1714,7 +1718,7 @@ Authentication forwarded with each delivery. Supported types:
-**formatterConfig:** `Optional>` — Custom payload transformation configuration. Required only when `type` is `custom`. +**formatterConfig:** `Optional` — Custom payload formatter. Required when `type` is `custom`.
@@ -1967,7 +1971,7 @@ client.webhooks().updateWebhook(
-**formatterConfig:** `Optional>` — Updated formatter configuration. +**formatterConfig:** `Optional` — Updated custom payload formatter. Set only when `type` is `custom`.
@@ -2396,6 +2400,101 @@ client.webhooks().listWebhooksForResource( + + + + +
client.webhooks.triggerWebhook(resourceType, resourceId) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Manually dispatches a webhook delivery for a resource on demand, without +waiting for the next job or monitor cycle. + +Use this to re-deliver results after a failed delivery, replay a specific +job's results, or validate a webhook against live data. The webhook must +already be assigned to the resource. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```java +client.webhooks().triggerWebhook( + MappableResourceType.JOB, + "3fec5b07-8786-46d7-9486-d43ff67eccd4", + TriggerWebhookRequest + .builder() + .webhookId("a1b2c3d4-e5f6-7890-abcd-ef1234567890") + .jobId("3fec5b07-8786-46d7-9486-d43ff67eccd4") + .build() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resourceType:** `MappableResourceType` + +
+
+ +
+
+ +**resourceId:** `String` — Unique resource identifier. + +
+
+ +
+
+ +**webhookId:** `String` — Identifier of the webhook to trigger. Must be assigned to the resource. + +
+
+ +
+
+ +**jobId:** `Optional` + +Specific job run to deliver. Optional for `job` resources; for +`monitor` and `monitor_group` resources, selects a past run to replay. +When omitted, the latest available results are delivered. + +
+
+
+
+ +
@@ -2608,10 +2707,10 @@ client.entities().listEntities( Creates a new company entity and begins background enrichment. +Each entity requires a `name` plus at least one of: a `description` or a `domain`. Providing both is recommended — `domain` is the highest-signal identifier because it is unambiguous; a well-written `description` is the best alternative when no domain is available. + The entity status starts as `pending` and transitions to `ready` once -enrichment completes. Provide as much identifying information as -possible — `domain` is the highest-signal field because it is -unambiguous. +enrichment completes. @@ -2631,7 +2730,7 @@ client.entities().createEntity( .builder() .name("NewsCatcher") .entityType(EntityType.COMPANY) - .description("AI-powered news data provider") + .description("NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).") .additionalAttributes( AdditionalAttributes .builder() @@ -2646,7 +2745,7 @@ client.entities().createEntity( ) .alternativeNames( Optional.of( - Arrays.asList("NC", "NewsCatcher API") + Arrays.asList("NewsCatcher CatchAll", "NewsCatcher API") ) ) .build() @@ -2695,6 +2794,8 @@ client.entities().createEntity( Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. +Each entity requires a `name` plus at least one of: a `description` or a `domain`. See [Create entity](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entity) for the full field reference. + Returns an array of `{id, status}` objects in the same order as the input array. @@ -2956,7 +3057,7 @@ client.entities().updateEntity( .builder() .alternativeNames( Optional.of( - Arrays.asList("NC", "NewsCatcher API", "NCA") + Arrays.asList("NewsCatcher CatchAll", "NewsCatcher API", "NCA") ) ) .build() @@ -3152,7 +3253,9 @@ client.datasets().listDatasets(
-Creates a new dataset from a list of existing entity IDs. +Creates a new dataset from a list of existing entity IDs. The optional `description` field here describes the dataset itself — it is separate from the entity-level `description` used for matching. + +Entities must be created before adding them to a dataset. Each entity requires a `name` plus at least one of: a `description` or a `domain`. Use [Create entity](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entity) or [Create entities batch](https://www.newscatcherapi.com/docs/web-search-api/api-reference/entities/create-entities-batch) to create entities first. If any of the provided entity IDs do not exist or do not belong to your organization, the request fails with `400`. All entity IDs must @@ -3240,12 +3343,12 @@ client.datasets().createDataset(
-Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The `name` and `domain`columns are required; all other columns are optional. +Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a `name` plus at least one of: a `description` or a `domain`; all other columns are optional. Note: `description` in the CSV is the entity's matching description — it is separate from the dataset-level `description` field in the form data. **CSV format:** ```csv name,description,domain,alternative_names,key_persons -NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka" +NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka" OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman" ``` diff --git a/src/main/java/com/newscatcher/catchall/core/ClientOptions.java b/src/main/java/com/newscatcher/catchall/core/ClientOptions.java index a903af7..897675d 100644 --- a/src/main/java/com/newscatcher/catchall/core/ClientOptions.java +++ b/src/main/java/com/newscatcher/catchall/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.newscatcherapi:newscatcher-catchall-sdk/3.0.2"); + put("User-Agent", "com.newscatcherapi:newscatcher-catchall-sdk/0.0.0-fern-placeholder"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.newscatcher.fern:api-sdk"); - put("X-Fern-SDK-Version", "3.0.2"); + put("X-Fern-SDK-Version", "0.0.0-fern-placeholder"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/newscatcher/catchall/core/DateTimeDeserializer.java b/src/main/java/com/newscatcher/catchall/core/DateTimeDeserializer.java index e3828ba..869cebb 100644 --- a/src/main/java/com/newscatcher/catchall/core/DateTimeDeserializer.java +++ b/src/main/java/com/newscatcher/catchall/core/DateTimeDeserializer.java @@ -19,7 +19,8 @@ import java.time.temporal.TemporalQueries; /** - * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + * Custom deserializer that handles converting date-time strings into {@link OffsetDateTime} objects. + * Supports ISO 8601 format, space-separated variants, and RFC 1123 (RFC 2822) format. */ class DateTimeDeserializer extends JsonDeserializer { private static final SimpleModule MODULE; @@ -48,9 +49,15 @@ public OffsetDateTime deserialize(JsonParser parser, DeserializationContext cont try { temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(value, OffsetDateTime::from, LocalDateTime::from); } catch (DateTimeParseException e) { - // Fall back to space-separated format (e.g. "2025-02-15 10:30:00+00:00"). - temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( - value.replace(' ', 'T'), OffsetDateTime::from, LocalDateTime::from); + try { + // Fall back to space-separated format (e.g. "2025-02-15 10:30:00+00:00"). + temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + value.replace(' ', 'T'), OffsetDateTime::from, LocalDateTime::from); + } catch (DateTimeParseException e2) { + // Fall back to RFC 1123 format (e.g. "Thu, 07 May 2026 14:23:38 +0000"). + temporal = DateTimeFormatter.RFC_1123_DATE_TIME.parseBest( + value, OffsetDateTime::from, LocalDateTime::from); + } } if (temporal.query(TemporalQueries.offset()) == null) { diff --git a/src/main/java/com/newscatcher/catchall/core/RequestOptions.java b/src/main/java/com/newscatcher/catchall/core/RequestOptions.java index 1c1862d..a556072 100644 --- a/src/main/java/com/newscatcher/catchall/core/RequestOptions.java +++ b/src/main/java/com/newscatcher/catchall/core/RequestOptions.java @@ -16,6 +16,8 @@ public final class RequestOptions { private final TimeUnit timeoutTimeUnit; + private final Optional maxRetries; + private final Map headers; private final Map> headerSuppliers; @@ -28,6 +30,7 @@ private RequestOptions( String apiKey, Optional timeout, TimeUnit timeoutTimeUnit, + Optional maxRetries, Map headers, Map> headerSuppliers, Map queryParameters, @@ -35,6 +38,7 @@ private RequestOptions( this.apiKey = apiKey; this.timeout = timeout; this.timeoutTimeUnit = timeoutTimeUnit; + this.maxRetries = maxRetries; this.headers = headers; this.headerSuppliers = headerSuppliers; this.queryParameters = queryParameters; @@ -49,6 +53,10 @@ public TimeUnit getTimeoutTimeUnit() { return timeoutTimeUnit; } + public Optional getMaxRetries() { + return maxRetries; + } + public Map getHeaders() { Map headers = new HashMap<>(); if (this.apiKey != null) { @@ -80,6 +88,8 @@ public static class Builder { private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + private Optional maxRetries = Optional.empty(); + private final Map headers = new HashMap<>(); private final Map> headerSuppliers = new HashMap<>(); @@ -104,6 +114,11 @@ public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { return this; } + public Builder maxRetries(Integer maxRetries) { + this.maxRetries = Optional.of(maxRetries); + return this; + } + public Builder addHeader(String key, String value) { this.headers.put(key, value); return this; @@ -129,6 +144,7 @@ public RequestOptions build() { apiKey, timeout, timeoutTimeUnit, + maxRetries, headers, headerSuppliers, queryParameters, diff --git a/src/main/java/com/newscatcher/catchall/core/RetryInterceptor.java b/src/main/java/com/newscatcher/catchall/core/RetryInterceptor.java index 2ab6763..f6a389f 100644 --- a/src/main/java/com/newscatcher/catchall/core/RetryInterceptor.java +++ b/src/main/java/com/newscatcher/catchall/core/RetryInterceptor.java @@ -11,6 +11,7 @@ import java.util.Optional; import java.util.Random; import okhttp3.Interceptor; +import okhttp3.Request; import okhttp3.Response; public class RetryInterceptor implements Interceptor { @@ -28,17 +29,24 @@ public RetryInterceptor(int maxRetries) { @Override public Response intercept(Chain chain) throws IOException { - Response response = chain.proceed(chain.request()); + Request request = chain.request(); + int effectiveMaxRetries = resolveMaxRetries(request); + Response response = chain.proceed(request); if (shouldRetry(response.code())) { - return retryChain(response, chain); + return retryChain(response, chain, effectiveMaxRetries); } return response; } - private Response retryChain(Response response, Chain chain) throws IOException { - ExponentialBackoff backoff = new ExponentialBackoff(this.maxRetries); + private int resolveMaxRetries(Request request) { + MaxRetriesOverride override = request.tag(MaxRetriesOverride.class); + return override != null ? override.getValue() : this.maxRetries; + } + + private Response retryChain(Response response, Chain chain, int maxRetries) throws IOException { + ExponentialBackoff backoff = new ExponentialBackoff(maxRetries); Optional nextBackoff = backoff.nextBackoff(response); while (nextBackoff.isPresent()) { try { @@ -158,6 +166,23 @@ private static boolean shouldRetry(int statusCode) { return statusCode == 408 || statusCode == 429 || statusCode >= 500; } + /** + * Per-request override carried on the OkHttp {@link Request} as a tag. + * When present, the interceptor uses this value instead of the client-wide + * {@code maxRetries} configured at construction time. + */ + public static final class MaxRetriesOverride { + private final int value; + + public MaxRetriesOverride(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + private final class ExponentialBackoff { private final int maxNumRetries; diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncDatasetsClient.java b/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncDatasetsClient.java index f4686d3..b479dfb 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncDatasetsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncDatasetsClient.java @@ -75,7 +75,8 @@ public CompletableFuture listDatasets( } /** - * Creates a new dataset from a list of existing entity IDs. + * Creates a new dataset from a list of existing entity IDs. The optional description field here describes the dataset itself — it is separate from the entity-level description used for matching. + *

Entities must be created before adding them to a dataset. Each entity requires a name plus at least one of: a description or a domain. Use Create entity or Create entities batch to create entities first.

*

If any of the provided entity IDs do not exist or do not belong to * your organization, the request fails with 400. All entity IDs must * be valid before the dataset is created.

@@ -87,7 +88,8 @@ public CompletableFuture createDataset(CreateDatasetRequest req } /** - * Creates a new dataset from a list of existing entity IDs. + * Creates a new dataset from a list of existing entity IDs. The optional description field here describes the dataset itself — it is separate from the entity-level description used for matching. + *

Entities must be created before adding them to a dataset. Each entity requires a name plus at least one of: a description or a domain. Use Create entity or Create entities batch to create entities first.

*

If any of the provided entity IDs do not exist or do not belong to * your organization, the request fails with 400. All entity IDs must * be valid before the dataset is created.

@@ -100,10 +102,10 @@ public CompletableFuture createDataset( } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The name and domaincolumns are required; all other columns are optional. + * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a name plus at least one of: a description or a domain; all other columns are optional. Note: description in the CSV is the entity's matching description — it is separate from the dataset-level description field in the form data. *

CSV format:

*
name,description,domain,alternative_names,key_persons
-     * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
+     * NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
      * OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
      * 
*

Use semicolons (;) to separate multiple values in alternative_names and key_persons. Rows with empty name are skipped and reported in validation_report.

@@ -115,10 +117,10 @@ public CompletableFuture createDatasetFromCsv( } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The name and domaincolumns are required; all other columns are optional. + * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a name plus at least one of: a description or a domain; all other columns are optional. Note: description in the CSV is the entity's matching description — it is separate from the dataset-level description field in the form data. *

CSV format:

*
name,description,domain,alternative_names,key_persons
-     * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
+     * NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
      * OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
      * 
*

Use semicolons (;) to separate multiple values in alternative_names and key_persons. Rows with empty name are skipped and reported in validation_report.

diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncRawDatasetsClient.java b/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncRawDatasetsClient.java index acc2ceb..36bd41e 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncRawDatasetsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncRawDatasetsClient.java @@ -13,6 +13,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -138,6 +139,15 @@ public CompletableFuture> listDatas if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -163,6 +173,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -177,7 +190,8 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Creates a new dataset from a list of existing entity IDs. + * Creates a new dataset from a list of existing entity IDs. The optional description field here describes the dataset itself — it is separate from the entity-level description used for matching. + *

Entities must be created before adding them to a dataset. Each entity requires a name plus at least one of: a description or a domain. Use Create entity or Create entities batch to create entities first.

*

If any of the provided entity IDs do not exist or do not belong to * your organization, the request fails with 400. All entity IDs must * be valid before the dataset is created.

@@ -189,7 +203,8 @@ public CompletableFuture> createDataset } /** - * Creates a new dataset from a list of existing entity IDs. + * Creates a new dataset from a list of existing entity IDs. The optional description field here describes the dataset itself — it is separate from the entity-level description used for matching. + *

Entities must be created before adding them to a dataset. Each entity requires a name plus at least one of: a description or a domain. Use Create entity or Create entities batch to create entities first.

*

If any of the provided entity IDs do not exist or do not belong to * your organization, the request fails with 400. All entity IDs must * be valid before the dataset is created.

@@ -224,6 +239,15 @@ public CompletableFuture> createDataset if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -262,6 +286,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -276,10 +303,10 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The name and domaincolumns are required; all other columns are optional. + * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a name plus at least one of: a description or a domain; all other columns are optional. Note: description in the CSV is the entity's matching description — it is separate from the dataset-level description field in the form data. *

CSV format:

*
name,description,domain,alternative_names,key_persons
-     * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
+     * NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
      * OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
      * 
*

Use semicolons (;) to separate multiple values in alternative_names and key_persons. Rows with empty name are skipped and reported in validation_report.

@@ -291,10 +318,10 @@ public CompletableFuture> crea } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The name and domaincolumns are required; all other columns are optional. + * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a name plus at least one of: a description or a domain; all other columns are optional. Note: description in the CSV is the entity's matching description — it is separate from the dataset-level description field in the form data. *

CSV format:

*
name,description,domain,alternative_names,key_persons
-     * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
+     * NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
      * OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
      * 
*

Use semicolons (;) to separate multiple values in alternative_names and key_persons. Rows with empty name are skipped and reported in validation_report.

@@ -334,6 +361,15 @@ public CompletableFuture> crea if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -367,6 +403,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -428,6 +467,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -489,6 +531,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -525,6 +570,15 @@ public CompletableFuture> crea if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -558,6 +612,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -594,6 +651,15 @@ public CompletableFuture> crea if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -627,6 +693,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -687,6 +756,15 @@ public CompletableFuture> getDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -719,6 +797,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -787,6 +868,15 @@ public CompletableFuture> deleteDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -817,6 +907,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -885,6 +978,15 @@ public CompletableFuture> updateDataset if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -923,6 +1025,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -977,6 +1082,15 @@ public CompletableFuture> addEnt if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1015,6 +1129,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1069,6 +1186,15 @@ public CompletableFuture> remove if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1107,6 +1233,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1180,6 +1309,15 @@ public CompletableFuture> lis if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1219,6 +1357,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1283,6 +1424,15 @@ public CompletableFuture> if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1316,6 +1466,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1373,6 +1526,15 @@ public CompletableFuture> up if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1412,6 +1574,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1481,6 +1646,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1550,6 +1718,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1588,6 +1759,15 @@ public CompletableFuture> up if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1627,6 +1807,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1665,6 +1848,15 @@ public CompletableFuture> up if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1704,6 +1896,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/DatasetsClient.java b/src/main/java/com/newscatcher/catchall/resources/datasets/DatasetsClient.java index 21441d1..bcf5942 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/DatasetsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/DatasetsClient.java @@ -73,7 +73,8 @@ public DatasetListResponse listDatasets(ListDatasetsRequest request, RequestOpti } /** - * Creates a new dataset from a list of existing entity IDs. + * Creates a new dataset from a list of existing entity IDs. The optional description field here describes the dataset itself — it is separate from the entity-level description used for matching. + *

Entities must be created before adding them to a dataset. Each entity requires a name plus at least one of: a description or a domain. Use Create entity or Create entities batch to create entities first.

*

If any of the provided entity IDs do not exist or do not belong to * your organization, the request fails with 400. All entity IDs must * be valid before the dataset is created.

@@ -85,7 +86,8 @@ public DatasetResponse createDataset(CreateDatasetRequest request) { } /** - * Creates a new dataset from a list of existing entity IDs. + * Creates a new dataset from a list of existing entity IDs. The optional description field here describes the dataset itself — it is separate from the entity-level description used for matching. + *

Entities must be created before adding them to a dataset. Each entity requires a name plus at least one of: a description or a domain. Use Create entity or Create entities batch to create entities first.

*

If any of the provided entity IDs do not exist or do not belong to * your organization, the request fails with 400. All entity IDs must * be valid before the dataset is created.

@@ -97,10 +99,10 @@ public DatasetResponse createDataset(CreateDatasetRequest request, RequestOption } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The name and domaincolumns are required; all other columns are optional. + * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a name plus at least one of: a description or a domain; all other columns are optional. Note: description in the CSV is the entity's matching description — it is separate from the dataset-level description field in the form data. *

CSV format:

*
name,description,domain,alternative_names,key_persons
-     * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
+     * NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
      * OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
      * 
*

Use semicolons (;) to separate multiple values in alternative_names and key_persons. Rows with empty name are skipped and reported in validation_report.

@@ -111,10 +113,10 @@ public CreateDatasetCsvResponse createDatasetFromCsv(File file, CreateDatasetFro } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The name and domaincolumns are required; all other columns are optional. + * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a name plus at least one of: a description or a domain; all other columns are optional. Note: description in the CSV is the entity's matching description — it is separate from the dataset-level description field in the form data. *

CSV format:

*
name,description,domain,alternative_names,key_persons
-     * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
+     * NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
      * OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
      * 
*

Use semicolons (;) to separate multiple values in alternative_names and key_persons. Rows with empty name are skipped and reported in validation_report.

diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/RawDatasetsClient.java b/src/main/java/com/newscatcher/catchall/resources/datasets/RawDatasetsClient.java index 0fa7b2b..b20460c 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/RawDatasetsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/RawDatasetsClient.java @@ -13,6 +13,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -134,6 +135,15 @@ public CatchAllApiHttpResponse listDatasets( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -152,13 +162,16 @@ public CatchAllApiHttpResponse listDatasets( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } } /** - * Creates a new dataset from a list of existing entity IDs. + * Creates a new dataset from a list of existing entity IDs. The optional description field here describes the dataset itself — it is separate from the entity-level description used for matching. + *

Entities must be created before adding them to a dataset. Each entity requires a name plus at least one of: a description or a domain. Use Create entity or Create entities batch to create entities first.

*

If any of the provided entity IDs do not exist or do not belong to * your organization, the request fails with 400. All entity IDs must * be valid before the dataset is created.

@@ -170,7 +183,8 @@ public CatchAllApiHttpResponse createDataset(CreateDatasetReque } /** - * Creates a new dataset from a list of existing entity IDs. + * Creates a new dataset from a list of existing entity IDs. The optional description field here describes the dataset itself — it is separate from the entity-level description used for matching. + *

Entities must be created before adding them to a dataset. Each entity requires a name plus at least one of: a description or a domain. Use Create entity or Create entities batch to create entities first.

*

If any of the provided entity IDs do not exist or do not belong to * your organization, the request fails with 400. All entity IDs must * be valid before the dataset is created.

@@ -205,6 +219,15 @@ public CatchAllApiHttpResponse createDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -231,16 +254,18 @@ public CatchAllApiHttpResponse createDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The name and domaincolumns are required; all other columns are optional. + * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a name plus at least one of: a description or a domain; all other columns are optional. Note: description in the CSV is the entity's matching description — it is separate from the dataset-level description field in the form data. *

CSV format:

*
name,description,domain,alternative_names,key_persons
-     * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
+     * NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
      * OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
      * 
*

Use semicolons (;) to separate multiple values in alternative_names and key_persons. Rows with empty name are skipped and reported in validation_report.

@@ -252,10 +277,10 @@ public CatchAllApiHttpResponse createDatasetFromCsv( } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The name and domaincolumns are required; all other columns are optional. + * Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. Each row requires a name plus at least one of: a description or a domain; all other columns are optional. Note: description in the CSV is the entity's matching description — it is separate from the dataset-level description field in the form data. *

CSV format:

*
name,description,domain,alternative_names,key_persons
-     * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
+     * NewsCatcher,"NewsCatcher is a data-as-a-service company providing news intelligence APIs including the CatchAll Web Search API (2B+ web pages indexed) and News API (140,000+ sources, 100+ countries).",newscatcherapi.com,"NewsCatcher CatchAll;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
      * OpenAI,"Artificial intelligence research company",openai.com,"Open AI","Sam Altman"
      * 
*

Use semicolons (;) to separate multiple values in alternative_names and key_persons. Rows with empty name are skipped and reported in validation_report.

@@ -295,6 +320,15 @@ public CatchAllApiHttpResponse createDatasetFromCsv( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -319,6 +353,8 @@ public CatchAllApiHttpResponse createDatasetFromCsv( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -362,6 +398,8 @@ public CatchAllApiHttpResponse createDatasetFromCsv(In Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -406,6 +444,8 @@ public CatchAllApiHttpResponse createDatasetFromCsv( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -434,6 +474,15 @@ public CatchAllApiHttpResponse createDatasetFromCsv( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -458,6 +507,8 @@ public CatchAllApiHttpResponse createDatasetFromCsv( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -486,6 +537,15 @@ public CatchAllApiHttpResponse createDatasetFromCsv( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -510,6 +570,8 @@ public CatchAllApiHttpResponse createDatasetFromCsv( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -560,6 +622,15 @@ public CatchAllApiHttpResponse getDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -582,6 +653,8 @@ public CatchAllApiHttpResponse getDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -640,6 +713,15 @@ public CatchAllApiHttpResponse deleteDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { @@ -661,6 +743,8 @@ public CatchAllApiHttpResponse deleteDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -719,6 +803,15 @@ public CatchAllApiHttpResponse updateDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -745,6 +838,8 @@ public CatchAllApiHttpResponse updateDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -791,6 +886,15 @@ public CatchAllApiHttpResponse addEntitiesToDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -818,6 +922,8 @@ public CatchAllApiHttpResponse addEntitiesToDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -864,6 +970,15 @@ public CatchAllApiHttpResponse removeEntitiesFromDataset if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -891,6 +1006,8 @@ public CatchAllApiHttpResponse removeEntitiesFromDataset Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -955,6 +1072,15 @@ public CatchAllApiHttpResponse listEntitiesInDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -982,6 +1108,8 @@ public CatchAllApiHttpResponse listEntitiesInDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -1037,6 +1165,15 @@ public CatchAllApiHttpResponse getDatasetStatusHis if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -1060,6 +1197,8 @@ public CatchAllApiHttpResponse getDatasetStatusHis Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -1109,6 +1248,15 @@ public CatchAllApiHttpResponse uploadCsvToDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -1136,6 +1284,8 @@ public CatchAllApiHttpResponse uploadCsvToDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -1185,6 +1335,8 @@ public CatchAllApiHttpResponse uploadCsvToDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -1234,6 +1386,8 @@ public CatchAllApiHttpResponse uploadCsvToDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -1264,6 +1418,15 @@ public CatchAllApiHttpResponse uploadCsvToDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -1291,6 +1454,8 @@ public CatchAllApiHttpResponse uploadCsvToDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -1321,6 +1486,15 @@ public CatchAllApiHttpResponse uploadCsvToDataset( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -1348,6 +1522,8 @@ public CatchAllApiHttpResponse uploadCsvToDataset( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/requests/CreateDatasetFromCsvRequest.java b/src/main/java/com/newscatcher/catchall/resources/datasets/requests/CreateDatasetFromCsvRequest.java index c0d3ba6..328f056 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/requests/CreateDatasetFromCsvRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/requests/CreateDatasetFromCsvRequest.java @@ -122,7 +122,6 @@ public Builder from(CreateDatasetFromCsvRequest other) { } /** - *

Name for the new dataset.

*

Name for the new dataset.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/requests/CreateDatasetRequest.java b/src/main/java/com/newscatcher/catchall/resources/datasets/requests/CreateDatasetRequest.java index cd0948f..e1d572b 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/requests/CreateDatasetRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/requests/CreateDatasetRequest.java @@ -147,7 +147,6 @@ public Builder from(CreateDatasetRequest other) { } /** - *

Name for the dataset.

*

Name for the dataset.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/entities/AsyncEntitiesClient.java b/src/main/java/com/newscatcher/catchall/resources/entities/AsyncEntitiesClient.java index 9fd8ca3..48e52a6 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/AsyncEntitiesClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/AsyncEntitiesClient.java @@ -65,10 +65,9 @@ public CompletableFuture listEntities( /** * Creates a new company entity and begins background enrichment. + *

Each entity requires a name plus at least one of: a description or a domain. Providing both is recommended — domain is the highest-signal identifier because it is unambiguous; a well-written description is the best alternative when no domain is available.

*

The entity status starts as pending and transitions to ready once - * enrichment completes. Provide as much identifying information as - * possible — domain is the highest-signal field because it is - * unambiguous.

+ * enrichment completes.

*/ public CompletableFuture createEntity(CreateEntityRequest request) { return this.rawClient.createEntity(request).thenApply(response -> response.body()); @@ -76,10 +75,9 @@ public CompletableFuture createEntity(CreateEntityRequest /** * Creates a new company entity and begins background enrichment. + *

Each entity requires a name plus at least one of: a description or a domain. Providing both is recommended — domain is the highest-signal identifier because it is unambiguous; a well-written description is the best alternative when no domain is available.

*

The entity status starts as pending and transitions to ready once - * enrichment completes. Provide as much identifying information as - * possible — domain is the highest-signal field because it is - * unambiguous.

+ * enrichment completes.

*/ public CompletableFuture createEntity( CreateEntityRequest request, RequestOptions requestOptions) { @@ -88,6 +86,7 @@ public CompletableFuture createEntity( /** * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

Each entity requires a name plus at least one of: a description or a domain. See Create entity for the full field reference.

*

Returns an array of {id, status} objects in the same order as the input array.

*/ public CompletableFuture createEntitiesBatch(CreateEntitiesBatchRequest request) { @@ -96,6 +95,7 @@ public CompletableFuture createEntitiesBatch(Create /** * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

Each entity requires a name plus at least one of: a description or a domain. See Create entity for the full field reference.

*

Returns an array of {id, status} objects in the same order as the input array.

*/ public CompletableFuture createEntitiesBatch( diff --git a/src/main/java/com/newscatcher/catchall/resources/entities/AsyncRawEntitiesClient.java b/src/main/java/com/newscatcher/catchall/resources/entities/AsyncRawEntitiesClient.java index 6e98da9..ac18ac4 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/AsyncRawEntitiesClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/AsyncRawEntitiesClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -118,6 +119,15 @@ public CompletableFuture> listEntiti if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -143,6 +153,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -158,10 +171,9 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Creates a new company entity and begins background enrichment. + *

Each entity requires a name plus at least one of: a description or a domain. Providing both is recommended — domain is the highest-signal identifier because it is unambiguous; a well-written description is the best alternative when no domain is available.

*

The entity status starts as pending and transitions to ready once - * enrichment completes. Provide as much identifying information as - * possible — domain is the highest-signal field because it is - * unambiguous.

+ * enrichment completes.

*/ public CompletableFuture> createEntity(CreateEntityRequest request) { return createEntity(request, null); @@ -169,10 +181,9 @@ public CompletableFuture> createEn /** * Creates a new company entity and begins background enrichment. + *

Each entity requires a name plus at least one of: a description or a domain. Providing both is recommended — domain is the highest-signal identifier because it is unambiguous; a well-written description is the best alternative when no domain is available.

*

The entity status starts as pending and transitions to ready once - * enrichment completes. Provide as much identifying information as - * possible — domain is the highest-signal field because it is - * unambiguous.

+ * enrichment completes.

*/ public CompletableFuture> createEntity( CreateEntityRequest request, RequestOptions requestOptions) { @@ -202,6 +213,15 @@ public CompletableFuture> createEn if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -234,6 +254,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -249,6 +272,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { /** * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

Each entity requires a name plus at least one of: a description or a domain. See Create entity for the full field reference.

*

Returns an array of {id, status} objects in the same order as the input array.

*/ public CompletableFuture> createEntitiesBatch( @@ -258,6 +282,7 @@ public CompletableFuture> c /** * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

Each entity requires a name plus at least one of: a description or a domain. See Create entity for the full field reference.

*

Returns an array of {id, status} objects in the same order as the input array.

*/ public CompletableFuture> createEntitiesBatch( @@ -288,6 +313,15 @@ public CompletableFuture> c if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -321,6 +355,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -381,6 +418,15 @@ public CompletableFuture> getEntity( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -413,6 +459,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -476,6 +525,15 @@ public CompletableFuture> deleteEntity( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -506,6 +564,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -574,6 +635,15 @@ public CompletableFuture> updateEntity( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -611,6 +681,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } diff --git a/src/main/java/com/newscatcher/catchall/resources/entities/EntitiesClient.java b/src/main/java/com/newscatcher/catchall/resources/entities/EntitiesClient.java index b2bf5ad..58cb7b0 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/EntitiesClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/EntitiesClient.java @@ -63,10 +63,9 @@ public EntityListResponse listEntities(ListEntitiesRequest request, RequestOptio /** * Creates a new company entity and begins background enrichment. + *

Each entity requires a name plus at least one of: a description or a domain. Providing both is recommended — domain is the highest-signal identifier because it is unambiguous; a well-written description is the best alternative when no domain is available.

*

The entity status starts as pending and transitions to ready once - * enrichment completes. Provide as much identifying information as - * possible — domain is the highest-signal field because it is - * unambiguous.

+ * enrichment completes.

*/ public CreateEntityResponse createEntity(CreateEntityRequest request) { return this.rawClient.createEntity(request).body(); @@ -74,10 +73,9 @@ public CreateEntityResponse createEntity(CreateEntityRequest request) { /** * Creates a new company entity and begins background enrichment. + *

Each entity requires a name plus at least one of: a description or a domain. Providing both is recommended — domain is the highest-signal identifier because it is unambiguous; a well-written description is the best alternative when no domain is available.

*

The entity status starts as pending and transitions to ready once - * enrichment completes. Provide as much identifying information as - * possible — domain is the highest-signal field because it is - * unambiguous.

+ * enrichment completes.

*/ public CreateEntityResponse createEntity(CreateEntityRequest request, RequestOptions requestOptions) { return this.rawClient.createEntity(request, requestOptions).body(); @@ -85,6 +83,7 @@ public CreateEntityResponse createEntity(CreateEntityRequest request, RequestOpt /** * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

Each entity requires a name plus at least one of: a description or a domain. See Create entity for the full field reference.

*

Returns an array of {id, status} objects in the same order as the input array.

*/ public CreateEntitiesBatchResponse createEntitiesBatch(CreateEntitiesBatchRequest request) { @@ -93,6 +92,7 @@ public CreateEntitiesBatchResponse createEntitiesBatch(CreateEntitiesBatchReques /** * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

Each entity requires a name plus at least one of: a description or a domain. See Create entity for the full field reference.

*

Returns an array of {id, status} objects in the same order as the input array.

*/ public CreateEntitiesBatchResponse createEntitiesBatch( diff --git a/src/main/java/com/newscatcher/catchall/resources/entities/RawEntitiesClient.java b/src/main/java/com/newscatcher/catchall/resources/entities/RawEntitiesClient.java index aa3f769..8529a13 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/RawEntitiesClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/RawEntitiesClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -114,6 +115,15 @@ public CatchAllApiHttpResponse listEntities( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -132,6 +142,8 @@ public CatchAllApiHttpResponse listEntities( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -139,10 +151,9 @@ public CatchAllApiHttpResponse listEntities( /** * Creates a new company entity and begins background enrichment. + *

Each entity requires a name plus at least one of: a description or a domain. Providing both is recommended — domain is the highest-signal identifier because it is unambiguous; a well-written description is the best alternative when no domain is available.

*

The entity status starts as pending and transitions to ready once - * enrichment completes. Provide as much identifying information as - * possible — domain is the highest-signal field because it is - * unambiguous.

+ * enrichment completes.

*/ public CatchAllApiHttpResponse createEntity(CreateEntityRequest request) { return createEntity(request, null); @@ -150,10 +161,9 @@ public CatchAllApiHttpResponse createEntity(CreateEntityRe /** * Creates a new company entity and begins background enrichment. + *

Each entity requires a name plus at least one of: a description or a domain. Providing both is recommended — domain is the highest-signal identifier because it is unambiguous; a well-written description is the best alternative when no domain is available.

*

The entity status starts as pending and transitions to ready once - * enrichment completes. Provide as much identifying information as - * possible — domain is the highest-signal field because it is - * unambiguous.

+ * enrichment completes.

*/ public CatchAllApiHttpResponse createEntity( CreateEntityRequest request, RequestOptions requestOptions) { @@ -183,6 +193,15 @@ public CatchAllApiHttpResponse createEntity( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -205,6 +224,8 @@ public CatchAllApiHttpResponse createEntity( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -212,6 +233,7 @@ public CatchAllApiHttpResponse createEntity( /** * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

Each entity requires a name plus at least one of: a description or a domain. See Create entity for the full field reference.

*

Returns an array of {id, status} objects in the same order as the input array.

*/ public CatchAllApiHttpResponse createEntitiesBatch( @@ -221,6 +243,7 @@ public CatchAllApiHttpResponse createEntitiesBatch( /** * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

Each entity requires a name plus at least one of: a description or a domain. See Create entity for the full field reference.

*

Returns an array of {id, status} objects in the same order as the input array.

*/ public CatchAllApiHttpResponse createEntitiesBatch( @@ -251,6 +274,15 @@ public CatchAllApiHttpResponse createEntitiesBatch( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -274,6 +306,8 @@ public CatchAllApiHttpResponse createEntitiesBatch( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -324,6 +358,15 @@ public CatchAllApiHttpResponse getEntity( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -346,6 +389,8 @@ public CatchAllApiHttpResponse getEntity( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -400,6 +445,15 @@ public CatchAllApiHttpResponse deleteEntity( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { @@ -421,6 +475,8 @@ public CatchAllApiHttpResponse deleteEntity( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -479,6 +535,15 @@ public CatchAllApiHttpResponse updateEntity( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -504,6 +569,8 @@ public CatchAllApiHttpResponse updateEntity( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncRawJobsClient.java b/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncRawJobsClient.java index dd51402..c9331bc 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncRawJobsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncRawJobsClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -121,6 +122,15 @@ public CompletableFuture> getUs if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -146,6 +156,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -200,6 +213,15 @@ public CompletableFuture> vali if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -233,6 +255,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -284,6 +309,15 @@ public CompletableFuture> initial if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -317,6 +351,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -368,6 +405,15 @@ public CompletableFuture> createJob( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -406,6 +452,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -466,6 +515,15 @@ public CompletableFuture> getJobStatu if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -498,6 +556,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -566,6 +627,15 @@ public CompletableFuture> getJobResu if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -598,6 +668,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -659,6 +732,15 @@ public CompletableFuture> getJobResultsCsv( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -689,6 +771,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -740,6 +825,15 @@ public CompletableFuture> continueJ if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -778,6 +872,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -846,6 +943,15 @@ public CompletableFuture> deleteJo if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -878,6 +984,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/RawJobsClient.java b/src/main/java/com/newscatcher/catchall/resources/jobs/RawJobsClient.java index 4d1255c..663dfc2 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/RawJobsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/RawJobsClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -116,6 +117,15 @@ public CatchAllApiHttpResponse getUserJobs( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -135,6 +145,8 @@ public CatchAllApiHttpResponse getUserJobs( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -180,6 +192,15 @@ public CatchAllApiHttpResponse validateQuery( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -204,6 +225,8 @@ public CatchAllApiHttpResponse validateQuery( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -247,6 +270,15 @@ public CatchAllApiHttpResponse initialize( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -270,6 +302,8 @@ public CatchAllApiHttpResponse initialize( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -313,6 +347,15 @@ public CatchAllApiHttpResponse createJob( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -339,6 +382,8 @@ public CatchAllApiHttpResponse createJob( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -389,6 +434,15 @@ public CatchAllApiHttpResponse getJobStatus( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -411,6 +465,8 @@ public CatchAllApiHttpResponse getJobStatus( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -469,6 +525,15 @@ public CatchAllApiHttpResponse getJobResults( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -491,6 +556,8 @@ public CatchAllApiHttpResponse getJobResults( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -542,6 +609,15 @@ public CatchAllApiHttpResponse getJobResultsCsv( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -563,6 +639,8 @@ public CatchAllApiHttpResponse getJobResultsCsv( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -606,6 +684,15 @@ public CatchAllApiHttpResponse continueJob( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -632,6 +719,8 @@ public CatchAllApiHttpResponse continueJob( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -690,6 +779,15 @@ public CatchAllApiHttpResponse deleteJob( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -712,6 +810,8 @@ public CatchAllApiHttpResponse deleteJob( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/ContinueRequestDto.java b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/ContinueRequestDto.java index 49a9726..62d4726 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/ContinueRequestDto.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/ContinueRequestDto.java @@ -121,7 +121,6 @@ public Builder from(ContinueRequestDto other) { } /** - *

Job identifier of the completed job to continue.

*

Job identifier of the completed job to continue.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/SubmitRequestDto.java b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/SubmitRequestDto.java index f1549fb..4620559 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/SubmitRequestDto.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/SubmitRequestDto.java @@ -117,7 +117,11 @@ public Optional getEndDate() { /** * @return Custom validators for filtering web page clusters. - *

If not provided, validators are generated automatically based on the query.

+ *

If not provided, validators are generated automatically based on the query. + * The system may also inject validators during the analyzing stage — for + * example, converting a relative time qualifier into an explicit event-date + * gate. The returned validators[] in the job status shows the complete + * applied set, including any system-added ones.

*/ @JsonProperty("validators") public Optional> getValidators() { @@ -286,7 +290,11 @@ public interface _FinalStage { /** *

Custom validators for filtering web page clusters.

- *

If not provided, validators are generated automatically based on the query.

+ *

If not provided, validators are generated automatically based on the query. + * The system may also inject validators during the analyzing stage — for + * example, converting a relative time qualifier into an explicit event-date + * gate. The returned validators[] in the job status shows the complete + * applied set, including any system-added ones.

*/ _FinalStage validators(Optional> validators); @@ -605,7 +613,11 @@ public _FinalStage enrichments(Optional> enrichments) { /** *

Custom validators for filtering web page clusters.

- *

If not provided, validators are generated automatically based on the query.

+ *

If not provided, validators are generated automatically based on the query. + * The system may also inject validators during the analyzing stage — for + * example, converting a relative time qualifier into an explicit event-date + * gate. The returned validators[] in the job status shows the complete + * applied set, including any system-added ones.

* @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -616,7 +628,11 @@ public _FinalStage validators(List validators) { /** *

Custom validators for filtering web page clusters.

- *

If not provided, validators are generated automatically based on the query.

+ *

If not provided, validators are generated automatically based on the query. + * The system may also inject validators during the analyzing stage — for + * example, converting a relative time qualifier into an explicit event-date + * gate. The returned validators[] in the job status shows the complete + * applied set, including any system-added ones.

*/ @java.lang.Override @JsonSetter(value = "validators", nulls = Nulls.SKIP) diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/ValidateQueryRequestDto.java b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/ValidateQueryRequestDto.java index e397345..46b5ac6 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/ValidateQueryRequestDto.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/ValidateQueryRequestDto.java @@ -98,7 +98,6 @@ public Builder from(ValidateQueryRequestDto other) { } /** - *

Plain text query to validate.

*

Plain text query to validate.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/meta/AsyncRawMetaClient.java b/src/main/java/com/newscatcher/catchall/resources/meta/AsyncRawMetaClient.java index 2ce46d4..4502cdd 100644 --- a/src/main/java/com/newscatcher/catchall/resources/meta/AsyncRawMetaClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/meta/AsyncRawMetaClient.java @@ -10,6 +10,7 @@ import com.newscatcher.catchall.core.ClientOptions; import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.resources.meta.types.GetVersionResponse; import com.newscatcher.catchall.resources.meta.types.HealthCheckResponse; @@ -64,6 +65,15 @@ public CompletableFuture> healthChe if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -80,6 +90,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -122,6 +135,15 @@ public CompletableFuture> getVersion if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -138,6 +160,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -181,6 +206,15 @@ public CompletableFuture> getP if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -206,6 +240,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } diff --git a/src/main/java/com/newscatcher/catchall/resources/meta/RawMetaClient.java b/src/main/java/com/newscatcher/catchall/resources/meta/RawMetaClient.java index 114e07a..122d044 100644 --- a/src/main/java/com/newscatcher/catchall/resources/meta/RawMetaClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/meta/RawMetaClient.java @@ -10,6 +10,7 @@ import com.newscatcher.catchall.core.ClientOptions; import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.resources.meta.types.GetVersionResponse; import com.newscatcher.catchall.resources.meta.types.HealthCheckResponse; @@ -60,6 +61,15 @@ public CatchAllApiHttpResponse healthCheck(RequestOptions r if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -70,6 +80,8 @@ public CatchAllApiHttpResponse healthCheck(RequestOptions r Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -104,6 +116,15 @@ public CatchAllApiHttpResponse getVersion(RequestOptions req if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -114,6 +135,8 @@ public CatchAllApiHttpResponse getVersion(RequestOptions req Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -148,6 +171,15 @@ public CatchAllApiHttpResponse getPlanLimits(RequestOp if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -167,6 +199,8 @@ public CatchAllApiHttpResponse getPlanLimits(RequestOp Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/newscatcher/catchall/resources/monitors/AsyncRawMonitorsClient.java b/src/main/java/com/newscatcher/catchall/resources/monitors/AsyncRawMonitorsClient.java index c225143..7b7b368 100644 --- a/src/main/java/com/newscatcher/catchall/resources/monitors/AsyncRawMonitorsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/monitors/AsyncRawMonitorsClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; import com.newscatcher.catchall.errors.UnauthorizedError; @@ -123,6 +124,15 @@ public CompletableFuture> listM if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -156,6 +166,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -208,6 +221,15 @@ public CompletableFuture> crea if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -235,6 +257,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -295,6 +320,15 @@ public CompletableFuture> pullMo if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -328,6 +362,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -391,6 +428,15 @@ public CompletableFuture> pullMonitorResultsCsv( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -421,6 +467,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -486,6 +535,15 @@ public CompletableFuture> listM if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -519,6 +577,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -583,6 +644,15 @@ public CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -616,6 +686,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -685,6 +758,15 @@ public CompletableFuture> enableM if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -723,6 +805,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -784,6 +869,15 @@ public CompletableFuture> disabl if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -822,6 +916,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -902,6 +999,15 @@ public CompletableFuture> dele if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -934,6 +1040,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1002,6 +1111,15 @@ public CompletableFuture> upda if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1040,6 +1158,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } diff --git a/src/main/java/com/newscatcher/catchall/resources/monitors/RawMonitorsClient.java b/src/main/java/com/newscatcher/catchall/resources/monitors/RawMonitorsClient.java index 03e0ac3..0fdd954 100644 --- a/src/main/java/com/newscatcher/catchall/resources/monitors/RawMonitorsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/monitors/RawMonitorsClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; import com.newscatcher.catchall.errors.UnauthorizedError; @@ -117,6 +118,15 @@ public CatchAllApiHttpResponse listMonitors( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -141,6 +151,8 @@ public CatchAllApiHttpResponse listMonitors( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -184,6 +196,15 @@ public CatchAllApiHttpResponse createMonitor( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -204,6 +225,8 @@ public CatchAllApiHttpResponse createMonitor( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -256,6 +279,15 @@ public CatchAllApiHttpResponse pullMonitorResults( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -280,6 +312,8 @@ public CatchAllApiHttpResponse pullMonitorResults( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -334,6 +368,15 @@ public CatchAllApiHttpResponse pullMonitorResultsCsv( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -355,6 +398,8 @@ public CatchAllApiHttpResponse pullMonitorResultsCsv( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -412,6 +457,15 @@ public CatchAllApiHttpResponse listMonitorJobs( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -436,6 +490,8 @@ public CatchAllApiHttpResponse listMonitorJobs( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -491,6 +547,15 @@ public CatchAllApiHttpResponse getMonitorStatus if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -514,6 +579,8 @@ public CatchAllApiHttpResponse getMonitorStatus Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -575,6 +642,15 @@ public CatchAllApiHttpResponse enableMonitor( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -601,6 +677,8 @@ public CatchAllApiHttpResponse enableMonitor( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -654,6 +732,15 @@ public CatchAllApiHttpResponse disableMonitor( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -681,6 +768,8 @@ public CatchAllApiHttpResponse disableMonitor( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -753,6 +842,15 @@ public CatchAllApiHttpResponse deleteMonitor( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -776,6 +874,8 @@ public CatchAllApiHttpResponse deleteMonitor( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -836,6 +936,15 @@ public CatchAllApiHttpResponse updateMonitor( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -863,6 +972,8 @@ public CatchAllApiHttpResponse updateMonitor( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/newscatcher/catchall/resources/monitors/requests/CreateMonitorRequestDto.java b/src/main/java/com/newscatcher/catchall/resources/monitors/requests/CreateMonitorRequestDto.java index f0e37d1..e0c484c 100644 --- a/src/main/java/com/newscatcher/catchall/resources/monitors/requests/CreateMonitorRequestDto.java +++ b/src/main/java/com/newscatcher/catchall/resources/monitors/requests/CreateMonitorRequestDto.java @@ -260,8 +260,6 @@ public Builder from(CreateMonitorRequestDto other) { } /** - *

Job ID to use as template for scheduled runs. Defines the query, validators, and enrichments used for each scheduled run.

- *

If backfill is true, the job's end_date must be within the last 7 days.

*

Job ID to use as template for scheduled runs. Defines the query, validators, and enrichments used for each scheduled run.

*

If backfill is true, the job's end_date must be within the last 7 days.

* @return Reference to {@code this} so that method calls can be chained together. @@ -274,7 +272,6 @@ public ScheduleStage referenceJobId(@NotNull String referenceJobId) { } /** - *

Monitor schedule in plain text format. Minimum frequency depends on your plan.

*

Monitor schedule in plain text format. Minimum frequency depends on your plan.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/monitors/types/DisableMonitorResponse.java b/src/main/java/com/newscatcher/catchall/resources/monitors/types/DisableMonitorResponse.java index 982bb00..49ebeb4 100644 --- a/src/main/java/com/newscatcher/catchall/resources/monitors/types/DisableMonitorResponse.java +++ b/src/main/java/com/newscatcher/catchall/resources/monitors/types/DisableMonitorResponse.java @@ -141,7 +141,6 @@ public Builder from(DisableMonitorResponse other) { } /** - *

True if the operation succeeded; false otherwise.

*

True if the operation succeeded; false otherwise.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -153,7 +152,6 @@ public MessageStage success(boolean success) { } /** - *

Human-readable success message.

*

Human-readable success message.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -165,7 +163,6 @@ public MonitorIdStage message(@NotNull String message) { } /** - *

ID of the disabled monitor.

*

ID of the disabled monitor.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/monitors/types/EnableMonitorResponse.java b/src/main/java/com/newscatcher/catchall/resources/monitors/types/EnableMonitorResponse.java index 95ac68a..64b7630 100644 --- a/src/main/java/com/newscatcher/catchall/resources/monitors/types/EnableMonitorResponse.java +++ b/src/main/java/com/newscatcher/catchall/resources/monitors/types/EnableMonitorResponse.java @@ -141,7 +141,6 @@ public Builder from(EnableMonitorResponse other) { } /** - *

True if the operation succeeded; false otherwise.

*

True if the operation succeeded; false otherwise.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -153,7 +152,6 @@ public MessageStage success(boolean success) { } /** - *

Human-readable success message.

*

Human-readable success message.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -165,7 +163,6 @@ public MonitorIdStage message(@NotNull String message) { } /** - *

ID of the enabled monitor.

*

ID of the enabled monitor.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/monitors/types/ListMonitorJobsResponse.java b/src/main/java/com/newscatcher/catchall/resources/monitors/types/ListMonitorJobsResponse.java index 2a0d652..4f53dc5 100644 --- a/src/main/java/com/newscatcher/catchall/resources/monitors/types/ListMonitorJobsResponse.java +++ b/src/main/java/com/newscatcher/catchall/resources/monitors/types/ListMonitorJobsResponse.java @@ -175,7 +175,6 @@ public Builder from(ListMonitorJobsResponse other) { } /** - *

Monitor identifier.

*

Monitor identifier.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -187,7 +186,6 @@ public SortOrderStage monitorId(@NotNull String monitorId) { } /** - *

Sort order applied to results.

*

Sort order applied to results.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -199,7 +197,6 @@ public TotalJobsStage sortOrder(@NotNull ListMonitorJobsResponseSortOrder sortOr } /** - *

Total number of jobs for this monitor.

*

Total number of jobs for this monitor.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/projects/AsyncRawProjectsClient.java b/src/main/java/com/newscatcher/catchall/resources/projects/AsyncRawProjectsClient.java index dfc5eff..205e34b 100644 --- a/src/main/java/com/newscatcher/catchall/resources/projects/AsyncRawProjectsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/projects/AsyncRawProjectsClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -118,6 +119,15 @@ public CompletableFuture> listPr if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -151,6 +161,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -203,6 +216,15 @@ public CompletableFuture> crea if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -236,6 +258,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -296,6 +321,15 @@ public CompletableFuture> getProject if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -328,6 +362,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -392,6 +429,15 @@ public CompletableFuture> deleteProject( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -422,6 +468,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -490,6 +539,15 @@ public CompletableFuture> upda if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -528,6 +586,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -593,6 +654,15 @@ public CompletableFuture> ge if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -626,6 +696,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -702,6 +775,15 @@ public CompletableFuture if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -741,6 +823,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -795,6 +880,15 @@ public CompletableFuture> addRes if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -832,6 +926,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -916,6 +1013,15 @@ public CompletableFuture> rem if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -949,6 +1055,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } diff --git a/src/main/java/com/newscatcher/catchall/resources/projects/RawProjectsClient.java b/src/main/java/com/newscatcher/catchall/resources/projects/RawProjectsClient.java index d2871f2..63215a8 100644 --- a/src/main/java/com/newscatcher/catchall/resources/projects/RawProjectsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/projects/RawProjectsClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -112,6 +113,15 @@ public CatchAllApiHttpResponse listProjects( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -136,6 +146,8 @@ public CatchAllApiHttpResponse listProjects( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -179,6 +191,15 @@ public CatchAllApiHttpResponse createProject( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -203,6 +224,8 @@ public CatchAllApiHttpResponse createProject( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -253,6 +276,15 @@ public CatchAllApiHttpResponse getProject( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -275,6 +307,8 @@ public CatchAllApiHttpResponse getProject( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -329,6 +363,15 @@ public CatchAllApiHttpResponse deleteProject( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { @@ -350,6 +393,8 @@ public CatchAllApiHttpResponse deleteProject( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -410,6 +455,15 @@ public CatchAllApiHttpResponse updateProject( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -437,6 +491,8 @@ public CatchAllApiHttpResponse updateProject( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -494,6 +550,15 @@ public CatchAllApiHttpResponse getProjectOverview( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -517,6 +582,8 @@ public CatchAllApiHttpResponse getProjectOverview( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -584,6 +651,15 @@ public CatchAllApiHttpResponse listProjectResour if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -611,6 +687,8 @@ public CatchAllApiHttpResponse listProjectResour Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -657,6 +735,15 @@ public CatchAllApiHttpResponse addResourceToProject( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -683,6 +770,8 @@ public CatchAllApiHttpResponse addResourceToProject( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -759,6 +848,15 @@ public CatchAllApiHttpResponse removeResourceFromProj if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -782,6 +880,8 @@ public CatchAllApiHttpResponse removeResourceFromProj Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/newscatcher/catchall/resources/projects/requests/CreateProjectRequestDto.java b/src/main/java/com/newscatcher/catchall/resources/projects/requests/CreateProjectRequestDto.java index d89c0ad..8aa0ec7 100644 --- a/src/main/java/com/newscatcher/catchall/resources/projects/requests/CreateProjectRequestDto.java +++ b/src/main/java/com/newscatcher/catchall/resources/projects/requests/CreateProjectRequestDto.java @@ -122,7 +122,6 @@ public Builder from(CreateProjectRequestDto other) { } /** - *

Name for the project.

*

Name for the project.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/AsyncRawWebhooksClient.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/AsyncRawWebhooksClient.java index 29f3dd8..59ee645 100644 --- a/src/main/java/com/newscatcher/catchall/resources/webhooks/AsyncRawWebhooksClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/AsyncRawWebhooksClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -26,6 +27,7 @@ import com.newscatcher.catchall.resources.webhooks.requests.ListWebhooksRequest; import com.newscatcher.catchall.resources.webhooks.requests.RemoveWebhookResourceRequest; import com.newscatcher.catchall.resources.webhooks.requests.TestWebhookRequestDto; +import com.newscatcher.catchall.resources.webhooks.requests.TriggerWebhookRequest; import com.newscatcher.catchall.resources.webhooks.requests.UpdateWebhookRequestDto; import com.newscatcher.catchall.types.AssignWebhookResourceResponseDto; import com.newscatcher.catchall.types.CreateWebhookResponseDto; @@ -116,6 +118,15 @@ public CompletableFuture> listW if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -149,6 +160,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -201,6 +215,15 @@ public CompletableFuture> crea if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -234,6 +257,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -294,6 +320,15 @@ public CompletableFuture> getWebh if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -332,6 +367,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -396,6 +434,15 @@ public CompletableFuture> deleteWebhook( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -426,6 +473,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -494,6 +544,15 @@ public CompletableFuture> upda if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -532,6 +591,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -605,6 +667,15 @@ public CompletableFuture> testWe if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -643,6 +714,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -719,6 +793,15 @@ public CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -758,6 +841,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -818,6 +904,15 @@ public CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -862,6 +957,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -946,6 +1044,15 @@ public CompletableFuture> removeWebhookResource( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -976,6 +1083,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1061,6 +1171,15 @@ public CompletableFuture> listW if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1099,6 +1218,119 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); + } catch (IOException e) { + future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Manually dispatches a webhook delivery for a resource on demand, without + * waiting for the next job or monitor cycle. + *

Use this to re-deliver results after a failed delivery, replay a specific + * job's results, or validate a webhook against live data. The webhook must + * already be assigned to the resource.

+ */ + public CompletableFuture> triggerWebhook( + MappableResourceType resourceType, String resourceId, TriggerWebhookRequest request) { + return triggerWebhook(resourceType, resourceId, request, null); + } + + /** + * Manually dispatches a webhook delivery for a resource on demand, without + * waiting for the next job or monitor cycle. + *

Use this to re-deliver results after a failed delivery, replay a specific + * job's results, or validate a webhook against live data. The webhook must + * already be assigned to the resource.

+ */ + public CompletableFuture> triggerWebhook( + MappableResourceType resourceType, + String resourceId, + TriggerWebhookRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("catchAll/webhook/trigger") + .addPathSegment(resourceType.toString()) + .addPathSegment(resourceId); + QueryStringMapper.addQueryParameter(httpUrl, "webhook_id", request.getWebhookId(), false); + if (request.getJobId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "job_id", request.getJobId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + 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()) { + if (response.isSuccessful()) { + future.complete(new CatchAllApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 403: + future.completeExceptionally(new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 404: + future.completeExceptionally(new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), + response)); + return; + case 422: + future.completeExceptionally(new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ValidationErrorResponse.class), + response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new CatchAllApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } @@ -1155,6 +1387,15 @@ public CompletableFuture> ge if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } CompletableFuture> future = new CompletableFuture<>(); client.newCall(okhttpRequest).enqueue(new Callback() { @Override @@ -1194,6 +1435,9 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO future.completeExceptionally(new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response)); return; + } catch (JsonProcessingException e) { + future.completeExceptionally( + new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e)); } catch (IOException e) { future.completeExceptionally(new CatchAllApiException("Network error executing HTTP request", e)); } diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/AsyncWebhooksClient.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/AsyncWebhooksClient.java index 77913f9..e414d26 100644 --- a/src/main/java/com/newscatcher/catchall/resources/webhooks/AsyncWebhooksClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/AsyncWebhooksClient.java @@ -15,6 +15,7 @@ import com.newscatcher.catchall.resources.webhooks.requests.ListWebhooksRequest; import com.newscatcher.catchall.resources.webhooks.requests.RemoveWebhookResourceRequest; import com.newscatcher.catchall.resources.webhooks.requests.TestWebhookRequestDto; +import com.newscatcher.catchall.resources.webhooks.requests.TriggerWebhookRequest; import com.newscatcher.catchall.resources.webhooks.requests.UpdateWebhookRequestDto; import com.newscatcher.catchall.types.AssignWebhookResourceResponseDto; import com.newscatcher.catchall.types.CreateWebhookResponseDto; @@ -362,6 +363,35 @@ public CompletableFuture listWebhooksForResource( .thenApply(response -> response.body()); } + /** + * Manually dispatches a webhook delivery for a resource on demand, without + * waiting for the next job or monitor cycle. + *

Use this to re-deliver results after a failed delivery, replay a specific + * job's results, or validate a webhook against live data. The webhook must + * already be assigned to the resource.

+ */ + public CompletableFuture triggerWebhook( + MappableResourceType resourceType, String resourceId, TriggerWebhookRequest request) { + return this.rawClient.triggerWebhook(resourceType, resourceId, request).thenApply(response -> response.body()); + } + + /** + * Manually dispatches a webhook delivery for a resource on demand, without + * waiting for the next job or monitor cycle. + *

Use this to re-deliver results after a failed delivery, replay a specific + * job's results, or validate a webhook against live data. The webhook must + * already be assigned to the resource.

+ */ + public CompletableFuture triggerWebhook( + MappableResourceType resourceType, + String resourceId, + TriggerWebhookRequest request, + RequestOptions requestOptions) { + return this.rawClient + .triggerWebhook(resourceType, resourceId, request, requestOptions) + .thenApply(response -> response.body()); + } + /** * Returns a paginated delivery log for a given resource, ordered by timestamp descending. *

Each record shows the webhook dispatched, the HTTP status code returned, delivery outcome, and any error or warning messages. Use this to debug failed deliveries or audit dispatch activity.

diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/RawWebhooksClient.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/RawWebhooksClient.java index 981eab6..779b0d1 100644 --- a/src/main/java/com/newscatcher/catchall/resources/webhooks/RawWebhooksClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/RawWebhooksClient.java @@ -12,6 +12,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.core.QueryStringMapper; import com.newscatcher.catchall.core.RequestOptions; +import com.newscatcher.catchall.core.RetryInterceptor; import com.newscatcher.catchall.errors.BadRequestError; import com.newscatcher.catchall.errors.ForbiddenError; import com.newscatcher.catchall.errors.NotFoundError; @@ -26,6 +27,7 @@ import com.newscatcher.catchall.resources.webhooks.requests.ListWebhooksRequest; import com.newscatcher.catchall.resources.webhooks.requests.RemoveWebhookResourceRequest; import com.newscatcher.catchall.resources.webhooks.requests.TestWebhookRequestDto; +import com.newscatcher.catchall.resources.webhooks.requests.TriggerWebhookRequest; import com.newscatcher.catchall.resources.webhooks.requests.UpdateWebhookRequestDto; import com.newscatcher.catchall.types.AssignWebhookResourceResponseDto; import com.newscatcher.catchall.types.CreateWebhookResponseDto; @@ -110,6 +112,15 @@ public CatchAllApiHttpResponse listWebhooks( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -134,6 +145,8 @@ public CatchAllApiHttpResponse listWebhooks( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -177,6 +190,15 @@ public CatchAllApiHttpResponse createWebhook( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -201,6 +223,8 @@ public CatchAllApiHttpResponse createWebhook( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -251,6 +275,15 @@ public CatchAllApiHttpResponse getWebhook( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -277,6 +310,8 @@ public CatchAllApiHttpResponse getWebhook( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -331,6 +366,15 @@ public CatchAllApiHttpResponse deleteWebhook( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { @@ -352,6 +396,8 @@ public CatchAllApiHttpResponse deleteWebhook( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -412,6 +458,15 @@ public CatchAllApiHttpResponse updateWebhook( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -439,6 +494,8 @@ public CatchAllApiHttpResponse updateWebhook( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -504,6 +561,15 @@ public CatchAllApiHttpResponse testWebhook( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -531,6 +597,8 @@ public CatchAllApiHttpResponse testWebhook( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -598,6 +666,15 @@ public CatchAllApiHttpResponse listWebhookResou if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -625,6 +702,8 @@ public CatchAllApiHttpResponse listWebhookResou Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -677,6 +756,15 @@ public CatchAllApiHttpResponse assignWebhookRe if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -707,6 +795,8 @@ public CatchAllApiHttpResponse assignWebhookRe Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -783,6 +873,15 @@ public CatchAllApiHttpResponse removeWebhookResource( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { @@ -804,6 +903,8 @@ public CatchAllApiHttpResponse removeWebhookResource( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -881,6 +982,15 @@ public CatchAllApiHttpResponse listWebhooksForResource( if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -908,6 +1018,98 @@ public CatchAllApiHttpResponse listWebhooksForResource( Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); + } catch (IOException e) { + throw new CatchAllApiException("Network error executing HTTP request", e); + } + } + + /** + * Manually dispatches a webhook delivery for a resource on demand, without + * waiting for the next job or monitor cycle. + *

Use this to re-deliver results after a failed delivery, replay a specific + * job's results, or validate a webhook against live data. The webhook must + * already be assigned to the resource.

+ */ + public CatchAllApiHttpResponse triggerWebhook( + MappableResourceType resourceType, String resourceId, TriggerWebhookRequest request) { + return triggerWebhook(resourceType, resourceId, request, null); + } + + /** + * Manually dispatches a webhook delivery for a resource on demand, without + * waiting for the next job or monitor cycle. + *

Use this to re-deliver results after a failed delivery, replay a specific + * job's results, or validate a webhook against live data. The webhook must + * already be assigned to the resource.

+ */ + public CatchAllApiHttpResponse triggerWebhook( + MappableResourceType resourceType, + String resourceId, + TriggerWebhookRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("catchAll/webhook/trigger") + .addPathSegment(resourceType.toString()) + .addPathSegment(resourceId); + QueryStringMapper.addQueryParameter(httpUrl, "webhook_id", request.getWebhookId(), false); + if (request.getJobId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "job_id", request.getJobId().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", RequestBody.create("", null)) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new CatchAllApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + switch (response.code()) { + case 403: + throw new ForbiddenError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 404: + throw new NotFoundError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response); + case 422: + throw new UnprocessableEntityError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidationErrorResponse.class), + response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new CatchAllApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } @@ -956,6 +1158,15 @@ public CatchAllApiHttpResponse getWebhookDeliveryHis if (requestOptions != null && requestOptions.getTimeout().isPresent()) { client = clientOptions.httpClientWithTimeout(requestOptions); } + if (requestOptions != null && requestOptions.getMaxRetries().isPresent()) { + okhttpRequest = okhttpRequest + .newBuilder() + .tag( + RetryInterceptor.MaxRetriesOverride.class, + new RetryInterceptor.MaxRetriesOverride( + requestOptions.getMaxRetries().get())) + .build(); + } try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; @@ -983,6 +1194,8 @@ public CatchAllApiHttpResponse getWebhookDeliveryHis Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); throw new CatchAllApiApiException( "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (JsonProcessingException e) { + throw new CatchAllApiException("Failed to deserialize response: " + e.getMessage(), e); } catch (IOException e) { throw new CatchAllApiException("Network error executing HTTP request", e); } diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/WebhooksClient.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/WebhooksClient.java index 8e70c31..8c6769d 100644 --- a/src/main/java/com/newscatcher/catchall/resources/webhooks/WebhooksClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/WebhooksClient.java @@ -15,6 +15,7 @@ import com.newscatcher.catchall.resources.webhooks.requests.ListWebhooksRequest; import com.newscatcher.catchall.resources.webhooks.requests.RemoveWebhookResourceRequest; import com.newscatcher.catchall.resources.webhooks.requests.TestWebhookRequestDto; +import com.newscatcher.catchall.resources.webhooks.requests.TriggerWebhookRequest; import com.newscatcher.catchall.resources.webhooks.requests.UpdateWebhookRequestDto; import com.newscatcher.catchall.types.AssignWebhookResourceResponseDto; import com.newscatcher.catchall.types.CreateWebhookResponseDto; @@ -353,6 +354,34 @@ public ListWebhooksResponseDto listWebhooksForResource( .body(); } + /** + * Manually dispatches a webhook delivery for a resource on demand, without + * waiting for the next job or monitor cycle. + *

Use this to re-deliver results after a failed delivery, replay a specific + * job's results, or validate a webhook against live data. The webhook must + * already be assigned to the resource.

+ */ + public void triggerWebhook(MappableResourceType resourceType, String resourceId, TriggerWebhookRequest request) { + this.rawClient.triggerWebhook(resourceType, resourceId, request).body(); + } + + /** + * Manually dispatches a webhook delivery for a resource on demand, without + * waiting for the next job or monitor cycle. + *

Use this to re-deliver results after a failed delivery, replay a specific + * job's results, or validate a webhook against live data. The webhook must + * already be assigned to the resource.

+ */ + public void triggerWebhook( + MappableResourceType resourceType, + String resourceId, + TriggerWebhookRequest request, + RequestOptions requestOptions) { + this.rawClient + .triggerWebhook(resourceType, resourceId, request, requestOptions) + .body(); + } + /** * Returns a paginated delivery log for a given resource, ordered by timestamp descending. *

Each record shows the webhook dispatched, the HTTP status code returned, delivery outcome, and any error or warning messages. Use this to debug failed deliveries or audit dispatch activity.

diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/AssignWebhookResourceRequestDto.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/AssignWebhookResourceRequestDto.java index 0126f88..1685f9b 100644 --- a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/AssignWebhookResourceRequestDto.java +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/AssignWebhookResourceRequestDto.java @@ -121,7 +121,6 @@ public Builder from(AssignWebhookResourceRequestDto other) { } /** - *

Type of resource to assign.

*

Type of resource to assign.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -133,7 +132,6 @@ public ResourceIdStage resourceType(@NotNull MappableResourceType resourceType) } /** - *

ID of the resource to assign.

*

ID of the resource to assign.

* @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/CreateWebhookRequestDto.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/CreateWebhookRequestDto.java index 355c301..9010e9e 100644 --- a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/CreateWebhookRequestDto.java +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/CreateWebhookRequestDto.java @@ -17,6 +17,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.resources.webhooks.types.CreateWebhookRequestDtoAuth; import com.newscatcher.catchall.types.DeliveryMode; +import com.newscatcher.catchall.types.FormatterConfigDto; import com.newscatcher.catchall.types.HttpMethod; import com.newscatcher.catchall.types.WebhookType; import java.util.HashMap; @@ -44,7 +45,7 @@ public final class CreateWebhookRequestDto { private final Optional auth; - private final Optional> formatterConfig; + private final Optional formatterConfig; private final Map additionalProperties; @@ -57,7 +58,7 @@ private CreateWebhookRequestDto( Optional> headers, Optional> params, Optional auth, - Optional> formatterConfig, + Optional formatterConfig, Map additionalProperties) { this.name = name; this.url = url; @@ -140,10 +141,10 @@ public Optional getAuth() { } /** - * @return Custom payload transformation configuration. Required only when type is custom. + * @return Custom payload formatter. Required when type is custom. */ @JsonIgnore - public Optional> getFormatterConfig() { + public Optional getFormatterConfig() { if (formatterConfig == null) { return Optional.empty(); } @@ -152,7 +153,7 @@ public Optional> getFormatterConfig() { @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("formatter_config") - private Optional> _getFormatterConfig() { + private Optional _getFormatterConfig() { return formatterConfig; } @@ -272,13 +273,13 @@ public interface _FinalStage { _FinalStage auth(CreateWebhookRequestDtoAuth auth); /** - *

Custom payload transformation configuration. Required only when type is custom.

+ *

Custom payload formatter. Required when type is custom.

*/ - _FinalStage formatterConfig(Optional> formatterConfig); + _FinalStage formatterConfig(Optional formatterConfig); - _FinalStage formatterConfig(Map formatterConfig); + _FinalStage formatterConfig(FormatterConfigDto formatterConfig); - _FinalStage formatterConfig(Nullable> formatterConfig); + _FinalStage formatterConfig(Nullable formatterConfig); } @JsonIgnoreProperties(ignoreUnknown = true) @@ -287,7 +288,7 @@ public static final class Builder implements NameStage, UrlStage, _FinalStage { private String url; - private Optional> formatterConfig = Optional.empty(); + private Optional formatterConfig = Optional.empty(); private Optional auth = Optional.empty(); @@ -321,7 +322,6 @@ public Builder from(CreateWebhookRequestDto other) { } /** - *

Human-readable label for this webhook.

*

Human-readable label for this webhook.

* @return Reference to {@code this} so that method calls can be chained together. */ @@ -333,15 +333,6 @@ public UrlStage name(@NotNull String name) { } /** - *

Destination URL that receives the payload. Must use HTTPS. IP addresses are not accepted.

- *

Type-specific URL requirements:

- *
    - *
  • slack: Must start with https://hooks.slack.com/.
  • - *
  • teams: Hostname must match *.webhook.office.com or *.webhook.office365.com.
  • - *
  • generic: Any valid HTTPS domain.
  • - *
  • custom: Any valid HTTPS domain.
  • - *
- *

When type is omitted, it is auto-detected from the URL.

*

Destination URL that receives the payload. Must use HTTPS. IP addresses are not accepted.

*

Type-specific URL requirements:

*
    @@ -361,11 +352,11 @@ public _FinalStage url(@NotNull String url) { } /** - *

    Custom payload transformation configuration. Required only when type is custom.

    + *

    Custom payload formatter. Required when type is custom.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage formatterConfig(Nullable> formatterConfig) { + public _FinalStage formatterConfig(Nullable formatterConfig) { if (formatterConfig.isNull()) { this.formatterConfig = null; } else if (formatterConfig.isEmpty()) { @@ -377,21 +368,21 @@ public _FinalStage formatterConfig(Nullable> formatterConfig } /** - *

    Custom payload transformation configuration. Required only when type is custom.

    + *

    Custom payload formatter. Required when type is custom.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage formatterConfig(Map formatterConfig) { + public _FinalStage formatterConfig(FormatterConfigDto formatterConfig) { this.formatterConfig = Optional.ofNullable(formatterConfig); return this; } /** - *

    Custom payload transformation configuration. Required only when type is custom.

    + *

    Custom payload formatter. Required when type is custom.

    */ @java.lang.Override @JsonSetter(value = "formatter_config", nulls = Nulls.SKIP) - public _FinalStage formatterConfig(Optional> formatterConfig) { + public _FinalStage formatterConfig(Optional formatterConfig) { this.formatterConfig = formatterConfig; return this; } diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/GetWebhookDeliveryHistoryRequest.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/GetWebhookDeliveryHistoryRequest.java index de36611..7ba6294 100644 --- a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/GetWebhookDeliveryHistoryRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/GetWebhookDeliveryHistoryRequest.java @@ -172,7 +172,6 @@ public Builder from(GetWebhookDeliveryHistoryRequest other) { } /** - *

    Type of the resource to retrieve delivery history for.

    *

    Type of the resource to retrieve delivery history for.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -184,7 +183,6 @@ public ResourceIdStage resourceType(@NotNull MappableResourceType resourceType) } /** - *

    Identifier of the resource to retrieve delivery history for.

    *

    Identifier of the resource to retrieve delivery history for.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/TriggerWebhookRequest.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/TriggerWebhookRequest.java new file mode 100644 index 0000000..de6d624 --- /dev/null +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/TriggerWebhookRequest.java @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.newscatcher.catchall.resources.webhooks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.newscatcher.catchall.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggerWebhookRequest.Builder.class) +public final class TriggerWebhookRequest { + private final String webhookId; + + private final Optional jobId; + + private final Map additionalProperties; + + private TriggerWebhookRequest(String webhookId, Optional jobId, Map additionalProperties) { + this.webhookId = webhookId; + this.jobId = jobId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Identifier of the webhook to trigger. Must be assigned to the resource. + */ + @JsonProperty("webhook_id") + public String getWebhookId() { + return webhookId; + } + + /** + * @return Specific job run to deliver. Optional for job resources; for + * monitor and monitor_group resources, selects a past run to replay. + * When omitted, the latest available results are delivered. + */ + @JsonProperty("job_id") + public Optional getJobId() { + return jobId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggerWebhookRequest && equalTo((TriggerWebhookRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggerWebhookRequest other) { + return webhookId.equals(other.webhookId) && jobId.equals(other.jobId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.webhookId, this.jobId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static WebhookIdStage builder() { + return new Builder(); + } + + public interface WebhookIdStage { + /** + *

    Identifier of the webhook to trigger. Must be assigned to the resource.

    + */ + _FinalStage webhookId(@NotNull String webhookId); + + Builder from(TriggerWebhookRequest other); + } + + public interface _FinalStage { + TriggerWebhookRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    Specific job run to deliver. Optional for job resources; for + * monitor and monitor_group resources, selects a past run to replay. + * When omitted, the latest available results are delivered.

    + */ + _FinalStage jobId(Optional jobId); + + _FinalStage jobId(String jobId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements WebhookIdStage, _FinalStage { + private String webhookId; + + private Optional jobId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggerWebhookRequest other) { + webhookId(other.getWebhookId()); + jobId(other.getJobId()); + return this; + } + + /** + *

    Identifier of the webhook to trigger. Must be assigned to the resource.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("webhook_id") + public _FinalStage webhookId(@NotNull String webhookId) { + this.webhookId = Objects.requireNonNull(webhookId, "webhookId must not be null"); + return this; + } + + /** + *

    Specific job run to deliver. Optional for job resources; for + * monitor and monitor_group resources, selects a past run to replay. + * When omitted, the latest available results are delivered.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage jobId(String jobId) { + this.jobId = Optional.ofNullable(jobId); + return this; + } + + /** + *

    Specific job run to deliver. Optional for job resources; for + * monitor and monitor_group resources, selects a past run to replay. + * When omitted, the latest available results are delivered.

    + */ + @java.lang.Override + @JsonSetter(value = "job_id", nulls = Nulls.SKIP) + public _FinalStage jobId(Optional jobId) { + this.jobId = jobId; + return this; + } + + @java.lang.Override + public TriggerWebhookRequest build() { + return new TriggerWebhookRequest(webhookId, jobId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/UpdateWebhookRequestDto.java b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/UpdateWebhookRequestDto.java index 2e841d5..715b43a 100644 --- a/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/UpdateWebhookRequestDto.java +++ b/src/main/java/com/newscatcher/catchall/resources/webhooks/requests/UpdateWebhookRequestDto.java @@ -17,6 +17,7 @@ import com.newscatcher.catchall.core.ObjectMappers; import com.newscatcher.catchall.resources.webhooks.types.UpdateWebhookRequestDtoAuth; import com.newscatcher.catchall.types.DeliveryMode; +import com.newscatcher.catchall.types.FormatterConfigDto; import com.newscatcher.catchall.types.HttpMethod; import com.newscatcher.catchall.types.WebhookType; import java.util.HashMap; @@ -43,7 +44,7 @@ public final class UpdateWebhookRequestDto { private final Optional auth; - private final Optional> formatterConfig; + private final Optional formatterConfig; private final Optional isActive; @@ -58,7 +59,7 @@ private UpdateWebhookRequestDto( Optional> headers, Optional> params, Optional auth, - Optional> formatterConfig, + Optional formatterConfig, Optional isActive, Map additionalProperties) { this.name = name; @@ -130,10 +131,10 @@ public Optional getAuth() { } /** - * @return Updated formatter configuration. + * @return Updated custom payload formatter. Set only when type is custom. */ @JsonIgnore - public Optional> getFormatterConfig() { + public Optional getFormatterConfig() { if (formatterConfig == null) { return Optional.empty(); } @@ -150,7 +151,7 @@ public Optional getIsActive() { @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("formatter_config") - private Optional> _getFormatterConfig() { + private Optional _getFormatterConfig() { return formatterConfig; } @@ -220,7 +221,7 @@ public static final class Builder { private Optional auth = Optional.empty(); - private Optional> formatterConfig = Optional.empty(); + private Optional formatterConfig = Optional.empty(); private Optional isActive = Optional.empty(); @@ -347,20 +348,20 @@ public Builder auth(UpdateWebhookRequestDtoAuth auth) { } /** - *

    Updated formatter configuration.

    + *

    Updated custom payload formatter. Set only when type is custom.

    */ @JsonSetter(value = "formatter_config", nulls = Nulls.SKIP) - public Builder formatterConfig(Optional> formatterConfig) { + public Builder formatterConfig(Optional formatterConfig) { this.formatterConfig = formatterConfig; return this; } - public Builder formatterConfig(Map formatterConfig) { + public Builder formatterConfig(FormatterConfigDto formatterConfig) { this.formatterConfig = Optional.ofNullable(formatterConfig); return this; } - public Builder formatterConfig(Nullable> formatterConfig) { + public Builder formatterConfig(Nullable formatterConfig) { if (formatterConfig.isNull()) { this.formatterConfig = null; } else if (formatterConfig.isEmpty()) { diff --git a/src/main/java/com/newscatcher/catchall/types/AddResourceResponseDto.java b/src/main/java/com/newscatcher/catchall/types/AddResourceResponseDto.java index 4aaf627..aafe018 100644 --- a/src/main/java/com/newscatcher/catchall/types/AddResourceResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/AddResourceResponseDto.java @@ -149,7 +149,6 @@ public Builder from(AddResourceResponseDto other) { } /** - *

    True if the overall operation succeeded.

    *

    True if the overall operation succeeded.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -161,7 +160,6 @@ public MessageStage success(boolean success) { } /** - *

    Top-level result message.

    *

    Top-level result message.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ApiKeyAuthDto.java b/src/main/java/com/newscatcher/catchall/types/ApiKeyAuthDto.java index 0a9d663..7490261 100644 --- a/src/main/java/com/newscatcher/catchall/types/ApiKeyAuthDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ApiKeyAuthDto.java @@ -119,7 +119,6 @@ public Builder from(ApiKeyAuthDto other) { } /** - *

    HTTP header name for the API key.

    *

    HTTP header name for the API key.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -131,7 +130,6 @@ public ValueStage header(@NotNull String header) { } /** - *

    API key value.

    *

    API key value.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/AssignWebhookResourceResponseDto.java b/src/main/java/com/newscatcher/catchall/types/AssignWebhookResourceResponseDto.java index 136282f..7965689 100644 --- a/src/main/java/com/newscatcher/catchall/types/AssignWebhookResourceResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/AssignWebhookResourceResponseDto.java @@ -170,7 +170,6 @@ public Builder from(AssignWebhookResourceResponseDto other) { } /** - *

    True if the operation succeeded; false otherwise.

    *

    True if the operation succeeded; false otherwise.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/BaseRecord.java b/src/main/java/com/newscatcher/catchall/types/BaseRecord.java index de0ff10..524126f 100644 --- a/src/main/java/com/newscatcher/catchall/types/BaseRecord.java +++ b/src/main/java/com/newscatcher/catchall/types/BaseRecord.java @@ -152,7 +152,6 @@ public Builder from(BaseRecord other) { } /** - *

    Unique identifier for the record.

    *

    Unique identifier for the record.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -164,7 +163,6 @@ public RecordTitleStage recordId(@NotNull String recordId) { } /** - *

    Short title summarizing the record.

    *

    Short title summarizing the record.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -176,9 +174,6 @@ public EnrichmentStage recordTitle(@NotNull String recordTitle) { } /** - *

    Structured data extracted from web pages. Schema is dynamically generated per job. Field names are chosen semantically to match the content.

    - *

    Note: The system always includes the enrichment_confidence field within the enrichment object, regardless of whether enrichments are generated or specified by you.

    - *

    For integration guidance, see Dynamic schemas

    *

    Structured data extracted from web pages. Schema is dynamically generated per job. Field names are chosen semantically to match the content.

    *

    Note: The system always includes the enrichment_confidence field within the enrichment object, regardless of whether enrichments are generated or specified by you.

    *

    For integration guidance, see Dynamic schemas

    diff --git a/src/main/java/com/newscatcher/catchall/types/BasicAuthDto.java b/src/main/java/com/newscatcher/catchall/types/BasicAuthDto.java index 4b81204..5ed459f 100644 --- a/src/main/java/com/newscatcher/catchall/types/BasicAuthDto.java +++ b/src/main/java/com/newscatcher/catchall/types/BasicAuthDto.java @@ -119,7 +119,6 @@ public Builder from(BasicAuthDto other) { } /** - *

    Basic auth username.

    *

    Basic auth username.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -131,7 +130,6 @@ public PasswordStage username(@NotNull String username) { } /** - *

    Basic auth password.

    *

    Basic auth password.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/BearerAuthDto.java b/src/main/java/com/newscatcher/catchall/types/BearerAuthDto.java index 85547e0..e323b39 100644 --- a/src/main/java/com/newscatcher/catchall/types/BearerAuthDto.java +++ b/src/main/java/com/newscatcher/catchall/types/BearerAuthDto.java @@ -98,7 +98,6 @@ public Builder from(BearerAuthDto other) { } /** - *

    Bearer token sent in the Authorization header.

    *

    Bearer token sent in the Authorization header.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/Citation.java b/src/main/java/com/newscatcher/catchall/types/Citation.java index a42d23c..86aeba9 100644 --- a/src/main/java/com/newscatcher/catchall/types/Citation.java +++ b/src/main/java/com/newscatcher/catchall/types/Citation.java @@ -145,7 +145,6 @@ public Builder from(Citation other) { } /** - *

    The title of the source document.

    *

    The title of the source document.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -157,7 +156,6 @@ public LinkStage title(@NotNull String title) { } /** - *

    URL to the source document.

    *

    URL to the source document.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -169,7 +167,6 @@ public PublishedDateStage link(@NotNull String link) { } /** - *

    The publication date of the source document in ISO 8601 format (UTC timezone).

    *

    The publication date of the source document in ISO 8601 format (UTC timezone).

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/CompanyAttributes.java b/src/main/java/com/newscatcher/catchall/types/CompanyAttributes.java index df22a35..9ef8303 100644 --- a/src/main/java/com/newscatcher/catchall/types/CompanyAttributes.java +++ b/src/main/java/com/newscatcher/catchall/types/CompanyAttributes.java @@ -26,8 +26,6 @@ public final class CompanyAttributes { private final Optional domain; - private final Optional description; - private final Optional> keyPersons; private final Optional> alternativeNames; @@ -36,12 +34,10 @@ public final class CompanyAttributes { private CompanyAttributes( Optional domain, - Optional description, Optional> keyPersons, Optional> alternativeNames, Map additionalProperties) { this.domain = domain; - this.description = description; this.keyPersons = keyPersons; this.alternativeNames = alternativeNames; this.additionalProperties = additionalProperties; @@ -59,17 +55,6 @@ public Optional getDomain() { return domain; } - /** - * @return Detailed description of the company used for matching. - */ - @JsonIgnore - public Optional getDescription() { - if (description == null) { - return Optional.empty(); - } - return description; - } - /** * @return Names of key people associated with the company (founders, executives, etc.). Improves matching for articles that mention people rather than the company name. */ @@ -98,12 +83,6 @@ private Optional _getDomain() { return domain; } - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) - @JsonProperty("description") - private Optional _getDescription() { - return description; - } - @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("key_persons") private Optional> _getKeyPersons() { @@ -129,14 +108,13 @@ public Map getAdditionalProperties() { private boolean equalTo(CompanyAttributes other) { return domain.equals(other.domain) - && description.equals(other.description) && keyPersons.equals(other.keyPersons) && alternativeNames.equals(other.alternativeNames); } @java.lang.Override public int hashCode() { - return Objects.hash(this.domain, this.description, this.keyPersons, this.alternativeNames); + return Objects.hash(this.domain, this.keyPersons, this.alternativeNames); } @java.lang.Override @@ -152,8 +130,6 @@ public static Builder builder() { public static final class Builder { private Optional domain = Optional.empty(); - private Optional description = Optional.empty(); - private Optional> keyPersons = Optional.empty(); private Optional> alternativeNames = Optional.empty(); @@ -165,7 +141,6 @@ private Builder() {} public Builder from(CompanyAttributes other) { domain(other.getDomain()); - description(other.getDescription()); keyPersons(other.getKeyPersons()); alternativeNames(other.getAlternativeNames()); return this; @@ -197,31 +172,6 @@ public Builder domain(Nullable domain) { return this; } - /** - *

    Detailed description of the company used for matching.

    - */ - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public Builder description(Optional description) { - this.description = description; - return this; - } - - public Builder description(String description) { - this.description = Optional.ofNullable(description); - return this; - } - - public Builder description(Nullable description) { - if (description.isNull()) { - this.description = null; - } else if (description.isEmpty()) { - this.description = Optional.empty(); - } else { - this.description = Optional.of(description.get()); - } - return this; - } - /** *

    Names of key people associated with the company (founders, executives, etc.). Improves matching for articles that mention people rather than the company name.

    */ @@ -273,7 +223,7 @@ public Builder alternativeNames(Nullable> alternativeNames) { } public CompanyAttributes build() { - return new CompanyAttributes(domain, description, keyPersons, alternativeNames, additionalProperties); + return new CompanyAttributes(domain, keyPersons, alternativeNames, additionalProperties); } public Builder additionalProperty(String key, Object value) { diff --git a/src/main/java/com/newscatcher/catchall/types/CompanyEnrichmentOutput.java b/src/main/java/com/newscatcher/catchall/types/CompanyEnrichmentOutput.java index 510938c..5a49145 100644 --- a/src/main/java/com/newscatcher/catchall/types/CompanyEnrichmentOutput.java +++ b/src/main/java/com/newscatcher/catchall/types/CompanyEnrichmentOutput.java @@ -138,7 +138,6 @@ public Builder from(CompanyEnrichmentOutput other) { } /** - *

    The text span in the source document where the company was identified.

    *

    The text span in the source document where the company was identified.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -150,7 +149,6 @@ public ConfidenceStage sourceText(@NotNull String sourceText) { } /** - *

    Confidence score for the company identification.

    *

    Confidence score for the company identification.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/CompanyEnrichmentOutputMetadata.java b/src/main/java/com/newscatcher/catchall/types/CompanyEnrichmentOutputMetadata.java index 6ab809e..4568775 100644 --- a/src/main/java/com/newscatcher/catchall/types/CompanyEnrichmentOutputMetadata.java +++ b/src/main/java/com/newscatcher/catchall/types/CompanyEnrichmentOutputMetadata.java @@ -175,7 +175,6 @@ public Builder from(CompanyEnrichmentOutputMetadata other) { } /** - *

    Normalized company name.

    *

    Normalized company name.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ConnectedDataset.java b/src/main/java/com/newscatcher/catchall/types/ConnectedDataset.java index c89a8ae..7330802 100644 --- a/src/main/java/com/newscatcher/catchall/types/ConnectedDataset.java +++ b/src/main/java/com/newscatcher/catchall/types/ConnectedDataset.java @@ -143,7 +143,6 @@ public Builder from(ConnectedDataset other) { } /** - *

    Dataset identifier.

    *

    Dataset identifier.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -155,7 +154,6 @@ public NameStage id(@NotNull String id) { } /** - *

    Dataset name as stored. Check is_deleted to determine whether the dataset is still active.

    *

    Dataset name as stored. Check is_deleted to determine whether the dataset is still active.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ConnectedEntity.java b/src/main/java/com/newscatcher/catchall/types/ConnectedEntity.java index de4daf8..af30735 100644 --- a/src/main/java/com/newscatcher/catchall/types/ConnectedEntity.java +++ b/src/main/java/com/newscatcher/catchall/types/ConnectedEntity.java @@ -300,7 +300,6 @@ public Builder from(ConnectedEntity other) { } /** - *

    Unique identifier of the matched entity.

    *

    Unique identifier of the matched entity.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -312,7 +311,6 @@ public NameStage entityId(@NotNull String entityId) { } /** - *

    Name of the matched entity.

    *

    Name of the matched entity.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -324,13 +322,6 @@ public EdScoreStage name(@NotNull String name) { } /** - *

    Relevance score indicating how directly the entity is associated with this event.

    - *

    | Score | Meaning | - * |-------|---------| - * | 10 | Direct mention, critical event (merger, CEO change, major lawsuit) | - * | 7–9 | Major impact (earnings, product launch, senior hire) | - * | 4–6 | Routine update (minor product news, mid-level changes) | - * | 1–3 | Indirect mention (listed with others, stock noise) |

    *

    Relevance score indicating how directly the entity is associated with this event.

    *

    | Score | Meaning | * |-------|---------| @@ -348,7 +339,6 @@ public RelationStage edScore(int edScore) { } /** - *

    Short explanation (up to 100 characters) of why this entity is associated with the event.

    *

    Short explanation (up to 100 characters) of why this entity is associated with the event.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -360,7 +350,6 @@ public TypeStage relation(@NotNull String relation) { } /** - *

    The entity type.

    *

    The entity type.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ContinueResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ContinueResponseDto.java index 744d5fa..640ed31 100644 --- a/src/main/java/com/newscatcher/catchall/types/ContinueResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ContinueResponseDto.java @@ -171,7 +171,6 @@ public Builder from(ContinueResponseDto other) { } /** - *

    Job identifier for the continued job.

    *

    Job identifier for the continued job.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -183,7 +182,6 @@ public NewLimitStage jobId(@NotNull String jobId) { } /** - *

    New record limit after continuation.

    *

    New record limit after continuation.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -195,7 +193,6 @@ public StatusStage newLimit(int newLimit) { } /** - *

    Confirmation that the continuation request was accepted.

    *

    Confirmation that the continuation request was accepted.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/CreateDatasetCsvResponse.java b/src/main/java/com/newscatcher/catchall/types/CreateDatasetCsvResponse.java index 19f1216..f2d7836 100644 --- a/src/main/java/com/newscatcher/catchall/types/CreateDatasetCsvResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/CreateDatasetCsvResponse.java @@ -164,7 +164,6 @@ public Builder from(CreateDatasetCsvResponse other) { } /** - *

    Unique identifier of the created dataset.

    *

    Unique identifier of the created dataset.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -176,7 +175,6 @@ public DatasetNameStage datasetId(@NotNull String datasetId) { } /** - *

    Name of the created dataset.

    *

    Name of the created dataset.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -188,7 +186,6 @@ public EntitiesCreatedStage datasetName(@NotNull String datasetName) { } /** - *

    Number of entities successfully created from the CSV.

    *

    Number of entities successfully created from the CSV.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/CreateEntitiesBatchResponse.java b/src/main/java/com/newscatcher/catchall/types/CreateEntitiesBatchResponse.java index f2a7085..6317813 100644 --- a/src/main/java/com/newscatcher/catchall/types/CreateEntitiesBatchResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/CreateEntitiesBatchResponse.java @@ -124,7 +124,6 @@ public Builder from(CreateEntitiesBatchResponse other) { } /** - *

    Total number of entities created.

    *

    Total number of entities created.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/CreateEntityRequest.java b/src/main/java/com/newscatcher/catchall/types/CreateEntityRequest.java index d658b02..5228c28 100644 --- a/src/main/java/com/newscatcher/catchall/types/CreateEntityRequest.java +++ b/src/main/java/com/newscatcher/catchall/types/CreateEntityRequest.java @@ -62,7 +62,7 @@ public Optional getEntityType() { } /** - * @return Free-text description of the entity used for disambiguation when similar names exist. + * @return Free-text description of the entity used for disambiguation when similar names exist. See Writing effective descriptions for guidance on improving matching quality. */ @JsonProperty("description") public Optional getDescription() { @@ -137,7 +137,7 @@ public interface _FinalStage { _FinalStage entityType(EntityType entityType); /** - *

    Free-text description of the entity used for disambiguation when similar names exist.

    + *

    Free-text description of the entity used for disambiguation when similar names exist. See Writing effective descriptions for guidance on improving matching quality.

    */ _FinalStage description(Optional description); @@ -183,7 +183,6 @@ public Builder from(CreateEntityRequest other) { } /** - *

    The company or person name. Required and must be non-empty.

    *

    The company or person name. Required and must be non-empty.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -228,7 +227,7 @@ public _FinalStage externalEntityId(Optional externalEntityId) { } /** - *

    Free-text description of the entity used for disambiguation when similar names exist.

    + *

    Free-text description of the entity used for disambiguation when similar names exist. See Writing effective descriptions for guidance on improving matching quality.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -238,7 +237,7 @@ public _FinalStage description(String description) { } /** - *

    Free-text description of the entity used for disambiguation when similar names exist.

    + *

    Free-text description of the entity used for disambiguation when similar names exist. See Writing effective descriptions for guidance on improving matching quality.

    */ @java.lang.Override @JsonSetter(value = "description", nulls = Nulls.SKIP) diff --git a/src/main/java/com/newscatcher/catchall/types/CreateEntityResponse.java b/src/main/java/com/newscatcher/catchall/types/CreateEntityResponse.java index 281dc1b..e7c01b5 100644 --- a/src/main/java/com/newscatcher/catchall/types/CreateEntityResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/CreateEntityResponse.java @@ -119,7 +119,6 @@ public Builder from(CreateEntityResponse other) { } /** - *

    Unique identifier of the created entity.

    *

    Unique identifier of the created entity.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -131,7 +130,6 @@ public StatusStage id(@NotNull String id) { } /** - *

    Initial status of the entity. Always pending immediately after creation — enrichment happens asynchronously.

    *

    Initial status of the entity. Always pending immediately after creation — enrichment happens asynchronously.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/CreateMonitorResponseDto.java b/src/main/java/com/newscatcher/catchall/types/CreateMonitorResponseDto.java index 4c1ed18..4626eb1 100644 --- a/src/main/java/com/newscatcher/catchall/types/CreateMonitorResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/CreateMonitorResponseDto.java @@ -136,7 +136,6 @@ public Builder from(CreateMonitorResponseDto other) { } /** - *

    Creation status or error message

    *

    Creation status or error message

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/CreateProjectResponseDto.java b/src/main/java/com/newscatcher/catchall/types/CreateProjectResponseDto.java index 8ac0230..7e60d99 100644 --- a/src/main/java/com/newscatcher/catchall/types/CreateProjectResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/CreateProjectResponseDto.java @@ -165,7 +165,6 @@ public Builder from(CreateProjectResponseDto other) { } /** - *

    True if the operation succeeded; false otherwise.

    *

    True if the operation succeeded; false otherwise.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -177,7 +176,6 @@ public MessageStage success(boolean success) { } /** - *

    Human-readable result message.

    *

    Human-readable result message.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -189,7 +187,6 @@ public ProjectIdStage message(@NotNull String message) { } /** - *

    Project identifier.

    *

    Project identifier.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -201,7 +198,6 @@ public NameStage projectId(@NotNull String projectId) { } /** - *

    Name of the created project.

    *

    Name of the created project.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/CreateWebhookResponseDto.java b/src/main/java/com/newscatcher/catchall/types/CreateWebhookResponseDto.java index 09e3d8c..482354f 100644 --- a/src/main/java/com/newscatcher/catchall/types/CreateWebhookResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/CreateWebhookResponseDto.java @@ -146,7 +146,6 @@ public Builder from(CreateWebhookResponseDto other) { } /** - *

    True if the webhook was created; false otherwise.

    *

    True if the webhook was created; false otherwise.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -158,7 +157,6 @@ public MessageStage success(boolean success) { } /** - *

    Human-readable result message.

    *

    Human-readable result message.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/DatasetEntityListResponse.java b/src/main/java/com/newscatcher/catchall/types/DatasetEntityListResponse.java index a65430f..80a72c0 100644 --- a/src/main/java/com/newscatcher/catchall/types/DatasetEntityListResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/DatasetEntityListResponse.java @@ -169,7 +169,6 @@ public Builder from(DatasetEntityListResponse other) { } /** - *

    Total number of entities in the dataset.

    *

    Total number of entities in the dataset.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -181,7 +180,6 @@ public PageStage total(int total) { } /** - *

    Current page number.

    *

    Current page number.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -193,7 +191,6 @@ public PageSizeStage page(int page) { } /** - *

    Number of entities per page.

    *

    Number of entities per page.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/DatasetListResponse.java b/src/main/java/com/newscatcher/catchall/types/DatasetListResponse.java index 4c5d11f..87088f5 100644 --- a/src/main/java/com/newscatcher/catchall/types/DatasetListResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/DatasetListResponse.java @@ -173,7 +173,6 @@ public Builder from(DatasetListResponse other) { } /** - *

    Total number of datasets matching the filter criteria.

    *

    Total number of datasets matching the filter criteria.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -185,7 +184,6 @@ public PageStage total(int total) { } /** - *

    Current page number.

    *

    Current page number.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -197,7 +195,6 @@ public PageSizeStage page(int page) { } /** - *

    Number of datasets per page.

    *

    Number of datasets per page.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/DatasetResponse.java b/src/main/java/com/newscatcher/catchall/types/DatasetResponse.java index 2885f22..b759280 100644 --- a/src/main/java/com/newscatcher/catchall/types/DatasetResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/DatasetResponse.java @@ -35,6 +35,12 @@ public final class DatasetResponse { private final Optional entityCount; + private final Optional> entityStatusBreakdown; + + private final Optional healthScore; + + private final Optional> healthBreakdown; + private final Optional latestStatus; private final Optional createdByUserId; @@ -51,6 +57,9 @@ private DatasetResponse( String name, Optional description, Optional entityCount, + Optional> entityStatusBreakdown, + Optional healthScore, + Optional> healthBreakdown, Optional latestStatus, Optional createdByUserId, Optional createdAt, @@ -61,6 +70,9 @@ private DatasetResponse( this.name = name; this.description = description; this.entityCount = entityCount; + this.entityStatusBreakdown = entityStatusBreakdown; + this.healthScore = healthScore; + this.healthBreakdown = healthBreakdown; this.latestStatus = latestStatus; this.createdByUserId = createdByUserId; this.createdAt = createdAt; @@ -111,6 +123,33 @@ public Optional getEntityCount() { return entityCount; } + /** + * @return Count of entities grouped by processing status. Keys are status values + * (ready, pending, enriching, failed); values are entity counts. + */ + @JsonProperty("entity_status_breakdown") + public Optional> getEntityStatusBreakdown() { + return entityStatusBreakdown; + } + + /** + * @return Overall health score of the dataset, from 0 to 100. Reflects how many + * entities have sufficient identifying information for reliable matching. + */ + @JsonProperty("health_score") + public Optional getHealthScore() { + return healthScore; + } + + /** + * @return Health scores broken down by entity type. Keys are entity types + * (e.g. company); values are scores from 0 to 100. + */ + @JsonProperty("health_breakdown") + public Optional> getHealthBreakdown() { + return healthBreakdown; + } + @JsonProperty("latest_status") public Optional getLatestStatus() { return latestStatus; @@ -163,6 +202,9 @@ private boolean equalTo(DatasetResponse other) { && name.equals(other.name) && description.equals(other.description) && entityCount.equals(other.entityCount) + && entityStatusBreakdown.equals(other.entityStatusBreakdown) + && healthScore.equals(other.healthScore) + && healthBreakdown.equals(other.healthBreakdown) && latestStatus.equals(other.latestStatus) && createdByUserId.equals(other.createdByUserId) && createdAt.equals(other.createdAt) @@ -177,6 +219,9 @@ public int hashCode() { this.name, this.description, this.entityCount, + this.entityStatusBreakdown, + this.healthScore, + this.healthBreakdown, this.latestStatus, this.createdByUserId, this.createdAt, @@ -238,6 +283,30 @@ public interface _FinalStage { _FinalStage entityCount(Integer entityCount); + /** + *

    Count of entities grouped by processing status. Keys are status values + * (ready, pending, enriching, failed); values are entity counts.

    + */ + _FinalStage entityStatusBreakdown(Optional> entityStatusBreakdown); + + _FinalStage entityStatusBreakdown(Map entityStatusBreakdown); + + /** + *

    Overall health score of the dataset, from 0 to 100. Reflects how many + * entities have sufficient identifying information for reliable matching.

    + */ + _FinalStage healthScore(Optional healthScore); + + _FinalStage healthScore(Double healthScore); + + /** + *

    Health scores broken down by entity type. Keys are entity types + * (e.g. company); values are scores from 0 to 100.

    + */ + _FinalStage healthBreakdown(Optional> healthBreakdown); + + _FinalStage healthBreakdown(Map healthBreakdown); + _FinalStage latestStatus(Optional latestStatus); _FinalStage latestStatus(DatasetStatus latestStatus); @@ -280,6 +349,12 @@ public static final class Builder implements IdStage, OrganizationIdStage, NameS private Optional latestStatus = Optional.empty(); + private Optional> healthBreakdown = Optional.empty(); + + private Optional healthScore = Optional.empty(); + + private Optional> entityStatusBreakdown = Optional.empty(); + private Optional entityCount = Optional.empty(); private Optional description = Optional.empty(); @@ -296,6 +371,9 @@ public Builder from(DatasetResponse other) { name(other.getName()); description(other.getDescription()); entityCount(other.getEntityCount()); + entityStatusBreakdown(other.getEntityStatusBreakdown()); + healthScore(other.getHealthScore()); + healthBreakdown(other.getHealthBreakdown()); latestStatus(other.getLatestStatus()); createdByUserId(other.getCreatedByUserId()); createdAt(other.getCreatedAt()); @@ -304,7 +382,6 @@ public Builder from(DatasetResponse other) { } /** - *

    Unique identifier of the dataset.

    *

    Unique identifier of the dataset.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -316,7 +393,6 @@ public OrganizationIdStage id(@NotNull String id) { } /** - *

    Organization that owns this dataset.

    *

    Organization that owns this dataset.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -328,7 +404,6 @@ public NameStage organizationId(@NotNull String organizationId) { } /** - *

    Dataset name.

    *

    Dataset name.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -412,6 +487,72 @@ public _FinalStage latestStatus(Optional latestStatus) { return this; } + /** + *

    Health scores broken down by entity type. Keys are entity types + * (e.g. company); values are scores from 0 to 100.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage healthBreakdown(Map healthBreakdown) { + this.healthBreakdown = Optional.ofNullable(healthBreakdown); + return this; + } + + /** + *

    Health scores broken down by entity type. Keys are entity types + * (e.g. company); values are scores from 0 to 100.

    + */ + @java.lang.Override + @JsonSetter(value = "health_breakdown", nulls = Nulls.SKIP) + public _FinalStage healthBreakdown(Optional> healthBreakdown) { + this.healthBreakdown = healthBreakdown; + return this; + } + + /** + *

    Overall health score of the dataset, from 0 to 100. Reflects how many + * entities have sufficient identifying information for reliable matching.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage healthScore(Double healthScore) { + this.healthScore = Optional.ofNullable(healthScore); + return this; + } + + /** + *

    Overall health score of the dataset, from 0 to 100. Reflects how many + * entities have sufficient identifying information for reliable matching.

    + */ + @java.lang.Override + @JsonSetter(value = "health_score", nulls = Nulls.SKIP) + public _FinalStage healthScore(Optional healthScore) { + this.healthScore = healthScore; + return this; + } + + /** + *

    Count of entities grouped by processing status. Keys are status values + * (ready, pending, enriching, failed); values are entity counts.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage entityStatusBreakdown(Map entityStatusBreakdown) { + this.entityStatusBreakdown = Optional.ofNullable(entityStatusBreakdown); + return this; + } + + /** + *

    Count of entities grouped by processing status. Keys are status values + * (ready, pending, enriching, failed); values are entity counts.

    + */ + @java.lang.Override + @JsonSetter(value = "entity_status_breakdown", nulls = Nulls.SKIP) + public _FinalStage entityStatusBreakdown(Optional> entityStatusBreakdown) { + this.entityStatusBreakdown = entityStatusBreakdown; + return this; + } + /** *

    Total number of entities in this dataset.

    * @return Reference to {@code this} so that method calls can be chained together. @@ -476,6 +617,9 @@ public DatasetResponse build() { name, description, entityCount, + entityStatusBreakdown, + healthScore, + healthBreakdown, latestStatus, createdByUserId, createdAt, diff --git a/src/main/java/com/newscatcher/catchall/types/DatasetStatusHistoryResponse.java b/src/main/java/com/newscatcher/catchall/types/DatasetStatusHistoryResponse.java index 93f27e6..76227be 100644 --- a/src/main/java/com/newscatcher/catchall/types/DatasetStatusHistoryResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/DatasetStatusHistoryResponse.java @@ -125,7 +125,6 @@ public Builder from(DatasetStatusHistoryResponse other) { } /** - *

    ID of the dataset.

    *

    ID of the dataset.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/DeleteJobResponseDto.java b/src/main/java/com/newscatcher/catchall/types/DeleteJobResponseDto.java index 5ac8a2f..4a632e2 100644 --- a/src/main/java/com/newscatcher/catchall/types/DeleteJobResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/DeleteJobResponseDto.java @@ -170,7 +170,6 @@ public Builder from(DeleteJobResponseDto other) { } /** - *

    True if the delete operation succeeded; false otherwise.

    *

    True if the delete operation succeeded; false otherwise.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/DeleteMonitorResponseDto.java b/src/main/java/com/newscatcher/catchall/types/DeleteMonitorResponseDto.java index e69f787..180dde6 100644 --- a/src/main/java/com/newscatcher/catchall/types/DeleteMonitorResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/DeleteMonitorResponseDto.java @@ -170,7 +170,6 @@ public Builder from(DeleteMonitorResponseDto other) { } /** - *

    True if the delete operation succeeded; false otherwise.

    *

    True if the delete operation succeeded; false otherwise.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/DeliveryHistoryItemDto.java b/src/main/java/com/newscatcher/catchall/types/DeliveryHistoryItemDto.java index 73b1646..bce9c8e 100644 --- a/src/main/java/com/newscatcher/catchall/types/DeliveryHistoryItemDto.java +++ b/src/main/java/com/newscatcher/catchall/types/DeliveryHistoryItemDto.java @@ -378,7 +378,6 @@ public Builder from(DeliveryHistoryItemDto other) { } /** - *

    Delivery record identifier.

    *

    Delivery record identifier.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -390,7 +389,6 @@ public WebhookIdStage id(int id) { } /** - *

    Identifier of the webhook that was dispatched.

    *

    Identifier of the webhook that was dispatched.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -402,7 +400,6 @@ public ResourceTypeStage webhookId(@NotNull String webhookId) { } /** - *

    Type of the resource that triggered the delivery.

    *

    Type of the resource that triggered the delivery.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -414,7 +411,6 @@ public ResourceIdStage resourceType(@NotNull MappableResourceType resourceType) } /** - *

    Identifier of the resource that triggered the delivery.

    *

    Identifier of the resource that triggered the delivery.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -426,7 +422,6 @@ public StatusCodeStage resourceId(@NotNull String resourceId) { } /** - *

    HTTP response code returned by the webhook endpoint.

    *

    HTTP response code returned by the webhook endpoint.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -438,7 +433,6 @@ public AttemptNumberStage statusCode(int statusCode) { } /** - *

    Delivery attempt number. 1 indicates the first attempt.

    *

    Delivery attempt number. 1 indicates the first attempt.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -450,7 +444,6 @@ public TimestampStage attemptNumber(int attemptNumber) { } /** - *

    Time of the delivery attempt in ISO 8601 format with UTC timezone.

    *

    Time of the delivery attempt in ISO 8601 format with UTC timezone.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -462,7 +455,6 @@ public DeliveryStatusStage timestamp(@NotNull OffsetDateTime timestamp) { } /** - *

    Outcome of this delivery attempt.

    *

    Outcome of this delivery attempt.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/DeliveryHistoryResponseDto.java b/src/main/java/com/newscatcher/catchall/types/DeliveryHistoryResponseDto.java index 5c638b8..e140239 100644 --- a/src/main/java/com/newscatcher/catchall/types/DeliveryHistoryResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/DeliveryHistoryResponseDto.java @@ -251,7 +251,6 @@ public Builder from(DeliveryHistoryResponseDto other) { } /** - *

    Type of the queried resource.

    *

    Type of the queried resource.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -263,7 +262,6 @@ public ResourceIdStage resourceType(@NotNull MappableResourceType resourceType) } /** - *

    Identifier of the queried resource.

    *

    Identifier of the queried resource.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -275,7 +273,6 @@ public TotalStage resourceId(@NotNull String resourceId) { } /** - *

    Total number of delivery records for this resource.

    *

    Total number of delivery records for this resource.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -287,7 +284,6 @@ public PageStage total(int total) { } /** - *

    Current page number.

    *

    Current page number.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -299,7 +295,6 @@ public PageSizeStage page(int page) { } /** - *

    Number of records per page.

    *

    Number of records per page.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -311,7 +306,6 @@ public TotalPagesStage pageSize(int pageSize) { } /** - *

    Total number of pages available.

    *

    Total number of pages available.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/EnrichmentSchema.java b/src/main/java/com/newscatcher/catchall/types/EnrichmentSchema.java index 97a7fa9..b53399d 100644 --- a/src/main/java/com/newscatcher/catchall/types/EnrichmentSchema.java +++ b/src/main/java/com/newscatcher/catchall/types/EnrichmentSchema.java @@ -135,7 +135,6 @@ public Builder from(EnrichmentSchema other) { } /** - *

    Enrichment field name (snake_case recommended).

    *

    Enrichment field name (snake_case recommended).

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -147,7 +146,6 @@ public DescriptionStage name(@NotNull String name) { } /** - *

    What information this field extracts.

    *

    What information this field extracts.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/EntityListResponse.java b/src/main/java/com/newscatcher/catchall/types/EntityListResponse.java index 5ef2b11..9089af9 100644 --- a/src/main/java/com/newscatcher/catchall/types/EntityListResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/EntityListResponse.java @@ -173,7 +173,6 @@ public Builder from(EntityListResponse other) { } /** - *

    Total number of entities matching the filter criteria.

    *

    Total number of entities matching the filter criteria.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -185,7 +184,6 @@ public PageStage total(int total) { } /** - *

    Current page number.

    *

    Current page number.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -197,7 +195,6 @@ public PageSizeStage page(int page) { } /** - *

    Number of entities per page.

    *

    Number of entities per page.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/EntityResponse.java b/src/main/java/com/newscatcher/catchall/types/EntityResponse.java index c6fa4fa..dbe8d5f 100644 --- a/src/main/java/com/newscatcher/catchall/types/EntityResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/EntityResponse.java @@ -352,7 +352,6 @@ public Builder from(EntityResponse other) { } /** - *

    Unique identifier of the entity.

    *

    Unique identifier of the entity.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -371,7 +370,6 @@ public OrganizationIdStage entityType(@NotNull EntityType entityType) { } /** - *

    Organization that owns this entity.

    *

    Organization that owns this entity.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -383,7 +381,6 @@ public NameStage organizationId(@NotNull String organizationId) { } /** - *

    Entity name.

    *

    Entity name.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/EntitySummary.java b/src/main/java/com/newscatcher/catchall/types/EntitySummary.java index 17e7b54..28faf38 100644 --- a/src/main/java/com/newscatcher/catchall/types/EntitySummary.java +++ b/src/main/java/com/newscatcher/catchall/types/EntitySummary.java @@ -254,7 +254,6 @@ public Builder from(EntitySummary other) { } /** - *

    Unique identifier of the entity.

    *

    Unique identifier of the entity.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -266,7 +265,6 @@ public NameStage id(@NotNull String id) { } /** - *

    Entity name.

    *

    Entity name.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/EntityValidationErrorBody.java b/src/main/java/com/newscatcher/catchall/types/EntityValidationErrorBody.java index aef4e18..073850f 100644 --- a/src/main/java/com/newscatcher/catchall/types/EntityValidationErrorBody.java +++ b/src/main/java/com/newscatcher/catchall/types/EntityValidationErrorBody.java @@ -143,8 +143,6 @@ public Builder from(EntityValidationErrorBody other) { } /** - *

    Human-readable description of all validation errors, including - * field path, failure message, and error type.

    *

    Human-readable description of all validation errors, including * field path, failure message, and error type.

    * @return Reference to {@code this} so that method calls can be chained together. @@ -157,7 +155,6 @@ public StatusStage message(@NotNull String message) { } /** - *

    HTTP status text.

    *

    HTTP status text.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -169,7 +166,6 @@ public StatusCodeStage status(@NotNull String status) { } /** - *

    HTTP status code.

    *

    HTTP status code.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/FormatterConfigDto.java b/src/main/java/com/newscatcher/catchall/types/FormatterConfigDto.java new file mode 100644 index 0000000..73557f1 --- /dev/null +++ b/src/main/java/com/newscatcher/catchall/types/FormatterConfigDto.java @@ -0,0 +1,180 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.newscatcher.catchall.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.newscatcher.catchall.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FormatterConfigDto.Builder.class) +public final class FormatterConfigDto { + private final String template; + + private final Optional contentType; + + private final Map additionalProperties; + + private FormatterConfigDto( + String template, Optional contentType, Map additionalProperties) { + this.template = template; + this.contentType = contentType; + this.additionalProperties = additionalProperties; + } + + /** + * @return Liquid template string rendered at dispatch time. Maximum 10 KB. + */ + @JsonProperty("template") + public String getTemplate() { + return template; + } + + /** + * @return Content-Type of the rendered output. Supported values: application/json, + * application/ld+json, text/html, text/plain, text/xml, + * application/xml, text/csv. + */ + @JsonProperty("content_type") + public Optional getContentType() { + return contentType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FormatterConfigDto && equalTo((FormatterConfigDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FormatterConfigDto other) { + return template.equals(other.template) && contentType.equals(other.contentType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.template, this.contentType); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TemplateStage builder() { + return new Builder(); + } + + public interface TemplateStage { + /** + *

    Liquid template string rendered at dispatch time. Maximum 10 KB.

    + */ + _FinalStage template(@NotNull String template); + + Builder from(FormatterConfigDto other); + } + + public interface _FinalStage { + FormatterConfigDto build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

    Content-Type of the rendered output. Supported values: application/json, + * application/ld+json, text/html, text/plain, text/xml, + * application/xml, text/csv.

    + */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TemplateStage, _FinalStage { + private String template; + + private Optional contentType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FormatterConfigDto other) { + template(other.getTemplate()); + contentType(other.getContentType()); + return this; + } + + /** + *

    Liquid template string rendered at dispatch time. Maximum 10 KB.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("template") + public _FinalStage template(@NotNull String template) { + this.template = Objects.requireNonNull(template, "template must not be null"); + return this; + } + + /** + *

    Content-Type of the rendered output. Supported values: application/json, + * application/ld+json, text/html, text/plain, text/xml, + * application/xml, text/csv.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); + return this; + } + + /** + *

    Content-Type of the rendered output. Supported values: application/json, + * application/ld+json, text/html, text/plain, text/xml, + * application/xml, text/csv.

    + */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; + return this; + } + + @java.lang.Override + public FormatterConfigDto build() { + return new FormatterConfigDto(template, contentType, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/newscatcher/catchall/types/GetWebhookResponseDto.java b/src/main/java/com/newscatcher/catchall/types/GetWebhookResponseDto.java index 9eda090..dfacd88 100644 --- a/src/main/java/com/newscatcher/catchall/types/GetWebhookResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/GetWebhookResponseDto.java @@ -146,7 +146,6 @@ public Builder from(GetWebhookResponseDto other) { } /** - *

    True if the operation succeeded; false otherwise.

    *

    True if the operation succeeded; false otherwise.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -158,7 +157,6 @@ public MessageStage success(boolean success) { } /** - *

    Human-readable result message.

    *

    Human-readable result message.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/InitializeResponseDto.java b/src/main/java/com/newscatcher/catchall/types/InitializeResponseDto.java index 18b8de9..19832fa 100644 --- a/src/main/java/com/newscatcher/catchall/types/InitializeResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/InitializeResponseDto.java @@ -82,7 +82,10 @@ public Optional getContext() { } /** - * @return Suggested validators for filtering relevant web pages. + * @return Suggested validators for filtering relevant web pages. When the job is + * submitted, the system may inject additional validators during the analyzing + * stage — check the returned validators[] in the job status to see the + * complete applied set. */ @JsonProperty("validators") public List getValidators() { @@ -190,7 +193,10 @@ public interface _FinalStage { _FinalStage context(Nullable context); /** - *

    Suggested validators for filtering relevant web pages.

    + *

    Suggested validators for filtering relevant web pages. When the job is + * submitted, the system may inject additional validators during the analyzing + * stage — check the returned validators[] in the job status to see the + * complete applied set.

    */ _FinalStage validators(List validators); @@ -258,7 +264,6 @@ public Builder from(InitializeResponseDto other) { } /** - *

    Echo of the query from the request.

    *

    Echo of the query from the request.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -353,7 +358,10 @@ public _FinalStage enrichments(List enrichments) { } /** - *

    Suggested validators for filtering relevant web pages.

    + *

    Suggested validators for filtering relevant web pages. When the job is + * submitted, the system may inject additional validators during the analyzing + * stage — check the returned validators[] in the job status to see the + * complete applied set.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -365,7 +373,10 @@ public _FinalStage addAllValidators(List validators) { } /** - *

    Suggested validators for filtering relevant web pages.

    + *

    Suggested validators for filtering relevant web pages. When the job is + * submitted, the system may inject additional validators during the analyzing + * stage — check the returned validators[] in the job status to see the + * complete applied set.

    * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override @@ -375,7 +386,10 @@ public _FinalStage addValidators(ValidatorSchema validators) { } /** - *

    Suggested validators for filtering relevant web pages.

    + *

    Suggested validators for filtering relevant web pages. When the job is + * submitted, the system may inject additional validators during the analyzing + * stage — check the returned validators[] in the job status to see the + * complete applied set.

    */ @java.lang.Override @JsonSetter(value = "validators", nulls = Nulls.SKIP) diff --git a/src/main/java/com/newscatcher/catchall/types/JobStep.java b/src/main/java/com/newscatcher/catchall/types/JobStep.java index 3674f56..d47687f 100644 --- a/src/main/java/com/newscatcher/catchall/types/JobStep.java +++ b/src/main/java/com/newscatcher/catchall/types/JobStep.java @@ -141,7 +141,6 @@ public OrderStage status(@NotNull PublicJobStatus status) { } /** - *

    Sequential position of this step in the pipeline (1-7).

    *

    Sequential position of this step in the pipeline (1-7).

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -153,7 +152,6 @@ public CompletedStage order(int order) { } /** - *

    True if this step has finished processing; false otherwise.

    *

    True if this step has finished processing; false otherwise.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ListMonitorsResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ListMonitorsResponseDto.java index 0817629..c9f3696 100644 --- a/src/main/java/com/newscatcher/catchall/types/ListMonitorsResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ListMonitorsResponseDto.java @@ -196,7 +196,6 @@ public Builder from(ListMonitorsResponseDto other) { } /** - *

    Total number of monitors for this user.

    *

    Total number of monitors for this user.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -208,7 +207,6 @@ public PageStage total(int total) { } /** - *

    Current page number.

    *

    Current page number.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -220,7 +218,6 @@ public PageSizeStage page(int page) { } /** - *

    Number of monitors per page.

    *

    Number of monitors per page.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -232,7 +229,6 @@ public TotalPagesStage pageSize(int pageSize) { } /** - *

    Total number of pages available.

    *

    Total number of pages available.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ListUserJobsResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ListUserJobsResponseDto.java index 35efe88..ec7d515 100644 --- a/src/main/java/com/newscatcher/catchall/types/ListUserJobsResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ListUserJobsResponseDto.java @@ -196,7 +196,6 @@ public Builder from(ListUserJobsResponseDto other) { } /** - *

    Total number of jobs for this user.

    *

    Total number of jobs for this user.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -208,7 +207,6 @@ public PageStage total(int total) { } /** - *

    Current page number.

    *

    Current page number.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -220,7 +218,6 @@ public PageSizeStage page(int page) { } /** - *

    Number of jobs per page.

    *

    Number of jobs per page.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -232,7 +229,6 @@ public TotalPagesStage pageSize(int pageSize) { } /** - *

    Total number of pages available.

    *

    Total number of pages available.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ListWebhookResourcesResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ListWebhookResourcesResponseDto.java index cff1bfa..2fd181d 100644 --- a/src/main/java/com/newscatcher/catchall/types/ListWebhookResourcesResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ListWebhookResourcesResponseDto.java @@ -196,7 +196,6 @@ public Builder from(ListWebhookResourcesResponseDto other) { } /** - *

    Total number of resource mappings for this webhook.

    *

    Total number of resource mappings for this webhook.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -208,7 +207,6 @@ public PageStage total(int total) { } /** - *

    Current page number.

    *

    Current page number.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -220,7 +218,6 @@ public PageSizeStage page(int page) { } /** - *

    Number of mappings per page.

    *

    Number of mappings per page.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -232,7 +229,6 @@ public TotalPagesStage pageSize(int pageSize) { } /** - *

    Total number of pages available.

    *

    Total number of pages available.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ListWebhooksResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ListWebhooksResponseDto.java index 37658e0..1d46dd2 100644 --- a/src/main/java/com/newscatcher/catchall/types/ListWebhooksResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ListWebhooksResponseDto.java @@ -196,7 +196,6 @@ public Builder from(ListWebhooksResponseDto other) { } /** - *

    Total number of webhooks in the organization.

    *

    Total number of webhooks in the organization.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -208,7 +207,6 @@ public PageStage total(int total) { } /** - *

    Current page number.

    *

    Current page number.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -220,7 +218,6 @@ public PageSizeStage page(int page) { } /** - *

    Number of webhooks per page.

    *

    Number of webhooks per page.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -232,7 +229,6 @@ public TotalPagesStage pageSize(int pageSize) { } /** - *

    Total number of pages available.

    *

    Total number of pages available.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ManageEntitiesResponse.java b/src/main/java/com/newscatcher/catchall/types/ManageEntitiesResponse.java index 0016c4e..c544e0e 100644 --- a/src/main/java/com/newscatcher/catchall/types/ManageEntitiesResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/ManageEntitiesResponse.java @@ -119,7 +119,6 @@ public Builder from(ManageEntitiesResponse other) { } /** - *

    ID of the dataset that was modified.

    *

    ID of the dataset that was modified.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -131,7 +130,6 @@ public AffectedCountStage datasetId(@NotNull String datasetId) { } /** - *

    Number of entities that were added or removed.

    *

    Number of entities that were added or removed.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/MonitorCitation.java b/src/main/java/com/newscatcher/catchall/types/MonitorCitation.java index 2442223..d4d4271 100644 --- a/src/main/java/com/newscatcher/catchall/types/MonitorCitation.java +++ b/src/main/java/com/newscatcher/catchall/types/MonitorCitation.java @@ -220,7 +220,6 @@ public Builder from(MonitorCitation other) { } /** - *

    The title of the source document.

    *

    The title of the source document.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -232,7 +231,6 @@ public LinkStage title(@NotNull String title) { } /** - *

    URL to the source document.

    *

    URL to the source document.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -244,7 +242,6 @@ public PublishedDateStage link(@NotNull String link) { } /** - *

    The publication date of the source document in ISO 8601 format (UTC timezone).

    *

    The publication date of the source document in ISO 8601 format (UTC timezone).

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -256,7 +253,6 @@ public IdStage publishedDate(@NotNull OffsetDateTime publishedDate) { } /** - *

    Unique identifier of the document in the search index.

    *

    Unique identifier of the document in the search index.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -268,7 +264,6 @@ public JobIdStage id(@NotNull String id) { } /** - *

    Job ID that found this citation.

    *

    Job ID that found this citation.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -280,7 +275,6 @@ public AddedOnStage jobId(@NotNull String jobId) { } /** - *

    The date when the citation was added to the record in ISO 8601 format with UTC timezone.

    *

    The date when the citation was added to the record in ISO 8601 format with UTC timezone.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/MonitorJobItem.java b/src/main/java/com/newscatcher/catchall/types/MonitorJobItem.java index c91bfd0..60f9186 100644 --- a/src/main/java/com/newscatcher/catchall/types/MonitorJobItem.java +++ b/src/main/java/com/newscatcher/catchall/types/MonitorJobItem.java @@ -142,7 +142,6 @@ public Builder from(MonitorJobItem other) { } /** - *

    Unique identifier for this job execution.

    *

    Unique identifier for this job execution.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -154,7 +153,6 @@ public StartDateStage jobId(@NotNull String jobId) { } /** - *

    Start of the data collection time window for this job execution (based on monitor schedule) in ISO 8601 format with UTC timezone.

    *

    Start of the data collection time window for this job execution (based on monitor schedule) in ISO 8601 format with UTC timezone.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -166,7 +164,6 @@ public EndDateStage startDate(@NotNull OffsetDateTime startDate) { } /** - *

    End of the data collection time window for this job execution (based on monitor schedule) in ISO 8601 format with UTC timezone.

    *

    End of the data collection time window for this job execution (based on monitor schedule) in ISO 8601 format with UTC timezone.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/MonitorListItemDto.java b/src/main/java/com/newscatcher/catchall/types/MonitorListItemDto.java index 88668e3..d72188d 100644 --- a/src/main/java/com/newscatcher/catchall/types/MonitorListItemDto.java +++ b/src/main/java/com/newscatcher/catchall/types/MonitorListItemDto.java @@ -359,7 +359,6 @@ public Builder from(MonitorListItemDto other) { } /** - *

    Monitor identifier.

    *

    Monitor identifier.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -371,7 +370,6 @@ public ReferenceJobIdStage monitorId(@NotNull String monitorId) { } /** - *

    Job identifier used as a reference for this monitor.

    *

    Job identifier used as a reference for this monitor.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -383,7 +381,6 @@ public ReferenceJobQueryStage referenceJobId(@NotNull String referenceJobId) { } /** - *

    Plain text query from the reference job.

    *

    Plain text query from the reference job.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -395,7 +392,6 @@ public EnabledStage referenceJobQuery(@NotNull String referenceJobQuery) { } /** - *

    True if the monitor is currently active; false otherwise.

    *

    True if the monitor is currently active; false otherwise.

    * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/MonitorRecord.java b/src/main/java/com/newscatcher/catchall/types/MonitorRecord.java index 5bf7a38..a717b76 100644 --- a/src/main/java/com/newscatcher/catchall/types/MonitorRecord.java +++ b/src/main/java/com/newscatcher/catchall/types/MonitorRecord.java @@ -229,7 +229,6 @@ public Builder from(MonitorRecord other) { } /** - *

    Unique identifier for the record.

    *

    Unique identifier for the record.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -241,7 +240,6 @@ public RecordTitleStage recordId(@NotNull String recordId) { } /** - *

    Short title summarizing the record.

    *

    Short title summarizing the record.

    * @return Reference to {@code this} so that method calls can be chained together. */ @@ -253,9 +251,6 @@ public EnrichmentStage recordTitle(@NotNull String recordTitle) { } /** - *

    Structured data extracted from web pages. Schema is dynamically generated per job. Field names are chosen semantically to match the content.

    - *

    Note: The system always includes the enrichment_confidence field within the enrichment object, regardless of whether enrichments are generated or specified by you.

    - *

    For integration guidance, see Dynamic schemas

    *

    Structured data extracted from web pages. Schema is dynamically generated per job. Field names are chosen semantically to match the content.

    *

    Note: The system always includes the enrichment_confidence field within the enrichment object, regardless of whether enrichments are generated or specified by you.

    *

    For integration guidance, see Dynamic schemas

    diff --git a/src/main/java/com/newscatcher/catchall/types/MonitorStatusEntry.java b/src/main/java/com/newscatcher/catchall/types/MonitorStatusEntry.java index c9a8c1b..a3df845 100644 --- a/src/main/java/com/newscatcher/catchall/types/MonitorStatusEntry.java +++ b/src/main/java/com/newscatcher/catchall/types/MonitorStatusEntry.java @@ -223,18 +223,6 @@ public Builder from(MonitorStatusEntry other) { } /** - *

    Type of lifecycle event.

    - *
      - *
    • created: Monitor was created.
    • - *
    • enable: Monitor was enabled.
    • - *
    • disable: Monitor was disabled.
    • - *
    • scheduled: A job was triggered for execution. - * additional_information contains job_id, start_date, - * and end_date.
    • - *
    • dump: Results were collected after a job completed. - * additional_information contains nb_existing_records, - * nb_final_records, and optionally webhook.
    • - *
    *

    Type of lifecycle event.

    *
      *
    • created: Monitor was created.
    • @@ -257,7 +245,6 @@ public CreatedAtStage status(@NotNull MonitorStatusEntryStatus status) { } /** - *

      Timestamp of this event in ISO 8601 format with UTC timezone.

      *

      Timestamp of this event in ISO 8601 format with UTC timezone.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/MonitorStatusHistoryResponseDto.java b/src/main/java/com/newscatcher/catchall/types/MonitorStatusHistoryResponseDto.java index 56f5f0f..1e755a7 100644 --- a/src/main/java/com/newscatcher/catchall/types/MonitorStatusHistoryResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/MonitorStatusHistoryResponseDto.java @@ -241,7 +241,6 @@ public Builder from(MonitorStatusHistoryResponseDto other) { } /** - *

      True if the request succeeded; false otherwise.

      *

      True if the request succeeded; false otherwise.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/PlanFeature.java b/src/main/java/com/newscatcher/catchall/types/PlanFeature.java index 88f3832..c7096c2 100644 --- a/src/main/java/com/newscatcher/catchall/types/PlanFeature.java +++ b/src/main/java/com/newscatcher/catchall/types/PlanFeature.java @@ -194,7 +194,6 @@ public Builder from(PlanFeature other) { } /** - *

      Human-readable feature name.

      *

      Human-readable feature name.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -206,7 +205,6 @@ public CodeStage name(@NotNull String name) { } /** - *

      Machine-readable feature identifier.

      *

      Machine-readable feature identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ProjectListResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ProjectListResponseDto.java index 6bc1e34..502f7cc 100644 --- a/src/main/java/com/newscatcher/catchall/types/ProjectListResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ProjectListResponseDto.java @@ -196,7 +196,6 @@ public Builder from(ProjectListResponseDto other) { } /** - *

      Total number of projects matching the filter criteria.

      *

      Total number of projects matching the filter criteria.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -208,7 +207,6 @@ public PageStage total(int total) { } /** - *

      Current page number.

      *

      Current page number.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -220,7 +218,6 @@ public PageSizeStage page(int page) { } /** - *

      Number of projects per page.

      *

      Number of projects per page.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -232,7 +229,6 @@ public TotalPagesStage pageSize(int pageSize) { } /** - *

      Total number of pages.

      *

      Total number of pages.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ProjectOverviewResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ProjectOverviewResponseDto.java index 2cd2707..0e7c72b 100644 --- a/src/main/java/com/newscatcher/catchall/types/ProjectOverviewResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ProjectOverviewResponseDto.java @@ -120,7 +120,6 @@ public Builder from(ProjectOverviewResponseDto other) { } /** - *

      Project identifier.

      *

      Project identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -132,7 +131,6 @@ public OverviewStage projectId(@NotNull String projectId) { } /** - *

      Resource counts grouped by type.

      *

      Resource counts grouped by type.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ProjectResourceDto.java b/src/main/java/com/newscatcher/catchall/types/ProjectResourceDto.java index 910e135..9181b77 100644 --- a/src/main/java/com/newscatcher/catchall/types/ProjectResourceDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ProjectResourceDto.java @@ -198,7 +198,6 @@ public ResourceIdStage resourceType(@NotNull ProjectResourceType resourceType) { } /** - *

      Resource identifier.

      *

      Resource identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ProjectResourceListResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ProjectResourceListResponseDto.java index 7a92430..da0e3ae 100644 --- a/src/main/java/com/newscatcher/catchall/types/ProjectResourceListResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ProjectResourceListResponseDto.java @@ -196,7 +196,6 @@ public Builder from(ProjectResourceListResponseDto other) { } /** - *

      Total number of resources assigned to the project.

      *

      Total number of resources assigned to the project.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -208,7 +207,6 @@ public PageStage total(int total) { } /** - *

      Current page number.

      *

      Current page number.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -220,7 +218,6 @@ public PageSizeStage page(int page) { } /** - *

      Number of resources per page.

      *

      Number of resources per page.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -232,7 +229,6 @@ public TotalPagesStage pageSize(int pageSize) { } /** - *

      Total number of pages.

      *

      Total number of pages.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ProjectResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ProjectResponseDto.java index 237358f..c4b7a8a 100644 --- a/src/main/java/com/newscatcher/catchall/types/ProjectResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ProjectResponseDto.java @@ -286,7 +286,6 @@ public Builder from(ProjectResponseDto other) { } /** - *

      True if the operation succeeded; false otherwise.

      *

      True if the operation succeeded; false otherwise.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -298,7 +297,6 @@ public MessageStage success(boolean success) { } /** - *

      Human-readable result message.

      *

      Human-readable result message.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -310,7 +308,6 @@ public ProjectIdStage message(@NotNull String message) { } /** - *

      Project identifier.

      *

      Project identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -322,7 +319,6 @@ public NameStage projectId(@NotNull String projectId) { } /** - *

      Project name.

      *

      Project name.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ProjectSummaryDto.java b/src/main/java/com/newscatcher/catchall/types/ProjectSummaryDto.java index 20476fe..a661113 100644 --- a/src/main/java/com/newscatcher/catchall/types/ProjectSummaryDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ProjectSummaryDto.java @@ -233,7 +233,6 @@ public Builder from(ProjectSummaryDto other) { } /** - *

      Project identifier.

      *

      Project identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -245,7 +244,6 @@ public NameStage projectId(@NotNull String projectId) { } /** - *

      Project name.

      *

      Project name.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/PullJobResponseDto.java b/src/main/java/com/newscatcher/catchall/types/PullJobResponseDto.java index a2bd9b4..e8b20f4 100644 --- a/src/main/java/com/newscatcher/catchall/types/PullJobResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/PullJobResponseDto.java @@ -616,7 +616,6 @@ public Builder from(PullJobResponseDto other) { } /** - *

      Job identifier.

      *

      Job identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/PullMonitorResponseDto.java b/src/main/java/com/newscatcher/catchall/types/PullMonitorResponseDto.java index 94eeb60..4f6a567 100644 --- a/src/main/java/com/newscatcher/catchall/types/PullMonitorResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/PullMonitorResponseDto.java @@ -354,7 +354,6 @@ public Builder from(PullMonitorResponseDto other) { } /** - *

      Unique identifier for the monitor.

      *

      Unique identifier for the monitor.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -373,7 +372,6 @@ public StatusStage referenceJob(@NotNull ReferenceJob referenceJob) { } /** - *

      Current monitor status or error message if monitor creation failed.

      *

      Current monitor status or error message if monitor creation failed.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/Record.java b/src/main/java/com/newscatcher/catchall/types/Record.java index d8aaef2..445e4f8 100644 --- a/src/main/java/com/newscatcher/catchall/types/Record.java +++ b/src/main/java/com/newscatcher/catchall/types/Record.java @@ -206,7 +206,6 @@ public Builder from(Record other) { } /** - *

      Unique identifier for the record.

      *

      Unique identifier for the record.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -218,7 +217,6 @@ public RecordTitleStage recordId(@NotNull String recordId) { } /** - *

      Short title summarizing the record.

      *

      Short title summarizing the record.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -230,9 +228,6 @@ public EnrichmentStage recordTitle(@NotNull String recordTitle) { } /** - *

      Structured data extracted from web pages. Schema is dynamically generated per job. Field names are chosen semantically to match the content.

      - *

      Note: The system always includes the enrichment_confidence field within the enrichment object, regardless of whether enrichments are generated or specified by you.

      - *

      For integration guidance, see Dynamic schemas

      *

      Structured data extracted from web pages. Schema is dynamically generated per job. Field names are chosen semantically to match the content.

      *

      Note: The system always includes the enrichment_confidence field within the enrichment object, regardless of whether enrichments are generated or specified by you.

      *

      For integration guidance, see Dynamic schemas

      diff --git a/src/main/java/com/newscatcher/catchall/types/RemoveResourceResponseDto.java b/src/main/java/com/newscatcher/catchall/types/RemoveResourceResponseDto.java index 9801ea1..5d0caae 100644 --- a/src/main/java/com/newscatcher/catchall/types/RemoveResourceResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/RemoveResourceResponseDto.java @@ -119,7 +119,6 @@ public Builder from(RemoveResourceResponseDto other) { } /** - *

      True if the operation succeeded; false otherwise.

      *

      True if the operation succeeded; false otherwise.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -131,7 +130,6 @@ public MessageStage success(boolean success) { } /** - *

      Human-readable result message.

      *

      Human-readable result message.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ResourceItemDto.java b/src/main/java/com/newscatcher/catchall/types/ResourceItemDto.java index d204af2..c3ab9e4 100644 --- a/src/main/java/com/newscatcher/catchall/types/ResourceItemDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ResourceItemDto.java @@ -121,7 +121,6 @@ public ResourceIdStage resourceType(@NotNull ProjectResourceType resourceType) { } /** - *

      ID of the resource to add.

      *

      ID of the resource to add.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ResourceResultDto.java b/src/main/java/com/newscatcher/catchall/types/ResourceResultDto.java index e902599..c235710 100644 --- a/src/main/java/com/newscatcher/catchall/types/ResourceResultDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ResourceResultDto.java @@ -195,7 +195,6 @@ public Builder from(ResourceResultDto other) { } /** - *

      Type of the resource.

      *

      Type of the resource.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -207,7 +206,6 @@ public ResourceIdStage resourceType(@NotNull String resourceType) { } /** - *

      Resource identifier.

      *

      Resource identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -219,7 +217,6 @@ public SuccessStage resourceId(@NotNull String resourceId) { } /** - *

      True if this resource was processed successfully.

      *

      True if this resource was processed successfully.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -231,7 +228,6 @@ public MessageStage success(boolean success) { } /** - *

      Per-resource result message.

      *

      Per-resource result message.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/SharingInfo.java b/src/main/java/com/newscatcher/catchall/types/SharingInfo.java index f92e80a..9547e80 100644 --- a/src/main/java/com/newscatcher/catchall/types/SharingInfo.java +++ b/src/main/java/com/newscatcher/catchall/types/SharingInfo.java @@ -149,7 +149,6 @@ public Builder from(SharingInfo other) { } /** - *

      When the resource was shared.

      *

      When the resource was shared.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -161,7 +160,6 @@ public PermissionStage sharedAt(@NotNull OffsetDateTime sharedAt) { } /** - *

      Permission level granted to the recipient.

      *

      Permission level granted to the recipient.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -173,8 +171,6 @@ public SharedByStage permission(@NotNull SharingInfoPermission permission) { } /** - *

      Display name of the user who shared the resource (first + last - * name). Falls back to email address, then user ID.

      *

      Display name of the user who shared the resource (first + last * name). Falls back to email address, then user ID.

      * @return Reference to {@code this} so that method calls can be chained together. diff --git a/src/main/java/com/newscatcher/catchall/types/SkippedRow.java b/src/main/java/com/newscatcher/catchall/types/SkippedRow.java index 0fef626..7b7413e 100644 --- a/src/main/java/com/newscatcher/catchall/types/SkippedRow.java +++ b/src/main/java/com/newscatcher/catchall/types/SkippedRow.java @@ -121,8 +121,6 @@ public Builder from(SkippedRow other) { } /** - *

      1-based row number in the CSV file (including the header row).

      - *

      A value of 3 means the third line of the file (second data row).

      *

      1-based row number in the CSV file (including the header row).

      *

      A value of 3 means the third line of the file (second data row).

      * @return Reference to {@code this} so that method calls can be chained together. @@ -135,7 +133,6 @@ public ReasonStage row(int row) { } /** - *

      Human-readable explanation of why the row was skipped.

      *

      Human-readable explanation of why the row was skipped.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/StatusResponseDto.java b/src/main/java/com/newscatcher/catchall/types/StatusResponseDto.java index 13526d5..e72c8a1 100644 --- a/src/main/java/com/newscatcher/catchall/types/StatusResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/StatusResponseDto.java @@ -147,7 +147,6 @@ public Builder from(StatusResponseDto other) { } /** - *

      Job identifier.

      *

      Job identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/SubmitResponseDto.java b/src/main/java/com/newscatcher/catchall/types/SubmitResponseDto.java index 6f2b9df..7fb3fc3 100644 --- a/src/main/java/com/newscatcher/catchall/types/SubmitResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/SubmitResponseDto.java @@ -98,7 +98,6 @@ public Builder from(SubmitResponseDto other) { } /** - *

      Unique identifier for the created job. Use this to check status and retrieve results.

      *

      Unique identifier for the created job. Use this to check status and retrieve results.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/Suggestion.java b/src/main/java/com/newscatcher/catchall/types/Suggestion.java index c2bd8d9..e41e7cb 100644 --- a/src/main/java/com/newscatcher/catchall/types/Suggestion.java +++ b/src/main/java/com/newscatcher/catchall/types/Suggestion.java @@ -143,7 +143,6 @@ public Builder from(Suggestion other) { } /** - *

      The issue this suggestion addresses.

      *

      The issue this suggestion addresses.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -155,7 +154,6 @@ public MessageStage issue(@NotNull IssueType issue) { } /** - *

      Specific guidance for improving the query.

      *

      Specific guidance for improving the query.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/TestWebhookResponseDto.java b/src/main/java/com/newscatcher/catchall/types/TestWebhookResponseDto.java index 3e4742e..8147b61 100644 --- a/src/main/java/com/newscatcher/catchall/types/TestWebhookResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/TestWebhookResponseDto.java @@ -171,7 +171,6 @@ public Builder from(TestWebhookResponseDto other) { } /** - *

      True if the test delivery received a 2xx response; false otherwise.

      *

      True if the test delivery received a 2xx response; false otherwise.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -183,7 +182,6 @@ public MessageStage success(boolean success) { } /** - *

      Human-readable result message.

      *

      Human-readable result message.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/UpdateMonitorResponseDto.java b/src/main/java/com/newscatcher/catchall/types/UpdateMonitorResponseDto.java index 834584f..4665597 100644 --- a/src/main/java/com/newscatcher/catchall/types/UpdateMonitorResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/UpdateMonitorResponseDto.java @@ -119,7 +119,6 @@ public Builder from(UpdateMonitorResponseDto other) { } /** - *

      Monitor identifier.

      *

      Monitor identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -131,7 +130,6 @@ public StatusStage monitorId(@NotNull String monitorId) { } /** - *

      Confirmation message.

      *

      Confirmation message.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/UpdateProjectResponseDto.java b/src/main/java/com/newscatcher/catchall/types/UpdateProjectResponseDto.java index 7f4c387..6bf0bc7 100644 --- a/src/main/java/com/newscatcher/catchall/types/UpdateProjectResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/UpdateProjectResponseDto.java @@ -141,7 +141,6 @@ public Builder from(UpdateProjectResponseDto other) { } /** - *

      True if the operation succeeded; false otherwise.

      *

      True if the operation succeeded; false otherwise.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -153,7 +152,6 @@ public MessageStage success(boolean success) { } /** - *

      Human-readable result message.

      *

      Human-readable result message.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -165,7 +163,6 @@ public ProjectIdStage message(@NotNull String message) { } /** - *

      Project identifier.

      *

      Project identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/UpdateWebhookResponseDto.java b/src/main/java/com/newscatcher/catchall/types/UpdateWebhookResponseDto.java index b1f780d..cd35cfa 100644 --- a/src/main/java/com/newscatcher/catchall/types/UpdateWebhookResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/UpdateWebhookResponseDto.java @@ -146,7 +146,6 @@ public Builder from(UpdateWebhookResponseDto other) { } /** - *

      True if the webhook was updated; false otherwise.

      *

      True if the webhook was updated; false otherwise.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -158,7 +157,6 @@ public MessageStage success(boolean success) { } /** - *

      Human-readable result message.

      *

      Human-readable result message.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/UploadCsvToDatasetResponse.java b/src/main/java/com/newscatcher/catchall/types/UploadCsvToDatasetResponse.java index 9af8af2..81e2d75 100644 --- a/src/main/java/com/newscatcher/catchall/types/UploadCsvToDatasetResponse.java +++ b/src/main/java/com/newscatcher/catchall/types/UploadCsvToDatasetResponse.java @@ -141,7 +141,6 @@ public Builder from(UploadCsvToDatasetResponse other) { } /** - *

      ID of the dataset that was updated.

      *

      ID of the dataset that was updated.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -153,7 +152,6 @@ public EntitiesCreatedStage datasetId(@NotNull String datasetId) { } /** - *

      Number of new entities created from the CSV.

      *

      Number of new entities created from the CSV.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/UserJob.java b/src/main/java/com/newscatcher/catchall/types/UserJob.java index 262e175..e8fd824 100644 --- a/src/main/java/com/newscatcher/catchall/types/UserJob.java +++ b/src/main/java/com/newscatcher/catchall/types/UserJob.java @@ -242,7 +242,6 @@ public Builder from(UserJob other) { } /** - *

      Job identifier.

      *

      Job identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -254,7 +253,6 @@ public QueryStage jobId(@NotNull String jobId) { } /** - *

      Plain text query for this job.

      *

      Plain text query for this job.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -266,7 +264,6 @@ public CreatedAtStage query(@NotNull String query) { } /** - *

      Job creation timestamp in ISO 8601 format.

      *

      Job creation timestamp in ISO 8601 format.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -278,7 +275,6 @@ public StatusStage createdAt(@NotNull OffsetDateTime createdAt) { } /** - *

      Current processing status of the job.

      *

      Current processing status of the job.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ValidateQueryResponseDto.java b/src/main/java/com/newscatcher/catchall/types/ValidateQueryResponseDto.java index 10cb785..82d6d42 100644 --- a/src/main/java/com/newscatcher/catchall/types/ValidateQueryResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/ValidateQueryResponseDto.java @@ -218,7 +218,6 @@ public Builder from(ValidateQueryResponseDto other) { } /** - *

      Overall quality level of the query.

      *

      Overall quality level of the query.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -230,7 +229,6 @@ public TitleStage status(@NotNull QueryStatus status) { } /** - *

      Short headline summarising the assessment.

      *

      Short headline summarising the assessment.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -242,7 +240,6 @@ public ConfidenceStage title(@NotNull String title) { } /** - *

      Confidence score for this assessment.

      *

      Confidence score for this assessment.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ValidationReport.java b/src/main/java/com/newscatcher/catchall/types/ValidationReport.java index 449d261..818dcf0 100644 --- a/src/main/java/com/newscatcher/catchall/types/ValidationReport.java +++ b/src/main/java/com/newscatcher/catchall/types/ValidationReport.java @@ -175,8 +175,6 @@ public Builder from(ValidationReport other) { } /** - *

      Total number of data rows in the uploaded CSV (excluding the - * header row).

      *

      Total number of data rows in the uploaded CSV (excluding the * header row).

      * @return Reference to {@code this} so that method calls can be chained together. @@ -189,7 +187,6 @@ public ValidRowsStage totalRows(int totalRows) { } /** - *

      Number of rows successfully processed into entities.

      *

      Number of rows successfully processed into entities.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -201,7 +198,6 @@ public SkippedCountStage validRows(int validRows) { } /** - *

      Number of rows skipped due to validation errors.

      *

      Number of rows skipped due to validation errors.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/ValidatorSchema.java b/src/main/java/com/newscatcher/catchall/types/ValidatorSchema.java index 229af55..24d51f9 100644 --- a/src/main/java/com/newscatcher/catchall/types/ValidatorSchema.java +++ b/src/main/java/com/newscatcher/catchall/types/ValidatorSchema.java @@ -143,7 +143,6 @@ public Builder from(ValidatorSchema other) { } /** - *

      Validator field name (snake_case recommended).

      *

      Validator field name (snake_case recommended).

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -155,7 +154,6 @@ public DescriptionStage name(@NotNull String name) { } /** - *

      What this validator checks for in the web page.

      *

      What this validator checks for in the web page.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/WebhookDto.java b/src/main/java/com/newscatcher/catchall/types/WebhookDto.java index c306577..37294d4 100644 --- a/src/main/java/com/newscatcher/catchall/types/WebhookDto.java +++ b/src/main/java/com/newscatcher/catchall/types/WebhookDto.java @@ -195,7 +195,6 @@ public Builder from(WebhookDto other) { } /** - *

      Webhook endpoint URL.

      *

      Webhook endpoint URL.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/WebhookResourceMappingResponseDto.java b/src/main/java/com/newscatcher/catchall/types/WebhookResourceMappingResponseDto.java index 3f0d325..11c11e9 100644 --- a/src/main/java/com/newscatcher/catchall/types/WebhookResourceMappingResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/WebhookResourceMappingResponseDto.java @@ -196,7 +196,6 @@ public Builder from(WebhookResourceMappingResponseDto other) { } /** - *

      Mapping identifier.

      *

      Mapping identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -208,7 +207,6 @@ public WebhookIdStage id(@NotNull String id) { } /** - *

      Webhook identifier.

      *

      Webhook identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -220,7 +218,6 @@ public ResourceTypeStage webhookId(@NotNull String webhookId) { } /** - *

      Type of the assigned resource.

      *

      Type of the assigned resource.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -232,7 +229,6 @@ public ResourceIdStage resourceType(@NotNull String resourceType) { } /** - *

      Identifier of the assigned resource.

      *

      Identifier of the assigned resource.

      * @return Reference to {@code this} so that method calls can be chained together. */ diff --git a/src/main/java/com/newscatcher/catchall/types/WebhookResponseDto.java b/src/main/java/com/newscatcher/catchall/types/WebhookResponseDto.java index 33ba350..693a21c 100644 --- a/src/main/java/com/newscatcher/catchall/types/WebhookResponseDto.java +++ b/src/main/java/com/newscatcher/catchall/types/WebhookResponseDto.java @@ -41,7 +41,7 @@ public final class WebhookResponseDto { private final Optional> params; - private final Optional> formatterConfig; + private final Optional formatterConfig; private final boolean isActive; @@ -64,7 +64,7 @@ private WebhookResponseDto( HttpMethod method, Optional> headers, Optional> params, - Optional> formatterConfig, + Optional formatterConfig, boolean isActive, Optional organizationId, Optional createdByUserId, @@ -144,10 +144,10 @@ public Optional> getParams() { } /** - * @return Custom payload transformation configuration. Used only when type is custom. + * @return Custom payload formatter. Set only when type is custom. */ @JsonIgnore - public Optional> getFormatterConfig() { + public Optional getFormatterConfig() { if (formatterConfig == null) { return Optional.empty(); } @@ -196,7 +196,7 @@ public Optional getUpdatedAt() { @JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = NullableNonemptyFilter.class) @JsonProperty("formatter_config") - private Optional> _getFormatterConfig() { + private Optional _getFormatterConfig() { return formatterConfig; } @@ -320,13 +320,13 @@ public interface _FinalStage { _FinalStage params(Map params); /** - *

      Custom payload transformation configuration. Used only when type is custom.

      + *

      Custom payload formatter. Set only when type is custom.

      */ - _FinalStage formatterConfig(Optional> formatterConfig); + _FinalStage formatterConfig(Optional formatterConfig); - _FinalStage formatterConfig(Map formatterConfig); + _FinalStage formatterConfig(FormatterConfigDto formatterConfig); - _FinalStage formatterConfig(Nullable> formatterConfig); + _FinalStage formatterConfig(Nullable formatterConfig); /** *

      Organization that owns this webhook.

      @@ -389,7 +389,7 @@ public static final class Builder private Optional organizationId = Optional.empty(); - private Optional> formatterConfig = Optional.empty(); + private Optional formatterConfig = Optional.empty(); private Optional> params = Optional.empty(); @@ -420,7 +420,6 @@ public Builder from(WebhookResponseDto other) { } /** - *

      Webhook identifier.

      *

      Webhook identifier.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -432,7 +431,6 @@ public NameStage id(@NotNull String id) { } /** - *

      Human-readable label for this webhook.

      *

      Human-readable label for this webhook.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -444,7 +442,6 @@ public UrlStage name(@NotNull String name) { } /** - *

      Destination URL that receives the payload.

      *

      Destination URL that receives the payload.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -477,7 +474,6 @@ public IsActiveStage method(@NotNull HttpMethod method) { } /** - *

      True if the webhook is active; false otherwise.

      *

      True if the webhook is active; false otherwise.

      * @return Reference to {@code this} so that method calls can be chained together. */ @@ -569,11 +565,11 @@ public _FinalStage organizationId(Optional organizationId) { } /** - *

      Custom payload transformation configuration. Used only when type is custom.

      + *

      Custom payload formatter. Set only when type is custom.

      * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage formatterConfig(Nullable> formatterConfig) { + public _FinalStage formatterConfig(Nullable formatterConfig) { if (formatterConfig.isNull()) { this.formatterConfig = null; } else if (formatterConfig.isEmpty()) { @@ -585,21 +581,21 @@ public _FinalStage formatterConfig(Nullable> formatterConfig } /** - *

      Custom payload transformation configuration. Used only when type is custom.

      + *

      Custom payload formatter. Set only when type is custom.

      * @return Reference to {@code this} so that method calls can be chained together. */ @java.lang.Override - public _FinalStage formatterConfig(Map formatterConfig) { + public _FinalStage formatterConfig(FormatterConfigDto formatterConfig) { this.formatterConfig = Optional.ofNullable(formatterConfig); return this; } /** - *

      Custom payload transformation configuration. Used only when type is custom.

      + *

      Custom payload formatter. Set only when type is custom.

      */ @java.lang.Override @JsonSetter(value = "formatter_config", nulls = Nulls.SKIP) - public _FinalStage formatterConfig(Optional> formatterConfig) { + public _FinalStage formatterConfig(Optional formatterConfig) { this.formatterConfig = formatterConfig; return this; } From 01c1cfe9996bffe7acd2581cb3ea2927e844bd7f Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 09:49:50 +0000 Subject: [PATCH 2/2] [fern-autoversion] SDK regeneration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🌿 Generated with Fern --- .fern/metadata.json | 2 +- README.md | 4 ++-- build.gradle | 4 ++-- .../java/com/newscatcher/catchall/core/ClientOptions.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.fern/metadata.json b/.fern/metadata.json index 71d9bf1..1a0dcac 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -12,5 +12,5 @@ "invokedBy": "ci", "requestedVersion": "AUTO", "ciProvider": "unknown", - "sdkVersion": "0.0.0-fern-placeholder" + "sdkVersion": "3.0.3" } \ No newline at end of file diff --git a/README.md b/README.md index 677483a..9ceed59 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Add the dependency in your `build.gradle` file: ```groovy dependencies { - implementation 'com.newscatcherapi:newscatcher-catchall-sdk:0.0.0-fern-placeholder' + implementation 'com.newscatcherapi:newscatcher-catchall-sdk:3.0.3' } ``` @@ -47,7 +47,7 @@ Add the dependency in your `pom.xml` file: com.newscatcherapi newscatcher-catchall-sdk - 0.0.0-fern-placeholder + 3.0.3 ``` diff --git a/build.gradle b/build.gradle index 50f8a68..97e66a0 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,7 @@ java { group = 'com.newscatcherapi' -version = '0.0.0-fern-placeholder' +version = '3.0.3' jar { dependsOn(":generatePomFileForMavenPublication") @@ -88,7 +88,7 @@ publishing { maven(MavenPublication) { groupId = 'com.newscatcherapi' artifactId = 'newscatcher-catchall-sdk' - version = '0.0.0-fern-placeholder' + version = '3.0.3' from components.java pom { name = 'newscatcher' diff --git a/src/main/java/com/newscatcher/catchall/core/ClientOptions.java b/src/main/java/com/newscatcher/catchall/core/ClientOptions.java index 897675d..6e02a36 100644 --- a/src/main/java/com/newscatcher/catchall/core/ClientOptions.java +++ b/src/main/java/com/newscatcher/catchall/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.newscatcherapi:newscatcher-catchall-sdk/0.0.0-fern-placeholder"); + put("User-Agent", "com.newscatcherapi:newscatcher-catchall-sdk/3.0.3"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.newscatcher.fern:api-sdk"); - put("X-Fern-SDK-Version", "0.0.0-fern-placeholder"); + put("X-Fern-SDK-Version", "3.0.3"); } }); this.headerSuppliers = headerSuppliers;