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 { ) : PostsRepo, ReadPostsRepo by readPostsRepo, WritePostsRepo by writePostsRepo {
constructor( constructor(
baseUrl: String, baseUrl: String,
rootRoute: String = postsRootRoute, rootRoute: String? = postsRootRoute,
client: HttpClient = HttpClient { client: HttpClient = HttpClient {
install(WebSockets) install(WebSockets)
} }
) : this( ) : this(
ReadPostsRepoKtorClient( ReadPostsRepoKtorClient(
"${baseUrl}/$rootRoute", rootRoute ?.let { "${baseUrl}/$rootRoute" } ?: baseUrl,
client client
), ),
WritePostsRepoKtorClient( WritePostsRepoKtorClient(
"${baseUrl}/$rootRoute", rootRoute ?.let { "${baseUrl}/$rootRoute" } ?: baseUrl,
client client
) )
) )

View File

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