Add application version gating for firmware-specific APIs#18
Merged
Conversation
Collaborator
Author
|
Nice, thanks! |
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.
Summary
Adds reusable application-version gating for NanoKVM APIs that were introduced in specific firmware releases.
This follows the same general pattern as the existing hardware guard: methods can declare a minimum supported application version for non-Pro and/or Pro devices, and the client checks the detected device version before calling the endpoint.
This keeps firmware-specific API support centralized and predictable as upstream adds endpoints, avoiding scattered per-method fallback logic and unclear runtime failures on older devices.
Details
NanoKVMClient.detect_versions()using/vm/info.application_versionandimage_versionproperties.@require_application_version(non_pro=..., pro=...).NanoKVMNotSupportedErrorbefore the feature endpoint is called when the detected version is too old.get_shortcuts requires Pro application version >= 1.2.8 (detected: 1.2.7)get_shortcuts requires non-Pro application version >= 2.3.2 (detected: 2.3.1)Decorator Examples
Compatibility Notes
This is mostly additive, but it intentionally changes behavior for firmware-specific APIs on older devices. Instead of calling an endpoint that may not exist and surfacing a lower-level API/HTTP error, the client now raises
NanoKVMNotSupportedErrorbefore the feature endpoint is called when the detected application version is below the known minimum.Consumers that currently catch
NanoKVMApiErrorfor unsupported endpoints on older firmware may also need to catchNanoKVMNotSupportedError.Unknown or custom versions such as
devare allowed through, so custom builds are not blocked.The client also caches
image_versionfrom/vm/infofor future compatibility checks, but this PR only gates by application version. Current endpoint availability is mapped to upstream application changelog entries, and no public client method is currently gated by image version.