Return mod version creation datetime in API #195
Merged
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.
Motivation
Mod authors sometimes delete and replace a version of a mod with a new download. If such a version has already been indexed by an external service (such as CKAN's bot), there's no way to know this has happened (ignoring active notifications for the moment).
This can cause problems for CKAN, since it tracks hashes to ensure that the file the user downloads is the same one the CKAN bot indexed. In KSP-CKAN/CKAN#2337 we implemented a strategy that solved this for GitHub using the release creation timestamp, but the same has not been possible for SpaceDock because the timestamp is unknown.
Changes
Now the mod version API returns a
"created"
property containing the timestamp when that version was created, in ISO8601 format. This value is already part of theModVersion
data object:SpaceDock/KerbalStuff/objects.py
Lines 341 to 359 in b4d9d0f
The change itself is modeled after a similar property in
game_info
:SpaceDock/KerbalStuff/blueprints/api.py
Lines 80 to 92 in b4d9d0f
This will make it possible for the CKAN bot to tell when it has an old out of date download for a mod on SpaceDock.