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

twitter-api-v2

Package Overview
Dependencies
Maintainers
0
Versions
69
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.18.2 to 1.19.0

6

changelog.md

@@ -0,1 +1,7 @@

1.19.0
------
- fix: type definition for TweetRetweetedOrLikedByV2Params #550 (@dogukanakkaya)
- fix: add and correct field names #554 (@lin-stephanie)
- feat: get tweet usage v2 #555 (@jiahuijiang)
1.18.2

@@ -2,0 +8,0 @@ ------

4

dist/cjs/types/entities.types.d.ts

@@ -11,6 +11,6 @@ export interface Entity {

export interface HashtagEntity extends Entity {
hashtag: string;
tag: string;
}
export interface CashtagEntity extends Entity {
cashtag: string;
tag: string;
}

@@ -17,0 +17,0 @@ export interface MentionEntity extends Entity {

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

images?: TweetEntityUrlImageV2[];
media_key?: string;
}

@@ -105,0 +106,0 @@ export interface TweetEntityUrlImageV2 {

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

export declare type TTweetv2PollField = 'duration_minutes' | 'end_datetime' | 'id' | 'options' | 'voting_status';
export declare type TTweetv2TweetField = 'attachments' | 'author_id' | 'context_annotations' | 'conversation_id' | 'created_at' | 'entities' | 'geo' | 'id' | 'in_reply_to_user_id' | 'lang' | 'public_metrics' | 'non_public_metrics' | 'promoted_metrics' | 'organic_metrics' | 'edit_controls' | 'possibly_sensitive' | 'referenced_tweets' | 'reply_settings' | 'source' | 'text' | 'withheld' | 'note_tweet';
export declare type TTweetv2TweetField = 'attachments' | 'author_id' | 'context_annotations' | 'conversation_id' | 'created_at' | 'entities' | 'geo' | 'id' | 'in_reply_to_user_id' | 'lang' | 'public_metrics' | 'non_public_metrics' | 'promoted_metrics' | 'organic_metrics' | 'edit_controls' | 'possibly_sensitive' | 'referenced_tweets' | 'reply_settings' | 'source' | 'text' | 'withheld' | 'note_tweet' | 'edit_history_tweet_ids';
export declare type TTweetv2UserField = 'created_at' | 'description' | 'entities' | 'id' | 'location' | 'name' | 'pinned_tweet_id' | 'profile_image_url' | 'protected' | 'public_metrics' | 'url' | 'username' | 'verified' | 'verified_type' | 'withheld' | 'connection_status' | 'most_recent_tweet_id';

@@ -145,1 +145,25 @@ export interface Tweetv2FieldsParams {

export declare type BatchComplianceV2Result = DataV2<BatchComplianceJobV2>;
declare type TUsageField = 'cap_reset_day' | 'daily_client_app_usage' | 'daily_project_usage' | 'project_cap' | 'project_id' | 'project_usage';
export declare type TweetUsageV2Params = {
days?: number;
'usage.fields'?: TUsageField[];
};
declare type TUsageDaily = {
/** ISO date string */
date: string;
usage: string;
};
export declare type TweetV2UsageResult = DataV2<{
project_id?: string;
project_cap?: string;
project_usage?: string;
cap_reset_day?: number;
daily_project_usage?: {
project_id: string;
usage: TUsageDaily[];
}[];
daily_client_app_usage?: {
usage: TUsageDaily[];
}[];
}>;
export {};

@@ -26,3 +26,3 @@ import type { CashtagEntity, HashtagEntity, MentionEntity, UrlEntity } from '../entities.types';

}
export interface TweetRetweetedOrLikedByV2Params extends Partial<UsersV2Params> {
export interface TweetRetweetedOrLikedByV2Params extends UserV2TimelineParams {
asPaginator?: boolean;

@@ -96,2 +96,3 @@ }

like_count?: number;
media_count?: number;
};

@@ -98,0 +99,0 @@ pinned_tweet_id?: string;

import TwitterApiSubClient from '../client.subclient';
import { Tweetv2FieldsParams, Tweetv2SearchParams, UserV2Result, UsersV2Result, UsersV2Params, StreamingV2GetRulesParams, StreamingV2GetRulesResult, TweetV2LookupResult, TweetV2UserTimelineParams, StreamingV2AddRulesParams, StreamingV2DeleteRulesParams, StreamingV2UpdateRulesQuery, StreamingV2UpdateRulesDeleteResult, StreamingV2UpdateRulesAddResult, TweetV2SingleResult, TweetV2PaginableTimelineParams, TweetV2CountResult, TweetV2CountParams, TweetV2CountAllResult, TweetV2CountAllParams, TweetV2RetweetedByResult, TweetV2LikedByResult, UserV2TimelineParams, UserV2TimelineResult, FollowersV2ParamsWithPaginator, FollowersV2ParamsWithoutPaginator, TweetSearchV2StreamParams, TweetV2SingleStreamResult, TweetV2PaginableListParams, SpaceV2FieldsParams, SpaceV2LookupResult, SpaceV2CreatorLookupParams, SpaceV2SearchParams, SpaceV2SingleResult, BatchComplianceSearchV2Params, BatchComplianceListV2Result, BatchComplianceV2Result, BatchComplianceV2Params, BatchComplianceV2JobResult, BatchComplianceJobV2, GetListV2Params, ListGetV2Result, GetListTimelineV2Params, TweetRetweetedOrLikedByV2ParamsWithPaginator, TweetRetweetedOrLikedByV2ParamsWithoutPaginator, SpaceV2BuyersParams, TweetV2HomeTimelineParams } from '../types';
import { Tweetv2FieldsParams, Tweetv2SearchParams, UserV2Result, UsersV2Result, UsersV2Params, StreamingV2GetRulesParams, StreamingV2GetRulesResult, TweetV2LookupResult, TweetV2UserTimelineParams, StreamingV2AddRulesParams, StreamingV2DeleteRulesParams, StreamingV2UpdateRulesQuery, StreamingV2UpdateRulesDeleteResult, StreamingV2UpdateRulesAddResult, TweetV2SingleResult, TweetV2PaginableTimelineParams, TweetV2CountResult, TweetV2CountParams, TweetV2CountAllResult, TweetV2CountAllParams, TweetV2RetweetedByResult, TweetV2LikedByResult, UserV2TimelineParams, UserV2TimelineResult, FollowersV2ParamsWithPaginator, FollowersV2ParamsWithoutPaginator, TweetSearchV2StreamParams, TweetV2SingleStreamResult, TweetV2PaginableListParams, SpaceV2FieldsParams, SpaceV2LookupResult, SpaceV2CreatorLookupParams, SpaceV2SearchParams, SpaceV2SingleResult, BatchComplianceSearchV2Params, BatchComplianceListV2Result, BatchComplianceV2Result, BatchComplianceV2Params, BatchComplianceV2JobResult, BatchComplianceJobV2, GetListV2Params, ListGetV2Result, GetListTimelineV2Params, TweetRetweetedOrLikedByV2ParamsWithPaginator, TweetRetweetedOrLikedByV2ParamsWithoutPaginator, SpaceV2BuyersParams, TweetV2HomeTimelineParams, TweetUsageV2Params, TweetV2UsageResult } from '../types';
import { TweetSearchAllV2Paginator, TweetSearchRecentV2Paginator, TweetUserMentionTimelineV2Paginator, TweetUserTimelineV2Paginator, TweetV2UserLikedTweetsPaginator, UserOwnedListsV2Paginator, UserListMembershipsV2Paginator, UserListFollowedV2Paginator, TweetV2ListTweetsPaginator, TweetBookmarksTimelineV2Paginator, QuotedTweetsTimelineV2Paginator, TweetHomeTimelineV2Paginator } from '../paginators';

@@ -352,2 +352,8 @@ import TwitterApiv2LabsReadOnly from '../v2-labs/client.v2.labs.read';

complianceJobResult(job: BatchComplianceJobV2): Promise<BatchComplianceV2JobResult[]>;
/**
* Allows you to retrieve your project usage.
*
* https://developer.x.com/en/docs/x-api/usage/tweets/introduction
*/
usage(options?: Partial<TweetUsageV2Params>): Promise<TweetV2UsageResult>;
}

@@ -637,3 +637,12 @@ "use strict";

}
/* Usage */
/**
* Allows you to retrieve your project usage.
*
* https://developer.x.com/en/docs/x-api/usage/tweets/introduction
*/
async usage(options = {}) {
return this.get('usage/tweets', options);
}
}
exports.default = TwitterApiv2ReadOnly;

@@ -11,6 +11,6 @@ export interface Entity {

export interface HashtagEntity extends Entity {
hashtag: string;
tag: string;
}
export interface CashtagEntity extends Entity {
cashtag: string;
tag: string;
}

@@ -17,0 +17,0 @@ export interface MentionEntity extends Entity {

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

images?: TweetEntityUrlImageV2[];
media_key?: string;
}

@@ -105,0 +106,0 @@ export interface TweetEntityUrlImageV2 {

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

export declare type TTweetv2PollField = 'duration_minutes' | 'end_datetime' | 'id' | 'options' | 'voting_status';
export declare type TTweetv2TweetField = 'attachments' | 'author_id' | 'context_annotations' | 'conversation_id' | 'created_at' | 'entities' | 'geo' | 'id' | 'in_reply_to_user_id' | 'lang' | 'public_metrics' | 'non_public_metrics' | 'promoted_metrics' | 'organic_metrics' | 'edit_controls' | 'possibly_sensitive' | 'referenced_tweets' | 'reply_settings' | 'source' | 'text' | 'withheld' | 'note_tweet';
export declare type TTweetv2TweetField = 'attachments' | 'author_id' | 'context_annotations' | 'conversation_id' | 'created_at' | 'entities' | 'geo' | 'id' | 'in_reply_to_user_id' | 'lang' | 'public_metrics' | 'non_public_metrics' | 'promoted_metrics' | 'organic_metrics' | 'edit_controls' | 'possibly_sensitive' | 'referenced_tweets' | 'reply_settings' | 'source' | 'text' | 'withheld' | 'note_tweet' | 'edit_history_tweet_ids';
export declare type TTweetv2UserField = 'created_at' | 'description' | 'entities' | 'id' | 'location' | 'name' | 'pinned_tweet_id' | 'profile_image_url' | 'protected' | 'public_metrics' | 'url' | 'username' | 'verified' | 'verified_type' | 'withheld' | 'connection_status' | 'most_recent_tweet_id';

@@ -145,1 +145,25 @@ export interface Tweetv2FieldsParams {

export declare type BatchComplianceV2Result = DataV2<BatchComplianceJobV2>;
declare type TUsageField = 'cap_reset_day' | 'daily_client_app_usage' | 'daily_project_usage' | 'project_cap' | 'project_id' | 'project_usage';
export declare type TweetUsageV2Params = {
days?: number;
'usage.fields'?: TUsageField[];
};
declare type TUsageDaily = {
/** ISO date string */
date: string;
usage: string;
};
export declare type TweetV2UsageResult = DataV2<{
project_id?: string;
project_cap?: string;
project_usage?: string;
cap_reset_day?: number;
daily_project_usage?: {
project_id: string;
usage: TUsageDaily[];
}[];
daily_client_app_usage?: {
usage: TUsageDaily[];
}[];
}>;
export {};

@@ -26,3 +26,3 @@ import type { CashtagEntity, HashtagEntity, MentionEntity, UrlEntity } from '../entities.types';

}
export interface TweetRetweetedOrLikedByV2Params extends Partial<UsersV2Params> {
export interface TweetRetweetedOrLikedByV2Params extends UserV2TimelineParams {
asPaginator?: boolean;

@@ -96,2 +96,3 @@ }

like_count?: number;
media_count?: number;
};

@@ -98,0 +99,0 @@ pinned_tweet_id?: string;

import TwitterApiSubClient from '../client.subclient';
import { Tweetv2FieldsParams, Tweetv2SearchParams, UserV2Result, UsersV2Result, UsersV2Params, StreamingV2GetRulesParams, StreamingV2GetRulesResult, TweetV2LookupResult, TweetV2UserTimelineParams, StreamingV2AddRulesParams, StreamingV2DeleteRulesParams, StreamingV2UpdateRulesQuery, StreamingV2UpdateRulesDeleteResult, StreamingV2UpdateRulesAddResult, TweetV2SingleResult, TweetV2PaginableTimelineParams, TweetV2CountResult, TweetV2CountParams, TweetV2CountAllResult, TweetV2CountAllParams, TweetV2RetweetedByResult, TweetV2LikedByResult, UserV2TimelineParams, UserV2TimelineResult, FollowersV2ParamsWithPaginator, FollowersV2ParamsWithoutPaginator, TweetSearchV2StreamParams, TweetV2SingleStreamResult, TweetV2PaginableListParams, SpaceV2FieldsParams, SpaceV2LookupResult, SpaceV2CreatorLookupParams, SpaceV2SearchParams, SpaceV2SingleResult, BatchComplianceSearchV2Params, BatchComplianceListV2Result, BatchComplianceV2Result, BatchComplianceV2Params, BatchComplianceV2JobResult, BatchComplianceJobV2, GetListV2Params, ListGetV2Result, GetListTimelineV2Params, TweetRetweetedOrLikedByV2ParamsWithPaginator, TweetRetweetedOrLikedByV2ParamsWithoutPaginator, SpaceV2BuyersParams, TweetV2HomeTimelineParams } from '../types';
import { Tweetv2FieldsParams, Tweetv2SearchParams, UserV2Result, UsersV2Result, UsersV2Params, StreamingV2GetRulesParams, StreamingV2GetRulesResult, TweetV2LookupResult, TweetV2UserTimelineParams, StreamingV2AddRulesParams, StreamingV2DeleteRulesParams, StreamingV2UpdateRulesQuery, StreamingV2UpdateRulesDeleteResult, StreamingV2UpdateRulesAddResult, TweetV2SingleResult, TweetV2PaginableTimelineParams, TweetV2CountResult, TweetV2CountParams, TweetV2CountAllResult, TweetV2CountAllParams, TweetV2RetweetedByResult, TweetV2LikedByResult, UserV2TimelineParams, UserV2TimelineResult, FollowersV2ParamsWithPaginator, FollowersV2ParamsWithoutPaginator, TweetSearchV2StreamParams, TweetV2SingleStreamResult, TweetV2PaginableListParams, SpaceV2FieldsParams, SpaceV2LookupResult, SpaceV2CreatorLookupParams, SpaceV2SearchParams, SpaceV2SingleResult, BatchComplianceSearchV2Params, BatchComplianceListV2Result, BatchComplianceV2Result, BatchComplianceV2Params, BatchComplianceV2JobResult, BatchComplianceJobV2, GetListV2Params, ListGetV2Result, GetListTimelineV2Params, TweetRetweetedOrLikedByV2ParamsWithPaginator, TweetRetweetedOrLikedByV2ParamsWithoutPaginator, SpaceV2BuyersParams, TweetV2HomeTimelineParams, TweetUsageV2Params, TweetV2UsageResult } from '../types';
import { TweetSearchAllV2Paginator, TweetSearchRecentV2Paginator, TweetUserMentionTimelineV2Paginator, TweetUserTimelineV2Paginator, TweetV2UserLikedTweetsPaginator, UserOwnedListsV2Paginator, UserListMembershipsV2Paginator, UserListFollowedV2Paginator, TweetV2ListTweetsPaginator, TweetBookmarksTimelineV2Paginator, QuotedTweetsTimelineV2Paginator, TweetHomeTimelineV2Paginator } from '../paginators';

@@ -352,2 +352,8 @@ import TwitterApiv2LabsReadOnly from '../v2-labs/client.v2.labs.read';

complianceJobResult(job: BatchComplianceJobV2): Promise<BatchComplianceV2JobResult[]>;
/**
* Allows you to retrieve your project usage.
*
* https://developer.x.com/en/docs/x-api/usage/tweets/introduction
*/
usage(options?: Partial<TweetUsageV2Params>): Promise<TweetV2UsageResult>;
}

@@ -632,2 +632,11 @@ import TwitterApiSubClient from '../client.subclient';

}
/* Usage */
/**
* Allows you to retrieve your project usage.
*
* https://developer.x.com/en/docs/x-api/usage/tweets/introduction
*/
async usage(options = {}) {
return this.get('usage/tweets', options);
}
}
{
"name": "twitter-api-v2",
"version": "1.18.2",
"version": "1.19.0",
"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/cjs/index.js",

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