如何获取 getStream 上用户有多少未读通知
?
我只需要一个未读通知的整数
值。
(我将把未读通知称为主要通知,例如 Facebook
或 Instagram
!)
提前致谢
最佳答案
获取通知源时的典型响应是:
> notificationFeed.get().then((response) => console.log(response));
Promise { _state: 0, _onFulfilled: [], _onRejected: [] }
> { results:
[ { activities: [Array],
activity_count: 1,
actor_count: 1,
created_at: '2017-12-27T10:15:39.215550',
group: 'e325120c-eaee-11e7-97ec-1283934ff98c',
id: 'e3267b75-eaee-11e7-8080-800052f2693c.e325120c-eaee-11e7-97ec-1283934ff98c',
is_read: false,
is_seen: false,
updated_at: '2017-12-27T10:15:39.215550',
verb: 'post' } ],
next: '',
duration: '12.76ms',
unseen: 1,
unread: 1 }
响应中的 unseen
和 unread
属性分别指示通知源中标记为“不可见”和“未读”的事件数量。
关于getstream-io - 如何在getStream上获取 "How many unread notifications does user have"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47978982/