Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

twitter-api-v2

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter-api-v2 - npm Package Compare versions

Comparing version 1.12.3 to 1.12.4

8

changelog.md

@@ -0,3 +1,9 @@

1.12.4
------
- Fix: Ignore rate limit data for endpoints without rate limit headers in paginators #341
- Fix: Patch for unifiying endpoints with various error payload in v1 API #342
- Feat: `variants` property for `media.fields`, add `MediaVariantsV2` interface (thanks to @roncli) #347
1.12.3
-------
------
- Feat: .favoriteTimeline for API v1 #296 (thanks to @AuroraDysis)

@@ -4,0 +10,0 @@ - Feat: duration_millis property for v1 medias (thanks to @RyoshiKayo)

@@ -16,2 +16,5 @@ "use strict";

get _isRateLimitOk() {
if (!this._rateLimit) {
return true;
}
const resetDate = this._rateLimit.reset * 1000;

@@ -86,3 +89,4 @@ if (resetDate < Date.now()) {

get rateLimit() {
return { ...this._rateLimit };
var _a;
return { ...(_a = this._rateLimit) !== null && _a !== void 0 ? _a : {} };
}

@@ -89,0 +93,0 @@ /** Get raw data returned by Twitter API. */

@@ -40,2 +40,3 @@ /// <reference types="node" />

errors: (ErrorV1 | ErrorV2)[];
error?: string;
title?: string;

@@ -42,0 +43,0 @@ detail?: string;

@@ -77,3 +77,14 @@ "use strict";

this.rateLimit = options.rateLimit;
this.data = options.data;
// Fix bad error data payload on some v1 endpoints (see https://github.com/PLhery/node-twitter-api-v2/issues/342)
if ('error' in options.data) {
const data = { ...options.data };
data.errors = [{
code: EApiV1ErrorCode.InternalError,
message: data.error,
}];
this.data = data;
}
else {
this.data = options.data;
}
}

@@ -80,0 +91,0 @@ get request() {

@@ -26,2 +26,7 @@ import type { UserV2 } from './user.v2.types';

};
export interface MediaVariantsV2 {
bit_rate?: number;
content_type: 'video/mp4' | 'application/x-mpegURL' | string;
url: string;
}
export interface MediaObjectV2 {

@@ -42,2 +47,3 @@ media_key: string;

};
variants?: MediaVariantsV2[];
}

@@ -44,0 +50,0 @@ export interface PollV2 {

2

dist/types/v2/tweet.v2.types.d.ts

@@ -34,3 +34,3 @@ /// <reference types="node" />

export declare type TTweetv2Expansion = 'attachments.poll_ids' | 'attachments.media_keys' | 'author_id' | 'referenced_tweets.id' | 'in_reply_to_user_id' | 'geo.place_id' | 'entities.mentions.username' | 'referenced_tweets.id.author_id';
export declare type TTweetv2MediaField = 'duration_ms' | 'height' | 'media_key' | 'preview_image_url' | 'type' | 'url' | 'width' | 'public_metrics' | 'non_public_metrics' | 'organic_metrics' | 'alt_text';
export declare type TTweetv2MediaField = 'duration_ms' | 'height' | 'media_key' | 'preview_image_url' | 'type' | 'url' | 'width' | 'public_metrics' | 'non_public_metrics' | 'organic_metrics' | 'alt_text' | 'variants';
export declare type TTweetv2PlaceField = 'contained_within' | 'country' | 'country_code' | 'full_name' | 'geo' | 'id' | 'name' | 'place_type';

@@ -37,0 +37,0 @@ export declare type TTweetv2PollField = 'duration_minutes' | 'end_datetime' | 'id' | 'options' | 'voting_status';

{
"name": "twitter-api-v2",
"version": "1.12.3",
"version": "1.12.4",
"description": "Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -48,6 +48,6 @@ # Twitter API v2

// Tell typescript it's a readonly app
const roClient = twitterClient.readOnly;
const readOnlyClient = twitterClient.readOnly;
// Play with the built in methods
const user = await roClient.v2.userByUsername('plhery');
const user = await readOnlyClient.v2.userByUsername('plhery');
await twitterClient.v1.tweet('Hello, this is a test.');

@@ -54,0 +54,0 @@ // You can upload media easily!

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc