feat: add keyman-version check to package-version API#353
Open
mcdurdin wants to merge 1 commit into
Open
Conversation
Add the `keyman-version` parameter to /package-version API, for example: http://api.keyman.com/package-version?platform=android&keyboard=sil_euro_latin&model=nrc.en.mtnt&keyman-version=11.0.0 This also makes a small tweak to the results, so that an error response will no longer give a `version` or `kmp` field. (Reason: the iOS app sees the presence of those two fields as indication of a success response and never checks for error in that case. Yes, we will address that, but we need to support existing versions of the app anyway.) And refactor the package-version.inc.php module to make it clearer and simpler. Relates-to: #325 Test-bot: skip
User Test ResultsTest specification and instructions User tests are not required |
ermshiperete
approved these changes
Jun 25, 2026
| } else { | ||
| $dataKeyboard = $data[0]; | ||
|
|
||
| if (!empty($platform) && !$dataKeyboard[array_search($platform, PackageVersion::available_platforms()) + 2]) { |
Contributor
There was a problem hiding this comment.
Nothing new, but the order of the fields in the SELECT statement and in available_patforms() is different (k.platform_android, k.platform_linux, k.platform_macos, k.platform_ios, k.platform_web, k.platform_windows vs 'android', 'ios', 'linux', 'mac', 'web', 'windows'), so the results will be wrong for Linux, Mac and iOS (flagged by devin.ai).
| $platform = $params['platform']; | ||
| if(!in_array($platform, $available_platforms)) { | ||
| fail("Invalid platform $platform"); | ||
| fail("Invalid platform' $platform'"); |
Contributor
There was a problem hiding this comment.
Suggested change
| fail("Invalid platform' $platform'"); | |
| fail("Invalid platform '$platform'"); |
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.
Add the
keyman-versionparameter to /package-version API, for example:http://api.keyman.com/package-version?platform=android&keyboard=sil_euro_latin&model=nrc.en.mtnt&keyman-version=11.0.0
This also makes a small tweak to the results, so that an error response will no longer give a
versionorkmpfield. (Reason: the iOS app sees the presence of those two fields as indication of a success response and never checks for error in that case. Yes, we will address that, but we need to support existing versions of the app anyway.)And refactor the package-version.inc.php module to make it clearer and simpler.
Older versions of Keyman do not provide their version in the query, and in that scenario, the API will continue to return the latest version of the keyboard or lexical model, even if that means that it will not be installed (which can lead to an annoying update loop, hence this change).
Fixes: #325
Test-bot: skip