This sample allows me to fetch some labels from Gmail interface. The question is: Is it possible to fetch the number of a user's unread messages in Gmail, using the same tools in the sample?
I'm not very good at objective-c, but you can get every message with the UNREAD
-label and check the unread count:
Request
GET https://www.googleapis.com/gmail/v1/users/me/labels/UNREAD?access_token={YOUR_ACCESS_TOKEN}
Response
{
"id": "UNREAD",
"name": "UNREAD",
"type": "system",
"messagesTotal": 354,
"messagesUnread": 354,
"threadsTotal": 320,
"threadsUnread": 320
}
As you can see, messagesUnread
tells me I have 354
unread messages.