我正在使用getstream.io创建提要。用户可以关注feeds并添加反应,如和评论。如果一个用户在提要上添加了评论,而另一个用户想要回复评论,那么我如何实现这一点,并检索评论上的所有回复。
发布于 2019-04-13 22:17:15
getstream.io支持对反应的子反应。文档是here。
向活动添加反应时,请使用该反应创建子反应。
comment = client.reactions.add(
"comment",
activity_id,
user_id="mike",
data={"text": "@thierry great post!"},
target_feeds=["notification:thierry"],
)例如,为上面的comment反应创建子反应“like”。
client.reactions.add_child("like", comment, user_id="thierry")类似地,创建子反应“comment”
client.reactions.add_child(
"comment",
comment,
user_id="thierry",
data={"text":"Thanks @mike"},
target_feeds=["notification:mike"],
)检索反应的子反应
# retrieve first 10 likes for an reaction
response = client.reactions.filter(
reaction_id="ed2837a6-0a3b-4679-adc1-778a1704852d", kind="like", limit=10
)检索活动的父反应
# retrieve first 10 likes for an activity
response = client.reactions.filter(
activity_id="ed2837a6-0a3b-4679-adc1-778a1704852d", kind="like", limit=10
)注:子反应不能包含子反应。要了解有关分页和检索的更多信息,请阅读文档here。
发布于 2019-04-23 22:40:31
您可以使用reaction_id添加子反应
https://stackoverflow.com/questions/55644656
复制相似问题