ios - 通过 Gmail API 获取未读邮件数
<p><p> <a href="https://developers.google.com/gmail/api/quickstart/ios" rel="noreferrer noopener nofollow">This sample</a>允许我从 Gmail 界面获取一些标签。问题是:是否可以使用示例中的相同工具获取用户在 Gmail 中的未读邮件数?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我不太擅长 objective-c,但你可以 <a href="https://developers.google.com/gmail/api/v1/reference/users/labels/get?authuser=1#try-it" rel="noreferrer noopener nofollow">get every message with the <code>UNREAD</code>-label</a>并检查未读计数:</p>
<p><strong>请求</strong></p>
<pre><code>GET https://www.googleapis.com/gmail/v1/users/me/labels/UNREAD?access_token={YOUR_ACCESS_TOKEN}
</code></pre>
<p><strong>响应</strong></p>
<pre><code>{
"id": "UNREAD",
"name": "UNREAD",
"type": "system",
"messagesTotal": 354,
"messagesUnread": 354,
"threadsTotal": 320,
"threadsUnread": 320
}
</code></pre>
<p>如您所见,<code>messagesUnread</code> 告诉我有 <code>354</code> 条未读消息。</p></p>
<p style="font-size: 20px;">关于ios - 通过 Gmail API 获取未读邮件数,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/38592485/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/38592485/
</a>
</p>
页:
[1]