Skip to content

Commit ebb8756

Browse files
docs: add Kotlin example for API_GetGameProgression (#90)
Co-authored-by: Wes Copeland <[email protected]>
1 parent 9076071 commit ebb8756

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/v1/get-game-progression.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,33 @@ A call to this endpoint will retrieve information about the average time to unlo
2020
| `i` | Yes | The target game ID. |
2121
| `h` | | 1 to prefer players with more hardcore unlocks than non-hardcore unlocks. |
2222

23+
## Client Library
24+
25+
::: code-group
26+
27+
```kotlin [Kotlin]
28+
val credentials = RetroCredentials("<username>", "<web api key>")
29+
val api: RetroInterface = RetroClient(credentials).api
30+
31+
val response: NetworkResponse<GetGameProgression.Response, ErrorResponse> = api.getGameProgression(
32+
gameId = 228,
33+
)
34+
35+
if (response is NetworkResponse.Success) {
36+
// handle the data
37+
val gameProgression: GetGameProgression.Response = response.body
38+
39+
} else if (response is NetworkResponse.Error) {
40+
// if the server returns an error it be found here
41+
val errorResponse: ErrorResponse? = response.body
42+
43+
// if the api (locally) had an internal error, it'll be found here
44+
val internalError: Throwable? = response.error
45+
}
46+
```
47+
48+
:::
49+
2350
## Response
2451

2552
::: code-group

0 commit comments

Comments
 (0)