Skip to content
Snippets Groups Projects
Commit 426b8fe7 authored by William Walker's avatar William Walker
Browse files

wip

parent 66a5407e
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,7 @@ import io.ktor.client.statement.HttpResponse
import io.ktor.http.URLProtocol
import io.ktor.util.cio.toByteArray
import io.ktor.utils.io.ByteReadChannel
import java.io.FileWriter
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
......@@ -117,7 +118,7 @@ public class Temerity internal constructor(
// TODO: Use this as cache4k expiration time
public val DEFAULT_CACHE_EXPIRATION: Duration = 15.minutes
internal const val DEFAULT_MINIMUM_THREAD_COUNT: Int = 2
internal fun createLogger(tag: String?, supportKtxNotebook: Boolean = false): co.touchlab.kermit.Logger =
co.touchlab.kermit.Logger(
config = loggerConfigInit(
......@@ -252,7 +253,7 @@ public class Temerity internal constructor(
when (exception) {
is SerializationException -> {
// TODO: Implement platform API version checking
get<KermitLogger>().d { "Returned JSON object: ${exception.message}" }
get<KermitLogger>{ parametersOf("TemerityLib") }.d { "Returned JSON object: ${exception.message}" }
error("Encountered error decoding response from platform API. You likely need to choose a Temerity release that supports the API version implemented by your instance. \nPlatform API response data : $apiResponsePayload")
}
......@@ -261,8 +262,10 @@ public class Temerity internal constructor(
}
}
public override suspend fun getUsers(): List<User> =
decodeResponseCatching(platformApi.getUsers().executeApiResponse<String>())
public override suspend fun getUsers(): List<User> {
val userRequest = platformApi.getUsers()
return decodeResponseCatching(userRequest.executeApiResponse<String>())
}
public override suspend fun getUser(userId: Long): User =
getUsers().first { it.userId == userId }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment