How to get all results (over 100) using batch in gmail

I am using the Gmail API with the java client library.
I want to batch a lot of requests to get a list of messages.
I am doing a test for only one request.
Here's a snippet of code:

    Gmail client = getClient();     
    BatchRequest batch = client.batch();
    // Create the callback.
    JsonBatchCallback<ListMessagesResponse> callback = new JsonBatchCallback<ListMessagesResponse>() {
        public void onSuccess(ListMessagesResponse listMessagesResponse, HttpHeaders responseHeaders) {
            System.out.println(listMessagesResponse.getMessages().size());
            System.out.println(listMessagesResponse.getNextPageToken());
        }
        @Override
        public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
            System.out.println("Error Message: " + e.getMessage());
        }
    };

    client.users().messages().list("me@gmail.com").queue(batch, callback);      
    batch.execute();

      

The problem is that it only fetches 100 messages. I don't want to get the last token and reuse it for the next request, it doesn't make sense since I want to use the bundle.
So how can you get around the (100) limit to get all messages in one batch request?

thank

+3
java batch-processing gmail


source to share


No one has answered this question yet

Check out similar questions:

584
How to read all files in a folder with Java?
271
How do I send an email using Gmail as a provider using Python?
176
How do I send an email using a Java application using GMail, Yahoo or Hotmail?
128
Batch file. Delete all files and folders in a directory
83
How to download all emails with attachments from Gmail?
ten
How to get over 100 results with Twitter4j
3
Gmail API support getting support?
1
Can I download my requests from the Gmail API?
0
Gmail links with more than 100 characters {} Doesn't work
0
How to map the execution of a callback to update a request in a Google Drive API batch request



All Articles
Loading...
X
Show
Funny
Dev
Pics