diff --git a/core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/ReadPostsAPI.kt b/core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/ReadPostsAPI.kt index edf4ba76..f33cd66a 100644 --- a/core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/ReadPostsAPI.kt +++ b/core/src/commonMain/kotlin/com/insanusmokrassar/postssystem/core/post/api/ReadPostsAPI.kt @@ -13,6 +13,11 @@ import com.soywiz.klock.DateTime * Simple read API by different properties */ interface ReadPostsAPI { + /** + * @return [Set] of [PostId]s which can be used to get data using [getPostById] + */ + suspend fun getPostsIds(): Set + /** * @return [RegisteredPost] if it is available by [id] */ diff --git a/core/src/commonTest/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt b/core/src/commonTest/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt index b0b0b386..0a265175 100644 --- a/core/src/commonTest/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt +++ b/core/src/commonTest/kotlin/com/insanusmokrassar/postssystem/core/api/InMemoryPostsAPI.kt @@ -63,7 +63,7 @@ class InMemoryPostsAPI( } != null } - + override suspend fun getPostsIds(): Set = posts.keys.toSet() override suspend fun getPostById(id: PostId): RegisteredPost? = posts[id] override suspend fun getPostsByContent(id: ContentId): List = posts.values.filter { post -> id in post.content }