File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
gradle/build-logic/common-plugins/src/main/kotlin Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 11package common
22
33import io.ktor.client.*
4+ import io.ktor.client.call.*
45import io.ktor.client.engine.java.*
56import io.ktor.client.plugins.*
67import io.ktor.client.plugins.contentnegotiation.*
8+ import io.ktor.client.plugins.resources.*
79import io.ktor.client.plugins.resources.Resources
810import io.ktor.http.*
911import io.ktor.resources.*
1012import io.ktor.serialization.kotlinx.json.*
13+ import kotlinx.serialization.Serializable
1114import kotlinx.serialization.json.Json
1215
13- @Resource(" json " ) class JsonResource ( )
16+ @Resource(" /users/{name} " ) class UserReq ( val name : String )
1417
15- object ServiceClient {
18+ @Serializable data class User (val id : Long , val login : String , val name : String )
19+
20+ object ApiClient {
1621 fun get () =
1722 HttpClient (Java ) {
1823 install(Resources )
@@ -32,9 +37,11 @@ object ServiceClient {
3237 defaultRequest {
3338 url {
3439 protocol = URLProtocol .HTTPS
35- host = " app.dev "
40+ host = " api.github.com "
3641 }
3742 }
3843 engine { pipelining = true }
3944 }
45+
46+ suspend fun user (name : String ) = get().get(UserReq (name)).body<User >()
4047}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ tasks {
5656 pluginsMapConfiguration =
5757 mapOf (
5858 " org.jetbrains.dokka.base.DokkaBase" to
59- """ { "footerMessage": "Copyright © 2023 Suresh "}""" )
59+ """ { "footerMessage": "Copyright © 2023 Dokka "}""" )
6060
6161 // val rootPath = rootProject.rootDir.toPath()
6262 // val logoCss = rootPath.resolve("docs/css/logo-styles.css").toString().replace('\\', '/')
You can’t perform that action at this time.
0 commit comments