Skip to content

2.1.0

Latest

Choose a tag to compare

@barryceelen barryceelen released this 05 Jun 16:46
· 4 commits to main since this release

Added

  • Configurable API endpoint. Client::__construct() and Request::__construct() now accept a second $endpoint argument.
  • Automatic auth-header selection. The correct header is picked from the configured host: x-cg-pro-api-key for pro-api.coingecko.com, x-cg-demo-api-key for api.coingecko.com.
  • Client::companies() accessor. The Companies endpoint class existed but was not reachable from Client.
  • Retry with backoff on transient failures. Request::get() now retries once on network errors, HTTP 429, and HTTP 5xx.
  • Explicit 20s request timeout for the non-VIP wp_remote_get() path.

Changed

  • Default endpoint is now the Demo host (https://api.coingecko.com/api/v3).
  • WP_Error code on HTTP > 399 is now namespaced as http_<status> (e.g. http_429, http_500, http_404) instead of the previous catch-all coingecko_api_response.
  • Error message extraction now also reads status.error_message from Pro-API error envelopes.
  • JSON decode failures now report json_last_error_msg() instead of the numeric json_last_error().
  • Request::get() refactored into smaller, individually testable helpers: do_request(), backoff_us(), retry_after_seconds(), and the existing parse_response().

Fixed

  • Docblock @param for Request::get( $path, $args ) corrected from string to array.
  • Categories::get_categories( $order ) no longer drops the order argument.
  • Path segments are URL-encoded.
  • Client::categories() docblock @return corrected from Coins to Categories.
  • Client::companies() he Companies class was unreachable from Client.

Full Changelog: v2.0.0...v2.1.0