nylas/nylas-nodejs

threads.list pagination offset doesn't work

serhii12 opened this issue · 2 comments

Describe the bug
threads.list pagination doesn't work

To Reproduce
When trying to paginate threads list offset seems to work only for the first a couple request. Ex: offset: 50, limit:50 works, but if I try offset: 100, limit:50 it breaks when using sdk. But it works when using curl request.

.threads.list({
offset,
 limit,
view: 'expanded',
in: 'inbox`
})

Expected behavior
The result should be properly paginated with offset.

SDK Version:
v6.6.1 Latest

@serhii12 Sorry in the delay getting back to you on this. I have tried the following snippet and the threads seem to mirror the responses I got back from the cURL requests I made.

const CONFIG = require("./config.json");
const Nylas = require("nylas");

const nylasClient = new Nylas({
    clientId: CONFIG.nylas.client_id,
    clientSecret: CONFIG.nylas.client_secret,
});

const nylas = nylasClient.with(CONFIG.nylas.access_token);

nylas.threads.list({limit: 50, offset: 0, view: "expanded", in: "inbox"}).then(threads => {
    console.log(threads);
    nylas.threads.list({limit: 50, offset: 50, view: "expanded", in: "inbox"}).then(t2 => {
        console.log(t2);
        nylas.threads.list({limit: 50, offset: 100, view: "expanded", in: "inbox"}).then(t3 => {
            console.log(t3);
        })
    })
})

I'm wondering if you can show more of your code snippet to see if I can try and duplicate the issue more closely. Otherwise you can submit an inquiry with our support team at support@nylas.com so that they can help more closely by diagnosing the issue with your account and application details. Let me know what works best for you!

@serhii12 I'll close the ticket for now, if you have more questions or details please reopen the ticket or submit an inquiry with our support team at support@nylas.com. Thank you!