EDIT: see https://developers.google.com/gmail/api/v1/reference/users/t... and look at the 'q' parameter