如何在getTream上获得 How many unread notifications does user have
?
我只需要未读通知的integer
值。
(我将未读通知称为 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
属性指示了标记为未见的通知供稿中的活动数,并且未读取。