From 2e2feaec391e400bb840b0e3252076b9f07a7146 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 08:42:46 +0000 Subject: [PATCH] feat!: rename NlpDataEntity field and fix GET request serialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This release contains a breaking rename in `NlpDataEntity` and a behavioral fix to GET request serialization that restores correct query-parameter transmission. Key changes: - `NlpDataEntity.getSummaryTranslated()` / `Builder.summaryTranslated()` renamed to `getTranslationSummary()` / `translationSummary()`, with the JSON property key changed from `summary_translated` to `translation_summary` - `GetAggregationCountRequest`, `GetAuthorsRequest`, and `GetBreakingNewsRequest` getter annotations changed from `@JsonIgnore` to `@JsonProperty`, restoring correct serialization of all query parameters - `To` union type: deserialization now attempts `String` conversion before `OffsetDateTime`, and the `Visitor` interface method order is swapped accordingly - `PostSearchByLinkRequest`: removed Javadoc from `getFrom()`, `getTo()`, and their builder setters (documentation-only change) 🌿 Generated with Fern --- .fern/metadata.json | 8 +- CONTRIBUTING.md | 114 ++++++++++++++++ README.md | 17 ++- build.gradle | 4 +- changelog.md | 7 + reference.md | 34 ++--- .../newscatcher/api/core/ClientOptions.java | 4 +- .../requests/GetAggregationCountRequest.java | 92 ++++++------- .../authors/requests/GetAuthorsRequest.java | 90 ++++++------ .../requests/GetBreakingNewsRequest.java | 42 +++--- .../requests/GetLatestHeadlinesRequest.java | 92 ++++++------- .../search/requests/GetSearchRequest.java | 128 +++++++++--------- .../requests/GetSearchByLinkRequest.java | 16 +-- .../requests/PostSearchByLinkRequest.java | 44 ------ .../sources/requests/GetSourcesRequest.java | 30 ++-- .../newscatcher/api/types/NlpDataEntity.java | 32 ++--- .../java/com/newscatcher/api/types/To.java | 16 +-- 17 files changed, 424 insertions(+), 346 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/.fern/metadata.json b/.fern/metadata.json index 14f1e20..14a0bfd 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,14 +1,14 @@ { - "cliVersion": "5.1.0", + "cliVersion": "5.28.2", "generatorName": "fernapi/fern-java-sdk", - "generatorVersion": "4.6.4", + "generatorVersion": "4.8.10", "generatorConfig": { "publish-to": "central" }, - "originGitCommit": "57be6b5662276253461696b49ad9ff6448cc29f3", + "originGitCommit": "f44434d1b1da5712ce6098d90232ec46cf645a0d", "originGitCommitIsDirty": true, "invokedBy": "ci", "requestedVersion": "AUTO", "ciProvider": "unknown", - "sdkVersion": "2.1.1" + "sdkVersion": "3.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 75e124b..e0af6fc 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Add the dependency in your `build.gradle` file: ```groovy dependencies { - implementation 'com.newscatcherapi:newscatcher-sdk:2.1.1' + implementation 'com.newscatcherapi:newscatcher-sdk:3.0.0' } ``` @@ -55,7 +55,7 @@ Add the dependency in your `pom.xml` file: com.newscatcherapi newscatcher-sdk - 2.1.1 + 3.0.0 ``` @@ -261,11 +261,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. @@ -355,3 +363,4 @@ For release notes and changelog, visit our [GitHub releases page](https://github + diff --git a/build.gradle b/build.gradle index 9e31bef..ae2ab76 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ java { group = 'com.newscatcherapi' -version = '2.1.1' +version = '3.0.0' jar { dependsOn(":generatePomFileForMavenPublication") @@ -78,7 +78,7 @@ publishing { maven(MavenPublication) { groupId = 'com.newscatcherapi' artifactId = 'newscatcher-sdk' - version = '2.1.1' + version = '3.0.0' from components.java pom { name = 'newscatcher' diff --git a/changelog.md b/changelog.md index b00138f..b528e80 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,10 @@ +## 3.0.0 - 2026-05-19 +### Breaking Changes +* **`NlpDataEntity.getSummaryTranslated()`** — renamed to `getTranslationSummary()`; the underlying JSON field also changed from `summary_translated` to `translation_summary`. Update all call sites to use `getTranslationSummary()` and `Builder.translationSummary(...)`. +* **`To.Visitor`** — the `visit(OffsetDateTime)` and `visit(String)` method order in the `Visitor` interface is swapped; any anonymous or lambda implementations must reorder their overrides accordingly. +### Fixed +* **`GetAggregationCountRequest`**, **`GetAuthorsRequest`**, and **`GetBreakingNewsRequest`** — getter methods were annotated `@JsonIgnore` instead of `@JsonProperty`, causing all query parameters to be silently dropped from GET requests; they are now correctly annotated and transmitted. + ## 2.1.1 - 2026-04-30 * fix: use field-presence checks in union deserializers to prevent misclassification * Previously, all union response deserializers attempted blind `convertValue` diff --git a/reference.md b/reference.md index 458dcb2..792342d 100644 --- a/reference.md +++ b/reference.md @@ -46,7 +46,7 @@ client.search().get( From.of(OffsetDateTime.parse("1 day ago")) ) .to( - To.of(OffsetDateTime.parse("1 day ago")) + To.of("now") ) .publishedDatePrecision("full") .byParseDate(true) @@ -146,7 +146,9 @@ Multiple countries with the number of top sources can be specified as a comma-se Word or phrase to search within the source names. To specify multiple values, use a comma-separated string. -**Note**: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like `"sport"` or `"new york times"`. For example, `"sport"` returns sources such as `"Motorsport"`, `"Dot Esport"`, and `"Tuttosport"`. +**Note**: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like `"sport"` or `"new york times"`. + +For example, `"sport"` returns sources such as `"Motorsport"`, `"Dot Esport"`, and `"Tuttosport"`. @@ -2561,7 +2563,7 @@ client.authors().get( From.of(OffsetDateTime.parse("1 day ago")) ) .to( - To.of(OffsetDateTime.parse("1 day ago")) + To.of("now") ) .publishedDatePrecision("full") .byParseDate(true) @@ -3475,7 +3477,7 @@ client.searchByLink().get( From.of(OffsetDateTime.parse("1 day ago")) ) .to( - To.of(OffsetDateTime.parse("1 day ago")) + To.of("now") ) .page(2) .pageSize(50) @@ -3630,15 +3632,6 @@ client.searchByLink().post(
**from:** `Optional` - -The starting point in time to search from. Accepts date-time strings in ISO 8601 format and plain text strings. The default time zone is UTC. - -Formats with examples: -- YYYY-mm-ddTHH:MM:SS: `2024-07-01T00:00:00` -- YYYY-MM-dd: `2024-07-01` -- YYYY/mm/dd HH:MM:SS: `2024/07/01 00:00:00` -- YYYY/mm/dd: `2024/07/01` -- English phrases: `1 day ago`, `today`
@@ -3647,15 +3640,6 @@ Formats with examples:
**to:** `Optional` - -The ending point in time to search up to. Accepts date-time strings in ISO 8601 format and plain text strings. The default time zone is UTC. - -Formats with examples: -- YYYY-mm-ddTHH:MM:SS: `2024-07-01T00:00:00` -- YYYY-MM-dd: `2024-07-01` -- YYYY/mm/dd HH:MM:SS: `2024/07/01 00:00:00` -- YYYY/mm/dd: `2024/07/01` -- English phrases: `1 day ago`, `now`
@@ -3790,7 +3774,9 @@ Multiple countries with the number of top sources can be specified as a comma-se Word or phrase to search within the source names. To specify multiple values, use a comma-separated string. -**Note**: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like `"sport"` or `"new york times"`. For example, `"sport"` returns sources such as `"Motorsport"`, `"Dot Esport"`, and `"Tuttosport"`. +**Note**: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like `"sport"` or `"new york times"`. + +For example, `"sport"` returns sources such as `"Motorsport"`, `"Dot Esport"`, and `"Tuttosport"`. @@ -4053,7 +4039,7 @@ client.aggregationCount().get( From.of(OffsetDateTime.parse("1 day ago")) ) .to( - To.of(OffsetDateTime.parse("1 day ago")) + To.of("now") ) .publishedDatePrecision("full") .byParseDate(true) diff --git a/src/main/java/com/newscatcher/api/core/ClientOptions.java b/src/main/java/com/newscatcher/api/core/ClientOptions.java index 608f28a..8455eaf 100644 --- a/src/main/java/com/newscatcher/api/core/ClientOptions.java +++ b/src/main/java/com/newscatcher/api/core/ClientOptions.java @@ -38,10 +38,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "com.newscatcherapi:newscatcher-sdk/2.1.1"); + put("User-Agent", "com.newscatcherapi:newscatcher-sdk/3.0.0"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.newscatcher.fern:api-sdk"); - put("X-Fern-SDK-Version", "2.1.1"); + put("X-Fern-SDK-Version", "3.0.0"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/newscatcher/api/resources/aggregationcount/requests/GetAggregationCountRequest.java b/src/main/java/com/newscatcher/api/resources/aggregationcount/requests/GetAggregationCountRequest.java index be02cf9..8b003f3 100644 --- a/src/main/java/com/newscatcher/api/resources/aggregationcount/requests/GetAggregationCountRequest.java +++ b/src/main/java/com/newscatcher/api/resources/aggregationcount/requests/GetAggregationCountRequest.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; @@ -212,17 +212,17 @@ private GetAggregationCountRequest( this.additionalProperties = additionalProperties; } - @JsonIgnore + @JsonProperty("q") public String getQ() { return q; } - @JsonIgnore + @JsonProperty("aggregation_by") public Optional getAggregationBy() { return aggregationBy; } - @JsonIgnore + @JsonProperty("search_in") public Optional getSearchIn() { return searchIn; } @@ -232,7 +232,7 @@ public Optional getSearchIn() { *

Format: start with the word top, followed by the number of desired sources, and then the two-letter country code ISO 3166-1 alpha-2.

*

Multiple countries with the number of top sources can be specified as a comma-separated string.

*/ - @JsonIgnore + @JsonProperty("predefined_sources") public Optional getPredefinedSources() { return predefinedSources; } @@ -240,7 +240,7 @@ public Optional getPredefinedSources() { /** * @return One or more news sources to narrow down the search. The format must be a domain URL. Subdomains, such as finance.yahoo.com, are also acceptable.To specify multiple sources, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("sources") public Optional getSources() { return sources; } @@ -248,7 +248,7 @@ public Optional getSources() { /** * @return The news sources to exclude from the search. To exclude multiple sources, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("not_sources") public Optional getNotSources() { return notSources; } @@ -257,7 +257,7 @@ public Optional getNotSources() { * @return The language(s) of the search. The only accepted format is the two-letter ISO 639-1 code. To select multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("lang") public Optional getLang() { return lang; } @@ -266,7 +266,7 @@ public Optional getLang() { * @return The language(s) to exclude from the search. The accepted format is the two-letter ISO 639-1 code. To exclude multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("not_lang") public Optional getNotLang() { return notLang; } @@ -275,7 +275,7 @@ public Optional getNotLang() { * @return The countries where the news publisher is located. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To select multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("countries") public Optional getCountries() { return countries; } @@ -284,7 +284,7 @@ public Optional getCountries() { * @return The publisher location countries to exclude from the search. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To exclude multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("not_countries") public Optional getNotCountries() { return notCountries; } @@ -292,62 +292,62 @@ public Optional getNotCountries() { /** * @return The list of author names to exclude from your search. To exclude articles by specific authors, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("not_author_name") public Optional getNotAuthorName() { return notAuthorName; } - @JsonIgnore + @JsonProperty("from_") public Optional getFrom() { return from; } - @JsonIgnore + @JsonProperty("to_") public Optional getTo() { return to; } - @JsonIgnore + @JsonProperty("published_date_precision") public Optional getPublishedDatePrecision() { return publishedDatePrecision; } - @JsonIgnore + @JsonProperty("by_parse_date") public Optional getByParseDate() { return byParseDate; } - @JsonIgnore + @JsonProperty("sort_by") public Optional getSortBy() { return sortBy; } - @JsonIgnore + @JsonProperty("ranked_only") public Optional getRankedOnly() { return rankedOnly; } - @JsonIgnore + @JsonProperty("from_rank") public Optional getFromRank() { return fromRank; } - @JsonIgnore + @JsonProperty("to_rank") public Optional getToRank() { return toRank; } - @JsonIgnore + @JsonProperty("is_headline") public Optional getIsHeadline() { return isHeadline; } - @JsonIgnore + @JsonProperty("is_opinion") public Optional getIsOpinion() { return isOpinion; } - @JsonIgnore + @JsonProperty("is_paid_content") public Optional getIsPaidContent() { return isPaidContent; } @@ -355,7 +355,7 @@ public Optional getIsPaidContent() { /** * @return The categorical URL(s) to filter your search. To filter your search by multiple categorical URLs, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("parent_url") public Optional getParentUrl() { return parentUrl; } @@ -364,7 +364,7 @@ public Optional getParentUrl() { * @return The complete URL(s) mentioned in the article. For multiple URLs, use a comma-separated string. *

For more details, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_links") public Optional getAllLinks() { return allLinks; } @@ -373,7 +373,7 @@ public Optional getAllLinks() { * @return The domain(s) mentioned in the article. For multiple domains, use a comma-separated string. *

For more details, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_domain_links") public Optional getAllDomainLinks() { return allDomainLinks; } @@ -383,87 +383,87 @@ public Optional getAllDomainLinks() { *

Note: When this parameter is used, the response includes the all_links_data field with detailed link information.

*

To learn more, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_links_text") public Optional getAllLinksText() { return allLinksText; } - @JsonIgnore + @JsonProperty("word_count_min") public Optional getWordCountMin() { return wordCountMin; } - @JsonIgnore + @JsonProperty("word_count_max") public Optional getWordCountMax() { return wordCountMax; } - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } - @JsonIgnore + @JsonProperty("include_nlp_data") public Optional getIncludeNlpData() { return includeNlpData; } - @JsonIgnore + @JsonProperty("has_nlp") public Optional getHasNlp() { return hasNlp; } - @JsonIgnore + @JsonProperty("theme") public Optional getTheme() { return theme; } - @JsonIgnore + @JsonProperty("not_theme") public Optional getNotTheme() { return notTheme; } - @JsonIgnore + @JsonProperty("ORG_entity_name") public Optional getOrgEntityName() { return orgEntityName; } - @JsonIgnore + @JsonProperty("PER_entity_name") public Optional getPerEntityName() { return perEntityName; } - @JsonIgnore + @JsonProperty("LOC_entity_name") public Optional getLocEntityName() { return locEntityName; } - @JsonIgnore + @JsonProperty("MISC_entity_name") public Optional getMiscEntityName() { return miscEntityName; } - @JsonIgnore + @JsonProperty("title_sentiment_min") public Optional getTitleSentimentMin() { return titleSentimentMin; } - @JsonIgnore + @JsonProperty("title_sentiment_max") public Optional getTitleSentimentMax() { return titleSentimentMax; } - @JsonIgnore + @JsonProperty("content_sentiment_min") public Optional getContentSentimentMin() { return contentSentimentMin; } - @JsonIgnore + @JsonProperty("content_sentiment_max") public Optional getContentSentimentMax() { return contentSentimentMax; } @@ -473,7 +473,7 @@ public Optional getContentSentimentMax() { *

Note: The iptc_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see IPTC Media Topic NewsCodes.

*/ - @JsonIgnore + @JsonProperty("iptc_tags") public Optional getIptcTags() { return iptcTags; } @@ -483,12 +483,12 @@ public Optional getIptcTags() { *

Note: The not_iptc_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see IPTC Media Topic NewsCodes.

*/ - @JsonIgnore + @JsonProperty("not_iptc_tags") public Optional getNotIptcTags() { return notIptcTags; } - @JsonIgnore + @JsonProperty("robots_compliant") public Optional getRobotsCompliant() { return robotsCompliant; } diff --git a/src/main/java/com/newscatcher/api/resources/authors/requests/GetAuthorsRequest.java b/src/main/java/com/newscatcher/api/resources/authors/requests/GetAuthorsRequest.java index b68f3c9..f89605f 100644 --- a/src/main/java/com/newscatcher/api/resources/authors/requests/GetAuthorsRequest.java +++ b/src/main/java/com/newscatcher/api/resources/authors/requests/GetAuthorsRequest.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; @@ -207,7 +207,7 @@ private GetAuthorsRequest( this.additionalProperties = additionalProperties; } - @JsonIgnore + @JsonProperty("author_name") public String getAuthorName() { return authorName; } @@ -215,7 +215,7 @@ public String getAuthorName() { /** * @return The list of author names to exclude from your search. To exclude articles by specific authors, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("not_author_name") public Optional getNotAuthorName() { return notAuthorName; } @@ -225,7 +225,7 @@ public Optional getNotAuthorName() { *

Format: start with the word top, followed by the number of desired sources, and then the two-letter country code ISO 3166-1 alpha-2.

*

Multiple countries with the number of top sources can be specified as a comma-separated string.

*/ - @JsonIgnore + @JsonProperty("predefined_sources") public Optional getPredefinedSources() { return predefinedSources; } @@ -233,7 +233,7 @@ public Optional getPredefinedSources() { /** * @return One or more news sources to narrow down the search. The format must be a domain URL. Subdomains, such as finance.yahoo.com, are also acceptable.To specify multiple sources, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("sources") public Optional getSources() { return sources; } @@ -241,7 +241,7 @@ public Optional getSources() { /** * @return The news sources to exclude from the search. To exclude multiple sources, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("not_sources") public Optional getNotSources() { return notSources; } @@ -250,7 +250,7 @@ public Optional getNotSources() { * @return The language(s) of the search. The only accepted format is the two-letter ISO 639-1 code. To select multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("lang") public Optional getLang() { return lang; } @@ -259,7 +259,7 @@ public Optional getLang() { * @return The language(s) to exclude from the search. The accepted format is the two-letter ISO 639-1 code. To exclude multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("not_lang") public Optional getNotLang() { return notLang; } @@ -268,7 +268,7 @@ public Optional getNotLang() { * @return The countries where the news publisher is located. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To select multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("countries") public Optional getCountries() { return countries; } @@ -277,62 +277,62 @@ public Optional getCountries() { * @return The publisher location countries to exclude from the search. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To exclude multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("not_countries") public Optional getNotCountries() { return notCountries; } - @JsonIgnore + @JsonProperty("from_") public Optional getFrom() { return from; } - @JsonIgnore + @JsonProperty("to_") public Optional getTo() { return to; } - @JsonIgnore + @JsonProperty("published_date_precision") public Optional getPublishedDatePrecision() { return publishedDatePrecision; } - @JsonIgnore + @JsonProperty("by_parse_date") public Optional getByParseDate() { return byParseDate; } - @JsonIgnore + @JsonProperty("sort_by") public Optional getSortBy() { return sortBy; } - @JsonIgnore + @JsonProperty("ranked_only") public Optional getRankedOnly() { return rankedOnly; } - @JsonIgnore + @JsonProperty("from_rank") public Optional getFromRank() { return fromRank; } - @JsonIgnore + @JsonProperty("to_rank") public Optional getToRank() { return toRank; } - @JsonIgnore + @JsonProperty("is_headline") public Optional getIsHeadline() { return isHeadline; } - @JsonIgnore + @JsonProperty("is_opinion") public Optional getIsOpinion() { return isOpinion; } - @JsonIgnore + @JsonProperty("is_paid_content") public Optional getIsPaidContent() { return isPaidContent; } @@ -340,7 +340,7 @@ public Optional getIsPaidContent() { /** * @return The categorical URL(s) to filter your search. To filter your search by multiple categorical URLs, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("parent_url") public Optional getParentUrl() { return parentUrl; } @@ -349,7 +349,7 @@ public Optional getParentUrl() { * @return The complete URL(s) mentioned in the article. For multiple URLs, use a comma-separated string. *

For more details, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_links") public Optional getAllLinks() { return allLinks; } @@ -358,7 +358,7 @@ public Optional getAllLinks() { * @return The domain(s) mentioned in the article. For multiple domains, use a comma-separated string. *

For more details, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_domain_links") public Optional getAllDomainLinks() { return allDomainLinks; } @@ -368,77 +368,77 @@ public Optional getAllDomainLinks() { *

Note: When this parameter is used, the response includes the all_links_data field with detailed link information.

*

To learn more, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_links_text") public Optional getAllLinksText() { return allLinksText; } - @JsonIgnore + @JsonProperty("word_count_min") public Optional getWordCountMin() { return wordCountMin; } - @JsonIgnore + @JsonProperty("word_count_max") public Optional getWordCountMax() { return wordCountMax; } - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } - @JsonIgnore + @JsonProperty("include_translation_fields") public Optional getIncludeTranslationFields() { return includeTranslationFields; } - @JsonIgnore + @JsonProperty("include_nlp_data") public Optional getIncludeNlpData() { return includeNlpData; } - @JsonIgnore + @JsonProperty("has_nlp") public Optional getHasNlp() { return hasNlp; } - @JsonIgnore + @JsonProperty("theme") public Optional getTheme() { return theme; } - @JsonIgnore + @JsonProperty("not_theme") public Optional getNotTheme() { return notTheme; } - @JsonIgnore + @JsonProperty("ner_name") public Optional getNerName() { return nerName; } - @JsonIgnore + @JsonProperty("title_sentiment_min") public Optional getTitleSentimentMin() { return titleSentimentMin; } - @JsonIgnore + @JsonProperty("title_sentiment_max") public Optional getTitleSentimentMax() { return titleSentimentMax; } - @JsonIgnore + @JsonProperty("content_sentiment_min") public Optional getContentSentimentMin() { return contentSentimentMin; } - @JsonIgnore + @JsonProperty("content_sentiment_max") public Optional getContentSentimentMax() { return contentSentimentMax; } @@ -448,7 +448,7 @@ public Optional getContentSentimentMax() { *

Note: The iptc_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see IPTC Media Topic NewsCodes.

*/ - @JsonIgnore + @JsonProperty("iptc_tags") public Optional getIptcTags() { return iptcTags; } @@ -458,7 +458,7 @@ public Optional getIptcTags() { *

Note: The not_iptc_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see IPTC Media Topic NewsCodes.

*/ - @JsonIgnore + @JsonProperty("not_iptc_tags") public Optional getNotIptcTags() { return notIptcTags; } @@ -468,7 +468,7 @@ public Optional getNotIptcTags() { *

Note: The iab_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see the IAB Content taxonomy.

*/ - @JsonIgnore + @JsonProperty("iab_tags") public Optional getIabTags() { return iabTags; } @@ -478,7 +478,7 @@ public Optional getIabTags() { *

Note: The not_iab_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see the IAB Content taxonomy.

*/ - @JsonIgnore + @JsonProperty("not_iab_tags") public Optional getNotIabTags() { return notIabTags; } @@ -491,12 +491,12 @@ public Optional getNotIabTags() { *

Example: custom_tags.industry="Manufacturing,Logistics"

*

To learn more, see the Custom tags.

*/ - @JsonIgnore + @JsonProperty("custom_tags") public Optional getCustomTags() { return customTags; } - @JsonIgnore + @JsonProperty("robots_compliant") public Optional getRobotsCompliant() { return robotsCompliant; } diff --git a/src/main/java/com/newscatcher/api/resources/breakingnews/requests/GetBreakingNewsRequest.java b/src/main/java/com/newscatcher/api/resources/breakingnews/requests/GetBreakingNewsRequest.java index 96765b0..e8101ad 100644 --- a/src/main/java/com/newscatcher/api/resources/breakingnews/requests/GetBreakingNewsRequest.java +++ b/src/main/java/com/newscatcher/api/resources/breakingnews/requests/GetBreakingNewsRequest.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; @@ -108,102 +108,102 @@ private GetBreakingNewsRequest( this.additionalProperties = additionalProperties; } - @JsonIgnore + @JsonProperty("sort_by") public Optional getSortBy() { return sortBy; } - @JsonIgnore + @JsonProperty("ranked_only") public Optional getRankedOnly() { return rankedOnly; } - @JsonIgnore + @JsonProperty("from_rank") public Optional getFromRank() { return fromRank; } - @JsonIgnore + @JsonProperty("to_rank") public Optional getToRank() { return toRank; } - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } - @JsonIgnore + @JsonProperty("top_n_articles") public Optional getTopNArticles() { return topNArticles; } - @JsonIgnore + @JsonProperty("include_translation_fields") public Optional getIncludeTranslationFields() { return includeTranslationFields; } - @JsonIgnore + @JsonProperty("include_nlp_data") public Optional getIncludeNlpData() { return includeNlpData; } - @JsonIgnore + @JsonProperty("has_nlp") public Optional getHasNlp() { return hasNlp; } - @JsonIgnore + @JsonProperty("theme") public Optional getTheme() { return theme; } - @JsonIgnore + @JsonProperty("not_theme") public Optional getNotTheme() { return notTheme; } - @JsonIgnore + @JsonProperty("ORG_entity_name") public Optional getOrgEntityName() { return orgEntityName; } - @JsonIgnore + @JsonProperty("PER_entity_name") public Optional getPerEntityName() { return perEntityName; } - @JsonIgnore + @JsonProperty("LOC_entity_name") public Optional getLocEntityName() { return locEntityName; } - @JsonIgnore + @JsonProperty("MISC_entity_name") public Optional getMiscEntityName() { return miscEntityName; } - @JsonIgnore + @JsonProperty("title_sentiment_min") public Optional getTitleSentimentMin() { return titleSentimentMin; } - @JsonIgnore + @JsonProperty("title_sentiment_max") public Optional getTitleSentimentMax() { return titleSentimentMax; } - @JsonIgnore + @JsonProperty("content_sentiment_min") public Optional getContentSentimentMin() { return contentSentimentMin; } - @JsonIgnore + @JsonProperty("content_sentiment_max") public Optional getContentSentimentMax() { return contentSentimentMax; } diff --git a/src/main/java/com/newscatcher/api/resources/latestheadlines/requests/GetLatestHeadlinesRequest.java b/src/main/java/com/newscatcher/api/resources/latestheadlines/requests/GetLatestHeadlinesRequest.java index 1c2266f..e4b0e78 100644 --- a/src/main/java/com/newscatcher/api/resources/latestheadlines/requests/GetLatestHeadlinesRequest.java +++ b/src/main/java/com/newscatcher/api/resources/latestheadlines/requests/GetLatestHeadlinesRequest.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; @@ -209,17 +209,17 @@ private GetLatestHeadlinesRequest( this.additionalProperties = additionalProperties; } - @JsonIgnore + @JsonProperty("when") public Optional getWhen() { return when; } - @JsonIgnore + @JsonProperty("by_parse_date") public Optional getByParseDate() { return byParseDate; } - @JsonIgnore + @JsonProperty("sort_by") public Optional getSortBy() { return sortBy; } @@ -228,7 +228,7 @@ public Optional getSortBy() { * @return The language(s) of the search. The only accepted format is the two-letter ISO 639-1 code. To select multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("lang") public Optional getLang() { return lang; } @@ -237,7 +237,7 @@ public Optional getLang() { * @return The language(s) to exclude from the search. The accepted format is the two-letter ISO 639-1 code. To exclude multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("not_lang") public Optional getNotLang() { return notLang; } @@ -246,7 +246,7 @@ public Optional getNotLang() { * @return The countries where the news publisher is located. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To select multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("countries") public Optional getCountries() { return countries; } @@ -255,7 +255,7 @@ public Optional getCountries() { * @return The publisher location countries to exclude from the search. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To exclude multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("not_countries") public Optional getNotCountries() { return notCountries; } @@ -265,7 +265,7 @@ public Optional getNotCountries() { *

Format: start with the word top, followed by the number of desired sources, and then the two-letter country code ISO 3166-1 alpha-2.

*

Multiple countries with the number of top sources can be specified as a comma-separated string.

*/ - @JsonIgnore + @JsonProperty("predefined_sources") public Optional getPredefinedSources() { return predefinedSources; } @@ -273,7 +273,7 @@ public Optional getPredefinedSources() { /** * @return One or more news sources to narrow down the search. The format must be a domain URL. Subdomains, such as finance.yahoo.com, are also acceptable.To specify multiple sources, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("sources") public Optional getSources() { return sources; } @@ -281,7 +281,7 @@ public Optional getSources() { /** * @return The news sources to exclude from the search. To exclude multiple sources, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("not_sources") public Optional getNotSources() { return notSources; } @@ -289,27 +289,27 @@ public Optional getNotSources() { /** * @return The list of author names to exclude from your search. To exclude articles by specific authors, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("not_author_name") public Optional getNotAuthorName() { return notAuthorName; } - @JsonIgnore + @JsonProperty("ranked_only") public Optional getRankedOnly() { return rankedOnly; } - @JsonIgnore + @JsonProperty("is_headline") public Optional getIsHeadline() { return isHeadline; } - @JsonIgnore + @JsonProperty("is_opinion") public Optional getIsOpinion() { return isOpinion; } - @JsonIgnore + @JsonProperty("is_paid_content") public Optional getIsPaidContent() { return isPaidContent; } @@ -317,7 +317,7 @@ public Optional getIsPaidContent() { /** * @return The categorical URL(s) to filter your search. To filter your search by multiple categorical URLs, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("parent_url") public Optional getParentUrl() { return parentUrl; } @@ -326,7 +326,7 @@ public Optional getParentUrl() { * @return The complete URL(s) mentioned in the article. For multiple URLs, use a comma-separated string. *

For more details, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_links") public Optional getAllLinks() { return allLinks; } @@ -335,7 +335,7 @@ public Optional getAllLinks() { * @return The domain(s) mentioned in the article. For multiple domains, use a comma-separated string. *

For more details, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_domain_links") public Optional getAllDomainLinks() { return allDomainLinks; } @@ -345,107 +345,107 @@ public Optional getAllDomainLinks() { *

Note: When this parameter is used, the response includes the all_links_data field with detailed link information.

*

To learn more, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_links_text") public Optional getAllLinksText() { return allLinksText; } - @JsonIgnore + @JsonProperty("word_count_min") public Optional getWordCountMin() { return wordCountMin; } - @JsonIgnore + @JsonProperty("word_count_max") public Optional getWordCountMax() { return wordCountMax; } - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } - @JsonIgnore + @JsonProperty("clustering_enabled") public Optional getClusteringEnabled() { return clusteringEnabled; } - @JsonIgnore + @JsonProperty("clustering_variable") public Optional getClusteringVariable() { return clusteringVariable; } - @JsonIgnore + @JsonProperty("clustering_threshold") public Optional getClusteringThreshold() { return clusteringThreshold; } - @JsonIgnore + @JsonProperty("include_translation_fields") public Optional getIncludeTranslationFields() { return includeTranslationFields; } - @JsonIgnore + @JsonProperty("include_nlp_data") public Optional getIncludeNlpData() { return includeNlpData; } - @JsonIgnore + @JsonProperty("has_nlp") public Optional getHasNlp() { return hasNlp; } - @JsonIgnore + @JsonProperty("theme") public Optional getTheme() { return theme; } - @JsonIgnore + @JsonProperty("not_theme") public Optional getNotTheme() { return notTheme; } - @JsonIgnore + @JsonProperty("ORG_entity_name") public Optional getOrgEntityName() { return orgEntityName; } - @JsonIgnore + @JsonProperty("PER_entity_name") public Optional getPerEntityName() { return perEntityName; } - @JsonIgnore + @JsonProperty("LOC_entity_name") public Optional getLocEntityName() { return locEntityName; } - @JsonIgnore + @JsonProperty("MISC_entity_name") public Optional getMiscEntityName() { return miscEntityName; } - @JsonIgnore + @JsonProperty("title_sentiment_min") public Optional getTitleSentimentMin() { return titleSentimentMin; } - @JsonIgnore + @JsonProperty("title_sentiment_max") public Optional getTitleSentimentMax() { return titleSentimentMax; } - @JsonIgnore + @JsonProperty("content_sentiment_min") public Optional getContentSentimentMin() { return contentSentimentMin; } - @JsonIgnore + @JsonProperty("content_sentiment_max") public Optional getContentSentimentMax() { return contentSentimentMax; } @@ -455,7 +455,7 @@ public Optional getContentSentimentMax() { *

Note: The iptc_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see IPTC Media Topic NewsCodes.

*/ - @JsonIgnore + @JsonProperty("iptc_tags") public Optional getIptcTags() { return iptcTags; } @@ -465,7 +465,7 @@ public Optional getIptcTags() { *

Note: The not_iptc_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see IPTC Media Topic NewsCodes.

*/ - @JsonIgnore + @JsonProperty("not_iptc_tags") public Optional getNotIptcTags() { return notIptcTags; } @@ -475,7 +475,7 @@ public Optional getNotIptcTags() { *

Note: The iab_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see the IAB Content taxonomy.

*/ - @JsonIgnore + @JsonProperty("iab_tags") public Optional getIabTags() { return iabTags; } @@ -485,7 +485,7 @@ public Optional getIabTags() { *

Note: The not_iab_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see the IAB Content taxonomy.

*/ - @JsonIgnore + @JsonProperty("not_iab_tags") public Optional getNotIabTags() { return notIabTags; } @@ -498,12 +498,12 @@ public Optional getNotIabTags() { *

Example: custom_tags.industry="Manufacturing,Logistics"

*

To learn more, see the Custom tags.

*/ - @JsonIgnore + @JsonProperty("custom_tags") public Optional getCustomTags() { return customTags; } - @JsonIgnore + @JsonProperty("robots_compliant") public Optional getRobotsCompliant() { return robotsCompliant; } diff --git a/src/main/java/com/newscatcher/api/resources/search/requests/GetSearchRequest.java b/src/main/java/com/newscatcher/api/resources/search/requests/GetSearchRequest.java index 8742f76..ff51684 100644 --- a/src/main/java/com/newscatcher/api/resources/search/requests/GetSearchRequest.java +++ b/src/main/java/com/newscatcher/api/resources/search/requests/GetSearchRequest.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; @@ -261,17 +261,17 @@ private GetSearchRequest( this.additionalProperties = additionalProperties; } - @JsonIgnore + @JsonProperty("q") public String getQ() { return q; } - @JsonIgnore + @JsonProperty("search_in") public Optional getSearchIn() { return searchIn; } - @JsonIgnore + @JsonProperty("include_translation_fields") public Optional getIncludeTranslationFields() { return includeTranslationFields; } @@ -281,16 +281,17 @@ public Optional getIncludeTranslationFields() { *

Format: start with the word top, followed by the number of desired sources, and then the two-letter country code ISO 3166-1 alpha-2.

*

Multiple countries with the number of top sources can be specified as a comma-separated string.

*/ - @JsonIgnore + @JsonProperty("predefined_sources") public Optional getPredefinedSources() { return predefinedSources; } /** * @return Word or phrase to search within the source names. To specify multiple values, use a comma-separated string. - *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times". For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

+ *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times".

+ *

For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

*/ - @JsonIgnore + @JsonProperty("source_name") public Optional getSourceName() { return sourceName; } @@ -298,7 +299,7 @@ public Optional getSourceName() { /** * @return One or more news sources to narrow down the search. The format must be a domain URL. Subdomains, such as finance.yahoo.com, are also acceptable.To specify multiple sources, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("sources") public Optional getSources() { return sources; } @@ -306,7 +307,7 @@ public Optional getSources() { /** * @return The news sources to exclude from the search. To exclude multiple sources, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("not_sources") public Optional getNotSources() { return notSources; } @@ -315,7 +316,7 @@ public Optional getNotSources() { * @return The language(s) of the search. The only accepted format is the two-letter ISO 639-1 code. To select multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("lang") public Optional getLang() { return lang; } @@ -324,7 +325,7 @@ public Optional getLang() { * @return The language(s) to exclude from the search. The accepted format is the two-letter ISO 639-1 code. To exclude multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("not_lang") public Optional getNotLang() { return notLang; } @@ -333,7 +334,7 @@ public Optional getNotLang() { * @return The countries where the news publisher is located. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To select multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("countries") public Optional getCountries() { return countries; } @@ -342,7 +343,7 @@ public Optional getCountries() { * @return The publisher location countries to exclude from the search. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To exclude multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("not_countries") public Optional getNotCountries() { return notCountries; } @@ -350,62 +351,62 @@ public Optional getNotCountries() { /** * @return The list of author names to exclude from your search. To exclude articles by specific authors, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("not_author_name") public Optional getNotAuthorName() { return notAuthorName; } - @JsonIgnore + @JsonProperty("from_") public Optional getFrom() { return from; } - @JsonIgnore + @JsonProperty("to_") public Optional getTo() { return to; } - @JsonIgnore + @JsonProperty("published_date_precision") public Optional getPublishedDatePrecision() { return publishedDatePrecision; } - @JsonIgnore + @JsonProperty("by_parse_date") public Optional getByParseDate() { return byParseDate; } - @JsonIgnore + @JsonProperty("sort_by") public Optional getSortBy() { return sortBy; } - @JsonIgnore + @JsonProperty("ranked_only") public Optional getRankedOnly() { return rankedOnly; } - @JsonIgnore + @JsonProperty("from_rank") public Optional getFromRank() { return fromRank; } - @JsonIgnore + @JsonProperty("to_rank") public Optional getToRank() { return toRank; } - @JsonIgnore + @JsonProperty("is_headline") public Optional getIsHeadline() { return isHeadline; } - @JsonIgnore + @JsonProperty("is_opinion") public Optional getIsOpinion() { return isOpinion; } - @JsonIgnore + @JsonProperty("is_paid_content") public Optional getIsPaidContent() { return isPaidContent; } @@ -413,7 +414,7 @@ public Optional getIsPaidContent() { /** * @return The categorical URL(s) to filter your search. To filter your search by multiple categorical URLs, use a comma-separated string. */ - @JsonIgnore + @JsonProperty("parent_url") public Optional getParentUrl() { return parentUrl; } @@ -422,7 +423,7 @@ public Optional getParentUrl() { * @return The complete URL(s) mentioned in the article. For multiple URLs, use a comma-separated string. *

For more details, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_links") public Optional getAllLinks() { return allLinks; } @@ -431,7 +432,7 @@ public Optional getAllLinks() { * @return The domain(s) mentioned in the article. For multiple domains, use a comma-separated string. *

For more details, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_domain_links") public Optional getAllDomainLinks() { return allDomainLinks; } @@ -441,22 +442,22 @@ public Optional getAllDomainLinks() { *

Note: When this parameter is used, the response includes the all_links_data field with detailed link information.

*

To learn more, see Search by URL.

*/ - @JsonIgnore + @JsonProperty("all_links_text") public Optional getAllLinksText() { return allLinksText; } - @JsonIgnore + @JsonProperty("additional_domain_info") public Optional getAdditionalDomainInfo() { return additionalDomainInfo; } - @JsonIgnore + @JsonProperty("is_news_domain") public Optional getIsNewsDomain() { return isNewsDomain; } - @JsonIgnore + @JsonProperty("news_domain_type") public Optional getNewsDomainType() { return newsDomainType; } @@ -465,102 +466,102 @@ public Optional getNewsDomainType() { * @return Filters results based on the news type. Multiple types can be specified using a comma-separated string. *

For a complete list of available news types, see Enumerated parameters > News type.

*/ - @JsonIgnore + @JsonProperty("news_type") public Optional getNewsType() { return newsType; } - @JsonIgnore + @JsonProperty("word_count_min") public Optional getWordCountMin() { return wordCountMin; } - @JsonIgnore + @JsonProperty("word_count_max") public Optional getWordCountMax() { return wordCountMax; } - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } - @JsonIgnore + @JsonProperty("clustering_enabled") public Optional getClusteringEnabled() { return clusteringEnabled; } - @JsonIgnore + @JsonProperty("clustering_variable") public Optional getClusteringVariable() { return clusteringVariable; } - @JsonIgnore + @JsonProperty("clustering_threshold") public Optional getClusteringThreshold() { return clusteringThreshold; } - @JsonIgnore + @JsonProperty("include_nlp_data") public Optional getIncludeNlpData() { return includeNlpData; } - @JsonIgnore + @JsonProperty("has_nlp") public Optional getHasNlp() { return hasNlp; } - @JsonIgnore + @JsonProperty("theme") public Optional getTheme() { return theme; } - @JsonIgnore + @JsonProperty("not_theme") public Optional getNotTheme() { return notTheme; } - @JsonIgnore + @JsonProperty("ORG_entity_name") public Optional getOrgEntityName() { return orgEntityName; } - @JsonIgnore + @JsonProperty("PER_entity_name") public Optional getPerEntityName() { return perEntityName; } - @JsonIgnore + @JsonProperty("LOC_entity_name") public Optional getLocEntityName() { return locEntityName; } - @JsonIgnore + @JsonProperty("MISC_entity_name") public Optional getMiscEntityName() { return miscEntityName; } - @JsonIgnore + @JsonProperty("title_sentiment_min") public Optional getTitleSentimentMin() { return titleSentimentMin; } - @JsonIgnore + @JsonProperty("title_sentiment_max") public Optional getTitleSentimentMax() { return titleSentimentMax; } - @JsonIgnore + @JsonProperty("content_sentiment_min") public Optional getContentSentimentMin() { return contentSentimentMin; } - @JsonIgnore + @JsonProperty("content_sentiment_max") public Optional getContentSentimentMax() { return contentSentimentMax; } @@ -570,7 +571,7 @@ public Optional getContentSentimentMax() { *

Note: The iptc_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see IPTC Media Topic NewsCodes.

*/ - @JsonIgnore + @JsonProperty("iptc_tags") public Optional getIptcTags() { return iptcTags; } @@ -580,7 +581,7 @@ public Optional getIptcTags() { *

Note: The not_iptc_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see IPTC Media Topic NewsCodes.

*/ - @JsonIgnore + @JsonProperty("not_iptc_tags") public Optional getNotIptcTags() { return notIptcTags; } @@ -590,7 +591,7 @@ public Optional getNotIptcTags() { *

Note: The iab_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see the IAB Content taxonomy.

*/ - @JsonIgnore + @JsonProperty("iab_tags") public Optional getIabTags() { return iabTags; } @@ -600,7 +601,7 @@ public Optional getIabTags() { *

Note: The not_iab_tags parameter is only available in the v3_nlp_iptc_tags subscription plan.

*

To learn more, see the IAB Content taxonomy.

*/ - @JsonIgnore + @JsonProperty("not_iab_tags") public Optional getNotIabTags() { return notIabTags; } @@ -613,17 +614,17 @@ public Optional getNotIabTags() { *

Example: custom_tags.industry="Manufacturing,Logistics"

*

To learn more, see the Custom tags.

*/ - @JsonIgnore + @JsonProperty("custom_tags") public Optional getCustomTags() { return customTags; } - @JsonIgnore + @JsonProperty("exclude_duplicates") public Optional getExcludeDuplicates() { return excludeDuplicates; } - @JsonIgnore + @JsonProperty("robots_compliant") public Optional getRobotsCompliant() { return robotsCompliant; } @@ -802,7 +803,8 @@ public interface _FinalStage { /** *

Word or phrase to search within the source names. To specify multiple values, use a comma-separated string.

- *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times". For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

+ *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times".

+ *

For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

*/ _FinalStage sourceName(Optional sourceName); @@ -2121,7 +2123,8 @@ public _FinalStage sources(Optional sources) { /** *

Word or phrase to search within the source names. To specify multiple values, use a comma-separated string.

- *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times". For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

+ *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times".

+ *

For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

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

Word or phrase to search within the source names. To specify multiple values, use a comma-separated string.

- *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times". For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

+ *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times".

+ *

For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

*/ @java.lang.Override @JsonSetter(value = "source_name", nulls = Nulls.SKIP) diff --git a/src/main/java/com/newscatcher/api/resources/searchbylink/requests/GetSearchByLinkRequest.java b/src/main/java/com/newscatcher/api/resources/searchbylink/requests/GetSearchByLinkRequest.java index a51c2df..5979dae 100644 --- a/src/main/java/com/newscatcher/api/resources/searchbylink/requests/GetSearchByLinkRequest.java +++ b/src/main/java/com/newscatcher/api/resources/searchbylink/requests/GetSearchByLinkRequest.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; @@ -61,7 +61,7 @@ private GetSearchByLinkRequest( * @return The Newscatcher article ID (corresponds to the _id field in API response) or a list of article IDs to search for. To specify multiple IDs, use a comma-separated string. *

Caution: You can use either the links or the ids parameter, but not both at the same time.

*/ - @JsonIgnore + @JsonProperty("ids") public Optional getIds() { return ids; } @@ -70,32 +70,32 @@ public Optional getIds() { * @return The article link or list of article links to search for. To specify multiple links, use a comma-separated string. *

Caution: You can use either the links or the ids parameter, but not both at the same time.

*/ - @JsonIgnore + @JsonProperty("links") public Optional getLinks() { return links; } - @JsonIgnore + @JsonProperty("from_") public Optional getFrom() { return from; } - @JsonIgnore + @JsonProperty("to_") public Optional getTo() { return to; } - @JsonIgnore + @JsonProperty("page") public Optional getPage() { return page; } - @JsonIgnore + @JsonProperty("page_size") public Optional getPageSize() { return pageSize; } - @JsonIgnore + @JsonProperty("robots_compliant") public Optional getRobotsCompliant() { return robotsCompliant; } diff --git a/src/main/java/com/newscatcher/api/resources/searchbylink/requests/PostSearchByLinkRequest.java b/src/main/java/com/newscatcher/api/resources/searchbylink/requests/PostSearchByLinkRequest.java index ac85416..56c5328 100644 --- a/src/main/java/com/newscatcher/api/resources/searchbylink/requests/PostSearchByLinkRequest.java +++ b/src/main/java/com/newscatcher/api/resources/searchbylink/requests/PostSearchByLinkRequest.java @@ -69,33 +69,11 @@ public Optional getLinks() { return links; } - /** - * @return The starting point in time to search from. Accepts date-time strings in ISO 8601 format and plain text strings. The default time zone is UTC. - *

Formats with examples:

- *
    - *
  • YYYY-mm-ddTHH:MM:SS: 2024-07-01T00:00:00
  • - *
  • YYYY-MM-dd: 2024-07-01
  • - *
  • YYYY/mm/dd HH:MM:SS: 2024/07/01 00:00:00
  • - *
  • YYYY/mm/dd: 2024/07/01
  • - *
  • English phrases: 1 day ago, today
  • - *
- */ @JsonProperty("from_") public Optional getFrom() { return from; } - /** - * @return The ending point in time to search up to. Accepts date-time strings in ISO 8601 format and plain text strings. The default time zone is UTC. - *

Formats with examples:

- *
    - *
  • YYYY-mm-ddTHH:MM:SS: 2024-07-01T00:00:00
  • - *
  • YYYY-MM-dd: 2024-07-01
  • - *
  • YYYY/mm/dd HH:MM:SS: 2024/07/01 00:00:00
  • - *
  • YYYY/mm/dd: 2024/07/01
  • - *
  • English phrases: 1 day ago, now
  • - *
- */ @JsonProperty("to_") public Optional getTo() { return to; @@ -205,17 +183,6 @@ public Builder links(Links links) { return this; } - /** - *

The starting point in time to search from. Accepts date-time strings in ISO 8601 format and plain text strings. The default time zone is UTC.

- *

Formats with examples:

- *
    - *
  • YYYY-mm-ddTHH:MM:SS: 2024-07-01T00:00:00
  • - *
  • YYYY-MM-dd: 2024-07-01
  • - *
  • YYYY/mm/dd HH:MM:SS: 2024/07/01 00:00:00
  • - *
  • YYYY/mm/dd: 2024/07/01
  • - *
  • English phrases: 1 day ago, today
  • - *
- */ @JsonSetter(value = "from_", nulls = Nulls.SKIP) public Builder from(Optional from) { this.from = from; @@ -227,17 +194,6 @@ public Builder from(From from) { return this; } - /** - *

The ending point in time to search up to. Accepts date-time strings in ISO 8601 format and plain text strings. The default time zone is UTC.

- *

Formats with examples:

- *
    - *
  • YYYY-mm-ddTHH:MM:SS: 2024-07-01T00:00:00
  • - *
  • YYYY-MM-dd: 2024-07-01
  • - *
  • YYYY/mm/dd HH:MM:SS: 2024/07/01 00:00:00
  • - *
  • YYYY/mm/dd: 2024/07/01
  • - *
  • English phrases: 1 day ago, now
  • - *
- */ @JsonSetter(value = "to_", nulls = Nulls.SKIP) public Builder to(Optional to) { this.to = to; diff --git a/src/main/java/com/newscatcher/api/resources/sources/requests/GetSourcesRequest.java b/src/main/java/com/newscatcher/api/resources/sources/requests/GetSourcesRequest.java index c7c6e35..97bcda1 100644 --- a/src/main/java/com/newscatcher/api/resources/sources/requests/GetSourcesRequest.java +++ b/src/main/java/com/newscatcher/api/resources/sources/requests/GetSourcesRequest.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; @@ -76,7 +76,7 @@ private GetSourcesRequest( * @return The language(s) of the search. The only accepted format is the two-letter ISO 639-1 code. To select multiple languages, use a comma-separated string. *

To learn more, see Enumerated parameters > Language.

*/ - @JsonIgnore + @JsonProperty("lang") public Optional getLang() { return lang; } @@ -85,7 +85,7 @@ public Optional getLang() { * @return The countries where the news publisher is located. The accepted format is the two-letter ISO 3166-1 alpha-2 code. To select multiple countries, use a comma-separated string. *

To learn more, see Enumerated parameters > Country.

*/ - @JsonIgnore + @JsonProperty("countries") public Optional getCountries() { return countries; } @@ -95,16 +95,17 @@ public Optional getCountries() { *

Format: start with the word top, followed by the number of desired sources, and then the two-letter country code ISO 3166-1 alpha-2.

*

Multiple countries with the number of top sources can be specified as a comma-separated string.

*/ - @JsonIgnore + @JsonProperty("predefined_sources") public Optional getPredefinedSources() { return predefinedSources; } /** * @return Word or phrase to search within the source names. To specify multiple values, use a comma-separated string. - *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times". For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

+ *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times".

+ *

For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

*/ - @JsonIgnore + @JsonProperty("source_name") public Optional getSourceName() { return sourceName; } @@ -114,22 +115,22 @@ public Optional getSourceName() { *

Caution: When specifying the source_url parameter, * you can only use include_additional_info as an extra parameter.

*/ - @JsonIgnore + @JsonProperty("source_url") public Optional getSourceUrl() { return sourceUrl; } - @JsonIgnore + @JsonProperty("include_additional_info") public Optional getIncludeAdditionalInfo() { return includeAdditionalInfo; } - @JsonIgnore + @JsonProperty("is_news_domain") public Optional getIsNewsDomain() { return isNewsDomain; } - @JsonIgnore + @JsonProperty("news_domain_type") public Optional getNewsDomainType() { return newsDomainType; } @@ -138,17 +139,17 @@ public Optional getNewsDomainType() { * @return Filters results based on the news type. Multiple types can be specified using a comma-separated string. *

For a complete list of available news types, see Enumerated parameters > News type.

*/ - @JsonIgnore + @JsonProperty("news_type") public Optional getNewsType() { return newsType; } - @JsonIgnore + @JsonProperty("from_rank") public Optional getFromRank() { return fromRank; } - @JsonIgnore + @JsonProperty("to_rank") public Optional getToRank() { return toRank; } @@ -295,7 +296,8 @@ public Builder predefinedSources(String predefinedSources) { /** *

Word or phrase to search within the source names. To specify multiple values, use a comma-separated string.

- *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times". For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

+ *

Note: The search doesn't require an exact match and returns sources containing the specified terms in their names. You can use any word or phrase, like "sport" or "new york times".

+ *

For example, "sport" returns sources such as "Motorsport", "Dot Esport", and "Tuttosport".

*/ @JsonSetter(value = "source_name", nulls = Nulls.SKIP) public Builder sourceName(Optional sourceName) { diff --git a/src/main/java/com/newscatcher/api/types/NlpDataEntity.java b/src/main/java/com/newscatcher/api/types/NlpDataEntity.java index fd041a2..da025b1 100644 --- a/src/main/java/com/newscatcher/api/types/NlpDataEntity.java +++ b/src/main/java/com/newscatcher/api/types/NlpDataEntity.java @@ -21,7 +21,7 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = NlpDataEntity.Builder.class) public final class NlpDataEntity { - private final Optional summaryTranslated; + private final Optional translationSummary; private final Optional theme; @@ -58,7 +58,7 @@ public final class NlpDataEntity { private final Map additionalProperties; private NlpDataEntity( - Optional summaryTranslated, + Optional translationSummary, Optional theme, Optional summary, Optional sentiment, @@ -76,7 +76,7 @@ private NlpDataEntity( Optional> iptcTagsId, Optional> iabTagsName, Map additionalProperties) { - this.summaryTranslated = summaryTranslated; + this.translationSummary = translationSummary; this.theme = theme; this.summary = summary; this.sentiment = sentiment; @@ -99,9 +99,9 @@ private NlpDataEntity( /** * @return A brief AI-generated summary of the article's English translation. */ - @JsonProperty("summary_translated") - public Optional getSummaryTranslated() { - return summaryTranslated; + @JsonProperty("translation_summary") + public Optional getTranslationSummary() { + return translationSummary; } /** @@ -246,7 +246,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(NlpDataEntity other) { - return summaryTranslated.equals(other.summaryTranslated) + return translationSummary.equals(other.translationSummary) && theme.equals(other.theme) && summary.equals(other.summary) && sentiment.equals(other.sentiment) @@ -268,7 +268,7 @@ private boolean equalTo(NlpDataEntity other) { @java.lang.Override public int hashCode() { return Objects.hash( - this.summaryTranslated, + this.translationSummary, this.theme, this.summary, this.sentiment, @@ -298,7 +298,7 @@ public static Builder builder() { @JsonIgnoreProperties(ignoreUnknown = true) public static final class Builder { - private Optional summaryTranslated = Optional.empty(); + private Optional translationSummary = Optional.empty(); private Optional theme = Optional.empty(); @@ -338,7 +338,7 @@ public static final class Builder { private Builder() {} public Builder from(NlpDataEntity other) { - summaryTranslated(other.getSummaryTranslated()); + translationSummary(other.getTranslationSummary()); theme(other.getTheme()); summary(other.getSummary()); sentiment(other.getSentiment()); @@ -361,14 +361,14 @@ public Builder from(NlpDataEntity other) { /** *

A brief AI-generated summary of the article's English translation.

*/ - @JsonSetter(value = "summary_translated", nulls = Nulls.SKIP) - public Builder summaryTranslated(Optional summaryTranslated) { - this.summaryTranslated = summaryTranslated; + @JsonSetter(value = "translation_summary", nulls = Nulls.SKIP) + public Builder translationSummary(Optional translationSummary) { + this.translationSummary = translationSummary; return this; } - public Builder summaryTranslated(String summaryTranslated) { - this.summaryTranslated = Optional.ofNullable(summaryTranslated); + public Builder translationSummary(String translationSummary) { + this.translationSummary = Optional.ofNullable(translationSummary); return this; } @@ -600,7 +600,7 @@ public Builder iabTagsName(List iabTagsName) { public NlpDataEntity build() { return new NlpDataEntity( - summaryTranslated, + translationSummary, theme, summary, sentiment, diff --git a/src/main/java/com/newscatcher/api/types/To.java b/src/main/java/com/newscatcher/api/types/To.java index e492fdd..15cc551 100644 --- a/src/main/java/com/newscatcher/api/types/To.java +++ b/src/main/java/com/newscatcher/api/types/To.java @@ -33,9 +33,9 @@ public Object get() { @SuppressWarnings("unchecked") public T visit(Visitor visitor) { if (this.type == 0) { - return visitor.visit((OffsetDateTime) this.value); - } else if (this.type == 1) { return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((OffsetDateTime) this.value); } throw new IllegalStateException("Failed to visit value. This should never happen."); } @@ -60,18 +60,18 @@ public String toString() { return this.value.toString(); } - public static To of(OffsetDateTime value) { + public static To of(String value) { return new To(value, 0); } - public static To of(String value) { + public static To of(OffsetDateTime value) { return new To(value, 1); } public interface Visitor { - T visit(OffsetDateTime value); - T visit(String value); + + T visit(OffsetDateTime value); } static final class Deserializer extends StdDeserializer { @@ -83,11 +83,11 @@ static final class Deserializer extends StdDeserializer { public To deserialize(JsonParser p, DeserializationContext context) throws IOException { Object value = p.readValueAs(Object.class); try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, OffsetDateTime.class)); + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); } catch (RuntimeException e) { } try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + return of(ObjectMappers.JSON_MAPPER.convertValue(value, OffsetDateTime.class)); } catch (RuntimeException e) { } throw new JsonParseException(p, "Failed to deserialize");