fix: public_net parsing error & add deprecation/locationAvailability to ServerType#145
Open
jprangenbergde wants to merge 5 commits intoLKDevelopment:masterfrom
Open
fix: public_net parsing error & add deprecation/locationAvailability to ServerType#145jprangenbergde wants to merge 5 commits intoLKDevelopment:masterfrom
jprangenbergde wants to merge 5 commits intoLKDevelopment:masterfrom
Conversation
The Hetzner API returns a `deprecation` object for server types that are no longer available for new bookings. Map this field so consumers can filter out deprecated types without making a separate API call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(array) null evaluates to [] not null, so the null-check for filtering deprecated server types never matched. Explicitly guard against null before casting to array. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Hetzner deprecates server types per location via a nested locations array. This field maps location name to its deprecation info (null = still available), enabling per-location availability checks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
collect() is a Laravel helper and not available in this standalone SDK. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
public_net parameter optional in server management methods
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.
Description:
Bugfixes
public_net JSON parse error
Fixes a server creation failure where the API rejected the public_net parameter with:
failed to parse json: cannot parse type array as createServerPublicNet
The public_net parameter is now optional and handled correctly.
New Features
ServerType::$deprecation
Maps the top-level deprecation object from the Hetzner API onto ServerType. Previously this field was not available in the model, making it impossible to detect globally deprecated server types.
▎ Bugfix included: (array) null evaluates to [] not null, so an explicit !== null guard was added before casting.
ServerType::$locationAvailability
Hetzner deprecates server types not only globally but also per location via a nested locations array in the API response. This new field maps location name → deprecation info (null = still bookable), enabling consumers to filter out unavailable types per location.
// Example: filter out types deprecated in a specific location
$type->locationAvailability['fsn1'] === null // true = still bookable