Getstream.io 获得点赞数和点赞用户

Getstream.io get like count and users who liked

我的 add like 函数看起来像这样 (kotlin)

private fun addLike(user: String, token: String, activityID: String) {
    val client = CloudClient.builder(API_KEY, token, user).build()
    val like = Reaction.Builder().kind("like").activityID(activityID).build()
    client.reactions().add(user, like).join()
}

读取的是:

private fun getActivitiesForTeam(user: String, token: String, team: String): List<EnrichedActivity> {
    val client = CloudClient.builder(API_KEY, token, user).build()
    return client.flatFeed(team, "messages")
            .getEnrichedActivities(Limit(25), EnrichmentFlags().withOwnReactions().withRecentReactions().withReactionCounts()).join()
}

当我得到 latest_reactions_extra 字段时,这将是:

latest_reactions_extra {} // 我认为这将是空的

latest_reactions_extra {like: {next: }} //这个不是空的?但为什么它是空字符串?

那我怎么才能知道点赞数和点赞的用户呢?

还有我怎样才能删除那个喜欢的?我没有得到像 'reactionID' 这样的东西,但文档说它将是一个叫做 reactionID

的东西

谢谢

编辑

private fun addLike(user: String, token: String, activityID: String) {
    val client = CloudClient.builder(API_KEY, token, user).build()
    val like = Reaction.Builder().kind("like").activityID(activityID).userID(user).build()
    client.reactions().add(user, like).get()
}

result.success(ObjectMapper().writeValueAsString(反应))

当我修改 addLike 函数时,我得到了这个:

latest_reactions_extra {喜欢:{下一个:https://stream-io-api.com/api/v1.0/reaction/activity_id/34oijgiojiojgiojijoijoij-tgrgrtgrtgt/like/?id_lt=ergerg-01e1-4b73-b88d-regger&limit=5&withOwnChildren=false}}

这是什么?

解决方案

好的,看起来 fasterxml ObjectMapper 只是 erased/killed 我的反应字段,所以我不得不以其他方式创建 json 字符串...:/

解决方案

好的,看起来 fasterxml ObjectMapper 只是 erased/killed 我的反应字段,所以我不得不以其他方式创建 json 字符串...:/