I need to read messages from user's inbox using gmail API client. And what I want is to get only new messages since last time I read them. Sure, I don't want to read all messages and check which of them are new, I want to get just new messages in a query. The best solution I could figure out so far is to star messages I have read and get not starred messages like this:
$gmail->users_messages->listUsersMessages('me',['maxResults' => 10, 'q' => "in:inbox AND -in:starred"]);
What I don't like in this solution is that this affects message some way and assuming this email is used to read and send messages in common way (using web browser) I'm not sure if user can't star messages himself so my application consider it as read. I need to do something like read all messages, which were received after some time or may be where id is greater than id of last read message. Is there a way to do it?