diff --git a/.fern/metadata.json b/.fern/metadata.json index 1463dfc..bc20bf3 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,16 +1,16 @@ { - "cliVersion": "4.90.0", + "cliVersion": "5.28.2", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.4.1", + "generatorVersion": "4.8.10", "generatorConfig": { "publish-to": "central", "client-class-name": "CatchAllApi", "package-prefix": "com.newscatcher.catchall" }, - "originGitCommit": "3707beee5d0e236f2469e89f7b19c3a08efb6f95", + "originGitCommit": "22c183ea79ae5db44081d7400064d8907991d81b", "originGitCommitIsDirty": true, "invokedBy": "ci", "requestedVersion": "AUTO", "ciProvider": "unknown", - "sdkVersion": "1.5.0" + "sdkVersion": "2.0.0" } \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..24cf9fa --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,114 @@ +# Contributing + +Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project. + +## Getting Started + +### Prerequisites + +- Java 11+ +- Gradle + +### Installation + +Install the project dependencies: + +```bash +./gradlew build +``` + +### Building + +Build the project: + +```bash +./gradlew build +``` + +### Testing + +Run the test suite: + +```bash +./gradlew test +``` + +### Formatting + +Check and fix code style: + +```bash +./gradlew spotlessApply +``` + +## About Generated Code + +**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated. + +### Generated Files + +The following directories contain generated code: +- `src/` - API client classes and types +- Most Java files in the project + +### How to Customize + +If you need to customize the SDK, you have two options: + +#### Option 1: Use `.fernignore` + +For custom code that should persist across SDK regenerations: + +1. Create a `.fernignore` file in the project root +2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax) +3. Add your custom code to those files + +Files listed in `.fernignore` will not be overwritten when the SDK is regenerated. + +For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code). + +#### Option 2: Contribute to the Generator + +If you want to change how code is generated for all users of this SDK: + +1. The Java SDK generator lives in the [Fern repository](https://github.com/fern-api/fern) +2. Generator code is located at `generators/java-v2/` +3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md) +4. Submit a pull request with your changes to the generator + +This approach is best for: +- Bug fixes in generated code +- New features that would benefit all users +- Improvements to code generation patterns + +## Making Changes + +### Workflow + +1. Create a new branch for your changes +2. Make your modifications +3. Run tests to ensure nothing breaks: `./gradlew test` +4. Run formatting: `./gradlew spotlessApply` +5. Build the project: `./gradlew build` +6. Commit your changes with a clear commit message +7. Push your branch and create a pull request + +### Commit Messages + +Write clear, descriptive commit messages that explain what changed and why. + +### Code Style + +This project uses automated code formatting. Run `./gradlew spotlessApply` before committing to ensure your code meets the project's style guidelines. + +## Questions or Issues? + +If you have questions or run into issues: + +1. Check the [Fern documentation](https://buildwithfern.com) +2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues) +3. Open a new issue if your question hasn't been addressed + +## License + +By contributing to this project, you agree that your contributions will be licensed under the same license as the project. diff --git a/README.md b/README.md index 3f9db05..35e89ab 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Add the dependency in your `build.gradle` file: ```groovy dependencies { - implementation 'com.newscatcherapi:newscatcher-catchall-sdk:1.5.0' + implementation 'com.newscatcherapi:newscatcher-catchall-sdk:2.0.0' } ``` @@ -47,7 +47,7 @@ Add the dependency in your `pom.xml` file: com.newscatcherapi newscatcher-catchall-sdk - 1.5.0 + 2.0.0 ``` @@ -157,11 +157,19 @@ retry limit (default: 2). Before defaulting to exponential backoff, the SDK will the `Retry-After` header (as either in seconds or as an HTTP date), and then the `X-RateLimit-Reset` header (as a Unix timestamp in epoch seconds); failing both of those, it will fall back to exponential backoff. -A request is deemed retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retry-status-codes` generator configuration: +**`legacy`** (current default): retries on - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500) + +**`recommended`**: retries on +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) Use the `maxRetries` client option to configure this behavior. @@ -253,3 +261,4 @@ On the other hand, contributions to the README are always very welcome! + diff --git a/build.gradle b/build.gradle index ddafdb8..be9efdc 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ java { group = 'com.newscatcherapi' -version = '1.5.0' +version = '2.0.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -78,7 +78,7 @@ publishing { maven(MavenPublication) { groupId = 'com.newscatcherapi' artifactId = 'newscatcher-catchall-sdk' - version = '1.5.0' + version = '2.0.0' from components.java pom { name = 'newscatcher' diff --git a/changelog.md b/changelog.md index 69681fe..26d0bf2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,19 @@ +## 2.0.0 - 2026-05-19 +### Breaking Changes +* **`ListEntitiesInDatasetRequest`** — renamed to **`ListDatasetEntitiesRequest`**; update all imports and usages to the new class name. +* **`listEntitiesInDataset()`** — now sends `POST /catchAll/datasets/{id}/entities/list` instead of `GET /catchAll/datasets/{id}/entities`; recompile against the new SDK and update any HTTP-level integrations. +* **`ConnectedEntity.Builder`** — a new mandatory `.type(entityType)` step is now required between `.relation()` and `.build()`; update all existing builder chains accordingly. +### Added +* **`ConnectedEntity.getType()`** — returns the entity type string for a connected entity. +* **`ConnectedEntity.getCompany()`** — returns an `Optional` with stored company attributes when present. +* **`SubmitRequestDto.getEdScoreMin()`** — new optional `ed_score_min` field to set a minimum relevance score threshold for Company Watchlist mode results. +* **`CreateMonitorRequestDto.getTimezone()`** — new optional `timezone` field accepting an IANA timezone identifier used as a fallback when the schedule string lacks an explicit timezone. +### Changed +* **`addEntitiesToDataset()`** — now throws `UnprocessableEntityError` on HTTP 422 responses in addition to the existing `NotFoundError` on 404. +* **`createDataset()` / `uploadCsvToDataset()` documentation** — clarifies that both `name` and `domain` columns are required in the uploaded CSV (previously only `name` was documented as required). +### Fixed +* **`ListDatasetsRequest` and `ListDatasetEntitiesRequest`** — getter methods were incorrectly annotated with `@JsonIgnore` instead of `@JsonProperty`, causing query parameters (`page`, `page_size`, `search`, etc.) to be silently dropped during serialization; now correctly annotated. + ## 1.5.0 - 2026-04-23 * ## [1.5.0] - 2025 ### Added diff --git a/reference.md b/reference.md index c3d7eb9..79f86eb 100644 --- a/reference.md +++ b/reference.md @@ -70,7 +70,7 @@ client.jobs().getUserJobs(
-**ownership:** `Optional` — Filter results by ownership. Defaults to `all`. +**ownership:** `Optional`
@@ -281,10 +281,22 @@ Job processing mode. **connectedDatasetIds:** `Optional>` -Dataset IDs to connect to this job. When provided, activates Company Watchlist mode — the job returns only events relevant to companies in the connected datasets with each record including a `connected_entities` array scored per company. +Dataset IDs to connect to the job. When provided, this enables Company Watchlist mode — the job returns only events relevant to companies in the connected datasets. To set the minimum relevance threshold, use `ed_score_min`. The dataset must have `latest_status: ready` before the job is submitted. Submitting with a non-existent or inaccessible dataset ID returns `400`. + + + +
+
+ +**edScoreMin:** `Optional` + +The minimum relevance score a connected entity must reach for its record to be included in results. + +Only valid when `connected_dataset_ids` is set; otherwise ignored. Records where no connected entity meets the threshold are excluded entirely. +
@@ -509,11 +521,9 @@ client.jobs().continueJob(
-Soft-deletes a job. The job is flagged as deleted and no longer -appears in list results. The underlying data is retained. +Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. -Only the job owner can delete a job. Returns `404` if the job is not -found or does not belong to the authenticated user. +Only the job owner can delete a job. Returns `404` if the job is not found or does not belong to the authenticated user. Deleting an already-deleted job returns `200`.
@@ -633,7 +643,7 @@ client.monitors().listMonitors(
-**ownership:** `Optional` — Filter results by ownership. Defaults to `all`. +**ownership:** `Optional`
@@ -676,7 +686,8 @@ client.monitors().createMonitor( CreateMonitorRequestDto .builder() .referenceJobId("5f0c9087-85cb-4917-b3c7-e5a5eff73a0c") - .schedule("every day at 12 PM UTC") + .schedule("every day at 12 PM") + .timezone("UTC") .webhook( WebhookDto .builder() @@ -719,11 +730,19 @@ If [`backfill`](https://www.newscatcherapi.com/docs/web-search-api/api-reference
-**schedule:** `String` +**schedule:** `String` — Monitor schedule in plain text format. Minimum frequency depends on your plan. + +
+
+ +
+
-Monitor schedule in plain text format (e.g. 'every day at 12 PM UTC', 'every 48 hours'). +**timezone:** `Optional` -Minimum frequency depends on your plan. +The IANA timezone identifier used as the fallback when the `schedule` string does not include an explicit timezone. + +If the schedule includes a timezone abbreviation (for example, `"every day at 9am EST"`), the parsed timezone takes priority and this value is ignored.
@@ -1245,9 +1264,7 @@ client.monitors().updateMonitor(
-Returns a paginated list of entities belonging to the authenticated -organization. Supports filtering by status and entity type, and -sorting by name, status, or creation date. +Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date.
@@ -1441,11 +1458,9 @@ client.entities().createEntity(
-Creates multiple entities in a single request. Each entity is -processed independently — a failure in one does not affect others. +Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. -Returns an array of `{id, status}` objects in the same order as -the input array. +Returns an array of `{id, status}` objects in the same order as the input array.
@@ -1778,9 +1793,7 @@ client.entities().updateEntity(
-Returns a paginated list of datasets belonging to the authenticated -organization. Supports filtering by status and sorting by name, -status, or creation date. +Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date.
@@ -1863,7 +1876,7 @@ client.datasets().listDatasets(
-**ownership:** `Optional` — Filter results by ownership. Defaults to `all`. +**ownership:** `Optional`
@@ -1975,9 +1988,7 @@ client.datasets().createDataset(
-Creates a new dataset by uploading a CSV file. Each row in the CSV -becomes an entity. The `name` column is required; all other columns -are optional. +Creates a new dataset by uploading a CSV file. Each row in the CSV becomes an entity. The `name` and `domain`columns are required; all other columns are optional. **CSV format:** ```csv @@ -2004,6 +2015,7 @@ Use semicolons (`;`) to separate multiple values in `alternative_names` and `key ```java client.datasets().createDatasetFromCsv( + null, CreateDatasetFromCsvRequest .builder() .name("name") @@ -2217,7 +2229,7 @@ client.datasets().updateDataset(
-
client.datasets.listEntitiesInDataset(datasetId) -> DatasetEntityListResponse +
client.datasets.addEntitiesToDataset(datasetId, request) -> ManageEntitiesResponse
@@ -2229,7 +2241,7 @@ client.datasets().updateDataset(
-Returns a paginated list of entities in a dataset. Supports filtering by status and entity type. +Adds one or more existing entities to a dataset. Returns the number of entities added.
@@ -2244,10 +2256,18 @@ Returns a paginated list of entities in a dataset. Supports filtering by status
```java -client.datasets().listEntitiesInDataset( +client.datasets().addEntitiesToDataset( "ccabb755-afc2-4047-b84c-78d1f23d49b2", - ListEntitiesInDatasetRequest + AddEntitiesToDatasetRequest .builder() + .body( + DatasetEntityIdsRequest + .builder() + .entityIds( + Arrays.asList("854198fa-f702-49db-a381-0427fa87f173") + ) + .build() + ) .build() ); ``` @@ -2272,55 +2292,7 @@ client.datasets().listEntitiesInDataset(
-**page:** `Optional` — Page number to retrieve. - -
-
- -
-
- -**pageSize:** `Optional` — Number of entities per page. - -
-
- -
-
- -**search:** `Optional` — Filter entities by name. - -
-
- -
-
- -**status:** `Optional` - -
-
- -
-
- -**entityType:** `Optional` - -
-
- -
-
- -**sortBy:** `Optional` - -
-
- -
-
- -**sortOrder:** `Optional` +**request:** `DatasetEntityIdsRequest`
@@ -2332,7 +2304,7 @@ client.datasets().listEntitiesInDataset(
-
client.datasets.addEntitiesToDataset(datasetId, request) -> ManageEntitiesResponse +
client.datasets.removeEntitiesFromDataset(datasetId, request) -> ManageEntitiesResponse
@@ -2344,7 +2316,7 @@ client.datasets().listEntitiesInDataset(
-Adds one or more existing entities to a dataset. Returns the number of entities added. +Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
@@ -2359,9 +2331,9 @@ Adds one or more existing entities to a dataset. Returns the number of entities
```java -client.datasets().addEntitiesToDataset( +client.datasets().removeEntitiesFromDataset( "ccabb755-afc2-4047-b84c-78d1f23d49b2", - AddEntitiesToDatasetRequest + RemoveEntitiesFromDatasetRequest .builder() .body( DatasetEntityIdsRequest @@ -2407,7 +2379,7 @@ client.datasets().addEntitiesToDataset(
-
client.datasets.removeEntitiesFromDataset(datasetId, request) -> ManageEntitiesResponse +
client.datasets.listEntitiesInDataset(datasetId, request) -> DatasetEntityListResponse
@@ -2419,9 +2391,7 @@ client.datasets().addEntitiesToDataset(
-Removes one or more entities from a dataset. The entities themselves -are not deleted — they are only removed from this dataset. Returns -the number of entities removed. +Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
@@ -2436,18 +2406,17 @@ the number of entities removed.
```java -client.datasets().removeEntitiesFromDataset( +client.datasets().listEntitiesInDataset( "ccabb755-afc2-4047-b84c-78d1f23d49b2", - RemoveEntitiesFromDatasetRequest + ListDatasetEntitiesRequest .builder() - .body( - DatasetEntityIdsRequest - .builder() - .entityIds( - Arrays.asList("854198fa-f702-49db-a381-0427fa87f173") - ) - .build() - ) + .page(1) + .pageSize(100) + .search("OpenAI") + .status(EntityStatus.READY) + .entityType(EntityType.COMPANY) + .sortBy(EntitySortBy.CREATED_AT) + .sortOrder(SortOrder.DESC) .build() ); ``` @@ -2472,7 +2441,55 @@ client.datasets().removeEntitiesFromDataset(
-**request:** `DatasetEntityIdsRequest` +**page:** `Optional` — The page number to retrieve. + +
+
+ +
+
+ +**pageSize:** `Optional` — The number of entities per page. + +
+
+ +
+
+ +**search:** `Optional` — Filters entities by name using a case-insensitive substring match. + +
+
+ +
+
+ +**status:** `Optional` + +
+
+ +
+
+ +**entityType:** `Optional` + +
+
+ +
+
+ +**sortBy:** `Optional` + +
+
+ +
+
+ +**sortOrder:** `Optional`
@@ -2496,8 +2513,7 @@ client.datasets().removeEntitiesFromDataset(
-Returns the full status change history for a dataset, ordered -chronologically from oldest to newest. +Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
@@ -2556,11 +2572,9 @@ client.datasets().getDatasetStatusHistory(
-Appends new companies to an existing dataset by uploading a CSV file. -Uses the same CSV format as the dataset creation endpoint. +Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. -The response omits `dataset_name` compared to the create-from-CSV -endpoint since the dataset already exists. +The response omits `dataset_name` compared to the create-from-CSV endpoint since the dataset already exists.
@@ -2577,6 +2591,7 @@ endpoint since the dataset already exists. ```java client.datasets().uploadCsvToDataset( "ccabb755-afc2-4047-b84c-78d1f23d49b2", + null, UploadCsvToDatasetRequest .builder() .build() diff --git a/src/main/java/com/newscatcher/catchall/core/ClientOptions.java b/src/main/java/com/newscatcher/catchall/core/ClientOptions.java index 032e1db..ea3bc42 100644 --- a/src/main/java/com/newscatcher/catchall/core/ClientOptions.java +++ b/src/main/java/com/newscatcher/catchall/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.newscatcherapi:newscatcher-catchall-sdk/1.5.0"); + put("User-Agent", "com.newscatcherapi:newscatcher-catchall-sdk/2.0.0"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.newscatcher.fern:api-sdk"); - put("X-Fern-SDK-Version", "1.5.0"); + put("X-Fern-SDK-Version", "2.0.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncDatasetsClient.java b/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncDatasetsClient.java index ede9470..f4686d3 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncDatasetsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncDatasetsClient.java @@ -11,8 +11,8 @@ import com.newscatcher.catchall.resources.datasets.requests.DeleteDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.GetDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.GetDatasetStatusHistoryRequest; +import com.newscatcher.catchall.resources.datasets.requests.ListDatasetEntitiesRequest; import com.newscatcher.catchall.resources.datasets.requests.ListDatasetsRequest; -import com.newscatcher.catchall.resources.datasets.requests.ListEntitiesInDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.RemoveEntitiesFromDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.UpdateDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.UploadCsvToDatasetRequest; @@ -46,36 +46,28 @@ public AsyncRawDatasetsClient withRawResponse() { } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CompletableFuture listDatasets() { return this.rawClient.listDatasets().thenApply(response -> response.body()); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CompletableFuture listDatasets(RequestOptions requestOptions) { return this.rawClient.listDatasets(requestOptions).thenApply(response -> response.body()); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CompletableFuture listDatasets(ListDatasetsRequest request) { return this.rawClient.listDatasets(request).thenApply(response -> response.body()); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CompletableFuture listDatasets( ListDatasetsRequest request, RequestOptions requestOptions) { @@ -108,9 +100,7 @@ public CompletableFuture createDataset( } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV - * becomes an entity. The name column is required; all other columns - * are optional. + * 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. *

CSV format:

*
name,description,domain,alternative_names,key_persons
      * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
@@ -125,9 +115,7 @@ public CompletableFuture createDatasetFromCsv(
     }
 
     /**
-     * Creates a new dataset by uploading a CSV file. Each row in the CSV
-     * becomes an entity. The name column is required; all other columns
-     * are optional.
+     * 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.
      * 

CSV format:

*
name,description,domain,alternative_names,key_persons
      * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
@@ -262,89 +250,83 @@ public CompletableFuture updateDataset(
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Adds one or more existing entities to a dataset. Returns the number of entities added.
      */
-    public CompletableFuture listEntitiesInDataset(String datasetId) {
-        return this.rawClient.listEntitiesInDataset(datasetId).thenApply(response -> response.body());
+    public CompletableFuture addEntitiesToDataset(
+            String datasetId, AddEntitiesToDatasetRequest request) {
+        return this.rawClient.addEntitiesToDataset(datasetId, request).thenApply(response -> response.body());
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Adds one or more existing entities to a dataset. Returns the number of entities added.
      */
-    public CompletableFuture listEntitiesInDataset(
-            String datasetId, RequestOptions requestOptions) {
-        return this.rawClient.listEntitiesInDataset(datasetId, requestOptions).thenApply(response -> response.body());
+    public CompletableFuture addEntitiesToDataset(
+            String datasetId, AddEntitiesToDatasetRequest request, RequestOptions requestOptions) {
+        return this.rawClient
+                .addEntitiesToDataset(datasetId, request, requestOptions)
+                .thenApply(response -> response.body());
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
      */
-    public CompletableFuture listEntitiesInDataset(
-            String datasetId, ListEntitiesInDatasetRequest request) {
-        return this.rawClient.listEntitiesInDataset(datasetId, request).thenApply(response -> response.body());
+    public CompletableFuture removeEntitiesFromDataset(
+            String datasetId, RemoveEntitiesFromDatasetRequest request) {
+        return this.rawClient.removeEntitiesFromDataset(datasetId, request).thenApply(response -> response.body());
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
      */
-    public CompletableFuture listEntitiesInDataset(
-            String datasetId, ListEntitiesInDatasetRequest request, RequestOptions requestOptions) {
+    public CompletableFuture removeEntitiesFromDataset(
+            String datasetId, RemoveEntitiesFromDatasetRequest request, RequestOptions requestOptions) {
         return this.rawClient
-                .listEntitiesInDataset(datasetId, request, requestOptions)
+                .removeEntitiesFromDataset(datasetId, request, requestOptions)
                 .thenApply(response -> response.body());
     }
 
     /**
-     * Adds one or more existing entities to a dataset. Returns the number of entities added.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public CompletableFuture addEntitiesToDataset(
-            String datasetId, AddEntitiesToDatasetRequest request) {
-        return this.rawClient.addEntitiesToDataset(datasetId, request).thenApply(response -> response.body());
+    public CompletableFuture listEntitiesInDataset(String datasetId) {
+        return this.rawClient.listEntitiesInDataset(datasetId).thenApply(response -> response.body());
     }
 
     /**
-     * Adds one or more existing entities to a dataset. Returns the number of entities added.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public CompletableFuture addEntitiesToDataset(
-            String datasetId, AddEntitiesToDatasetRequest request, RequestOptions requestOptions) {
-        return this.rawClient
-                .addEntitiesToDataset(datasetId, request, requestOptions)
-                .thenApply(response -> response.body());
+    public CompletableFuture listEntitiesInDataset(
+            String datasetId, RequestOptions requestOptions) {
+        return this.rawClient.listEntitiesInDataset(datasetId, requestOptions).thenApply(response -> response.body());
     }
 
     /**
-     * Removes one or more entities from a dataset. The entities themselves
-     * are not deleted — they are only removed from this dataset. Returns
-     * the number of entities removed.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public CompletableFuture removeEntitiesFromDataset(
-            String datasetId, RemoveEntitiesFromDatasetRequest request) {
-        return this.rawClient.removeEntitiesFromDataset(datasetId, request).thenApply(response -> response.body());
+    public CompletableFuture listEntitiesInDataset(
+            String datasetId, ListDatasetEntitiesRequest request) {
+        return this.rawClient.listEntitiesInDataset(datasetId, request).thenApply(response -> response.body());
     }
 
     /**
-     * Removes one or more entities from a dataset. The entities themselves
-     * are not deleted — they are only removed from this dataset. Returns
-     * the number of entities removed.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public CompletableFuture removeEntitiesFromDataset(
-            String datasetId, RemoveEntitiesFromDatasetRequest request, RequestOptions requestOptions) {
+    public CompletableFuture listEntitiesInDataset(
+            String datasetId, ListDatasetEntitiesRequest request, RequestOptions requestOptions) {
         return this.rawClient
-                .removeEntitiesFromDataset(datasetId, request, requestOptions)
+                .listEntitiesInDataset(datasetId, request, requestOptions)
                 .thenApply(response -> response.body());
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CompletableFuture getDatasetStatusHistory(String datasetId) {
         return this.rawClient.getDatasetStatusHistory(datasetId).thenApply(response -> response.body());
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CompletableFuture getDatasetStatusHistory(
             String datasetId, RequestOptions requestOptions) {
@@ -352,8 +334,7 @@ public CompletableFuture getDatasetStatusHistory(
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CompletableFuture getDatasetStatusHistory(
             String datasetId, GetDatasetStatusHistoryRequest request) {
@@ -361,8 +342,7 @@ public CompletableFuture getDatasetStatusHistory(
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CompletableFuture getDatasetStatusHistory(
             String datasetId, GetDatasetStatusHistoryRequest request, RequestOptions requestOptions) {
@@ -372,10 +352,8 @@ public CompletableFuture getDatasetStatusHistory(
     }
 
     /**
-     * Appends new companies to an existing dataset by uploading a CSV file.
-     * Uses the same CSV format as the dataset creation endpoint.
-     * 

The response omits dataset_name compared to the create-from-CSV - * endpoint since the dataset already exists.

+ * Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. + *

The response omits dataset_name compared to the create-from-CSV endpoint since the dataset already exists.

*/ public CompletableFuture uploadCsvToDataset( String datasetId, File file, UploadCsvToDatasetRequest request) { @@ -383,10 +361,8 @@ public CompletableFuture uploadCsvToDataset( } /** - * Appends new companies to an existing dataset by uploading a CSV file. - * Uses the same CSV format as the dataset creation endpoint. - *

The response omits dataset_name compared to the create-from-CSV - * endpoint since the dataset already exists.

+ * Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. + *

The response omits dataset_name compared to the create-from-CSV endpoint since the dataset already exists.

*/ public CompletableFuture uploadCsvToDataset( String datasetId, File file, UploadCsvToDatasetRequest request, RequestOptions requestOptions) { diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncRawDatasetsClient.java b/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncRawDatasetsClient.java index ccd5bb1..556327a 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncRawDatasetsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/AsyncRawDatasetsClient.java @@ -23,8 +23,8 @@ import com.newscatcher.catchall.resources.datasets.requests.DeleteDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.GetDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.GetDatasetStatusHistoryRequest; +import com.newscatcher.catchall.resources.datasets.requests.ListDatasetEntitiesRequest; import com.newscatcher.catchall.resources.datasets.requests.ListDatasetsRequest; -import com.newscatcher.catchall.resources.datasets.requests.ListEntitiesInDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.RemoveEntitiesFromDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.UpdateDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.UploadCsvToDatasetRequest; @@ -63,36 +63,28 @@ public AsyncRawDatasetsClient(ClientOptions clientOptions) { } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CompletableFuture> listDatasets() { return listDatasets(ListDatasetsRequest.builder().build()); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CompletableFuture> listDatasets(RequestOptions requestOptions) { return listDatasets(ListDatasetsRequest.builder().build(), requestOptions); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CompletableFuture> listDatasets(ListDatasetsRequest request) { return listDatasets(request, null); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CompletableFuture> listDatasets( ListDatasetsRequest request, RequestOptions requestOptions) { @@ -280,9 +272,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV - * becomes an entity. The name column is required; all other columns - * are optional. + * 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. *

CSV format:

*
name,description,domain,alternative_names,key_persons
      * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
@@ -297,9 +287,7 @@ public CompletableFuture> crea
     }
 
     /**
-     * Creates a new dataset by uploading a CSV file. Each row in the CSV
-     * becomes an entity. The name column is required; all other columns
-     * are optional.
+     * 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.
      * 

CSV format:

*
name,description,domain,alternative_names,key_persons
      * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
@@ -945,85 +933,47 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
-     */
-    public CompletableFuture> listEntitiesInDataset(
-            String datasetId) {
-        return listEntitiesInDataset(
-                datasetId, ListEntitiesInDatasetRequest.builder().build());
-    }
-
-    /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
-     */
-    public CompletableFuture> listEntitiesInDataset(
-            String datasetId, RequestOptions requestOptions) {
-        return listEntitiesInDataset(
-                datasetId, ListEntitiesInDatasetRequest.builder().build(), requestOptions);
-    }
-
-    /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Adds one or more existing entities to a dataset. Returns the number of entities added.
      */
-    public CompletableFuture> listEntitiesInDataset(
-            String datasetId, ListEntitiesInDatasetRequest request) {
-        return listEntitiesInDataset(datasetId, request, null);
+    public CompletableFuture> addEntitiesToDataset(
+            String datasetId, AddEntitiesToDatasetRequest request) {
+        return addEntitiesToDataset(datasetId, request, null);
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Adds one or more existing entities to a dataset. Returns the number of entities added.
      */
-    public CompletableFuture> listEntitiesInDataset(
-            String datasetId, ListEntitiesInDatasetRequest request, RequestOptions requestOptions) {
+    public CompletableFuture> addEntitiesToDataset(
+            String datasetId, AddEntitiesToDatasetRequest request, RequestOptions requestOptions) {
         HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
                 .newBuilder()
                 .addPathSegments("catchAll/datasets")
                 .addPathSegment(datasetId)
                 .addPathSegments("entities");
-        if (request.getPage().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "page", request.getPage().get(), false);
-        }
-        if (request.getPageSize().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "page_size", request.getPageSize().get(), false);
-        }
-        if (request.getSearch().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "search", request.getSearch().get(), false);
-        }
-        if (request.getStatus().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "status", request.getStatus().get(), false);
-        }
-        if (request.getEntityType().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "entity_type", request.getEntityType().get(), false);
-        }
-        if (request.getSortBy().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "sort_by", request.getSortBy().get(), false);
-        }
-        if (request.getSortOrder().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "sort_order", request.getSortOrder().get(), false);
-        }
         if (requestOptions != null) {
             requestOptions.getQueryParameters().forEach((_key, _value) -> {
                 httpUrl.addQueryParameter(_key, _value);
             });
         }
-        Request.Builder _requestBuilder = new Request.Builder()
+        RequestBody body;
+        try {
+            body = RequestBody.create(
+                    ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON);
+        } catch (JsonProcessingException e) {
+            throw new CatchAllApiException("Failed to serialize request", e);
+        }
+        Request okhttpRequest = new Request.Builder()
                 .url(httpUrl.build())
-                .method("GET", null)
+                .method("POST", body)
                 .headers(Headers.of(clientOptions.headers(requestOptions)))
-                .addHeader("Accept", "application/json");
-        Request okhttpRequest = _requestBuilder.build();
+                .addHeader("Content-Type", "application/json")
+                .addHeader("Accept", "application/json")
+                .build();
         OkHttpClient client = clientOptions.httpClient();
         if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
             client = clientOptions.httpClientWithTimeout(requestOptions);
         }
-        CompletableFuture> future = new CompletableFuture<>();
+        CompletableFuture> future = new CompletableFuture<>();
         client.newCall(okhttpRequest).enqueue(new Callback() {
             @Override
             public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
@@ -1031,8 +981,7 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
                     String responseBodyString = responseBody != null ? responseBody.string() : "{}";
                     if (response.isSuccessful()) {
                         future.complete(new CatchAllApiHttpResponse<>(
-                                ObjectMappers.JSON_MAPPER.readValue(
-                                        responseBodyString, DatasetEntityListResponse.class),
+                                ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ManageEntitiesResponse.class),
                                 response));
                         return;
                     }
@@ -1048,6 +997,12 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
                                         ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class),
                                         response));
                                 return;
+                            case 422:
+                                future.completeExceptionally(new UnprocessableEntityError(
+                                        ObjectMappers.JSON_MAPPER.readValue(
+                                                responseBodyString, ValidationErrorResponse.class),
+                                        response));
+                                return;
                         }
                     } catch (JsonProcessingException ignored) {
                         // unable to map error response, throwing generic error
@@ -1070,18 +1025,18 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
     }
 
     /**
-     * Adds one or more existing entities to a dataset. Returns the number of entities added.
+     * Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
      */
-    public CompletableFuture> addEntitiesToDataset(
-            String datasetId, AddEntitiesToDatasetRequest request) {
-        return addEntitiesToDataset(datasetId, request, null);
+    public CompletableFuture> removeEntitiesFromDataset(
+            String datasetId, RemoveEntitiesFromDatasetRequest request) {
+        return removeEntitiesFromDataset(datasetId, request, null);
     }
 
     /**
-     * Adds one or more existing entities to a dataset. Returns the number of entities added.
+     * Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
      */
-    public CompletableFuture> addEntitiesToDataset(
-            String datasetId, AddEntitiesToDatasetRequest request, RequestOptions requestOptions) {
+    public CompletableFuture> removeEntitiesFromDataset(
+            String datasetId, RemoveEntitiesFromDatasetRequest request, RequestOptions requestOptions) {
         HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
                 .newBuilder()
                 .addPathSegments("catchAll/datasets")
@@ -1101,7 +1056,7 @@ public CompletableFuture> addEnt
         }
         Request okhttpRequest = new Request.Builder()
                 .url(httpUrl.build())
-                .method("POST", body)
+                .method("DELETE", body)
                 .headers(Headers.of(clientOptions.headers(requestOptions)))
                 .addHeader("Content-Type", "application/json")
                 .addHeader("Accept", "application/json")
@@ -1162,27 +1117,42 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
     }
 
     /**
-     * Removes one or more entities from a dataset. The entities themselves
-     * are not deleted — they are only removed from this dataset. Returns
-     * the number of entities removed.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public CompletableFuture> removeEntitiesFromDataset(
-            String datasetId, RemoveEntitiesFromDatasetRequest request) {
-        return removeEntitiesFromDataset(datasetId, request, null);
+    public CompletableFuture> listEntitiesInDataset(
+            String datasetId) {
+        return listEntitiesInDataset(
+                datasetId, ListDatasetEntitiesRequest.builder().build());
     }
 
     /**
-     * Removes one or more entities from a dataset. The entities themselves
-     * are not deleted — they are only removed from this dataset. Returns
-     * the number of entities removed.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public CompletableFuture> removeEntitiesFromDataset(
-            String datasetId, RemoveEntitiesFromDatasetRequest request, RequestOptions requestOptions) {
+    public CompletableFuture> listEntitiesInDataset(
+            String datasetId, RequestOptions requestOptions) {
+        return listEntitiesInDataset(
+                datasetId, ListDatasetEntitiesRequest.builder().build(), requestOptions);
+    }
+
+    /**
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
+     */
+    public CompletableFuture> listEntitiesInDataset(
+            String datasetId, ListDatasetEntitiesRequest request) {
+        return listEntitiesInDataset(datasetId, request, null);
+    }
+
+    /**
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
+     */
+    public CompletableFuture> listEntitiesInDataset(
+            String datasetId, ListDatasetEntitiesRequest request, RequestOptions requestOptions) {
         HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
                 .newBuilder()
                 .addPathSegments("catchAll/datasets")
                 .addPathSegment(datasetId)
-                .addPathSegments("entities");
+                .addPathSegments("entities")
+                .addPathSegments("list");
         if (requestOptions != null) {
             requestOptions.getQueryParameters().forEach((_key, _value) -> {
                 httpUrl.addQueryParameter(_key, _value);
@@ -1191,13 +1161,13 @@ public CompletableFuture> remove
         RequestBody body;
         try {
             body = RequestBody.create(
-                    ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON);
+                    ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
         } catch (JsonProcessingException e) {
             throw new CatchAllApiException("Failed to serialize request", e);
         }
         Request okhttpRequest = new Request.Builder()
                 .url(httpUrl.build())
-                .method("DELETE", body)
+                .method("POST", body)
                 .headers(Headers.of(clientOptions.headers(requestOptions)))
                 .addHeader("Content-Type", "application/json")
                 .addHeader("Accept", "application/json")
@@ -1206,7 +1176,7 @@ public CompletableFuture> remove
         if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
             client = clientOptions.httpClientWithTimeout(requestOptions);
         }
-        CompletableFuture> future = new CompletableFuture<>();
+        CompletableFuture> future = new CompletableFuture<>();
         client.newCall(okhttpRequest).enqueue(new Callback() {
             @Override
             public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException {
@@ -1214,7 +1184,8 @@ public void onResponse(@NotNull Call call, @NotNull Response response) throws IO
                     String responseBodyString = responseBody != null ? responseBody.string() : "{}";
                     if (response.isSuccessful()) {
                         future.complete(new CatchAllApiHttpResponse<>(
-                                ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ManageEntitiesResponse.class),
+                                ObjectMappers.JSON_MAPPER.readValue(
+                                        responseBodyString, DatasetEntityListResponse.class),
                                 response));
                         return;
                     }
@@ -1258,8 +1229,7 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CompletableFuture> getDatasetStatusHistory(
             String datasetId) {
@@ -1268,8 +1238,7 @@ public CompletableFuture>
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CompletableFuture> getDatasetStatusHistory(
             String datasetId, RequestOptions requestOptions) {
@@ -1278,8 +1247,7 @@ public CompletableFuture>
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CompletableFuture> getDatasetStatusHistory(
             String datasetId, GetDatasetStatusHistoryRequest request) {
@@ -1287,8 +1255,7 @@ public CompletableFuture>
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CompletableFuture> getDatasetStatusHistory(
             String datasetId, GetDatasetStatusHistoryRequest request, RequestOptions requestOptions) {
@@ -1359,10 +1326,8 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) {
     }
 
     /**
-     * Appends new companies to an existing dataset by uploading a CSV file.
-     * Uses the same CSV format as the dataset creation endpoint.
-     * 

The response omits dataset_name compared to the create-from-CSV - * endpoint since the dataset already exists.

+ * Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. + *

The response omits dataset_name compared to the create-from-CSV endpoint since the dataset already exists.

*/ public CompletableFuture> uploadCsvToDataset( String datasetId, File file, UploadCsvToDatasetRequest request) { @@ -1370,10 +1335,8 @@ public CompletableFuture> up } /** - * Appends new companies to an existing dataset by uploading a CSV file. - * Uses the same CSV format as the dataset creation endpoint. - *

The response omits dataset_name compared to the create-from-CSV - * endpoint since the dataset already exists.

+ * Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. + *

The response omits dataset_name compared to the create-from-CSV endpoint since the dataset already exists.

*/ public CompletableFuture> uploadCsvToDataset( String datasetId, File file, UploadCsvToDatasetRequest request, RequestOptions requestOptions) { 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 e6e63f4..21441d1 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/DatasetsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/DatasetsClient.java @@ -11,8 +11,8 @@ import com.newscatcher.catchall.resources.datasets.requests.DeleteDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.GetDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.GetDatasetStatusHistoryRequest; +import com.newscatcher.catchall.resources.datasets.requests.ListDatasetEntitiesRequest; import com.newscatcher.catchall.resources.datasets.requests.ListDatasetsRequest; -import com.newscatcher.catchall.resources.datasets.requests.ListEntitiesInDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.RemoveEntitiesFromDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.UpdateDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.UploadCsvToDatasetRequest; @@ -45,36 +45,28 @@ public RawDatasetsClient withRawResponse() { } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public DatasetListResponse listDatasets() { return this.rawClient.listDatasets().body(); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public DatasetListResponse listDatasets(RequestOptions requestOptions) { return this.rawClient.listDatasets(requestOptions).body(); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public DatasetListResponse listDatasets(ListDatasetsRequest request) { return this.rawClient.listDatasets(request).body(); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public DatasetListResponse listDatasets(ListDatasetsRequest request, RequestOptions requestOptions) { return this.rawClient.listDatasets(request, requestOptions).body(); @@ -105,9 +97,7 @@ 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 column is required; all other columns - * are optional. + * 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. *

CSV format:

*
name,description,domain,alternative_names,key_persons
      * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
@@ -121,9 +111,7 @@ 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 column is required; all other columns
-     * are optional.
+     * 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.
      * 

CSV format:

*
name,description,domain,alternative_names,key_persons
      * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
@@ -255,94 +243,87 @@ public DatasetResponse updateDataset(
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Adds one or more existing entities to a dataset. Returns the number of entities added.
      */
-    public DatasetEntityListResponse listEntitiesInDataset(String datasetId) {
-        return this.rawClient.listEntitiesInDataset(datasetId).body();
+    public ManageEntitiesResponse addEntitiesToDataset(String datasetId, AddEntitiesToDatasetRequest request) {
+        return this.rawClient.addEntitiesToDataset(datasetId, request).body();
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Adds one or more existing entities to a dataset. Returns the number of entities added.
      */
-    public DatasetEntityListResponse listEntitiesInDataset(String datasetId, RequestOptions requestOptions) {
-        return this.rawClient.listEntitiesInDataset(datasetId, requestOptions).body();
+    public ManageEntitiesResponse addEntitiesToDataset(
+            String datasetId, AddEntitiesToDatasetRequest request, RequestOptions requestOptions) {
+        return this.rawClient
+                .addEntitiesToDataset(datasetId, request, requestOptions)
+                .body();
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
      */
-    public DatasetEntityListResponse listEntitiesInDataset(String datasetId, ListEntitiesInDatasetRequest request) {
-        return this.rawClient.listEntitiesInDataset(datasetId, request).body();
+    public ManageEntitiesResponse removeEntitiesFromDataset(
+            String datasetId, RemoveEntitiesFromDatasetRequest request) {
+        return this.rawClient.removeEntitiesFromDataset(datasetId, request).body();
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
      */
-    public DatasetEntityListResponse listEntitiesInDataset(
-            String datasetId, ListEntitiesInDatasetRequest request, RequestOptions requestOptions) {
+    public ManageEntitiesResponse removeEntitiesFromDataset(
+            String datasetId, RemoveEntitiesFromDatasetRequest request, RequestOptions requestOptions) {
         return this.rawClient
-                .listEntitiesInDataset(datasetId, request, requestOptions)
+                .removeEntitiesFromDataset(datasetId, request, requestOptions)
                 .body();
     }
 
     /**
-     * Adds one or more existing entities to a dataset. Returns the number of entities added.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public ManageEntitiesResponse addEntitiesToDataset(String datasetId, AddEntitiesToDatasetRequest request) {
-        return this.rawClient.addEntitiesToDataset(datasetId, request).body();
+    public DatasetEntityListResponse listEntitiesInDataset(String datasetId) {
+        return this.rawClient.listEntitiesInDataset(datasetId).body();
     }
 
     /**
-     * Adds one or more existing entities to a dataset. Returns the number of entities added.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public ManageEntitiesResponse addEntitiesToDataset(
-            String datasetId, AddEntitiesToDatasetRequest request, RequestOptions requestOptions) {
-        return this.rawClient
-                .addEntitiesToDataset(datasetId, request, requestOptions)
-                .body();
+    public DatasetEntityListResponse listEntitiesInDataset(String datasetId, RequestOptions requestOptions) {
+        return this.rawClient.listEntitiesInDataset(datasetId, requestOptions).body();
     }
 
     /**
-     * Removes one or more entities from a dataset. The entities themselves
-     * are not deleted — they are only removed from this dataset. Returns
-     * the number of entities removed.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public ManageEntitiesResponse removeEntitiesFromDataset(
-            String datasetId, RemoveEntitiesFromDatasetRequest request) {
-        return this.rawClient.removeEntitiesFromDataset(datasetId, request).body();
+    public DatasetEntityListResponse listEntitiesInDataset(String datasetId, ListDatasetEntitiesRequest request) {
+        return this.rawClient.listEntitiesInDataset(datasetId, request).body();
     }
 
     /**
-     * Removes one or more entities from a dataset. The entities themselves
-     * are not deleted — they are only removed from this dataset. Returns
-     * the number of entities removed.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public ManageEntitiesResponse removeEntitiesFromDataset(
-            String datasetId, RemoveEntitiesFromDatasetRequest request, RequestOptions requestOptions) {
+    public DatasetEntityListResponse listEntitiesInDataset(
+            String datasetId, ListDatasetEntitiesRequest request, RequestOptions requestOptions) {
         return this.rawClient
-                .removeEntitiesFromDataset(datasetId, request, requestOptions)
+                .listEntitiesInDataset(datasetId, request, requestOptions)
                 .body();
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public DatasetStatusHistoryResponse getDatasetStatusHistory(String datasetId) {
         return this.rawClient.getDatasetStatusHistory(datasetId).body();
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public DatasetStatusHistoryResponse getDatasetStatusHistory(String datasetId, RequestOptions requestOptions) {
         return this.rawClient.getDatasetStatusHistory(datasetId, requestOptions).body();
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public DatasetStatusHistoryResponse getDatasetStatusHistory(
             String datasetId, GetDatasetStatusHistoryRequest request) {
@@ -350,8 +331,7 @@ public DatasetStatusHistoryResponse getDatasetStatusHistory(
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public DatasetStatusHistoryResponse getDatasetStatusHistory(
             String datasetId, GetDatasetStatusHistoryRequest request, RequestOptions requestOptions) {
@@ -361,10 +341,8 @@ public DatasetStatusHistoryResponse getDatasetStatusHistory(
     }
 
     /**
-     * Appends new companies to an existing dataset by uploading a CSV file.
-     * Uses the same CSV format as the dataset creation endpoint.
-     * 

The response omits dataset_name compared to the create-from-CSV - * endpoint since the dataset already exists.

+ * Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. + *

The response omits dataset_name compared to the create-from-CSV endpoint since the dataset already exists.

*/ public UploadCsvToDatasetResponse uploadCsvToDataset( String datasetId, File file, UploadCsvToDatasetRequest request) { @@ -372,10 +350,8 @@ public UploadCsvToDatasetResponse uploadCsvToDataset( } /** - * Appends new companies to an existing dataset by uploading a CSV file. - * Uses the same CSV format as the dataset creation endpoint. - *

The response omits dataset_name compared to the create-from-CSV - * endpoint since the dataset already exists.

+ * Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. + *

The response omits dataset_name compared to the create-from-CSV endpoint since the dataset already exists.

*/ public UploadCsvToDatasetResponse uploadCsvToDataset( String datasetId, File file, UploadCsvToDatasetRequest request, RequestOptions requestOptions) { 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 e0fd5c3..f82adb3 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/RawDatasetsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/RawDatasetsClient.java @@ -23,8 +23,8 @@ import com.newscatcher.catchall.resources.datasets.requests.DeleteDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.GetDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.GetDatasetStatusHistoryRequest; +import com.newscatcher.catchall.resources.datasets.requests.ListDatasetEntitiesRequest; import com.newscatcher.catchall.resources.datasets.requests.ListDatasetsRequest; -import com.newscatcher.catchall.resources.datasets.requests.ListEntitiesInDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.RemoveEntitiesFromDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.UpdateDatasetRequest; import com.newscatcher.catchall.resources.datasets.requests.UploadCsvToDatasetRequest; @@ -59,36 +59,28 @@ public RawDatasetsClient(ClientOptions clientOptions) { } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CatchAllApiHttpResponse listDatasets() { return listDatasets(ListDatasetsRequest.builder().build()); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CatchAllApiHttpResponse listDatasets(RequestOptions requestOptions) { return listDatasets(ListDatasetsRequest.builder().build(), requestOptions); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CatchAllApiHttpResponse listDatasets(ListDatasetsRequest request) { return listDatasets(request, null); } /** - * Returns a paginated list of datasets belonging to the authenticated - * organization. Supports filtering by status and sorting by name, - * status, or creation date. + * Returns a paginated list of datasets belonging to the authenticated organization. Supports filtering by status and sorting by name, status, or creation date. */ public CatchAllApiHttpResponse listDatasets( ListDatasetsRequest request, RequestOptions requestOptions) { @@ -241,9 +233,7 @@ public CatchAllApiHttpResponse createDataset( } /** - * Creates a new dataset by uploading a CSV file. Each row in the CSV - * becomes an entity. The name column is required; all other columns - * are optional. + * 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. *

CSV format:

*
name,description,domain,alternative_names,key_persons
      * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
@@ -258,9 +248,7 @@ public CatchAllApiHttpResponse createDatasetFromCsv(
     }
 
     /**
-     * Creates a new dataset by uploading a CSV file. Each row in the CSV
-     * becomes an entity. The name column is required; all other columns
-     * are optional.
+     * 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.
      * 

CSV format:

*
name,description,domain,alternative_names,key_persons
      * NewsCatcher,"AI-powered news data provider",newscatcherapi.com,"NC;NewsCatcher API","Artem Bugara;Maksym Sugonyaka"
@@ -759,79 +747,42 @@ public CatchAllApiHttpResponse updateDataset(
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
-     */
-    public CatchAllApiHttpResponse listEntitiesInDataset(String datasetId) {
-        return listEntitiesInDataset(
-                datasetId, ListEntitiesInDatasetRequest.builder().build());
-    }
-
-    /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
-     */
-    public CatchAllApiHttpResponse listEntitiesInDataset(
-            String datasetId, RequestOptions requestOptions) {
-        return listEntitiesInDataset(
-                datasetId, ListEntitiesInDatasetRequest.builder().build(), requestOptions);
-    }
-
-    /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Adds one or more existing entities to a dataset. Returns the number of entities added.
      */
-    public CatchAllApiHttpResponse listEntitiesInDataset(
-            String datasetId, ListEntitiesInDatasetRequest request) {
-        return listEntitiesInDataset(datasetId, request, null);
+    public CatchAllApiHttpResponse addEntitiesToDataset(
+            String datasetId, AddEntitiesToDatasetRequest request) {
+        return addEntitiesToDataset(datasetId, request, null);
     }
 
     /**
-     * Returns a paginated list of entities in a dataset. Supports filtering by status and entity type.
+     * Adds one or more existing entities to a dataset. Returns the number of entities added.
      */
-    public CatchAllApiHttpResponse listEntitiesInDataset(
-            String datasetId, ListEntitiesInDatasetRequest request, RequestOptions requestOptions) {
+    public CatchAllApiHttpResponse addEntitiesToDataset(
+            String datasetId, AddEntitiesToDatasetRequest request, RequestOptions requestOptions) {
         HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
                 .newBuilder()
                 .addPathSegments("catchAll/datasets")
                 .addPathSegment(datasetId)
                 .addPathSegments("entities");
-        if (request.getPage().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "page", request.getPage().get(), false);
-        }
-        if (request.getPageSize().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "page_size", request.getPageSize().get(), false);
-        }
-        if (request.getSearch().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "search", request.getSearch().get(), false);
-        }
-        if (request.getStatus().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "status", request.getStatus().get(), false);
-        }
-        if (request.getEntityType().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "entity_type", request.getEntityType().get(), false);
-        }
-        if (request.getSortBy().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "sort_by", request.getSortBy().get(), false);
-        }
-        if (request.getSortOrder().isPresent()) {
-            QueryStringMapper.addQueryParameter(
-                    httpUrl, "sort_order", request.getSortOrder().get(), false);
-        }
         if (requestOptions != null) {
             requestOptions.getQueryParameters().forEach((_key, _value) -> {
                 httpUrl.addQueryParameter(_key, _value);
             });
         }
-        Request.Builder _requestBuilder = new Request.Builder()
+        RequestBody body;
+        try {
+            body = RequestBody.create(
+                    ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON);
+        } catch (JsonProcessingException e) {
+            throw new CatchAllApiException("Failed to serialize request", e);
+        }
+        Request okhttpRequest = new Request.Builder()
                 .url(httpUrl.build())
-                .method("GET", null)
+                .method("POST", body)
                 .headers(Headers.of(clientOptions.headers(requestOptions)))
-                .addHeader("Accept", "application/json");
-        Request okhttpRequest = _requestBuilder.build();
+                .addHeader("Content-Type", "application/json")
+                .addHeader("Accept", "application/json")
+                .build();
         OkHttpClient client = clientOptions.httpClient();
         if (requestOptions != null && requestOptions.getTimeout().isPresent()) {
             client = clientOptions.httpClientWithTimeout(requestOptions);
@@ -841,7 +792,7 @@ public CatchAllApiHttpResponse listEntitiesInDataset(
             String responseBodyString = responseBody != null ? responseBody.string() : "{}";
             if (response.isSuccessful()) {
                 return new CatchAllApiHttpResponse<>(
-                        ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DatasetEntityListResponse.class),
+                        ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ManageEntitiesResponse.class),
                         response);
             }
             try {
@@ -852,6 +803,10 @@ public CatchAllApiHttpResponse listEntitiesInDataset(
                     case 404:
                         throw new NotFoundError(
                                 ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Error.class), response);
+                    case 422:
+                        throw new UnprocessableEntityError(
+                                ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ValidationErrorResponse.class),
+                                response);
                 }
             } catch (JsonProcessingException ignored) {
                 // unable to map error response, throwing generic error
@@ -865,18 +820,18 @@ public CatchAllApiHttpResponse listEntitiesInDataset(
     }
 
     /**
-     * Adds one or more existing entities to a dataset. Returns the number of entities added.
+     * Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
      */
-    public CatchAllApiHttpResponse addEntitiesToDataset(
-            String datasetId, AddEntitiesToDatasetRequest request) {
-        return addEntitiesToDataset(datasetId, request, null);
+    public CatchAllApiHttpResponse removeEntitiesFromDataset(
+            String datasetId, RemoveEntitiesFromDatasetRequest request) {
+        return removeEntitiesFromDataset(datasetId, request, null);
     }
 
     /**
-     * Adds one or more existing entities to a dataset. Returns the number of entities added.
+     * Removes one or more entities from a dataset. The entities themselves are not deleted — they are only removed from this dataset. Returns the number of entities removed.
      */
-    public CatchAllApiHttpResponse addEntitiesToDataset(
-            String datasetId, AddEntitiesToDatasetRequest request, RequestOptions requestOptions) {
+    public CatchAllApiHttpResponse removeEntitiesFromDataset(
+            String datasetId, RemoveEntitiesFromDatasetRequest request, RequestOptions requestOptions) {
         HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
                 .newBuilder()
                 .addPathSegments("catchAll/datasets")
@@ -896,7 +851,7 @@ public CatchAllApiHttpResponse addEntitiesToDataset(
         }
         Request okhttpRequest = new Request.Builder()
                 .url(httpUrl.build())
-                .method("POST", body)
+                .method("DELETE", body)
                 .headers(Headers.of(clientOptions.headers(requestOptions)))
                 .addHeader("Content-Type", "application/json")
                 .addHeader("Accept", "application/json")
@@ -938,27 +893,41 @@ public CatchAllApiHttpResponse addEntitiesToDataset(
     }
 
     /**
-     * Removes one or more entities from a dataset. The entities themselves
-     * are not deleted — they are only removed from this dataset. Returns
-     * the number of entities removed.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public CatchAllApiHttpResponse removeEntitiesFromDataset(
-            String datasetId, RemoveEntitiesFromDatasetRequest request) {
-        return removeEntitiesFromDataset(datasetId, request, null);
+    public CatchAllApiHttpResponse listEntitiesInDataset(String datasetId) {
+        return listEntitiesInDataset(
+                datasetId, ListDatasetEntitiesRequest.builder().build());
     }
 
     /**
-     * Removes one or more entities from a dataset. The entities themselves
-     * are not deleted — they are only removed from this dataset. Returns
-     * the number of entities removed.
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
      */
-    public CatchAllApiHttpResponse removeEntitiesFromDataset(
-            String datasetId, RemoveEntitiesFromDatasetRequest request, RequestOptions requestOptions) {
+    public CatchAllApiHttpResponse listEntitiesInDataset(
+            String datasetId, RequestOptions requestOptions) {
+        return listEntitiesInDataset(
+                datasetId, ListDatasetEntitiesRequest.builder().build(), requestOptions);
+    }
+
+    /**
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
+     */
+    public CatchAllApiHttpResponse listEntitiesInDataset(
+            String datasetId, ListDatasetEntitiesRequest request) {
+        return listEntitiesInDataset(datasetId, request, null);
+    }
+
+    /**
+     * Returns a paginated list of entities in a dataset. Supports filtering by status, entity type, and name search.
+     */
+    public CatchAllApiHttpResponse listEntitiesInDataset(
+            String datasetId, ListDatasetEntitiesRequest request, RequestOptions requestOptions) {
         HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl())
                 .newBuilder()
                 .addPathSegments("catchAll/datasets")
                 .addPathSegment(datasetId)
-                .addPathSegments("entities");
+                .addPathSegments("entities")
+                .addPathSegments("list");
         if (requestOptions != null) {
             requestOptions.getQueryParameters().forEach((_key, _value) -> {
                 httpUrl.addQueryParameter(_key, _value);
@@ -967,13 +936,13 @@ public CatchAllApiHttpResponse removeEntitiesFromDataset
         RequestBody body;
         try {
             body = RequestBody.create(
-                    ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON);
+                    ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON);
         } catch (JsonProcessingException e) {
             throw new CatchAllApiException("Failed to serialize request", e);
         }
         Request okhttpRequest = new Request.Builder()
                 .url(httpUrl.build())
-                .method("DELETE", body)
+                .method("POST", body)
                 .headers(Headers.of(clientOptions.headers(requestOptions)))
                 .addHeader("Content-Type", "application/json")
                 .addHeader("Accept", "application/json")
@@ -987,7 +956,7 @@ public CatchAllApiHttpResponse removeEntitiesFromDataset
             String responseBodyString = responseBody != null ? responseBody.string() : "{}";
             if (response.isSuccessful()) {
                 return new CatchAllApiHttpResponse<>(
-                        ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ManageEntitiesResponse.class),
+                        ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DatasetEntityListResponse.class),
                         response);
             }
             try {
@@ -1015,8 +984,7 @@ public CatchAllApiHttpResponse removeEntitiesFromDataset
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CatchAllApiHttpResponse getDatasetStatusHistory(String datasetId) {
         return getDatasetStatusHistory(
@@ -1024,8 +992,7 @@ public CatchAllApiHttpResponse getDatasetStatusHis
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CatchAllApiHttpResponse getDatasetStatusHistory(
             String datasetId, RequestOptions requestOptions) {
@@ -1034,8 +1001,7 @@ public CatchAllApiHttpResponse getDatasetStatusHis
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CatchAllApiHttpResponse getDatasetStatusHistory(
             String datasetId, GetDatasetStatusHistoryRequest request) {
@@ -1043,8 +1009,7 @@ public CatchAllApiHttpResponse getDatasetStatusHis
     }
 
     /**
-     * Returns the full status change history for a dataset, ordered
-     * chronologically from oldest to newest.
+     * Returns the full status change history for a dataset, ordered chronologically from oldest to newest.
      */
     public CatchAllApiHttpResponse getDatasetStatusHistory(
             String datasetId, GetDatasetStatusHistoryRequest request, RequestOptions requestOptions) {
@@ -1097,10 +1062,8 @@ public CatchAllApiHttpResponse getDatasetStatusHis
     }
 
     /**
-     * Appends new companies to an existing dataset by uploading a CSV file.
-     * Uses the same CSV format as the dataset creation endpoint.
-     * 

The response omits dataset_name compared to the create-from-CSV - * endpoint since the dataset already exists.

+ * Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. + *

The response omits dataset_name compared to the create-from-CSV endpoint since the dataset already exists.

*/ public CatchAllApiHttpResponse uploadCsvToDataset( String datasetId, File file, UploadCsvToDatasetRequest request) { @@ -1108,10 +1071,8 @@ public CatchAllApiHttpResponse uploadCsvToDataset( } /** - * Appends new companies to an existing dataset by uploading a CSV file. - * Uses the same CSV format as the dataset creation endpoint. - *

The response omits dataset_name compared to the create-from-CSV - * endpoint since the dataset already exists.

+ * Appends new companies to an existing dataset by uploading a CSV file. Uses the same CSV format as the dataset creation endpoint. + *

The response omits dataset_name compared to the create-from-CSV endpoint since the dataset already exists.

*/ public CatchAllApiHttpResponse uploadCsvToDataset( String datasetId, File file, UploadCsvToDatasetRequest request, RequestOptions requestOptions) { diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListEntitiesInDatasetRequest.java b/src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListDatasetEntitiesRequest.java similarity index 86% rename from src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListEntitiesInDatasetRequest.java rename to src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListDatasetEntitiesRequest.java index 03edb9b..c5ea6e5 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListEntitiesInDatasetRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListDatasetEntitiesRequest.java @@ -5,9 +5,9 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -22,8 +22,8 @@ import java.util.Optional; @JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListEntitiesInDatasetRequest.Builder.class) -public final class ListEntitiesInDatasetRequest { +@JsonDeserialize(builder = ListDatasetEntitiesRequest.Builder.class) +public final class ListDatasetEntitiesRequest { private final Optional page; private final Optional pageSize; @@ -40,7 +40,7 @@ public final class ListEntitiesInDatasetRequest { private final Map additionalProperties; - private ListEntitiesInDatasetRequest( + private ListDatasetEntitiesRequest( Optional page, Optional pageSize, Optional search, @@ -60,45 +60,45 @@ private ListEntitiesInDatasetRequest( } /** - * @return Page number to retrieve. + * @return The page number to retrieve. */ - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } /** - * @return Number of entities per page. + * @return The number of entities per page. */ - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } /** - * @return Filter entities by name. + * @return Filters entities by name using a case-insensitive substring match. */ - @JsonIgnore + @JsonProperty("search") public Optional getSearch() { return search; } - @JsonIgnore + @JsonProperty("status") public Optional getStatus() { return status; } - @JsonIgnore + @JsonProperty("entity_type") public Optional getEntityType() { return entityType; } - @JsonIgnore + @JsonProperty("sort_by") public Optional getSortBy() { return sortBy; } - @JsonIgnore + @JsonProperty("sort_order") public Optional getSortOrder() { return sortOrder; } @@ -106,7 +106,7 @@ public Optional getSortOrder() { @java.lang.Override public boolean equals(Object other) { if (this == other) return true; - return other instanceof ListEntitiesInDatasetRequest && equalTo((ListEntitiesInDatasetRequest) other); + return other instanceof ListDatasetEntitiesRequest && equalTo((ListDatasetEntitiesRequest) other); } @JsonAnyGetter @@ -114,7 +114,7 @@ public Map getAdditionalProperties() { return this.additionalProperties; } - private boolean equalTo(ListEntitiesInDatasetRequest other) { + private boolean equalTo(ListDatasetEntitiesRequest other) { return page.equals(other.page) && pageSize.equals(other.pageSize) && search.equals(other.search) @@ -160,7 +160,7 @@ public static final class Builder { private Builder() {} - public Builder from(ListEntitiesInDatasetRequest other) { + public Builder from(ListDatasetEntitiesRequest other) { page(other.getPage()); pageSize(other.getPageSize()); search(other.getSearch()); @@ -172,7 +172,7 @@ public Builder from(ListEntitiesInDatasetRequest other) { } /** - *

Page number to retrieve.

+ *

The page number to retrieve.

*/ @JsonSetter(value = "page", nulls = Nulls.SKIP) public Builder page(Optional page) { @@ -186,7 +186,7 @@ public Builder page(Integer page) { } /** - *

Number of entities per page.

+ *

The number of entities per page.

*/ @JsonSetter(value = "page_size", nulls = Nulls.SKIP) public Builder pageSize(Optional pageSize) { @@ -200,7 +200,7 @@ public Builder pageSize(Integer pageSize) { } /** - *

Filter entities by name.

+ *

Filters entities by name using a case-insensitive substring match.

*/ @JsonSetter(value = "search", nulls = Nulls.SKIP) public Builder search(Optional search) { @@ -257,8 +257,8 @@ public Builder sortOrder(SortOrder sortOrder) { return this; } - public ListEntitiesInDatasetRequest build() { - return new ListEntitiesInDatasetRequest( + public ListDatasetEntitiesRequest build() { + return new ListDatasetEntitiesRequest( page, pageSize, search, status, entityType, sortBy, sortOrder, additionalProperties); } diff --git a/src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListDatasetsRequest.java b/src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListDatasetsRequest.java index a8f0bb5..04096f5 100644 --- a/src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListDatasetsRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/datasets/requests/ListDatasetsRequest.java @@ -5,9 +5,9 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -62,7 +62,7 @@ private ListDatasetsRequest( /** * @return Page number to retrieve. */ - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } @@ -70,7 +70,7 @@ public Optional getPage() { /** * @return Number of datasets per page. */ - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } @@ -78,7 +78,7 @@ public Optional getPageSize() { /** * @return Filter datasets by name (case-insensitive substring match). */ - @JsonIgnore + @JsonProperty("search") public Optional getSearch() { return search; } @@ -86,25 +86,22 @@ public Optional getSearch() { /** * @return Filter by dataset status. */ - @JsonIgnore + @JsonProperty("latest_status") public Optional getLatestStatus() { return latestStatus; } - @JsonIgnore + @JsonProperty("sort_by") public Optional getSortBy() { return sortBy; } - @JsonIgnore + @JsonProperty("sort_order") public Optional getSortOrder() { return sortOrder; } - /** - * @return Filter results by ownership. Defaults to all. - */ - @JsonIgnore + @JsonProperty("ownership") public Optional getOwnership() { return ownership; } @@ -255,9 +252,6 @@ public Builder sortOrder(SortOrder sortOrder) { return this; } - /** - *

Filter results by ownership. Defaults to all.

- */ @JsonSetter(value = "ownership", nulls = Nulls.SKIP) public Builder ownership(Optional ownership) { this.ownership = ownership; 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 3812997..9fd8ca3 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/AsyncEntitiesClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/AsyncEntitiesClient.java @@ -35,36 +35,28 @@ public AsyncRawEntitiesClient withRawResponse() { } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CompletableFuture listEntities() { return this.rawClient.listEntities().thenApply(response -> response.body()); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CompletableFuture listEntities(RequestOptions requestOptions) { return this.rawClient.listEntities(requestOptions).thenApply(response -> response.body()); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CompletableFuture listEntities(ListEntitiesRequest request) { return this.rawClient.listEntities(request).thenApply(response -> response.body()); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CompletableFuture listEntities( ListEntitiesRequest request, RequestOptions requestOptions) { @@ -95,20 +87,16 @@ public CompletableFuture createEntity( } /** - * Creates multiple entities in a single request. Each entity is - * processed independently — a failure in one does not affect others. - *

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

+ * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

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

*/ public CompletableFuture createEntitiesBatch(CreateEntitiesBatchRequest request) { return this.rawClient.createEntitiesBatch(request).thenApply(response -> response.body()); } /** - * Creates multiple entities in a single request. Each entity is - * processed independently — a failure in one does not affect others. - *

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

+ * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

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

*/ public CompletableFuture createEntitiesBatch( CreateEntitiesBatchRequest request, RequestOptions requestOptions) { 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 c435149..6e98da9 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/AsyncRawEntitiesClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/AsyncRawEntitiesClient.java @@ -47,36 +47,28 @@ public AsyncRawEntitiesClient(ClientOptions clientOptions) { } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CompletableFuture> listEntities() { return listEntities(ListEntitiesRequest.builder().build()); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CompletableFuture> listEntities(RequestOptions requestOptions) { return listEntities(ListEntitiesRequest.builder().build(), requestOptions); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CompletableFuture> listEntities(ListEntitiesRequest request) { return listEntities(request, null); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CompletableFuture> listEntities( ListEntitiesRequest request, RequestOptions requestOptions) { @@ -256,10 +248,8 @@ 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. - *

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

+ * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

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

*/ public CompletableFuture> createEntitiesBatch( CreateEntitiesBatchRequest request) { @@ -267,10 +257,8 @@ public CompletableFuture> c } /** - * Creates multiple entities in a single request. Each entity is - * processed independently — a failure in one does not affect others. - *

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

+ * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

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

*/ public CompletableFuture> createEntitiesBatch( CreateEntitiesBatchRequest request, RequestOptions requestOptions) { 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 d53f7b3..b2bf5ad 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/EntitiesClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/EntitiesClient.java @@ -34,36 +34,28 @@ public RawEntitiesClient withRawResponse() { } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public EntityListResponse listEntities() { return this.rawClient.listEntities().body(); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public EntityListResponse listEntities(RequestOptions requestOptions) { return this.rawClient.listEntities(requestOptions).body(); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public EntityListResponse listEntities(ListEntitiesRequest request) { return this.rawClient.listEntities(request).body(); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public EntityListResponse listEntities(ListEntitiesRequest request, RequestOptions requestOptions) { return this.rawClient.listEntities(request, requestOptions).body(); @@ -92,20 +84,16 @@ 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. - *

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

+ * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

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

*/ public CreateEntitiesBatchResponse createEntitiesBatch(CreateEntitiesBatchRequest request) { return this.rawClient.createEntitiesBatch(request).body(); } /** - * Creates multiple entities in a single request. Each entity is - * processed independently — a failure in one does not affect others. - *

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

+ * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

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

*/ public CreateEntitiesBatchResponse createEntitiesBatch( CreateEntitiesBatchRequest request, RequestOptions requestOptions) { 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 26626d8..aa3f769 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/RawEntitiesClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/RawEntitiesClient.java @@ -43,36 +43,28 @@ public RawEntitiesClient(ClientOptions clientOptions) { } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CatchAllApiHttpResponse listEntities() { return listEntities(ListEntitiesRequest.builder().build()); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CatchAllApiHttpResponse listEntities(RequestOptions requestOptions) { return listEntities(ListEntitiesRequest.builder().build(), requestOptions); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CatchAllApiHttpResponse listEntities(ListEntitiesRequest request) { return listEntities(request, null); } /** - * Returns a paginated list of entities belonging to the authenticated - * organization. Supports filtering by status and entity type, and - * sorting by name, status, or creation date. + * Returns a paginated list of entities belonging to the authenticated organization. Supports filtering by status and entity type, and sorting by name, status, or creation date. */ public CatchAllApiHttpResponse listEntities( ListEntitiesRequest request, RequestOptions requestOptions) { @@ -219,10 +211,8 @@ public CatchAllApiHttpResponse createEntity( } /** - * Creates multiple entities in a single request. Each entity is - * processed independently — a failure in one does not affect others. - *

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

+ * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

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

*/ public CatchAllApiHttpResponse createEntitiesBatch( CreateEntitiesBatchRequest request) { @@ -230,10 +220,8 @@ public CatchAllApiHttpResponse createEntitiesBatch( } /** - * Creates multiple entities in a single request. Each entity is - * processed independently — a failure in one does not affect others. - *

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

+ * Creates multiple entities in a single request. Each entity is processed independently — a failure in one does not affect others. + *

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

*/ public CatchAllApiHttpResponse createEntitiesBatch( CreateEntitiesBatchRequest request, RequestOptions requestOptions) { diff --git a/src/main/java/com/newscatcher/catchall/resources/entities/requests/ListEntitiesRequest.java b/src/main/java/com/newscatcher/catchall/resources/entities/requests/ListEntitiesRequest.java index 040640d..95caf83 100644 --- a/src/main/java/com/newscatcher/catchall/resources/entities/requests/ListEntitiesRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/entities/requests/ListEntitiesRequest.java @@ -5,9 +5,9 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -62,7 +62,7 @@ private ListEntitiesRequest( /** * @return Page number to retrieve. */ - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } @@ -70,7 +70,7 @@ public Optional getPage() { /** * @return Number of entities per page. */ - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } @@ -78,27 +78,27 @@ public Optional getPageSize() { /** * @return Filter entities by name (case-insensitive substring match). */ - @JsonIgnore + @JsonProperty("search") public Optional getSearch() { return search; } - @JsonIgnore + @JsonProperty("status") public Optional getStatus() { return status; } - @JsonIgnore + @JsonProperty("entity_type") public Optional getEntityType() { return entityType; } - @JsonIgnore + @JsonProperty("sort_by") public Optional getSortBy() { return sortBy; } - @JsonIgnore + @JsonProperty("sort_order") public Optional getSortOrder() { return sortOrder; } diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncJobsClient.java b/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncJobsClient.java index 8500708..b62d853 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncJobsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncJobsClient.java @@ -170,10 +170,8 @@ public CompletableFuture continueJob( } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CompletableFuture deleteJob(String jobId) { @@ -181,10 +179,8 @@ public CompletableFuture deleteJob(String jobId) { } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CompletableFuture deleteJob(String jobId, RequestOptions requestOptions) { @@ -192,10 +188,8 @@ public CompletableFuture deleteJob(String jobId, RequestOp } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CompletableFuture deleteJob(String jobId, DeleteJobRequest request) { @@ -203,10 +197,8 @@ public CompletableFuture deleteJob(String jobId, DeleteJob } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CompletableFuture deleteJob( 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 5ed94fe..a24dab1 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncRawJobsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/AsyncRawJobsClient.java @@ -607,10 +607,8 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CompletableFuture> deleteJob(String jobId) { @@ -618,10 +616,8 @@ public CompletableFuture> deleteJo } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CompletableFuture> deleteJob( @@ -630,10 +626,8 @@ public CompletableFuture> deleteJo } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CompletableFuture> deleteJob( @@ -642,10 +636,8 @@ public CompletableFuture> deleteJo } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CompletableFuture> deleteJob( diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/JobsClient.java b/src/main/java/com/newscatcher/catchall/resources/jobs/JobsClient.java index b39f706..99f2da8 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/JobsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/JobsClient.java @@ -164,10 +164,8 @@ public ContinueResponseDto continueJob(ContinueRequestDto request, RequestOption } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public DeleteJobResponseDto deleteJob(String jobId) { @@ -175,10 +173,8 @@ public DeleteJobResponseDto deleteJob(String jobId) { } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public DeleteJobResponseDto deleteJob(String jobId, RequestOptions requestOptions) { @@ -186,10 +182,8 @@ public DeleteJobResponseDto deleteJob(String jobId, RequestOptions requestOption } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public DeleteJobResponseDto deleteJob(String jobId, DeleteJobRequest request) { @@ -197,10 +191,8 @@ public DeleteJobResponseDto deleteJob(String jobId, DeleteJobRequest request) { } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public DeleteJobResponseDto deleteJob(String jobId, DeleteJobRequest request, RequestOptions requestOptions) { 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 fde4972..2a2c7f7 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/RawJobsClient.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/RawJobsClient.java @@ -490,10 +490,8 @@ public CatchAllApiHttpResponse continueJob( } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CatchAllApiHttpResponse deleteJob(String jobId) { @@ -501,10 +499,8 @@ public CatchAllApiHttpResponse deleteJob(String jobId) { } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CatchAllApiHttpResponse deleteJob(String jobId, RequestOptions requestOptions) { @@ -512,10 +508,8 @@ public CatchAllApiHttpResponse deleteJob(String jobId, Req } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CatchAllApiHttpResponse deleteJob(String jobId, DeleteJobRequest request) { @@ -523,10 +517,8 @@ public CatchAllApiHttpResponse deleteJob(String jobId, Del } /** - * Soft-deletes a job. The job is flagged as deleted and no longer - * appears in list results. The underlying data is retained. - *

Only the job owner can delete a job. Returns 404 if the job is not - * found or does not belong to the authenticated user.

+ * Soft-deletes a job. The job is flagged as deleted and no longer appears in list results. The underlying data is retained. + *

Only the job owner can delete a job. Returns 404 if the job is not found or does not belong to the authenticated user.

*

Deleting an already-deleted job returns 200.

*/ public CatchAllApiHttpResponse deleteJob( diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/GetJobResultsRequest.java b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/GetJobResultsRequest.java index 5eb2847..0a8a21d 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/GetJobResultsRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/GetJobResultsRequest.java @@ -5,9 +5,9 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -36,7 +36,7 @@ private GetJobResultsRequest( /** * @return Page number to retrieve. */ - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } @@ -44,7 +44,7 @@ public Optional getPage() { /** * @return Number of records per page. */ - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } diff --git a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/GetUserJobsRequest.java b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/GetUserJobsRequest.java index 81d52bc..f4c7d5d 100644 --- a/src/main/java/com/newscatcher/catchall/resources/jobs/requests/GetUserJobsRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/jobs/requests/GetUserJobsRequest.java @@ -5,9 +5,9 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -47,7 +47,7 @@ private GetUserJobsRequest( /** * @return Page number to retrieve. */ - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } @@ -55,7 +55,7 @@ public Optional getPage() { /** * @return Number of records per page. */ - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } @@ -63,15 +63,12 @@ public Optional getPageSize() { /** * @return Filter results by text (case-insensitive substring match). */ - @JsonIgnore + @JsonProperty("search") public Optional getSearch() { return search; } - /** - * @return Filter results by ownership. Defaults to all. - */ - @JsonIgnore + @JsonProperty("ownership") public Optional getOwnership() { return ownership; } @@ -173,9 +170,6 @@ public Builder search(String search) { return this; } - /** - *

Filter results by ownership. Defaults to all.

- */ @JsonSetter(value = "ownership", nulls = Nulls.SKIP) public Builder ownership(Optional ownership) { this.ownership = ownership; 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 e7dd3fa..2803a77 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 @@ -44,6 +44,8 @@ public final class SubmitRequestDto { private final Optional> connectedDatasetIds; + private final Optional edScoreMin; + private final Map additionalProperties; private SubmitRequestDto( @@ -56,6 +58,7 @@ private SubmitRequestDto( Optional> enrichments, Optional mode, Optional> connectedDatasetIds, + Optional edScoreMin, Map additionalProperties) { this.query = query; this.context = context; @@ -66,6 +69,7 @@ private SubmitRequestDto( this.enrichments = enrichments; this.mode = mode; this.connectedDatasetIds = connectedDatasetIds; + this.edScoreMin = edScoreMin; this.additionalProperties = additionalProperties; } @@ -125,7 +129,7 @@ public Optional getMode() { } /** - * @return Dataset IDs to connect to this job. When provided, activates Company Watchlist mode — the job returns only events relevant to companies in the connected datasets with each record including a connected_entities array scored per company. + * @return Dataset IDs to connect to the job. When provided, this enables Company Watchlist mode — the job returns only events relevant to companies in the connected datasets. To set the minimum relevance threshold, use ed_score_min. *

The dataset must have latest_status: ready before the job is submitted. Submitting with a non-existent or inaccessible dataset ID returns 400.

*/ @JsonProperty("connected_dataset_ids") @@ -133,6 +137,15 @@ public Optional> getConnectedDatasetIds() { return connectedDatasetIds; } + /** + * @return The minimum relevance score a connected entity must reach for its record to be included in results. + *

Only valid when connected_dataset_ids is set; otherwise ignored. Records where no connected entity meets the threshold are excluded entirely.

+ */ + @JsonProperty("ed_score_min") + public Optional getEdScoreMin() { + return edScoreMin; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -153,7 +166,8 @@ private boolean equalTo(SubmitRequestDto other) { && validators.equals(other.validators) && enrichments.equals(other.enrichments) && mode.equals(other.mode) - && connectedDatasetIds.equals(other.connectedDatasetIds); + && connectedDatasetIds.equals(other.connectedDatasetIds) + && edScoreMin.equals(other.edScoreMin); } @java.lang.Override @@ -167,7 +181,8 @@ public int hashCode() { this.validators, this.enrichments, this.mode, - this.connectedDatasetIds); + this.connectedDatasetIds, + this.edScoreMin); } @java.lang.Override @@ -236,18 +251,28 @@ public interface _FinalStage { _FinalStage mode(SubmitRequestDtoMode mode); /** - *

Dataset IDs to connect to this job. When provided, activates Company Watchlist mode — the job returns only events relevant to companies in the connected datasets with each record including a connected_entities array scored per company.

+ *

Dataset IDs to connect to the job. When provided, this enables Company Watchlist mode — the job returns only events relevant to companies in the connected datasets. To set the minimum relevance threshold, use ed_score_min.

*

The dataset must have latest_status: ready before the job is submitted. Submitting with a non-existent or inaccessible dataset ID returns 400.

*/ _FinalStage connectedDatasetIds(Optional> connectedDatasetIds); _FinalStage connectedDatasetIds(List connectedDatasetIds); + + /** + *

The minimum relevance score a connected entity must reach for its record to be included in results.

+ *

Only valid when connected_dataset_ids is set; otherwise ignored. Records where no connected entity meets the threshold are excluded entirely.

+ */ + _FinalStage edScoreMin(Optional edScoreMin); + + _FinalStage edScoreMin(Integer edScoreMin); } @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder implements QueryStage, _FinalStage { private String query; + private Optional edScoreMin = Optional.empty(); + private Optional> connectedDatasetIds = Optional.empty(); private Optional mode = Optional.empty(); @@ -280,6 +305,7 @@ public Builder from(SubmitRequestDto other) { enrichments(other.getEnrichments()); mode(other.getMode()); connectedDatasetIds(other.getConnectedDatasetIds()); + edScoreMin(other.getEdScoreMin()); return this; } @@ -291,7 +317,29 @@ public _FinalStage query(@NotNull String query) { } /** - *

Dataset IDs to connect to this job. When provided, activates Company Watchlist mode — the job returns only events relevant to companies in the connected datasets with each record including a connected_entities array scored per company.

+ *

The minimum relevance score a connected entity must reach for its record to be included in results.

+ *

Only valid when connected_dataset_ids is set; otherwise ignored. Records where no connected entity meets the threshold are excluded entirely.

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

The minimum relevance score a connected entity must reach for its record to be included in results.

+ *

Only valid when connected_dataset_ids is set; otherwise ignored. Records where no connected entity meets the threshold are excluded entirely.

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

Dataset IDs to connect to the job. When provided, this enables Company Watchlist mode — the job returns only events relevant to companies in the connected datasets. To set the minimum relevance threshold, use ed_score_min.

*

The dataset must have latest_status: ready before the job is submitted. Submitting with a non-existent or inaccessible dataset ID returns 400.

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

Dataset IDs to connect to this job. When provided, activates Company Watchlist mode — the job returns only events relevant to companies in the connected datasets with each record including a connected_entities array scored per company.

+ *

Dataset IDs to connect to the job. When provided, this enables Company Watchlist mode — the job returns only events relevant to companies in the connected datasets. To set the minimum relevance threshold, use ed_score_min.

*

The dataset must have latest_status: ready before the job is submitted. Submitting with a non-existent or inaccessible dataset ID returns 400.

*/ @java.lang.Override @@ -448,6 +496,7 @@ public SubmitRequestDto build() { enrichments, mode, connectedDatasetIds, + edScoreMin, additionalProperties); } 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 ee9e30e..35d428c 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 @@ -26,6 +26,8 @@ public final class CreateMonitorRequestDto { private final String schedule; + private final Optional timezone; + private final Optional webhook; private final Optional limit; @@ -37,12 +39,14 @@ public final class CreateMonitorRequestDto { private CreateMonitorRequestDto( String referenceJobId, String schedule, + Optional timezone, Optional webhook, Optional limit, Optional backfill, Map additionalProperties) { this.referenceJobId = referenceJobId; this.schedule = schedule; + this.timezone = timezone; this.webhook = webhook; this.limit = limit; this.backfill = backfill; @@ -59,14 +63,22 @@ public String getReferenceJobId() { } /** - * @return Monitor schedule in plain text format (e.g. 'every day at 12 PM UTC', 'every 48 hours'). - *

Minimum frequency depends on your plan.

+ * @return Monitor schedule in plain text format. Minimum frequency depends on your plan. */ @JsonProperty("schedule") public String getSchedule() { return schedule; } + /** + * @return The IANA timezone identifier used as the fallback when the schedule string does not include an explicit timezone. + *

If the schedule includes a timezone abbreviation (for example, "every day at 9am EST"), the parsed timezone takes priority and this value is ignored.

+ */ + @JsonProperty("timezone") + public Optional getTimezone() { + return timezone; + } + /** * @return Optional webhook to receive notifications when jobs complete. */ @@ -106,6 +118,7 @@ public Map getAdditionalProperties() { private boolean equalTo(CreateMonitorRequestDto other) { return referenceJobId.equals(other.referenceJobId) && schedule.equals(other.schedule) + && timezone.equals(other.timezone) && webhook.equals(other.webhook) && limit.equals(other.limit) && backfill.equals(other.backfill); @@ -113,7 +126,7 @@ private boolean equalTo(CreateMonitorRequestDto other) { @java.lang.Override public int hashCode() { - return Objects.hash(this.referenceJobId, this.schedule, this.webhook, this.limit, this.backfill); + return Objects.hash(this.referenceJobId, this.schedule, this.timezone, this.webhook, this.limit, this.backfill); } @java.lang.Override @@ -137,8 +150,7 @@ public interface ReferenceJobIdStage { public interface ScheduleStage { /** - *

Monitor schedule in plain text format (e.g. 'every day at 12 PM UTC', 'every 48 hours').

- *

Minimum frequency depends on your plan.

+ *

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

*/ _FinalStage schedule(@NotNull String schedule); } @@ -150,6 +162,14 @@ public interface _FinalStage { _FinalStage additionalProperties(Map additionalProperties); + /** + *

The IANA timezone identifier used as the fallback when the schedule string does not include an explicit timezone.

+ *

If the schedule includes a timezone abbreviation (for example, "every day at 9am EST"), the parsed timezone takes priority and this value is ignored.

+ */ + _FinalStage timezone(Optional timezone); + + _FinalStage timezone(String timezone); + /** *

Optional webhook to receive notifications when jobs complete.

*/ @@ -185,6 +205,8 @@ public static final class Builder implements ReferenceJobIdStage, ScheduleStage, private Optional webhook = Optional.empty(); + private Optional timezone = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -194,6 +216,7 @@ private Builder() {} public Builder from(CreateMonitorRequestDto other) { referenceJobId(other.getReferenceJobId()); schedule(other.getSchedule()); + timezone(other.getTimezone()); webhook(other.getWebhook()); limit(other.getLimit()); backfill(other.getBackfill()); @@ -215,10 +238,8 @@ public ScheduleStage referenceJobId(@NotNull String referenceJobId) { } /** - *

Monitor schedule in plain text format (e.g. 'every day at 12 PM UTC', 'every 48 hours').

- *

Minimum frequency depends on your plan.

- *

Monitor schedule in plain text format (e.g. 'every day at 12 PM UTC', 'every 48 hours').

- *

Minimum frequency depends on your plan.

+ *

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. */ @java.lang.Override @@ -290,10 +311,32 @@ public _FinalStage webhook(Optional webhook) { return this; } + /** + *

The IANA timezone identifier used as the fallback when the schedule string does not include an explicit timezone.

+ *

If the schedule includes a timezone abbreviation (for example, "every day at 9am EST"), the parsed timezone takes priority and this value is ignored.

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

The IANA timezone identifier used as the fallback when the schedule string does not include an explicit timezone.

+ *

If the schedule includes a timezone abbreviation (for example, "every day at 9am EST"), the parsed timezone takes priority and this value is ignored.

+ */ + @java.lang.Override + @JsonSetter(value = "timezone", nulls = Nulls.SKIP) + public _FinalStage timezone(Optional timezone) { + this.timezone = timezone; + return this; + } + @java.lang.Override public CreateMonitorRequestDto build() { return new CreateMonitorRequestDto( - referenceJobId, schedule, webhook, limit, backfill, additionalProperties); + referenceJobId, schedule, timezone, webhook, limit, backfill, additionalProperties); } @java.lang.Override diff --git a/src/main/java/com/newscatcher/catchall/resources/monitors/requests/ListMonitorJobsRequest.java b/src/main/java/com/newscatcher/catchall/resources/monitors/requests/ListMonitorJobsRequest.java index 434a08b..5575d5f 100644 --- a/src/main/java/com/newscatcher/catchall/resources/monitors/requests/ListMonitorJobsRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/monitors/requests/ListMonitorJobsRequest.java @@ -5,9 +5,9 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -34,7 +34,7 @@ private ListMonitorJobsRequest( /** * @return Sort by start_date (asc or desc). */ - @JsonIgnore + @JsonProperty("sort") public Optional getSort() { return sort; } diff --git a/src/main/java/com/newscatcher/catchall/resources/monitors/requests/ListMonitorsRequest.java b/src/main/java/com/newscatcher/catchall/resources/monitors/requests/ListMonitorsRequest.java index 1750b47..dc293af 100644 --- a/src/main/java/com/newscatcher/catchall/resources/monitors/requests/ListMonitorsRequest.java +++ b/src/main/java/com/newscatcher/catchall/resources/monitors/requests/ListMonitorsRequest.java @@ -5,9 +5,9 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -47,7 +47,7 @@ private ListMonitorsRequest( /** * @return Page number to retrieve. */ - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } @@ -55,7 +55,7 @@ public Optional getPage() { /** * @return Number of records per page. */ - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } @@ -63,15 +63,12 @@ public Optional getPageSize() { /** * @return Filter results by text (case-insensitive substring match). */ - @JsonIgnore + @JsonProperty("search") public Optional getSearch() { return search; } - /** - * @return Filter results by ownership. Defaults to all. - */ - @JsonIgnore + @JsonProperty("ownership") public Optional getOwnership() { return ownership; } @@ -173,9 +170,6 @@ public Builder search(String search) { return this; } - /** - *

Filter results by ownership. Defaults to all.

- */ @JsonSetter(value = "ownership", nulls = Nulls.SKIP) public Builder ownership(Optional ownership) { this.ownership = ownership; diff --git a/src/main/java/com/newscatcher/catchall/types/ConnectedEntity.java b/src/main/java/com/newscatcher/catchall/types/ConnectedEntity.java index f285bd4..58d9ab2 100644 --- a/src/main/java/com/newscatcher/catchall/types/ConnectedEntity.java +++ b/src/main/java/com/newscatcher/catchall/types/ConnectedEntity.java @@ -9,11 +9,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.newscatcher.catchall.core.ObjectMappers; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.Optional; import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @@ -27,14 +29,26 @@ public final class ConnectedEntity { private final String relation; + private final String type; + + private final Optional company; + private final Map additionalProperties; private ConnectedEntity( - String entityId, String name, int edScore, String relation, Map additionalProperties) { + String entityId, + String name, + int edScore, + String relation, + String type, + Optional company, + Map additionalProperties) { this.entityId = entityId; this.name = name; this.edScore = edScore; this.relation = relation; + this.type = type; + this.company = company; this.additionalProperties = additionalProperties; } @@ -55,8 +69,7 @@ public String getName() { } /** - * @return Relevance score indicating how directly the entity is associated - * with this event. + * @return Relevance score indicating how directly the entity is associated with this event. *

| Score | Meaning | * |-------|---------| * | 10 | Direct mention, critical event (merger, CEO change, major lawsuit) | @@ -70,14 +83,30 @@ public int getEdScore() { } /** - * @return Short explanation (up to 100 characters) of why this entity is - * associated with the event. + * @return Short explanation (up to 100 characters) of why this entity is associated with the event. */ @JsonProperty("relation") public String getRelation() { return relation; } + /** + * @return The entity type. + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * @return The stored attributes for this entity. Present only when attributes exist in the database. + *

The field name matches the value of type — for example, "company" type entities have a company field.

+ */ + @JsonProperty("company") + public Optional getCompany() { + return company; + } + @java.lang.Override public boolean equals(Object other) { if (this == other) return true; @@ -93,12 +122,14 @@ private boolean equalTo(ConnectedEntity other) { return entityId.equals(other.entityId) && name.equals(other.name) && edScore == other.edScore - && relation.equals(other.relation); + && relation.equals(other.relation) + && type.equals(other.type) + && company.equals(other.company); } @java.lang.Override public int hashCode() { - return Objects.hash(this.entityId, this.name, this.edScore, this.relation); + return Objects.hash(this.entityId, this.name, this.edScore, this.relation, this.type, this.company); } @java.lang.Override @@ -128,8 +159,7 @@ public interface NameStage { public interface EdScoreStage { /** - *

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

+ *

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

*

| Score | Meaning | * |-------|---------| * | 10 | Direct mention, critical event (merger, CEO change, major lawsuit) | @@ -142,10 +172,16 @@ public interface EdScoreStage { public interface RelationStage { /** - *

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

+ *

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

*/ - _FinalStage relation(@NotNull String relation); + TypeStage relation(@NotNull String relation); + } + + public interface TypeStage { + /** + *

The entity type.

+ */ + _FinalStage type(@NotNull String type); } public interface _FinalStage { @@ -154,10 +190,19 @@ public interface _FinalStage { _FinalStage additionalProperty(String key, Object value); _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The stored attributes for this entity. Present only when attributes exist in the database.

+ *

The field name matches the value of type — for example, "company" type entities have a company field.

+ */ + _FinalStage company(Optional company); + + _FinalStage company(CompanyAttributes company); } @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EntityIdStage, NameStage, EdScoreStage, RelationStage, _FinalStage { + public static final class Builder + implements EntityIdStage, NameStage, EdScoreStage, RelationStage, TypeStage, _FinalStage { private String entityId; private String name; @@ -166,6 +211,10 @@ public static final class Builder implements EntityIdStage, NameStage, EdScoreSt private String relation; + private String type; + + private Optional company = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); @@ -177,6 +226,8 @@ public Builder from(ConnectedEntity other) { name(other.getName()); edScore(other.getEdScore()); relation(other.getRelation()); + type(other.getType()); + company(other.getCompany()); return this; } @@ -205,16 +256,14 @@ public EdScoreStage name(@NotNull String name) { } /** - *

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

+ *

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

*

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

- *

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

+ *

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

*

| Score | Meaning | * |-------|---------| * | 10 | Direct mention, critical event (merger, CEO change, major lawsuit) | @@ -231,22 +280,54 @@ public RelationStage edScore(int edScore) { } /** - *

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

- *

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

+ *

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

+ *

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

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

The entity type.

+ *

The entity type.

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

The stored attributes for this entity. Present only when attributes exist in the database.

+ *

The field name matches the value of type — for example, "company" type entities have a company field.

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

The stored attributes for this entity. Present only when attributes exist in the database.

+ *

The field name matches the value of type — for example, "company" type entities have a company field.

+ */ + @java.lang.Override + @JsonSetter(value = "company", nulls = Nulls.SKIP) + public _FinalStage company(Optional company) { + this.company = company; + return this; + } + @java.lang.Override public ConnectedEntity build() { - return new ConnectedEntity(entityId, name, edScore, relation, additionalProperties); + return new ConnectedEntity(entityId, name, edScore, relation, type, company, additionalProperties); } @java.lang.Override