Skip to content

Comments

Add EU endpoint support and improve API client functionality#9

Merged
jonathan-kosgei merged 2 commits intomasterfrom
claude/update-ipdata-api-3ggxS
Feb 24, 2026
Merged

Add EU endpoint support and improve API client functionality#9
jonathan-kosgei merged 2 commits intomasterfrom
claude/update-ipdata-api-3ggxS

Conversation

@jonathan-kosgei
Copy link
Collaborator

Summary

This PR enhances the Ipdata API client with support for EU endpoints, improves the lookup functionality, and updates documentation and tests to reflect these changes.

Key Changes

Source Code Improvements

  • EU Endpoint Support: Added EU_BASE_URL constant and $baseUrl parameter to constructor, allowing users to route requests through EU servers for GDPR compliance
  • Caller IP Lookup: Modified lookup() method to accept an optional IP parameter (defaults to empty string), enabling lookup of the calling IP address when no argument is provided
  • Method Rename: Renamed buildLookup() to bulkLookup() for better naming consistency, with buildLookup() kept as a deprecated alias for backward compatibility
  • Content-Type Fix: Changed bulk lookup Content-Type header from text/plain to application/json for correct API specification
  • Base URL Refactoring: Replaced hardcoded BASE_URL constant with configurable $baseUrl instance variable

Test Coverage

  • Added testCallerIpLookup() to verify lookup without IP argument
  • Added testBulkLookup() to verify bulk lookup request structure
  • Added testBulkLookupContentType() to verify correct Content-Type header
  • Added testCustomBaseUrl() to verify EU endpoint functionality
  • Renamed testConstructWithDiscovery() to testConstructWithDiscoveryThrowsWhenNoClientAvailable() and updated to verify exception handling
  • Enhanced mock response data with additional fields: company, is_vpn, is_icloud_relay, is_datacenter, blocklists, and scores

Documentation Updates

  • Added EU endpoint usage example
  • Clarified lookup functionality with separate sections for caller IP and specific IP lookups
  • Fixed typo: buildLookup()bulkLookup() in README example
  • Updated example response to include new API fields

Dependencies

  • Removed unused php-http/httplug and symfony/http-client from dev dependencies

https://claude.ai/code/session_017km7GVfNGXQe2UGceb34hf

Add caller IP lookup (lookup with no args), EU endpoint support via
configurable base URL and Ipdata::EU_BASE_URL constant, and properly
named bulkLookup() method with buildLookup() kept as deprecated alias.
Fix bulk request Content-Type from text/plain to application/json.

https://claude.ai/code/session_017km7GVfNGXQe2UGceb34hf
Neither package was imported or used anywhere in source or tests.
symfony/http-client was only implicitly needed to make the auto-discovery
test pass; updated that test to instead verify the expected LogicException
when no PSR-18 client is installed.

https://claude.ai/code/session_017km7GVfNGXQe2UGceb34hf
@jonathan-kosgei jonathan-kosgei merged commit a873513 into master Feb 24, 2026
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants