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

Missing types: UserV2.public_metrics.like_count, TweetV2.public_metrics.bookmark_count #527

Closed liorgrossman closed 2 months ago

liorgrossman commented 2 months ago

I started using node-twitter-api-v2 recently and I found the bundled types for responses extremely helpful.

However, I did encounter a couple of fields that are available through the Twitter API, but do not exist in the types:

  1. In UserV2, under public_metrics, the field like_count should probably be added. Here's the real data returned from the Twitter V2 API when this field is requested:
    "public_metrics": {
            "followers_count": 161,
            "following_count": 168,
            "tweet_count": 159,
            "listed_count": 0,
            "like_count": 437
          },
  2. In TweetV2, under public_metrics (which is of type TweetPublicMetricsV2), the field bookmark_count should probably be added. Here's real data returned from the Twitter V2 API when this field is requested:
    "public_metrics": {
            "retweet_count": 116,
            "reply_count": 0,
            "like_count": 513,
            "quote_count": 3,
            "bookmark_count": 31,
            "impression_count": 7668
          },

I'm able to get the code to work and return these fields, but TypeScript obviously does not like it:

image

Please let me know if you have any questions.

solojungle commented 2 months ago

@liorgrossman created a PR for this issue!

PLhery commented 2 months ago

Published in 1.16.4