OGeek|极客世界-中国程序员成长平台

标题: ios - 通过 Gmail API 获取未读邮件数 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 11:46
标题: ios - 通过 Gmail API 获取未读邮件数

This sample允许我从 Gmail 界面获取一些标签。问题是:是否可以使用示例中的相同工具获取用户在 Gmail 中的未读邮件数?



Best Answer-推荐答案


我不太擅长 objective-c,但你可以 get every message with the UNREAD-label并检查未读计数:

请求

GET https://www.googleapis.com/gmail/v1/users/me/labels/UNREAD?access_token={YOUR_ACCESS_TOKEN}

响应

{
 "id": "UNREAD",
 "name": "UNREAD",
 "type": "system",
 "messagesTotal": 354,
 "messagesUnread": 354,
 "threadsTotal": 320,
 "threadsUnread": 320
}

如您所见,messagesUnread 告诉我有 354 条未读消息。

关于ios - 通过 Gmail API 获取未读邮件数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38592485/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4