Use the package and request 100 messages at a time. You will need to make 1000 requests, but the good news is that it is very good and it will be easier for everyone (without downloading 1 GB of response in one request!).
:
https://developers.google.com/gmail/api/guides/batch
, , Gmail Api , Stack Overflow, , .