Skip to content

Commit

Permalink
Type support for Tweets with more than 280 characters (#526)
Browse files Browse the repository at this point in the history
* include note_tweet field in TweetV2 type

* define `NoteTweetV2` and `NoteTweetEntitiesV2` type

* fix typo
  • Loading branch information
weswalla authored Apr 22, 2024
1 parent 065b02a commit 31ae311
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/types/v2/tweet.definition.v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ export interface TweetOrganicMetricsV2 {

export type TweetPromotedMetricsV2 = TweetOrganicMetricsV2;

export interface NoteTweetV2 {
text: string;
entities?: NoteTweetEntitiesV2;
}

export type NoteTweetEntitiesV2 = Omit<TweetEntitiesV2, 'annotations'>;

export type TTweetReplySettingsV2 = 'mentionedUsers' | 'following' | 'everyone';

export interface SendTweetV2Params {
Expand Down Expand Up @@ -213,6 +220,7 @@ export interface TweetV2 {
lang?: string;
reply_settings?: 'everyone' | 'mentionedUsers' | 'following';
source?: string;
note_tweet?: NoteTweetV2;
}

export interface ApiV2Includes {
Expand Down
2 changes: 1 addition & 1 deletion src/types/v2/tweet.v2.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type TTweetv2PollField = 'duration_minutes' | 'end_datetime' | 'id' | 'op
export 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';
| 'possibly_sensitive' | 'referenced_tweets' | 'reply_settings' | 'source' | 'text' | 'withheld' | 'note_tweet';
export 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';
Expand Down

0 comments on commit 31ae311

Please sign in to comment.