Merge branch 'master' into onetomanyktorimpl
This commit is contained in:
commit
01ab884e68
@ -3,6 +3,7 @@ package com.insanusmokrassar.postssystem.publishing.ktor.client
|
||||
import com.insanusmokrassar.postssystem.core.post.PostId
|
||||
import com.insanusmokrassar.postssystem.core.publishing.TriggerControlKey
|
||||
import com.insanusmokrassar.postssystem.core.publishing.repos.ReadPublishingKeysRepo
|
||||
import com.insanusmokrassar.postssystem.ktor.buildStandardUrl
|
||||
import com.insanusmokrassar.postssystem.ktor.client.uniget
|
||||
import com.insanusmokrassar.postssystem.publishing.ktor.getPostIdByTriggerControlKeyRoute
|
||||
import com.insanusmokrassar.postssystem.publishing.ktor.getTriggerControlKeyByPostIdRoute
|
||||
@ -15,12 +16,12 @@ class ReadPublishingKeysRepoKtorClient (
|
||||
private val client: HttpClient = HttpClient()
|
||||
) : ReadPublishingKeysRepo {
|
||||
override suspend fun getPostIdByTriggerControlKey(key: TriggerControlKey): PostId? = client.uniget(
|
||||
"$baseUrl/$getPostIdByTriggerControlKeyRoute/$key",
|
||||
buildStandardUrl(baseUrl, "$getPostIdByTriggerControlKeyRoute/$key"),
|
||||
PostId.serializer().nullable
|
||||
)
|
||||
|
||||
override suspend fun getTriggerControlKeyByPostId(postId: PostId): TriggerControlKey? = client.uniget(
|
||||
"$baseUrl/$getTriggerControlKeyByPostIdRoute/$postId",
|
||||
buildStandardUrl(baseUrl, "$getTriggerControlKeyByPostIdRoute/$postId"),
|
||||
TriggerControlKey.serializer().nullable
|
||||
)
|
||||
}
|
@ -3,6 +3,7 @@ package com.insanusmokrassar.postssystem.publishing.ktor.client
|
||||
import com.insanusmokrassar.postssystem.core.post.PostId
|
||||
import com.insanusmokrassar.postssystem.core.publishing.TriggerControlKey
|
||||
import com.insanusmokrassar.postssystem.core.publishing.repos.WritePublishingKeysRepo
|
||||
import com.insanusmokrassar.postssystem.ktor.buildStandardUrl
|
||||
import com.insanusmokrassar.postssystem.ktor.client.BodyPair
|
||||
import com.insanusmokrassar.postssystem.ktor.client.unipost
|
||||
import com.insanusmokrassar.postssystem.publishing.ktor.SetPostTriggerControlKeyObject
|
||||
@ -16,13 +17,13 @@ class WritePublishingKeysRepoKtorClient (
|
||||
private val client: HttpClient = HttpClient()
|
||||
) : WritePublishingKeysRepo {
|
||||
override suspend fun setPostTriggerControlKey(postId: PostId, key: TriggerControlKey): Boolean = client.unipost(
|
||||
"$baseUrl/$setPostTriggerControlKeyRoute",
|
||||
buildStandardUrl(baseUrl, setPostTriggerControlKeyRoute),
|
||||
BodyPair(SetPostTriggerControlKeyObject.serializer(), SetPostTriggerControlKeyObject(postId, key)),
|
||||
Boolean.serializer()
|
||||
)
|
||||
|
||||
override suspend fun unsetPostTriggerControlKey(postId: PostId): Boolean = client.unipost(
|
||||
"$baseUrl/$unsetPostTriggerControlKeyRoute",
|
||||
buildStandardUrl(baseUrl, unsetPostTriggerControlKeyRoute),
|
||||
BodyPair(PostId.serializer(), postId),
|
||||
Boolean.serializer()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user