> 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