Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit ab2f0b3

Browse files
authored
Client functions creates new coroutine an returns Deferred (#26)
* Updates the `Client` functions to return a `Deferred` The functions inside the client create a new Coroutine, in the IO dispatcher, that async the requests and return a Deferred object. * Fixes the `ClientTest` Fixes the test function to handle the `Deferred` wrapper object. * Fixes the `Dispatchers` in the `RequestHandler` Replace the `withContext(Dispatchers.IO)` with `coroutineScope`. Removes some unused imports. * Update the `README` * Update the kdoc in the `Client`
1 parent ab5df7c commit ab2f0b3

File tree

4 files changed

+169
-143
lines changed

4 files changed

+169
-143
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ fun main() = runBlocking {
6767
val client = ClientBuilder("email", "password").build()
6868

6969
// Retrive player info
70-
val player = client.getPlayer("#tag")
70+
val player = client.getPlayer("#tag").await()
7171
println("Name: ${player.name}, TH lvl: ${player.townHallLevel}")
7272

7373
// Retrive clan info
74-
val clan = client.getClan("#tag")
74+
val clan = client.getClan("#tag").await()
7575
println("Name: ${clan.name}, Tag: ${clan.tag}")
7676
}
7777
```

0 commit comments

Comments
 (0)