nullabilities of root routes in clients

This commit is contained in:
InsanusMokrassar 2020-11-27 20:42:49 +06:00
parent f5a5330e93
commit 4d0aae2b91
2 changed files with 6 additions and 5 deletions

View File

@ -11,17 +11,17 @@ class PostsRepoKtorClient private constructor(
) : PostsRepo, ReadPostsRepo by readPostsRepo, WritePostsRepo by writePostsRepo {
constructor(
baseUrl: String,
rootRoute: String = postsRootRoute,
rootRoute: String? = postsRootRoute,
client: HttpClient = HttpClient {
install(WebSockets)
}
) : this(
ReadPostsRepoKtorClient(
"${baseUrl}/$rootRoute",
rootRoute ?.let { "${baseUrl}/$rootRoute" } ?: baseUrl,
client
),
WritePostsRepoKtorClient(
"${baseUrl}/$rootRoute",
rootRoute ?.let { "${baseUrl}/$rootRoute" } ?: baseUrl,
client
)
)

View File

@ -11,16 +11,17 @@ class PublishingKeysRepoKtorClient private constructor (
) : PublishingKeysRepo, ReadPublishingKeysRepo by readPublishingKeysClient, WritePublishingKeysRepo by writePublishingKeysClient {
constructor(
baseUrl: String,
subpath: String? = publishingKeysRootRoute,
client: HttpClient = HttpClient {
install(WebSockets)
}
) : this (
ReadPublishingKeysRepoKtorClient (
"$baseUrl/$publishingKeysRootRoute",
subpath ?.let { "$baseUrl/$subpath" } ?: baseUrl,
client
),
WritePublishingKeysRepoKtorClient(
"$baseUrl/$publishingKeysRootRoute",
subpath ?.let { "$baseUrl/$subpath" } ?: baseUrl,
client
)
)