add mutable posts api

This commit is contained in:
InsanusMokrassar 2019-09-20 13:12:14 +06:00
parent 9fb4a2aae6
commit 2d5189ce0a
2 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,15 @@
package com.github.insanusmokrassar.postssystem.core.api
import com.github.insanusmokrassar.postssystem.core.post.*
import kotlinx.coroutines.flow.Flow
interface MutablePostsAPI {
val postCreatedFlow: Flow<Post>
val postDeletedFlow: Flow<Post>
val postUpdatedFlow: Flow<Post>
suspend fun createPost(content: PostContents): Post?
suspend fun deletePost(id: PostId): Boolean
suspend fun updatePostContent(postId: PostId, content: PostContents): Boolean
}

View File

@ -3,10 +3,11 @@ package com.github.insanusmokrassar.postssystem.core.post
import com.github.insanusmokrassar.postssystem.core.content.Content import com.github.insanusmokrassar.postssystem.core.content.Content
typealias PostId = String typealias PostId = String
typealias PostContents = List<Content>
interface Post { interface Post {
val id: PostId val id: PostId
val content: List<Content> val content: PostContents
val meta: PostMetaInfo val meta: PostMetaInfo
} }