UNPKG

twitter-api-v2

Version:

Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.

70 lines (69 loc) 2.27 kB
import type { CashtagEntity, HashtagEntity, MentionEntity, UrlEntity } from '../entities.types'; import type { ApiV2Includes } from './tweet.definition.v2'; import type { DataAndIncludeV2, DataMetaAndIncludeV2, DataV2 } from './shared.v2.types'; import type { TTweetv2TweetField, TTweetv2UserField } from './tweet.v2.types'; import type { TypeOrArrayOf } from '../shared.types'; export declare type TUserV2Expansion = 'pinned_tweet_id'; export interface UsersV2Params { expansions: TypeOrArrayOf<TUserV2Expansion>; 'tweet.fields': TypeOrArrayOf<TTweetv2TweetField>; 'user.fields': TypeOrArrayOf<TTweetv2UserField>; } export interface FollowersV2Params { expansions: TypeOrArrayOf<TUserV2Expansion>; max_results: number; pagination_token: string; 'tweet.fields': TypeOrArrayOf<TTweetv2TweetField>; 'user.fields': TypeOrArrayOf<TTweetv2UserField>; } export declare type UserV2Result = DataAndIncludeV2<UserV2, ApiV2Includes>; export declare type UsersV2Result = DataAndIncludeV2<UserV2[], ApiV2Includes>; export declare type FollowersV2Result = DataMetaAndIncludeV2<UserV2[], { result_count: number; previous_token?: string; next_token?: string; }, ApiV2Includes>; export declare type UserV2FollowResult = DataV2<{ following: boolean; pending_follow: boolean; }>; export declare type UserV2UnfollowResult = DataV2<{ following: boolean; }>; export declare type UserV2BlockResult = DataV2<{ blocking: boolean; }>; export interface UserV2 { id: string; name: string; username: string; created_at?: string; protected?: boolean; withheld?: { country_codes?: string[]; scope?: 'user'; }; location?: string; url?: string; description?: string; verified?: boolean; entities?: { url?: { urls: UrlEntity[]; }; description: { urls?: UrlEntity[]; hashtags?: HashtagEntity[]; cashtags?: CashtagEntity[]; mentions?: MentionEntity[]; }; }; profile_image_url?: string; public_metrics?: { followers_count?: number; following_count?: number; tweet_count?: number; listed_count?: number; }; pinned_tweet_id?: string; }