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.24k stars 174 forks source link

`x-app-limit-24hour-x` header properties #495

Closed hkong-mitre closed 8 months ago

hkong-mitre commented 11 months ago

How do I use this library to get the x-app-limit-24hour-reset, x-app-limit-24hour-limit, and x-app-limit-24hour-remaining header properties?

I tried using the @twitter-api-v2/plugin-rate-limit plugin, using this code in the examples, but it returns the rateLimit property, whereas I need the x-app-limit-24hour-x header properties, which are different and (for my application at least, more useful).

Thank you in advance,

alkihis commented 9 months ago

Hello,

As 1.15.2 it is now available in rateLimit.day property.

A rateLimit object is a TwitterRateLimit

interface SingleTwitterRateLimit {
  limit: number;
  reset: number;
  remaining: number;
}

interface TwitterRateLimit extends SingleTwitterRateLimit {
  day?: SingleTwitterRateLimit;
}