diff --git a/README.md b/README.md index 9d6ab76..bd9cfa8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Then add this `api-kotlin` dependency to your `pom.xml` project! com.github.RetroAchievements api-kotlin - 1.0.18 + 1.1.0 ``` diff --git a/pom.xml b/pom.xml index c36059c..85c00f1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.retroachievements api-kotlin - 1.0.18 + 1.1.0 diff --git a/src/main/kotlin/org/retroachivements/api/RetroInterface.kt b/src/main/kotlin/org/retroachivements/api/RetroInterface.kt index 55e2a99..3ea4660 100644 --- a/src/main/kotlin/org/retroachivements/api/RetroInterface.kt +++ b/src/main/kotlin/org/retroachivements/api/RetroInterface.kt @@ -80,9 +80,20 @@ interface RetroInterface { @POST("/API/API_GetGameInfoAndUserProgress.php") suspend fun getGameInfoAndUserProgress( @Query("u") username: String, - @Query("g") gameId: Long + @Query("g") gameId: Long, + @Query("a") includeUserAward: Int = 0 ): NetworkResponse + /** + * A call to this endpoint will retrieve information about the average time to unlock achievements in a game, targeted via its unique ID. + */ + @Mock @MockResponse(body = "/v1/game/GetGameProgression.json") + @POST("/API/API_GetGameProgression.php") + suspend fun getGameProgression( + @Query("i") gameId: Long, + @Query("h") hardcore: Int = 0 + ): NetworkResponse + /** * A call to this function will retrieve a giver user's completion progress, targeted by their username. */ @@ -205,6 +216,16 @@ interface RetroInterface { @Query("c") count: Int = 100 ): NetworkResponse + /** + * A call to this endpoint will retrieve a given user's set requests, maximum total requests and points until next request. + */ + @Mock @MockResponse(body = "/v1/user/GetUserSetRequests.json") + @POST("/API/API_GetUserSetRequests.php") + suspend fun getUserSetRequests( + @Query("u") userId: String, + @Query("t") all: Int = 0 + ): NetworkResponse + /** * A call to this function will retrieve basic metadata about a game, targeted via its unique ID. */ @@ -291,6 +312,18 @@ interface RetroInterface { @Query("c") count: Int = 100 ): NetworkResponse + /** + * A call to this function will retrieve a given leaderboard's entries, targeted by its ID. + */ + @Mock @MockResponse(body = "/v1/game/GetUserGameLeaderboards.json") + @POST("/API/API_GetUserGameLeaderboards.php") + suspend fun getUserGameLeaderboards( + @Query("i") gameId: Long, + @Query("u") userId: String? = null, + @Query("o") offset: Int = 0, + @Query("c") count: Int = 100 + ): NetworkResponse + /** * A call to this function will retrieve the complete list of all system ID and name pairs on the site. * @@ -315,7 +348,9 @@ interface RetroInterface { suspend fun getGameList( @Query("i") consoleId: Long, @Query("f") shouldOnlyRetrieveGamesWithAchievements: Int = 0, - @Query("h") shouldRetrieveGameHashes: Int = 0 + @Query("h") shouldRetrieveGameHashes: Int = 0, + @Query("o") offset: Int = 0, + @Query("c") count: Int = 0 ): NetworkResponse /** @@ -438,7 +473,8 @@ interface RetroInterface { @Query("i") username: String, @Query("c") count: Int = 10, @Query("o") offset: Int = 0, - @Query("t") type: Int = 3 + @Query("t") type: Int = 3, + @Query("sort") sort: String = "submitted" ): NetworkResponse /** @@ -450,7 +486,8 @@ interface RetroInterface { @Query("i") gameId: Long, @Query("c") count: Int = 10, @Query("o") offset: Int = 0, - @Query("t") type: Int = 1 + @Query("t") type: Int = 1, + @Query("sort") sort: String = "submitted" ): NetworkResponse /** @@ -462,6 +499,7 @@ interface RetroInterface { @Query("i") achievementId: Long, @Query("c") count: Int = 10, @Query("o") offset: Int = 0, - @Query("t") type: Int = 2 + @Query("t") type: Int = 2, + @Query("sort") sort: String = "submitted" ): NetworkResponse } diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGame.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGame.kt index 89dbc3d..6529645 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGame.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGame.kt @@ -50,6 +50,9 @@ class GetGame { @SerializedName("Released") val released: String?, + @SerializedName("ReleasedAtGranularity") + val releasedAtGranularity: String?, + @SerializedName("GameTitle") val gameTitle: String, diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameExtended.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameExtended.kt index c855f68..6eb24f2 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameExtended.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameExtended.kt @@ -44,6 +44,9 @@ class GetGameExtended { @SerializedName("Released") val released: String?, + @SerializedName("ReleasedAtGranularity") + val releasedAtGranularity: String?, + @SerializedName("IsFinal") val isFinal: Boolean, diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameHashes.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameHashes.kt index 5c3276b..ab8c00a 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameHashes.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameHashes.kt @@ -11,10 +11,13 @@ class GetGameHashes { data class Result( @SerializedName("Name") val name: String, + @SerializedName("MD5") val md5: String, + @SerializedName("Labels") val labels: List, + @SerializedName("PatchUrl") val patchUrl: String?, ) diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameInfoAndUserProgress.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameInfoAndUserProgress.kt index 51f1ceb..27f02a5 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameInfoAndUserProgress.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameInfoAndUserProgress.kt @@ -56,6 +56,9 @@ class GetGameInfoAndUserProgress { @SerializedName("PlayersTotal") val playersTotal: Int, + @SerializedName("UserTotalPlaytime") + val userTotalPlaytime: Int, + @SerializedName("GuideURL") val guideUrl: String?, diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameLeaderboards.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameLeaderboards.kt index 27b074a..cd22b9d 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameLeaderboards.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameLeaderboards.kt @@ -3,11 +3,14 @@ package org.retroachivements.api.data.pojo.game import com.google.gson.annotations.SerializedName class GetGameLeaderboards { + data class Response( @SerializedName("Count") val count: Long, + @SerializedName("Total") val total: Long, + @SerializedName("Results") val results: List, ) @@ -15,23 +18,39 @@ class GetGameLeaderboards { data class Leaderboard( @SerializedName("ID") val id: Long, + @SerializedName("RankAsc") val rankAsc: Boolean, + @SerializedName("Title") val title: String, + @SerializedName("Description") val description: String, + @SerializedName("Format") val format: String, + @SerializedName("TopEntry") val topEntry: TopEntry, + + @SerializedName("Author") + val author: String, + + @SerializedName("AuthorULID") + val authorUlid: String ) data class TopEntry( @SerializedName("User") val user: String, + + @SerializedName("ULID") + val ulid: String, + @SerializedName("Score") val score: Long, + @SerializedName("FormattedScore") val formattedScore: String, ) diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameProgression.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameProgression.kt new file mode 100644 index 0000000..1ba3a99 --- /dev/null +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetGameProgression.kt @@ -0,0 +1,99 @@ +package org.retroachivements.api.data.pojo.game + +import com.google.gson.annotations.SerializedName + +class GetGameProgression { + + data class Response( + + @SerializedName("ID") + val id: Int, + + @SerializedName("Title") + val title: String, + + @SerializedName("ConsoleID") + val consoleId: Int, + + @SerializedName("ConsoleName") + val consoleName: String, + + @SerializedName("ImageIcon") + val imageIcon: String, + + @SerializedName("NumDistinctPlayers") + val numDistinctPlayers: Int, + + @SerializedName("TimesUsedInBeatMedian") + val timesUsedInBeatMedian: Int, + + @SerializedName("TimesUsedInHardcoreBeatMedian") + val timesUsedInHardcoreBeatMedia: Int, + + @SerializedName("MedianTimeToBeat") + val medianTimeToBeat: Int, + + @SerializedName("MedianTimeToBeatHardcore") + val medianTimeToBeatHardcore: Int, + + @SerializedName("TimesUsedInCompletionMedian") + val timesUsedInCompletionMedian: Int, + + @SerializedName("TimesUsedInMasteryMedian") + val timesUsedInMasteryMedian: Int, + + @SerializedName("MedianTimeToComplete") + val mediaTimeToComplete: Int, + + @SerializedName("MedianTimeToMaster") + val medianTimeToMaster: Int, + + @SerializedName("NumAchievements") + val numAchievements: Int, + + @SerializedName("Achievements") + val achievements: List + ) { + data class Achievement( + + @SerializedName("ID") + val id: Int, + + @SerializedName("Title") + val title: String, + + @SerializedName("Description") + val description: String, + + @SerializedName("Points") + val points: Int, + + @SerializedName("TrueRatio") + val trueRatio: Int, + + @SerializedName("Type") + val type: String?, + + @SerializedName("BadgeName") + val badgeName: String, + + @SerializedName("NumAwarded") + val numAwarded: Int, + + @SerializedName("NumAwardedHardcore") + val numAwardedHardcore: Int, + + @SerializedName("TimesUsedInUnlockMedian") + val timesUsedInUnlockMedian: Int, + + @SerializedName("TimesUsedInHardcoreUnlockMedian") + val timesUsedInHardcoreUnlockMedian: Int, + + @SerializedName("MedianTimeToUnlock") + val medianTimeToUnlock: Int, + + @SerializedName("MedianTimeToUnlockHardcore") + val medianTimeToUnlockHardcore: Int + ) + } +} diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetUserGameLeaderboard.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetUserGameLeaderboard.kt new file mode 100644 index 0000000..387abeb --- /dev/null +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/game/GetUserGameLeaderboard.kt @@ -0,0 +1,60 @@ +package org.retroachivements.api.data.pojo.game + +import com.google.gson.annotations.SerializedName + +class GetUserGameLeaderboard { + + data class Response( + + @SerializedName("Count") + val count: Int, + + @SerializedName("Total") + val total: Int, + + @SerializedName("Results") + val results: List + ) { + data class Result( + + @SerializedName("ID") + val id: Int, + + @SerializedName("RankAsc") + val rankAsc: Boolean, + + @SerializedName("Title") + val title: String, + + @SerializedName("Description") + val description: String, + + @SerializedName("Format") + val format: String, + + @SerializedName("UserEntry") + val userEntry: UserEntry + ) { + data class UserEntry( + + @SerializedName("User") + val user: String, + + @SerializedName("ULID") + val ulid: String, + + @SerializedName("Score") + val score: Int, + + @SerializedName("FormattedScore") + val formattedScore: String, + + @SerializedName("Rank") + val rank: Int, + + @SerializedName("DateUpdated") + val dateUpdated: String + ) + } + } +} diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserRecentAchievements.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserRecentAchievements.kt index 1ed3286..bbe3c7d 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserRecentAchievements.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserRecentAchievements.kt @@ -27,6 +27,9 @@ class GetUserRecentAchievements { @SerializedName("Points") val points: Int, + @SerializedName("TrueRatio") + val trueRatio: Int, + @SerializedName("Type") val type: String?, diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserSetRequests.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserSetRequests.kt new file mode 100644 index 0000000..8aef878 --- /dev/null +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserSetRequests.kt @@ -0,0 +1,36 @@ +package org.retroachivements.api.data.pojo.user + +import com.google.gson.annotations.SerializedName + +class GetUserSetRequests { + + data class Response( + + @SerializedName("RequestedSets") + val requestedSets: List, + + @SerializedName("TotalRequests") + val totalRequests: Int, + + @SerializedName("PointsForNext") + val pointsForNext: Int + ) { + data class Set( + + @SerializedName("GameID") + val gameId: Int, + + @SerializedName("Title") + val title: String, + + @SerializedName("ConsoleID") + val consoleId: Int, + + @SerializedName("ConsoleName") + val consoleName: String, + + @SerializedName("ImageIcon") + val imageIcon: String + ) + } +} diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserSummary.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserSummary.kt index 3f7b758..3056866 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserSummary.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUserSummary.kt @@ -23,6 +23,9 @@ class GetUserSummary { @SerializedName("RichPresenceMsg") val richPresenceMsg: String?, + @SerializedName("RichPresenceMsgDate") + val richPresenceMsgDate: String?, + @SerializedName("LastGameID") val lastGameId: Long, diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUsersFollowingMe.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUsersFollowingMe.kt index 12ad9c8..5b6f9a3 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUsersFollowingMe.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUsersFollowingMe.kt @@ -6,8 +6,10 @@ class GetUsersFollowingMe { data class Response( @SerializedName("Count") val count: Long, + @SerializedName("Total") val total: Long, + @SerializedName("Results") val results: List, ) @@ -15,10 +17,13 @@ class GetUsersFollowingMe { data class User( @SerializedName("User") val user: String, + @SerializedName("Points") val points: Long, + @SerializedName("PointsSoftcore") val pointsSoftcore: Long, + @SerializedName("AmIFollowing") val amIFollowing: Boolean, ) diff --git a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUsersIFollow.kt b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUsersIFollow.kt index 817d843..0d588fa 100644 --- a/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUsersIFollow.kt +++ b/src/main/kotlin/org/retroachivements/api/data/pojo/user/GetUsersIFollow.kt @@ -6,8 +6,10 @@ class GetUsersIFollow { data class Response( @SerializedName("Count") val count: Long, + @SerializedName("Total") val total: Long, + @SerializedName("Results") val results: List, ) @@ -15,10 +17,13 @@ class GetUsersIFollow { data class User( @SerializedName("User") val user: String, + @SerializedName("Points") val points: Long, + @SerializedName("PointsSoftcore") val pointsSoftcore: Long, + @SerializedName("IsFollowingMe") val isFollowingMe: Boolean, ) diff --git a/src/main/resources/mock/v1/game/GetGameExtended.json b/src/main/resources/mock/v1/game/GetGameExtended.json index 6cc1b45..9b22b66 100644 --- a/src/main/resources/mock/v1/game/GetGameExtended.json +++ b/src/main/resources/mock/v1/game/GetGameExtended.json @@ -12,6 +12,7 @@ "Developer": "", "Genre": "", "Released": "June 23, 1991", + "ReleasedAtGranularity": "day", "IsFinal": false, "RichPresencePatch": "cce60593880d25c97797446ed33eaffb", "players_total": 27080, diff --git a/src/main/resources/mock/v1/game/GetGameInfoAndUserProgress.json b/src/main/resources/mock/v1/game/GetGameInfoAndUserProgress.json index aa45e0e..ad8ee0f 100644 --- a/src/main/resources/mock/v1/game/GetGameInfoAndUserProgress.json +++ b/src/main/resources/mock/v1/game/GetGameInfoAndUserProgress.json @@ -11,12 +11,14 @@ "Publisher": "", "Developer": "", "Genre": "", - "Released": "June 23, 1991", + "Released": "1992-06-02 00:00:00", + "ReleasedAtGranularity": "day", "IsFinal": false, "RichPresencePatch": "cce60593880d25c97797446ed33eaffb", "players_total": 27080, "achievements_published": 23, "points_total": 250, + "UserTotalPlaytime": 60, "GuideURL": null, "ConsoleName": "Mega Drive", "ParentGameID": null, diff --git a/src/main/resources/mock/v1/game/GetGameLeaderboards.json b/src/main/resources/mock/v1/game/GetGameLeaderboards.json index 4cbfb43..03ee775 100644 --- a/src/main/resources/mock/v1/game/GetGameLeaderboards.json +++ b/src/main/resources/mock/v1/game/GetGameLeaderboards.json @@ -1,125 +1,20 @@ { - "Count": 10, - "Total": 64, + "Count": 29, + "Total": 29, "Results": [ { - "ID": 19062, - "RankAsc": true, - "Title": "New Zealand One", - "Description": "Complete New Zealand S1 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "Thebpg13", - "Score": 11903, - "FormattedScore": "1:59.03" - } - }, - { - "ID": 19063, - "RankAsc": true, - "Title": "New Zealand Two", - "Description": "Complete New Zealand S2 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "Thebpg13", - "Score": 15836, - "FormattedScore": "2:38.36" - } - }, - { - "ID": 19064, - "RankAsc": true, - "Title": "New Zealand Three", - "Description": "Complete New Zealand S3 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "Thebpg13", - "Score": 17619, - "FormattedScore": "2:56.19" - } - }, - { - "ID": 19065, - "RankAsc": true, - "Title": "New Zealand Four", - "Description": "Complete New Zealand S4 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "Thebpg13", - "Score": 14173, - "FormattedScore": "2:21.73" - } - }, - { - "ID": 19066, - "RankAsc": true, - "Title": "New Zealand Five", - "Description": "Complete New Zealand S5 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "Thebpg13", - "Score": 13963, - "FormattedScore": "2:19.63" - } - }, - { - "ID": 19067, - "RankAsc": true, - "Title": "New Zealand Six", - "Description": "Complete New Zealand S6 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "JollyClubber", - "Score": 15422, - "FormattedScore": "2:34.22" - } - }, - { - "ID": 19068, - "RankAsc": true, - "Title": "Greece One", - "Description": "Complete Greece S1 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "Thebpg13", - "Score": 15252, - "FormattedScore": "2:32.52" - } - }, - { - "ID": 19069, - "RankAsc": true, - "Title": "Greece Two", - "Description": "Complete Greece S2 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "josef733", - "Score": 13953, - "FormattedScore": "2:19.53" - } - }, - { - "ID": 19070, - "RankAsc": true, - "Title": "Greece Three", - "Description": "Complete Greece S3 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "josef733", - "Score": 12140, - "FormattedScore": "2:01.40" - } - }, - { - "ID": 19071, - "RankAsc": true, - "Title": "Greece Four", - "Description": "Complete Greece S4 in least time", - "Format": "MILLISECS", - "TopEntry": { - "User": "Thebpg13", - "Score": 15219, - "FormattedScore": "2:32.19" + "ID": 104370, + "RankAsc": false, + "Title": " South Island Conqueror", + "Description": "Complete the game with the highest score possible", + "Format": "VALUE", + "Author": "Scott", + "AuthorULID": "00003EMFWR7XB8SDPEHB3K56ZA", + "TopEntry": { + "User": "vani11a", + "ULID": "00003EMFWR7XB8SDPEHB3K56ZQ", + "Score": "390490", + "FormattedScore": "390,490" } } ] diff --git a/src/main/resources/mock/v1/game/GetGameProgression.json b/src/main/resources/mock/v1/game/GetGameProgression.json new file mode 100644 index 0000000..a513a7a --- /dev/null +++ b/src/main/resources/mock/v1/game/GetGameProgression.json @@ -0,0 +1,49 @@ +{ + "ID": 228, + "Title": "Super Mario World", + "ConsoleID": 3, + "ConsoleName": "SNES/Super Famicom", + "ImageIcon": "/Images/112443.png", + "NumDistinctPlayers": 79281, + "TimesUsedInBeatMedian": 4493, + "TimesUsedInHardcoreBeatMedian": 8249, + "MedianTimeToBeat": 17878, + "MedianTimeToBeatHardcore": 19224, + "TimesUsedInCompletionMedian": 155, + "TimesUsedInMasteryMedian": 1091, + "MedianTimeToComplete": 67017, + "MedianTimeToMaster": 79744, + "NumAchievements": 89, + "Achievements": [ + { + "ID": 342, + "Title": "Giddy Up!", + "Description": "Catch a ride with a friend", + "Points": 1, + "TrueRatio": 1, + "Type": null, + "BadgeName": "46580", + "NumAwarded": 75168, + "NumAwardedHardcore": 37024, + "TimesUsedInUnlockMedian": 63, + "TimesUsedInHardcoreUnlockMedian": 69, + "MedianTimeToUnlock": 274, + "MedianTimeToUnlockHardcore": 323 + }, + { + "ID": 341, + "Title": "Unleash The Dragon", + "Description": "Collect 5 Dragon Coins in a level", + "Points": 2, + "TrueRatio": 2, + "Type": null, + "BadgeName": "46591", + "NumAwarded": 66647, + "NumAwardedHardcore": 34051, + "TimesUsedInUnlockMedian": 66, + "TimesUsedInHardcoreUnlockMedian": 70, + "MedianTimeToUnlock": 290, + "MedianTimeToUnlockHardcore": 333 + } + ] +} diff --git a/src/main/resources/mock/v1/game/GetUserGameLeaderboards.json b/src/main/resources/mock/v1/game/GetUserGameLeaderboards.json new file mode 100644 index 0000000..2498981 --- /dev/null +++ b/src/main/resources/mock/v1/game/GetUserGameLeaderboards.json @@ -0,0 +1,21 @@ +{ + "Count": 10, + "Total": 64, + "Results": [ + { + "ID": 19062, + "RankAsc": true, + "Title": "New Zealand One", + "Description": "Complete New Zealand S1 in least time", + "Format": "MILLISECS", + "UserEntry": { + "User": "zuliman92", + "ULID": "00003EMFWR7XB8SDPEHB3K56ZQ", + "Score": 12620, + "FormattedScore": "2:06.20", + "Rank": 2, + "DateUpdated": "2024-12-12T16:40:59+00:00" + } + } + ] +} diff --git a/src/main/resources/mock/v1/user/GetUserSetRequests.json b/src/main/resources/mock/v1/user/GetUserSetRequests.json new file mode 100644 index 0000000..eebeaf6 --- /dev/null +++ b/src/main/resources/mock/v1/user/GetUserSetRequests.json @@ -0,0 +1,27 @@ +{ + "RequestedSets": [ + { + "GameID": 8149, + "Title": "Jurassic Park Institute Tour: Dinosaur Rescue", + "ConsoleID": 5, + "ConsoleName": "Game Boy Advance", + "ImageIcon": "/Images/000001.png" + }, + { + "GameID": 600, + "Title": "Psycho Pinball", + "ConsoleID": 1, + "ConsoleName": "Genesis/Mega Drive", + "ImageIcon": "/Images/039797.png" + }, + { + "GameID": 1, + "Title": "Sonic the Hedgehog", + "ConsoleID": 1, + "ConsoleName": "Genesis/Mega Drive", + "ImageIcon": "/Images/085573.png" + } + ], + "TotalRequests": 5, + "PointsForNext": 5000 +} diff --git a/src/main/resources/mock/v1/user/GetUserSummary.json b/src/main/resources/mock/v1/user/GetUserSummary.json index 767fcf3..575d5a5 100644 --- a/src/main/resources/mock/v1/user/GetUserSummary.json +++ b/src/main/resources/mock/v1/user/GetUserSummary.json @@ -11,6 +11,7 @@ "data2": null }, "RichPresenceMsg": "L=08-1 | 1 lives | 189300 points", + "RichPresenceMsgDate": "2025-11-19 12:05:04", "LastGameID": 15758, "ContribCount": 0, "ContribYield": 0, diff --git a/src/test/kotlin/org/retroachivements/api/RetroInterfaceTest.kt b/src/test/kotlin/org/retroachivements/api/RetroInterfaceTest.kt index bec134c..e170fb6 100644 --- a/src/test/kotlin/org/retroachivements/api/RetroInterfaceTest.kt +++ b/src/test/kotlin/org/retroachivements/api/RetroInterfaceTest.kt @@ -782,6 +782,43 @@ class RetroInterfaceTest { } } + @Test + fun `check getUserSetRequests response parser`() { + + runBlocking { + + // obtain mocked version of the API + val api = createMockedApi() + + val comments: NetworkResponse = api.getUserSetRequests( + userId = "MaxMilyin" + ) + + assert(comments is NetworkResponse.Success) + + assertNotNull((comments as NetworkResponse.Success).body) + } + } + + @Test + fun `check getUserGameLeaderboards response parser`() { + + runBlocking { + + // obtain mocked version of the API + val api = createMockedApi() + + val comments: NetworkResponse = api.getUserGameLeaderboards( + gameId = 27683, + userId = "MaxMilyin" + ) + + assert(comments is NetworkResponse.Success) + + assertNotNull((comments as NetworkResponse.Success).body) + } + } + private fun createMockedApi(): RetroInterface { val client = RetroClient(RetroCredentials("", ""))