PLhery / node-twitter-api-v2

Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.
https://www.npmjs.com/package/twitter-api-v2
Apache License 2.0
1.25k stars 175 forks source link

Use a previously available next_token #393

Closed etodanik closed 1 year ago

etodanik commented 1 year ago

Is your feature request related to a problem? Please describe. I am trying to asynchronously load some data with pagination, and to better control rate limiting it would be very useful for me instead of paginating everything in one lambda function I could make a request with a previously available next_token to me.

Describe the solution you'd like It would be ideal if I could make a non paginated request supplying next_token.

alkihis commented 1 year ago

You can still give a next_token parameter to a function returning a paginator.

const timeline = await client.v2.userTimeline('12', { next_token: '_your_token_' });

// Get the received data
const tweets = timeline.tweets;

// Get next token received
const nextToken = timeline.data.meta.next_token;