-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add recommended versions endpoint #17
Conversation
@@ -34,145 +34,170 @@ | |||
@SuppressWarnings("Duplicates") | |||
public class EndpointsV2 { | |||
|
|||
public static void setup() { | |||
public static void setup() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about this diff, I must have pressed Ctrl Alt L in Idea and auto formatted everything
|
||
for(MavenBuildVersion loader : FabricMeta.database.getLoader()){ | ||
infoList.add(new LoaderInfoV2(loader, mappings).populateMeta()); | ||
private static Object getRecommendedVersions(Context context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the relevant part
} | ||
|
||
return versions; | ||
} | ||
return new RecommendedVersions(gameVersion, yarn.get(0), loader.get(0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It relies on the fact that the latest versions of yarn and loader are always first in the JSON - is this reliable?
WebServer.jsonGet("/v2/versions/loader", context -> withLimitSkip(context, FabricMeta.database.getLoader())); | ||
WebServer.jsonGet("/v2/versions/loader/:game_version", context -> withLimitSkip(context, EndpointsV2.getLoaderInfoAll(context))); | ||
WebServer.jsonGet("/v2/versions/loader/:game_version/:loader_version", EndpointsV2::getLoaderInfo); | ||
WebServer.jsonGet("/v2/versions/:game_version", context -> EndpointsV2.getRecommendedVersions(context)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could perhaps do with a better endpoint name
This PR adds an endpoint to fetch the data that is normally available at
https://fabricmc.net/versions.html
through the API. It is marked as a draft as it needs some discussion - I'll self review it to add some comments on things that need addressing. It would be ideal if #10 was merged so that it could also provide FAPI?