Skip to content

Commit b0cc2aa

Browse files
authored
chore: add missing endpoints (#37)
* add support for missing GetRecentGameAwards API * add support for missing GetGameHashes API and GetRecentGameAwards parameters * add support for missing GetUserWantToPlayList API and fix bug on GetUsersFollowingMe * add support for missing GetComments endpoint. Rephrase comments to not use the term endpoint but function. * update version
1 parent c10cb0b commit b0cc2aa

File tree

14 files changed

+717
-42
lines changed

14 files changed

+717
-42
lines changed

README.md

Lines changed: 239 additions & 19 deletions
Large diffs are not rendered by default.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.retroachievements</groupId>
88
<artifactId>api-kotlin</artifactId>
9-
<version>1.0.14</version>
9+
<version>1.0.15</version>
1010

1111
<dependencyManagement>
1212
<dependencies>

src/main/kotlin/org/retroachivements/api/RetroInterface.kt

Lines changed: 93 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import org.retroachivements.api.core.DateFormat
88
import org.retroachivements.api.core.RequiresCache
99
import org.retroachivements.api.data.pojo.ErrorResponse
1010
import org.retroachivements.api.data.pojo.achievement.GetAchievementUnlocks
11+
import org.retroachivements.api.data.pojo.comments.GetComments
1112
import org.retroachivements.api.data.pojo.event.GetAchievementOfTheWeek
1213
import org.retroachivements.api.data.pojo.feed.GetClaims
14+
import org.retroachivements.api.data.pojo.feed.GetRecentGameAwards
1315
import org.retroachivements.api.data.pojo.feed.GetTopTenUsers
1416
import org.retroachivements.api.data.pojo.game.*
1517
import org.retroachivements.api.data.pojo.system.GetConsoleID
@@ -34,14 +36,14 @@ interface RetroInterface {
3436
suspend fun getTopTenUsers(): NetworkResponse<GetTopTenUsers.Response, ErrorResponse>
3537

3638
/**
37-
* A call to this endpoint will retrieve minimal user profile information, such as their ID, motto, most recent game ID, avatar, and points.
39+
* A call to this function will retrieve minimal user profile information, such as their ID, motto, most recent game ID, avatar, and points.
3840
*/
3941
@Mock @MockResponse(body = "/v1/user/GetUserProfile.json")
4042
@POST("/API/API_GetUserProfile.php")
4143
suspend fun getUserProfile(@Query("u") username: String): NetworkResponse<GetUserProfile.Response, ErrorResponse>
4244

4345
/**
44-
* A call to this endpoint will retrieve a list of a target user's recently unlocked achievements, via their username. By default, it fetches achievements unlocked in the last hour.
46+
* A call to this function will retrieve a list of a target user's recently unlocked achievements, via their username. By default, it fetches achievements unlocked in the last hour.
4547
*/
4648
@Mock @MockResponse(body = "/v1/user/GetUserRecentAchievements.json")
4749
@POST("/API/API_GetUserRecentAchievements.php")
@@ -51,7 +53,7 @@ interface RetroInterface {
5153
): NetworkResponse<GetUserRecentAchievements.Response, ErrorResponse>
5254

5355
/**
54-
* A call to this endpoint will retrieve a list of achievements unlocked by a given user between two given dates.
56+
* A call to this function will retrieve a list of achievements unlocked by a given user between two given dates.
5557
*/
5658
@Mock @MockResponse(body = "/v1/user/GetAchievementsEarnedBetween.json")
5759
@POST("/API/API_GetAchievementsEarnedBetween.php")
@@ -62,7 +64,7 @@ interface RetroInterface {
6264
): NetworkResponse<GetUserRecentAchievements.Response, ErrorResponse>
6365

6466
/**
65-
* A call to this endpoint will retrieve a list of achievements unlocked by a given user on a specified date.
67+
* A call to this function will retrieve a list of achievements unlocked by a given user on a specified date.
6668
*/
6769
@Mock @MockResponse(body = "/v1/user/GetAchievementsEarnedOnDay.json")
6870
@POST("/API/API_GetAchievementsEarnedOnDay.php")
@@ -72,7 +74,7 @@ interface RetroInterface {
7274
): NetworkResponse<GetUserRecentAchievements.Response, ErrorResponse>
7375

7476
/**
75-
* A call to this endpoint will retrieve extended metadata about a game, in addition to a user's progress about that game. This is targeted via a game's unique ID and a given username.
77+
* A call to this function will retrieve extended metadata about a game, in addition to a user's progress about that game. This is targeted via a game's unique ID and a given username.
7678
*/
7779
@Mock @MockResponse(body = "/v1/game/GetGameInfoAndUserProgress.json")
7880
@POST("/API/API_GetGameInfoAndUserProgress.php")
@@ -82,7 +84,7 @@ interface RetroInterface {
8284
): NetworkResponse<GetGameInfoAndUserProgress.Response, ErrorResponse>
8385

8486
/**
85-
* A call to this endpoint will retrieve a giver user's completion progress, targeted by their username.
87+
* A call to this function will retrieve a giver user's completion progress, targeted by their username.
8688
*/
8789
@Mock @MockResponse(body = "/v1/user/GetUserCompletionProgress.json")
8890
@POST("/API/API_GetUserCompletionProgress.php")
@@ -93,7 +95,7 @@ interface RetroInterface {
9395
): NetworkResponse<GetUserCompletionProgress.Response, ErrorResponse>
9496

9597
/**
96-
* A call to this endpoint will retrieve metadata about the target user's site awards, via their username.
98+
* A call to this function will retrieve metadata about the target user's site awards, via their username.
9799
*/
98100
@Mock @MockResponse(body = "/v1/user/GetUserAwards.json")
99101
@POST("/API/API_GetUserAwards.php")
@@ -160,7 +162,7 @@ interface RetroInterface {
160162
): NetworkResponse<GetUserSummary.Response, ErrorResponse>
161163

162164
/**
163-
* A call to this endpoint will retrieve completion metadata about the games a given user has played.
165+
* A call to this function will retrieve completion metadata about the games a given user has played.
164166
* It returns two entries per each game: one for the softcore completion and one for the hardcore completion.
165167
* These are designated by the hardcoreMode property on each completion object.
166168
*/
@@ -172,7 +174,19 @@ interface RetroInterface {
172174
): NetworkResponse<GetUserCompletedGames.Response, ErrorResponse>
173175

174176
/**
175-
* A call to this endpoint will retrieve a list of users that I follow.
177+
* A call to this function will retrieve a given user's "Want to Play Games" list, targeted by their username.
178+
* Results will only be returned if the target user is yourself, or if both you and the target user follow each other.
179+
*/
180+
@Mock @MockResponse(body = "/v1/user/GetUserWantToPlayList.json")
181+
@POST("/API/API_GetUserWantToPlayList.php")
182+
suspend fun getUserWantToPlayList(
183+
@Query("u") username: String,
184+
@Query("c") maxRecords: Int = 100,
185+
@Query("o") skipRecords: Int = 0
186+
): NetworkResponse<GetUserWantToPlayList.Response, ErrorResponse>
187+
188+
/**
189+
* A call to this function will retrieve a list of users that I follow.
176190
*/
177191
@Mock @MockResponse(body = "/v1/user/GetUsersIFollow.json")
178192
@POST("/API/API_GetUsersIFollow.php")
@@ -182,17 +196,17 @@ interface RetroInterface {
182196
): NetworkResponse<GetUsersIFollow.Response, ErrorResponse>
183197

184198
/**
185-
* A call to this endpoint will retrieve a list of users that are following me.
199+
* A call to this function will retrieve a list of users that are following me.
186200
*/
187201
@Mock @MockResponse(body = "/v1/user/GetUsersFollowingMe.json")
188-
@POST("/API/GetUsersFollowingMe.php")
202+
@POST("/API/API_GetUsersFollowingMe.php")
189203
suspend fun getUsersFollowingMe(
190204
@Query("o") offset: Int = 0,
191205
@Query("c") count: Int = 100
192206
): NetworkResponse<GetUsersFollowingMe.Response, ErrorResponse>
193207

194208
/**
195-
* A call to this endpoint will retrieve basic metadata about a game, targeted via its unique ID.
209+
* A call to this function will retrieve basic metadata about a game, targeted via its unique ID.
196210
*/
197211
@Mock @MockResponse(body = "/v1/game/GetGame.json")
198212
@POST("/API/API_GetGame.php")
@@ -201,7 +215,7 @@ interface RetroInterface {
201215
): NetworkResponse<GetGame.Response, ErrorResponse>
202216

203217
/**
204-
* A call to this endpoint will retrieve extended metadata about a game, targeted via its unique ID.
218+
* A call to this function will retrieve extended metadata about a game, targeted via its unique ID.
205219
*/
206220
@Mock @MockResponse(body = "/v1/game/GetGameExtended.json")
207221
@POST("/API/API_GetGameExtended.php")
@@ -211,7 +225,16 @@ interface RetroInterface {
211225
): NetworkResponse<GetGameExtended.Response, ErrorResponse>
212226

213227
/**
214-
* A call to this endpoint will retrieve the list of achievement IDs for a game, targeted by game ID.
228+
* A call to this function will retrieve the hashes linked to a game, targeted via its unique ID.
229+
*/
230+
@Mock @MockResponse(body = "/v1/game/GetGameHashes.json")
231+
@POST("/API/API_GetGameHashes.php")
232+
suspend fun getGameHashes(
233+
@Query("i") gameId: Long
234+
): NetworkResponse<GetGameHashes.Response, ErrorResponse>
235+
236+
/**
237+
* A call to this function will retrieve the list of achievement IDs for a game, targeted by game ID.
215238
* This can be useful if you'd like to quickly check how many achievements a particular game has.
216239
* Using this, you can also detect if a game has received a revision.
217240
* For example, if a game had 100 achievements last month and has 102 today,
@@ -224,8 +247,8 @@ interface RetroInterface {
224247
): NetworkResponse<GetAchievementCount.Response, ErrorResponse>
225248

226249
/**
227-
* A call to this endpoint will retrieve a dictionary of the number of players who have earned
228-
* a specific number of achievements for a given game ID. This endpoint can be used to determine
250+
* A call to this function will retrieve a dictionary of the number of players who have earned
251+
* a specific number of achievements for a given game ID. This function can be used to determine
229252
* the total mastery count for a game, as well as how rare that overall mastery is.
230253
*/
231254
@Mock @MockResponse(body = "/v1/game/GetAchievementDistribution.json")
@@ -247,7 +270,7 @@ interface RetroInterface {
247270
): NetworkResponse<GetGameRankAndScore.Response, ErrorResponse>
248271

249272
/**
250-
* A call to this endpoint will retrieve a given game's list of leaderboards, targeted by the game's ID.
273+
* A call to this function will retrieve a given game's list of leaderboards, targeted by the game's ID.
251274
*/
252275
@Mock @MockResponse(body = "/v1/game/GetGameLeaderboards.json")
253276
@POST("/API/API_GetGameLeaderboards.php")
@@ -258,7 +281,7 @@ interface RetroInterface {
258281
): NetworkResponse<GetGameLeaderboards.Response, ErrorResponse>
259282

260283
/**
261-
* A call to this endpoint will retrieve a given leaderboard's entries, targeted by its ID.
284+
* A call to this function will retrieve a given leaderboard's entries, targeted by its ID.
262285
*/
263286
@Mock @MockResponse(body = "/v1/game/GetLeaderboardEntries.json")
264287
@POST("/API/API_GetLeaderboardEntries.php")
@@ -269,7 +292,7 @@ interface RetroInterface {
269292
): NetworkResponse<GetLeaderboardEntries.Response, ErrorResponse>
270293

271294
/**
272-
* A call to this endpoint will retrieve the complete list of all system ID and name pairs on the site.
295+
* A call to this function will retrieve the complete list of all system ID and name pairs on the site.
273296
*
274297
* [activeSystemsOnly] set to 1
275298
* [gameSystemsOnly] set to 1
@@ -282,9 +305,9 @@ interface RetroInterface {
282305
): NetworkResponse<GetConsoleID.Response, ErrorResponse>
283306

284307
/**
285-
* A call to this endpoint will retrieve the complete list of games for a specified console on the site,
308+
* A call to this function will retrieve the complete list of games for a specified console on the site,
286309
* targeted by the console ID. If you do not know the console ID you're looking for,
287-
* try using the all systems endpoint.
310+
* try using the all systems function.
288311
*/
289312
@Mock @MockResponse(body = "/v1/system/GetGameList.json")
290313
@POST("/API/API_GetGameList.php")
@@ -324,7 +347,19 @@ interface RetroInterface {
324347
suspend fun getActiveClaims(): NetworkResponse<GetClaims.Response, ErrorResponse>
325348

326349
/**
327-
* A call to this endpoint will retrieve comprehensive metadata about the current Achievement of the Week.
350+
* A call to this function will retrieve all recently granted game awards across the site's userbase.
351+
*/
352+
@Mock @MockResponse(body = "/v1/feed/GetRecentGameAwards.json")
353+
@POST("/API/API_GetRecentGameAwards.php")
354+
suspend fun getRecentGameAwards(
355+
@Query("d") @DateFormat("yyyy-MM-dd") startingDate: Date = Date(),
356+
@Query("c") count: Int = 25,
357+
@Query("o") offset: Int = 0,
358+
@Query("k") kinds: String = listOf("beaten-softcore", "beaten-hardcore", "completed", "mastered").joinToString()
359+
): NetworkResponse<GetRecentGameAwards.Response, ErrorResponse>
360+
361+
/**
362+
* A call to this function will retrieve comprehensive metadata about the current Achievement of the Week.
328363
*/
329364
@Mock @MockResponse(body = "/v1/event/GetAchievementOfTheWeek.json")
330365
@POST("/API/API_GetAchievementOfTheWeek.php")
@@ -393,4 +428,40 @@ interface RetroInterface {
393428
suspend fun getAchievementTicketStats(
394429
@Query("a") achievementId: Long
395430
): NetworkResponse<GetAchievementTicketStats.Response, ErrorResponse>
431+
432+
/**
433+
* A call to this function returns comments of a specified user.
434+
*/
435+
@Mock @MockResponse(body = "/v1/comments/GetCommentsOnUserWall.json")
436+
@POST("/API/API_GetComments.php")
437+
suspend fun getCommentsOnUserWall(
438+
@Query("i") username: String,
439+
@Query("c") count: Int = 10,
440+
@Query("o") offset: Int = 0,
441+
@Query("t") type: Int = 3
442+
): NetworkResponse<GetComments.Response, ErrorResponse>
443+
444+
/**
445+
* A call to this function returns comments of a specified game.
446+
*/
447+
@Mock @MockResponse(body = "/v1/comments/GetCommentsOnGameWall.json")
448+
@POST("/API/API_GetComments.php")
449+
suspend fun getCommentsOnGameWall(
450+
@Query("i") gameId: Long,
451+
@Query("c") count: Int = 10,
452+
@Query("o") offset: Int = 0,
453+
@Query("t") type: Int = 1
454+
): NetworkResponse<GetComments.Response, ErrorResponse>
455+
456+
/**
457+
* A call to this function returns comments of a specified achievement.
458+
*/
459+
@Mock @MockResponse(body = "/v1/comments/GetCommentsOnAchievementWall.json")
460+
@POST("/API/API_GetComments.php")
461+
suspend fun getCommentsOnAchievementWall(
462+
@Query("i") achievementId: Long,
463+
@Query("c") count: Int = 10,
464+
@Query("o") offset: Int = 0,
465+
@Query("t") type: Int = 2
466+
): NetworkResponse<GetComments.Response, ErrorResponse>
396467
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package org.retroachivements.api.data.pojo.comments
2+
3+
import com.google.gson.annotations.SerializedName
4+
5+
class GetComments {
6+
data class Response(
7+
@SerializedName("Count")
8+
val count: Long,
9+
@SerializedName("Total")
10+
val total: Long,
11+
@SerializedName("Results")
12+
val results: List<Result>,
13+
)
14+
15+
data class Result(
16+
@SerializedName("User")
17+
val user: String,
18+
@SerializedName("Submitted")
19+
val submitted: String,
20+
@SerializedName("CommentText")
21+
val commentText: String,
22+
)
23+
24+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.retroachivements.api.data.pojo.feed
2+
3+
import com.google.gson.annotations.SerializedName
4+
5+
class GetRecentGameAwards {
6+
data class Response(
7+
@SerializedName("Count")
8+
val count: Long,
9+
@SerializedName("Total")
10+
val total: Long,
11+
@SerializedName("Results")
12+
val results: List<Result>,
13+
)
14+
15+
data class Result(
16+
@SerializedName("User")
17+
val user: String,
18+
@SerializedName("AwardKind")
19+
val awardKind: String,
20+
@SerializedName("AwardDate")
21+
val awardDate: String,
22+
@SerializedName("GameID")
23+
val gameId: Long,
24+
@SerializedName("GameTitle")
25+
val gameTitle: String,
26+
@SerializedName("ConsoleID")
27+
val consoleId: Long,
28+
@SerializedName("ConsoleName")
29+
val consoleName: String,
30+
)
31+
32+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.retroachivements.api.data.pojo.game
2+
3+
import com.google.gson.annotations.SerializedName
4+
5+
class GetGameHashes {
6+
data class Response(
7+
@SerializedName("Results")
8+
val results: List<Result>,
9+
)
10+
11+
data class Result(
12+
@SerializedName("Name")
13+
val name: String,
14+
@SerializedName("MD5")
15+
val md5: String,
16+
@SerializedName("Labels")
17+
val labels: List<String>,
18+
@SerializedName("PatchUrl")
19+
val patchUrl: String?,
20+
)
21+
22+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.retroachivements.api.data.pojo.user
2+
3+
import com.google.gson.annotations.SerializedName
4+
5+
class GetUserWantToPlayList {
6+
data class Response(
7+
@SerializedName("Count")
8+
val count: Long,
9+
@SerializedName("Total")
10+
val total: Long,
11+
@SerializedName("Results")
12+
val results: List<Result>,
13+
)
14+
15+
data class Result(
16+
@SerializedName("ID")
17+
val id: Long,
18+
@SerializedName("Title")
19+
val title: String,
20+
@SerializedName("ConsoleID")
21+
val consoleId: Long,
22+
@SerializedName("ConsoleName")
23+
val consoleName: String,
24+
@SerializedName("ImageIcon")
25+
val imageIcon: String,
26+
@SerializedName("PointsTotal")
27+
val pointsTotal: Long,
28+
@SerializedName("AchievementsPublished")
29+
val achievementsPublished: Long,
30+
)
31+
32+
}

0 commit comments

Comments
 (0)