Repository navigation
Conversation
Adds the v2 endpoints (newsV2, marketV2, cryptoV2, sourcesV2 and the three
count endpoints) alongside v1, each taking v2's snake_case filter vocabulary:
source_url / exclude_source_url replace the four domain filters,
source_priority replaces prioritydomain, and content replaces full_content.
There is no /2/archive — newsV2 covers historical news through from_date /
to_date. Responses read v2's total_results / next_page as well as v1's
totalResults / nextPage, so callers need not branch on the version.
A 429 whose body says the API credits are exhausted is no longer retried and
now throws NewsdataApiLimitExceededError (the account's whole pool) or
NewsdataApiKeyLimitExceededError (this one key's cap). Both extend
NewsdataRateLimitError, so existing catches keep working.
BREAKING: the real-time service moved to API v2. The management endpoints are
now /2/websocket/{register,fetch,delete}, news_type is "news" rather than
"latest", and websocketRegister takes the v2 filter vocabulary. Streamed
responses and websocketFetch now carry total_results, and websocketFetch
answers with a flat results list (one entry per query, each with a new
last_used timestamp) rather than nesting it under results['queries'].
RegistrationLimitExceeded — every registration the plan allows is in use — is
likewise never retried, but keeps the plain NewsdataRateLimitError, since it
is about slots rather than credits.
BREAKING: the base URL is now the API root without a version segment
(https://newsdata.io/api/); the endpoint paths carry 1/ or 2/. Drop the
trailing 1/ if you override it.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the v2 endpoints (
newsV2,marketV2,cryptoV2,sourcesV2and the three count endpoints) alongside v1, each taking v2's snake_case filter vocabulary:source_url/exclude_source_urlreplace the four domain filters,source_priorityreplacesprioritydomain, andcontentreplacesfull_content. There is no/2/archive—newsV2covers historical news throughfrom_date/to_date. Responses read v2'stotal_results/next_pageas well as v1'stotalResults/nextPage, so callers need not branch on the version.A 429 whose body says the API credits are exhausted is no longer retried and now throws
NewsdataApiLimitExceededError(the account's whole pool) orNewsdataApiKeyLimitExceededError(this one key's cap). Both extendNewsdataRateLimitError, so existing catches keep working.Breaking
/2/websocket/{register,fetch,delete},news_typeisnewsrather thanlatest, andwebsocketRegistertakes the v2 filter vocabulary. Streamed responses andwebsocketFetchnow carrytotal_results, andwebsocketFetchanswers with a flatresultslist (one entry per query, each with a newlast_usedtimestamp) rather than nesting it underresults['queries'].RegistrationLimitExceeded— every registration the plan allows is in use — is likewise never retried, but keeps the plainNewsdataRateLimitError, since it is about slots rather than credits.https://newsdata.io/api/); the endpoint paths carry1/or2/. Drop the trailing1/if you override it.Because this breaks the public surface and the package is on 1.2.1, it is intended to release as 2.0.0, matching the reactjs client.
Verification
phpunit83 tests / 153 assertions OK;phpstanreports no errors;php-cs-fixerfinds 0 of 32 files to fix.