Skip to content

⚠️ !Breaking Change! Reorder constructor parameters, remove $userAgent - #36

Merged
pavog merged 1 commit into
masterfrom
align-constructor
Oct 19, 2026
Merged

pavog merged 1 commit into
masterfrom
align-constructor

Conversation

@pavog

@pavog pavog commented Oct 19, 2026

Copy link
Copy Markdown
Member

The constructor of HangarAPIClient now takes the API key first, followed by the configuration and the HTTP client. This matches the other API clients (for Modrinth and CurseForge):

// before
$client = new HangarAPIClient(null, "api-key");

// after
$client = new HangarAPIClient("api-key");

Breaking changes

  • The parameters are now ordered $apiKey, $configuration, $httpClient. Calls that pass the configuration or the API key by position have to be updated. Calls with named arguments keep working, except for userAgent.
  • The $userAgent parameter is removed. Use setUserAgent() instead, or set the user agent on a configuration and pass it to the constructor.

Tests and README

  • The test helper passes the API key and the configuration to the constructor by position.
  • The test for the $userAgent parameter is replaced by a test that checks that the host and user agent of a configuration passed to the constructor are used.
  • A new test checks that an API key passed to the constructor is exchanged for a JWT, which is then sent with the next request.
  • The README shows how to pass the API key to the constructor and how to set the user agent on your own configuration.

@pavog pavog added this to the v6.0.0 milestone Oct 19, 2026
@pavog
pavog requested a review from JulianVennen October 19, 2026 13:16
@pavog
pavog merged commit f5f977c into master Oct 19, 2026
4 checks passed
@pavog
pavog deleted the align-constructor branch October 19, 2026 13:43
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