Skip to content

v1.1.0

Latest

Choose a tag to compare

@restocked restocked released this 08 Apr 15:17

What's New

Automatic Retry with Backoff

The SDK now automatically retries on transient errors with exponential backoff + jitter:

  • 429 (Rate Limit) — waits the retryAfter duration from the API, then retries
  • 5xx (Server Error) — retries with exponential backoff
  • Network errors — retries on timeouts and connection failures
  • 4xx (Client Error) — never retried (fail immediately)

Fully configurable via the new retry option:

const client = new TweetAPI({
  apiKey: "YOUR_API_KEY",
  retry: { maxRetries: 5, initialRetryDelay: 2000, backoffMultiplier: 3, maxRetryDelay: 60000 },
});

// Or disable entirely
const client = new TweetAPI({ apiKey: "YOUR_API_KEY", retry: false });

Auto-Pagination Helpers

New paginate() and paginatePages() async generators — no more manual cursor loops:

import { paginate } from "tweetapi-node";

for await (const user of paginate(
  (cursor) => client.user.getFollowers({ userId: "123", cursor }),
  { maxPages: 5 },
)) {
  console.log(user.username);
}

Works with any paginated endpoint — followers, tweets, search, lists, communities, etc.

Rate Limit Awareness

  • 429 retryAfter is respected automatically during retry
  • Last rate limit state exposed via client.rateLimitInfo

New Exports

  • paginate, paginatePages — pagination helper functions
  • RetryOptions, RateLimitInfo, PaginateOptions — TypeScript types

Full Changelog

v1.0.0...v1.1.0