/** * Generated by orval 🍺 * Do not edit manually. * Twitter OpenAPI * Twitter OpenAPI(Swagger) specification * OpenAPI spec version: 0.0.1 */ export type TypeName = (typeof TypeName)[keyof typeof TypeName]; export const TypeName = { TimelineTweet: "TimelineTweet", TimelineTimelineItem: "TimelineTimelineItem", TimelineUser: "TimelineUser", TimelineTimelineCursor: "TimelineTimelineCursor", TweetWithVisibilityResults: "TweetWithVisibilityResults", ContextualTweetInterstitial: "ContextualTweetInterstitial", TimelineTimelineModule: "TimelineTimelineModule", TweetTombstone: "TweetTombstone", TimelinePrompt: "TimelinePrompt", TimelineMessagePrompt: "TimelineMessagePrompt", TimelineCommunity: "TimelineCommunity", TimelineTombstone: "TimelineTombstone", TimelineTrend: "TimelineTrend", TimelineNotification: "TimelineNotification", TimelineNotificationAggregateUserActions: "TimelineNotificationAggregateUserActions", TweetUnavailable: "TweetUnavailable", TweetPreviewDisplay: "TweetPreviewDisplay", Tweet: "Tweet", User: "User", UserUnavailable: "UserUnavailable", Community: "Community", CommunityDeleteActionUnavailable: "CommunityDeleteActionUnavailable", CommunityJoinAction: "CommunityJoinAction", CommunityJoinActionUnavailable: "CommunityJoinActionUnavailable", CommunityLeaveActionUnavailable: "CommunityLeaveActionUnavailable", CommunityTweetPinActionUnavailable: "CommunityTweetPinActionUnavailable", CommunityTweetUnpinActionUnavailable: "CommunityTweetUnpinActionUnavailable", CommunityInvitesUnavailable: "CommunityInvitesUnavailable", CommunityJoinRequestsUnavailable: "CommunityJoinRequestsUnavailable", CommunityUnavailable: "CommunityUnavailable", ApiImage: "ApiImage", TimelineRichTextUser: "TimelineRichTextUser", } as const; export type ClientEventInfoDetails = { [key: string]: unknown }; export interface ClientEventInfo { component?: string; details?: ClientEventInfoDetails; element?: string; } export type ContentEntryType = (typeof ContentEntryType)[keyof typeof ContentEntryType]; export const ContentEntryType = { TimelineTimelineItem: "TimelineTimelineItem", TimelineTimelineCursor: "TimelineTimelineCursor", TimelineTimelineModule: "TimelineTimelineModule", } as const; export interface TextHighlight { endIndex: number; startIndex: number; } export interface Highlight { textHighlights: TextHighlight[]; } export type ContentItemType = (typeof ContentItemType)[keyof typeof ContentItemType]; export const ContentItemType = { TimelineTweet: "TimelineTweet", TimelineTimelineCursor: "TimelineTimelineCursor", TimelineUser: "TimelineUser", TimelinePrompt: "TimelinePrompt", TimelineMessagePrompt: "TimelineMessagePrompt", TimelineCommunity: "TimelineCommunity", TimelineTombstone: "TimelineTombstone", TimelineTrend: "TimelineTrend", TimelineNotification: "TimelineNotification", } as const; export type TimelineGeneralContextContextType = (typeof TimelineGeneralContextContextType)[keyof typeof TimelineGeneralContextContextType]; export const TimelineGeneralContextContextType = { Follow: "Follow", Pin: "Pin", Like: "Like", Location: "Location", Sparkle: "Sparkle", Conversation: "Conversation", List: "List", Community: "Community", Facepile: "Facepile", } as const; export type SocialContextLandingUrlUrlType = (typeof SocialContextLandingUrlUrlType)[keyof typeof SocialContextLandingUrlUrlType]; export const SocialContextLandingUrlUrlType = { DeepLink: "DeepLink", UrtEndpoint: "UrtEndpoint", ExternalUrl: "ExternalUrl", } as const; export interface UrtEndpointRequestParams { key: string; value: string; } export interface UrtEndpointOptions { requestParams: UrtEndpointRequestParams[]; title: string; } export interface SocialContextLandingUrl { url?: string; urlType?: SocialContextLandingUrlUrlType; urtEndpointOptions?: UrtEndpointOptions; } export type SocialContextUnionType = (typeof SocialContextUnionType)[keyof typeof SocialContextUnionType]; export const SocialContextUnionType = { TimelineGeneralContext: "TimelineGeneralContext", TimelineTopicContext: "TimelineTopicContext", } as const; export interface TimelineGeneralContext { contextImageUrls?: string[]; contextType?: TimelineGeneralContextContextType; landingUrl?: SocialContextLandingUrl; text?: string; type?: SocialContextUnionType; } export type TimelineTopicContextFunctionalityType = (typeof TimelineTopicContextFunctionalityType)[keyof typeof TimelineTopicContextFunctionalityType]; export const TimelineTopicContextFunctionalityType = { Basic: "Basic", } as const; export interface TopicContext { description?: string; following?: boolean; icon_url?: string; id?: string; name?: string; not_interested?: boolean; topic_id?: string; } export interface TimelineTopicContext { functionalityType?: TimelineTopicContextFunctionalityType; topic?: TopicContext; type?: SocialContextUnionType; } export type SocialContextUnion = TimelineGeneralContext | TimelineTopicContext; export type TimelineTweetTweetDisplayType = (typeof TimelineTweetTweetDisplayType)[keyof typeof TimelineTweetTweetDisplayType]; export const TimelineTweetTweetDisplayType = { Tweet: "Tweet", SelfThread: "SelfThread", MediaGrid: "MediaGrid", CondensedTweet: "CondensedTweet", } as const; export interface ArticleCoverMediaColorInfoPaletteRGB { blue: number; green: number; red: number; } export interface ArticleCoverMediaColorInfoPalette { percentage: number; rgb: ArticleCoverMediaColorInfoPaletteRGB; } export interface ArticleCoverMediaColorInfo { palette: ArticleCoverMediaColorInfoPalette[]; } export interface ArticleCoverMediaInfo { __typename?: TypeName; color_info: ArticleCoverMediaColorInfo; original_img_height: number; original_img_url: string; original_img_width: number; } export interface ArticleCoverMedia { id: string; /** @pattern ^[0-9]+$ */ media_id: string; media_info: ArticleCoverMediaInfo; media_key: string; } export interface ArticleLifecycleState { modified_at_secs: number; } export interface ArticleMetadata { first_published_at_secs: number; } export type ArticleResultContentState = { [key: string]: unknown }; export interface ArticleResult { content_state?: ArticleResultContentState; cover_media?: ArticleCoverMedia; id: string; is_grok_summary_eligible?: boolean; lifecycle_state?: ArticleLifecycleState; media_entities?: ArticleCoverMedia[]; metadata: ArticleMetadata; preview_text: string; /** @pattern ^[0-9]+$ */ rest_id: string; title: string; } export interface ArticleResults { result: ArticleResult; } export interface Article { article_results: ArticleResults; } export type CommunityDeleteActionResultReason = (typeof CommunityDeleteActionResultReason)[keyof typeof CommunityDeleteActionResultReason]; export const CommunityDeleteActionResultReason = { Unavailable: "Unavailable", } as const; export interface CommunityDeleteActionResult { __typename: TypeName; reason: CommunityDeleteActionResultReason; } export type _CommunityJoinActionTypename = (typeof _CommunityJoinActionTypename)[keyof typeof _CommunityJoinActionTypename]; export const _CommunityJoinActionTypename = { CommunityJoinAction: "CommunityJoinAction", } as const; export interface CommunityJoinAction { __typename: _CommunityJoinActionTypename; } export type _CommunityJoinActionUnavailableTypename = (typeof _CommunityJoinActionUnavailableTypename)[keyof typeof _CommunityJoinActionUnavailableTypename]; export const _CommunityJoinActionUnavailableTypename = { CommunityJoinActionUnavailable: "CommunityJoinActionUnavailable", } as const; export type CommunityJoinActionUnavailableReason = (typeof CommunityJoinActionUnavailableReason)[keyof typeof CommunityJoinActionUnavailableReason]; export const CommunityJoinActionUnavailableReason = { ViewerRequestRequired: "ViewerRequestRequired", } as const; export interface CommunityJoinActionUnavailable { __typename: _CommunityJoinActionUnavailableTypename; message: string; reason: CommunityJoinActionUnavailableReason; } export type CommunityJoinActionResultUnion = CommunityJoinAction | CommunityJoinActionUnavailable; export type CommunityLeaveActionResultReason = (typeof CommunityLeaveActionResultReason)[keyof typeof CommunityLeaveActionResultReason]; export const CommunityLeaveActionResultReason = { ViewerNotMember: "ViewerNotMember", } as const; export interface CommunityLeaveActionResult { __typename: TypeName; message: string; reason: CommunityLeaveActionResultReason; } export interface CommunityPinActionResult { __typename: TypeName; } export interface CommunityUnpinActionResult { __typename: TypeName; } export interface CommunityActions { delete_action_result?: CommunityDeleteActionResult; join_action_result?: CommunityJoinActionResultUnion; leave_action_result?: CommunityLeaveActionResult; pin_action_result?: CommunityPinActionResult; unpin_action_result?: CommunityUnpinActionResult; } export interface UserAvatar { image_url: string; } /** * @pattern ^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3])(: ?)([0-5][0-9])(: ?)([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$ */ export type TwitterTimeFormat = string; export interface UserCore { created_at: TwitterTimeFormat; name: string; screen_name: string; } export interface UserDmPermissions { can_dm: boolean; } export interface UserHighlightsInfo { can_highlight_tweets: boolean; highlighted_tweets: string; } export type UserLegacyVerifiedType = (typeof UserLegacyVerifiedType)[keyof typeof UserLegacyVerifiedType]; export const UserLegacyVerifiedType = { Business: "Business", Government: "Government", } as const; export type UserLegacyEntities = { [key: string]: unknown }; export type UserLegacyProfileBannerExtensions = { [key: string]: unknown }; export type UserLegacyProfileImageExtensions = { [key: string]: unknown }; export interface UserLegacy { blocked_by?: boolean; blocking?: boolean; can_dm?: boolean; can_media_tag?: boolean; created_at?: TwitterTimeFormat; default_profile: boolean; default_profile_image: boolean; description: string; entities: UserLegacyEntities; fast_followers_count: number; favourites_count: number; follow_request_sent?: boolean; followed_by?: boolean; followers_count: number; following?: boolean; friends_count: number; has_custom_timelines: boolean; is_translator: boolean; listed_count: number; location?: string; media_count: number; muting?: boolean; name?: string; normal_followers_count: number; notifications?: boolean; pinned_tweet_ids_str?: string[]; possibly_sensitive: boolean; profile_banner_extensions?: UserLegacyProfileBannerExtensions; profile_banner_url?: string; profile_image_extensions?: UserLegacyProfileImageExtensions; profile_image_url_https?: string; profile_interstitial_type: string; protected?: boolean; screen_name?: string; statuses_count: number; time_zone: string; translator_type: string; url?: string; utc_offset: number; verified?: boolean; verified_type?: UserLegacyVerifiedType; want_retweets?: boolean; withheld_description: string; withheld_in_countries?: string[]; withheld_scope: string; } export type UserLegacyExtendedProfileBirthdateVisibility = (typeof UserLegacyExtendedProfileBirthdateVisibility)[keyof typeof UserLegacyExtendedProfileBirthdateVisibility]; export const UserLegacyExtendedProfileBirthdateVisibility = { Self: "Self", Public: "Public", MutualFollow: "MutualFollow", Followers: "Followers", Following: "Following", } as const; export type UserLegacyExtendedProfileBirthdateYearVisibility = (typeof UserLegacyExtendedProfileBirthdateYearVisibility)[keyof typeof UserLegacyExtendedProfileBirthdateYearVisibility]; export const UserLegacyExtendedProfileBirthdateYearVisibility = { Self: "Self", Public: "Public", MutualFollow: "MutualFollow", Followers: "Followers", Following: "Following", } as const; export interface UserLegacyExtendedProfileBirthdate { day: number; month: number; visibility: UserLegacyExtendedProfileBirthdateVisibility; year?: number; year_visibility: UserLegacyExtendedProfileBirthdateYearVisibility; } export interface UserLegacyExtendedProfile { birthdate?: UserLegacyExtendedProfileBirthdate; } export interface UserLocation { location: string; } export interface UserMediaPermissions { can_media_tag: boolean; } export type UserParodyCommentaryFanLabel = (typeof UserParodyCommentaryFanLabel)[keyof typeof UserParodyCommentaryFanLabel]; export const UserParodyCommentaryFanLabel = { None: "None", Parody: "Parody", Commentary: "Commentary", Fan: "Fan", } as const; export interface UserPrivacy { protected: boolean; } export interface UserProfessionalCategory { icon_name: string; id: number; name: string; } export type UserProfessionalProfessionalType = (typeof UserProfessionalProfessionalType)[keyof typeof UserProfessionalProfessionalType]; export const UserProfessionalProfessionalType = { Business: "Business", Creator: "Creator", } as const; export interface UserProfessional { category?: UserProfessionalCategory[]; professional_type: UserProfessionalProfessionalType; /** @pattern ^[0-9]+$ */ rest_id: string; } export interface ProfileBio { description: string; } export type UserProfileImageShape = (typeof UserProfileImageShape)[keyof typeof UserProfileImageShape]; export const UserProfileImageShape = { Circle: "Circle", Square: "Square", Hexagon: "Hexagon", } as const; export interface UserRelationshipPerspectives { blocked_by?: boolean; blocking?: boolean; followed_by?: boolean; following?: boolean; } export interface SuperFollowUserProfile { is_active: boolean; } export interface UserProfile { super_follows_user_profile: SuperFollowUserProfile; } export interface UserTipJarSettings { bandcamp_handle?: string; bitcoin_handle?: string; cash_app_handle?: string; ethereum_handle?: string; gofundme_handle?: string; is_enabled?: boolean; patreon_handle?: string; pay_pal_handle?: string; venmo_handle?: string; } export type UserVerificationVerifiedType = (typeof UserVerificationVerifiedType)[keyof typeof UserVerificationVerifiedType]; export const UserVerificationVerifiedType = { Business: "Business", Government: "Government", } as const; export interface UserVerification { verified: boolean; verified_type?: UserVerificationVerifiedType; } export type UserVerificationInfoReasonDescriptionEntitiesRefUrlType = (typeof UserVerificationInfoReasonDescriptionEntitiesRefUrlType)[keyof typeof UserVerificationInfoReasonDescriptionEntitiesRefUrlType]; export const UserVerificationInfoReasonDescriptionEntitiesRefUrlType = { ExternalUrl: "ExternalUrl", } as const; export interface UserVerificationInfoReasonDescriptionEntitiesRef { url: string; url_type: UserVerificationInfoReasonDescriptionEntitiesRefUrlType; } export interface UserVerificationInfoReasonDescriptionEntities { from_index: number; ref: UserVerificationInfoReasonDescriptionEntitiesRef; to_index: number; } export interface UserVerificationInfoReasonDescription { entities: UserVerificationInfoReasonDescriptionEntities[]; text: string; } export interface UserVerificationInfoReason { description: UserVerificationInfoReasonDescription; override_verified_year?: number; /** @pattern ^-?[0-9]+$ */ verified_since_msec: string; } export interface UserVerificationInfo { is_identity_verified: boolean; reason?: UserVerificationInfoReason; } export type UserAffiliatesHighlightedLabel = { [key: string]: unknown }; export type UserBusinessAccount = { [key: string]: unknown }; export interface User { __typename: TypeName; affiliates_highlighted_label?: UserAffiliatesHighlightedLabel; avatar?: UserAvatar; business_account?: UserBusinessAccount; core?: UserCore; creator_subscriptions_count?: number; dm_permissions?: UserDmPermissions; has_graduated_access?: boolean; has_hidden_likes_on_profile?: boolean; has_hidden_subscriptions_on_profile?: boolean; has_nft_avatar?: boolean; highlights_info?: UserHighlightsInfo; /** @pattern ^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$ */ id: string; is_blue_verified: boolean; is_profile_translatable?: boolean; legacy: UserLegacy; legacy_extended_profile?: UserLegacyExtendedProfile; location?: UserLocation; media_permissions?: UserMediaPermissions; parody_commentary_fan_label?: UserParodyCommentaryFanLabel; premium_gifting_eligible?: boolean; privacy?: UserPrivacy; professional?: UserProfessional; profile_bio?: ProfileBio; profile_description_language?: string; profile_image_shape: UserProfileImageShape; profile_sort_enabled?: boolean; relationship_perspectives?: UserRelationshipPerspectives; /** @pattern ^[0-9]+$ */ rest_id: string; super_follow_eligible?: boolean; super_followed_by?: boolean; super_following?: boolean; super_follows_user_profile?: UserProfile; tipjar_settings?: UserTipJarSettings; user_seed_tweet_count?: number; verification?: UserVerification; verification_info?: UserVerificationInfo; verified_user_profiles?: UserProfile; } export interface UserUnavailable { __typename: TypeName; message?: string; reason: string; } export type UserUnion = User | UserUnavailable; export interface UserResults { result?: UserUnion; } export type CommunityInvitesPolicy = (typeof CommunityInvitesPolicy)[keyof typeof CommunityInvitesPolicy]; export const CommunityInvitesPolicy = { MemberInvitesAllowed: "MemberInvitesAllowed", ModeratorInvitesAllowed: "ModeratorInvitesAllowed", } as const; export type CommunityInvitesResultReason = (typeof CommunityInvitesResultReason)[keyof typeof CommunityInvitesResultReason]; export const CommunityInvitesResultReason = { Unavailable: "Unavailable", } as const; export interface CommunityInvitesResult { __typename: TypeName; message: string; reason: CommunityInvitesResultReason; } export type CommunityJoinPolicy = (typeof CommunityJoinPolicy)[keyof typeof CommunityJoinPolicy]; export const CommunityJoinPolicy = { Open: "Open", RestrictedJoinRequestsRequireModeratorApproval: "RestrictedJoinRequestsRequireModeratorApproval", } as const; export interface CommunityJoinRequestsResult { __typename: TypeName; } export interface PrimaryCommunityTopic { /** @pattern ^[0-9]+$ */ topic_id: string; topic_name: string; } export type CommunityRole = (typeof CommunityRole)[keyof typeof CommunityRole]; export const CommunityRole = { NonMember: "NonMember", } as const; export interface CommunityRule { description?: string; name: string; /** @pattern ^[0-9]+$ */ rest_id: string; } export interface CommunityUrlsPermalink { url: string; } export interface CommunityUrls { permalink: CommunityUrlsPermalink; } export type CommunityCustomBannerMedia = { [key: string]: unknown }; export type CommunityDefaultBannerMedia = { [key: string]: unknown }; export type CommunityViewerRelationship = { [key: string]: unknown }; export interface Community { __typename: TypeName; actions?: CommunityActions; admin_results?: UserResults; created_at?: number; creator_results?: UserResults; custom_banner_media?: CommunityCustomBannerMedia; default_banner_media?: CommunityDefaultBannerMedia; description?: string; /** @pattern ^[0-9]+$ */ id_str?: string; invites_policy?: CommunityInvitesPolicy; invites_result?: CommunityInvitesResult; is_pinned?: boolean; join_policy?: CommunityJoinPolicy; join_requests_result?: CommunityJoinRequestsResult; member_count?: number; members_facepile_results?: UserResults[]; moderator_count?: number; name?: string; primary_community_topic?: PrimaryCommunityTopic; question?: string; role?: CommunityRole; rules?: CommunityRule[]; search_tags?: string[]; show_only_users_to_display?: string[]; urls?: CommunityUrls; viewer_relationship?: CommunityViewerRelationship; } export interface CommunityUnavailable { __typename: TypeName; } export type CommunityUnion = Community | CommunityUnavailable; export interface CommunityResult { result: CommunityUnion; } export type AuthorCommunityRelationshipRole = (typeof AuthorCommunityRelationshipRole)[keyof typeof AuthorCommunityRelationshipRole]; export const AuthorCommunityRelationshipRole = { Member: "Member", Moderator: "Moderator", Admin: "Admin", NonMember: "NonMember", } as const; export interface AuthorCommunityRelationship { community_results: CommunityResult; role?: AuthorCommunityRelationshipRole; user_results?: UserResults; } export interface BirdwatchPivotCallToAction { destinationUrl: string; prompt: string; title: string; } export type BirdwatchEntityRefType = (typeof BirdwatchEntityRefType)[keyof typeof BirdwatchEntityRefType]; export const BirdwatchEntityRefType = { TimelineUrl: "TimelineUrl", TimelineRichTextHashtag: "TimelineRichTextHashtag", } as const; export type BirdwatchEntityRefUrlType = (typeof BirdwatchEntityRefUrlType)[keyof typeof BirdwatchEntityRefUrlType]; export const BirdwatchEntityRefUrlType = { ExternalUrl: "ExternalUrl", } as const; export interface BirdwatchEntityRef { text?: string; type: BirdwatchEntityRefType; url?: string; urlType?: BirdwatchEntityRefUrlType; } export interface BirdwatchEntity { fromIndex: number; ref: BirdwatchEntityRef; toIndex: number; } export interface BirdwatchPivotFooter { entities: BirdwatchEntity[]; text: string; } export type BirdwatchPivotFooterIconType = (typeof BirdwatchPivotFooterIconType)[keyof typeof BirdwatchPivotFooterIconType]; export const BirdwatchPivotFooterIconType = { BirdwatchEyeOff: "BirdwatchEyeOff", } as const; export type BirdwatchPivotIconType = (typeof BirdwatchPivotIconType)[keyof typeof BirdwatchPivotIconType]; export const BirdwatchPivotIconType = { BirdwatchV1Icon: "BirdwatchV1Icon", BirdwatchCameraVideo: "BirdwatchCameraVideo", } as const; export type GrokEntityRefType = (typeof GrokEntityRefType)[keyof typeof GrokEntityRefType]; export const GrokEntityRefType = { TimelineUrl: "TimelineUrl", TimelineRichTextHashtag: "TimelineRichTextHashtag", } as const; export type GrokEntityRefUrlType = (typeof GrokEntityRefUrlType)[keyof typeof GrokEntityRefUrlType]; export const GrokEntityRefUrlType = { ExternalUrl: "ExternalUrl", } as const; export interface GrokEntityRef { display_url?: string; expanded_url?: string; text?: string; type: GrokEntityRefType; url?: string; url_type?: GrokEntityRefUrlType; } export interface GrokEntity { from_index: string; ref: GrokEntityRef; to_index: string; } export interface GrokTranslatedCommunityNote { destination_language: string; rich_text_entities?: GrokEntity[]; source_language: string; translation: string; translation_available: boolean; } export interface GrokTranslatedCommunityNoteWithAvailability { data?: GrokTranslatedCommunityNote; is_available: boolean; } export interface BirdwatchPivotNote { grok_translated_community_note_with_availability?: GrokTranslatedCommunityNoteWithAvailability; is_community_note_translatable?: boolean; language?: string; /** @pattern ^[0-9]+$ */ rest_id: string; } export interface BirdwatchPivotSubtitle { entities: BirdwatchEntity[]; text: string; } export type BirdwatchPivotVisualStyle = (typeof BirdwatchPivotVisualStyle)[keyof typeof BirdwatchPivotVisualStyle]; export const BirdwatchPivotVisualStyle = { Default: "Default", Tentative: "Tentative", } as const; export interface BirdwatchPivot { callToAction?: BirdwatchPivotCallToAction; destinationUrl: string; footer?: BirdwatchPivotFooter; footerIconType?: BirdwatchPivotFooterIconType; iconType: BirdwatchPivotIconType; note?: BirdwatchPivotNote; shorttitle?: string; subtitle?: BirdwatchPivotSubtitle; title: string; titleDetail?: string; visualStyle?: BirdwatchPivotVisualStyle; } export interface TweetCardLegacyBindingValueDataImage { alt?: string; height: number; url: string; width: number; } export interface UserValue { /** @pattern ^[0-9]+$ */ id_str: string; } export type TweetCardLegacyBindingValueDataImageColorValue = { [key: string]: unknown }; export interface TweetCardLegacyBindingValueData { boolean_value?: boolean; image_color_value?: TweetCardLegacyBindingValueDataImageColorValue; image_value?: TweetCardLegacyBindingValueDataImage; scribe_key?: string; string_value?: string; type: string; user_value?: UserValue; } export interface TweetCardLegacyBindingValue { key: string; value: TweetCardLegacyBindingValueData; } export type TweetCardPlatformAudienceName = (typeof TweetCardPlatformAudienceName)[keyof typeof TweetCardPlatformAudienceName]; export const TweetCardPlatformAudienceName = { production: "production", } as const; export interface TweetCardPlatformAudience { name: TweetCardPlatformAudienceName; } export interface TweetCardPlatformDevice { name: string; /** @pattern ^[0-9]+$ */ version: string; } export interface TweetCardPlatform { audience: TweetCardPlatformAudience; device: TweetCardPlatformDevice; } export interface TweetCardPlatformData { platform: TweetCardPlatform; } export interface TweetCardLegacy { binding_values: TweetCardLegacyBindingValue[]; card_platform?: TweetCardPlatformData; name: string; url: string; user_refs_results?: UserResults[]; } export interface TweetCard { legacy?: TweetCardLegacy; rest_id?: string; } export type CommunityRelationshipModerationState = { [key: string]: unknown }; export interface CommunityRelationship { actions: CommunityActions; id: string; moderation_state: CommunityRelationshipModerationState; /** @pattern ^[0-9]+$ */ rest_id: string; } export interface ContentDisclosureAdvertisingDisclosure { is_paid_promotion: boolean; } export type ContentDisclosureAiGeneratedDisclosureAiGeneratedDetectionSource = (typeof ContentDisclosureAiGeneratedDisclosureAiGeneratedDetectionSource)[keyof typeof ContentDisclosureAiGeneratedDisclosureAiGeneratedDetectionSource]; export const ContentDisclosureAiGeneratedDisclosureAiGeneratedDetectionSource = { C2paClient: "C2paClient", ContentDisclosureAiGeneratedDisclosure: "ContentDisclosureAiGeneratedDisclosure", UserDeclared: "UserDeclared", } as const; export interface ContentDisclosureAiGeneratedDisclosure { ai_generated_detection_source?: ContentDisclosureAiGeneratedDisclosureAiGeneratedDetectionSource; can_edit: boolean; has_ai_generated_media: boolean; } export interface ContentDisclosure { advertising_disclosure?: ContentDisclosureAdvertisingDisclosure; ai_generated_disclosure?: ContentDisclosureAiGeneratedDisclosure; } export interface UserResultCore { user_results: UserResults; } export interface TweetEditControlInitial { /** @items.pattern ^[0-9]+$ */ edit_tweet_ids: string[]; /** @pattern ^[0-9]+$ */ editable_until_msecs: string; /** @pattern ^[0-9]+$ */ edits_remaining: string; is_edit_eligible: boolean; } export interface TweetEditControl { edit_control_initial?: TweetEditControlInitial; /** @items.pattern ^[0-9]+$ */ edit_tweet_ids?: string[]; /** @pattern ^[0-9]+$ */ editable_until_msecs?: string; /** @pattern ^[0-9]+$ */ edits_remaining?: string; /** @pattern ^[0-9]+$ */ initial_tweet_id?: string; is_edit_eligible?: boolean; } export interface TweetEditPrespective { favorited?: boolean; retweeted?: boolean; } export interface GrokAnnotation { is_image_editable_by_grok?: boolean; } export interface AnalysisResults { result: Tweet; } export type GrokShareAttachmentItemDeepsearchHeadersItem = { [key: string]: unknown }; export interface GrokShareAttachmentItem { analysis_post_id_results?: AnalysisResults; deepsearch_headers?: GrokShareAttachmentItemDeepsearchHeadersItem[]; media_urls: string[]; message: string; } export interface GrokShareAttachment { items: GrokShareAttachmentItem[]; } export interface Hashtag { [key: string]: unknown; } export interface AdditionalMediaInfoCallToActionsUrl { url: string; } export interface AdditionalMediaInfoCallToActions { visit_site?: AdditionalMediaInfoCallToActionsUrl; watch_now?: AdditionalMediaInfoCallToActionsUrl; } export interface AdditionalMediaInfo { call_to_actions?: AdditionalMediaInfoCallToActions; description?: string; embeddable?: boolean; monetizable: boolean; source_user?: UserResultCore; title?: string; } export interface AllowDownloadStatus { allow_download?: boolean; } export type ExtMediaAvailabilityStatus = (typeof ExtMediaAvailabilityStatus)[keyof typeof ExtMediaAvailabilityStatus]; export const ExtMediaAvailabilityStatus = { Available: "Available", Unavailable: "Unavailable", } as const; export interface ExtMediaAvailability { reason?: string; status?: ExtMediaAvailabilityStatus; } export interface GrokImageAnnotation { prompt: string; upsampled_prompt: string; } export interface MediaResult { grok_image_annotation?: GrokImageAnnotation; media_key: string; } export interface MediaResults { result: MediaResult; } export interface MediaOriginalInfoFocusRect { h: number; w: number; x: number; y: number; } export interface MediaOriginalInfo { focus_rects?: MediaOriginalInfoFocusRect[]; height: number; width: number; } export interface SensitiveMediaWarning { adult_content?: boolean; graphic_violence?: boolean; other?: boolean; } export type MediaSizeResize = (typeof MediaSizeResize)[keyof typeof MediaSizeResize]; export const MediaSizeResize = { crop: "crop", fit: "fit", } as const; export interface MediaSize { h: number; resize: MediaSizeResize; w: number; } export interface MediaSizes { large: MediaSize; medium: MediaSize; small: MediaSize; thumb: MediaSize; } export type MediaType = (typeof MediaType)[keyof typeof MediaType]; export const MediaType = { photo: "photo", video: "video", animated_gif: "animated_gif", } as const; export interface MediaVideoInfoVariant { bitrate?: number; content_type: string; url: string; } export interface MediaVideoInfo { aspect_ratio: number[]; duration_millis?: number; variants: MediaVideoInfoVariant[]; } export type MediaFeatures = { [key: string]: unknown }; export interface Media { additional_media_info?: AdditionalMediaInfo; allow_download_status?: AllowDownloadStatus; display_url: string; expanded_url: string; ext_alt_text?: string; ext_media_availability: ExtMediaAvailability; features?: MediaFeatures; grok_post_id?: string; /** @pattern ^[0-9]+$ */ id_str: string; indices: number[]; media_key: string; media_results?: MediaResults; media_url_https: string; original_info: MediaOriginalInfo; sensitive_media_warning?: SensitiveMediaWarning; sizes: MediaSizes; /** @pattern ^[0-9]+$ */ source_status_id_str?: string; /** @pattern ^[0-9]+$ */ source_user_id_str?: string; type: MediaType; url: string; video_info?: MediaVideoInfo; } export type SmarttagTagInfo = { [key: string]: unknown }; export interface SmarttagTag { info: SmarttagTagInfo; } export interface Smarttag { indices: number[]; tag: SmarttagTag; text: string; } export interface Symbol { [key: string]: unknown; } export interface Timestamp { indices: number[]; seconds: number; text: string; } export interface Url { display_url: string; expanded_url?: string; indices: number[]; url: string; } export interface UserMention { [key: string]: unknown; } export interface Entities { hashtags?: Hashtag[]; media?: Media[]; smarttags?: Smarttag[]; symbols?: Symbol[]; timestamps?: Timestamp[]; urls?: Url[]; user_mentions?: UserMention[]; } export type GrokTranslatedPostAssociatedData = { [key: string]: unknown }; export interface GrokTranslatedPost { associated_data?: GrokTranslatedPostAssociatedData; destination_language?: string; entities?: Entities; preview_translation?: string; source_language?: string; translation?: string; } export interface GrokTranslatedPostWithAvailability { data?: GrokTranslatedPost; is_available: boolean; } export interface MediaStats { viewCount: number; } export type MediaExtendedType = (typeof MediaExtendedType)[keyof typeof MediaExtendedType]; export const MediaExtendedType = { photo: "photo", video: "video", animated_gif: "animated_gif", } as const; export type MediaExtendedFeatures = { [key: string]: unknown }; export interface MediaExtended { additional_media_info?: AdditionalMediaInfo; allow_download_status?: AllowDownloadStatus; display_url: string; expanded_url: string; ext_alt_text?: string; ext_media_availability?: ExtMediaAvailability; features?: MediaExtendedFeatures; grok_post_id?: string; /** @pattern ^[0-9]+$ */ id_str: string; indices: number[]; mediaStats?: MediaStats; media_key: string; media_results?: MediaResults; media_url_https: string; original_info: MediaOriginalInfo; sensitive_media_warning?: SensitiveMediaWarning; sizes: MediaSizes; /** @pattern ^[0-9]+$ */ source_status_id_str?: string; /** @pattern ^[0-9]+$ */ source_user_id_str?: string; type: MediaExtendedType; url: string; video_info?: MediaVideoInfo; } export interface ExtendedEntities { media: MediaExtended[]; } export type TweetLegacyLimitedActions = (typeof TweetLegacyLimitedActions)[keyof typeof TweetLegacyLimitedActions]; export const TweetLegacyLimitedActions = { limited_replies: "limited_replies", non_compliant: "non_compliant", dynamic_product_ad: "dynamic_product_ad", stale_tweet: "stale_tweet", community_tweet_non_member_public_community: "community_tweet_non_member_public_community", community_tweet_non_member_closed_community: "community_tweet_non_member_closed_community", blocked_viewer: "blocked_viewer", } as const; export interface QuotedStatusPermalink { display: string; expanded: string; url: string; } export interface TweetLegacyScopes { followers: boolean; } export interface SelfThread { /** @pattern ^[0-9]+$ */ id_str: string; } export type TweetLegacyConversationControl = { [key: string]: unknown }; export type TweetLegacyPlace = { [key: string]: unknown }; export interface TweetLegacy { bookmark_count: number; bookmarked: boolean; conversation_control?: TweetLegacyConversationControl; /** @pattern ^[0-9]+$ */ conversation_id_str: string; created_at: TwitterTimeFormat; display_text_range: number[]; entities?: Entities; extended_entities?: ExtendedEntities; favorite_count: number; favorited: boolean; full_text: string; /** @pattern ^[0-9]+$ */ id_str: string; in_reply_to_screen_name?: string; /** @pattern ^[0-9]+$ */ in_reply_to_status_id_str?: string; /** @pattern ^[0-9]+$ */ in_reply_to_user_id_str?: string; is_quote_status: boolean; lang: string; limited_actions?: TweetLegacyLimitedActions; place?: TweetLegacyPlace; possibly_sensitive?: boolean; possibly_sensitive_editable?: boolean; quote_count: number; /** @pattern ^[0-9]+$ */ quoted_status_id_str?: string; quoted_status_permalink?: QuotedStatusPermalink; reply_count: number; retweet_count: number; retweeted: boolean; retweeted_status_result?: ItemResult; scopes?: TweetLegacyScopes; self_thread?: SelfThread; /** @pattern ^[0-9]+$ */ user_id_str: string; } export interface NoteTweetResultMediaInlineMedia { index: number; /** @pattern ^[0-9]+$ */ media_id: string; } export interface NoteTweetResultMedia { inline_media: NoteTweetResultMediaInlineMedia[]; } export type NoteTweetResultRichTextTagRichtextTypesItem = (typeof NoteTweetResultRichTextTagRichtextTypesItem)[keyof typeof NoteTweetResultRichTextTagRichtextTypesItem]; export const NoteTweetResultRichTextTagRichtextTypesItem = { Bold: "Bold", Italic: "Italic", } as const; export interface NoteTweetResultRichTextTag { from_index: number; richtext_types: NoteTweetResultRichTextTagRichtextTypesItem[]; to_index: number; } export interface NoteTweetResultRichText { richtext_tags: NoteTweetResultRichTextTag[]; } export interface NoteTweetResultData { entity_set: Entities; /** @pattern ^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$ */ id: string; media?: NoteTweetResultMedia; richtext?: NoteTweetResultRichText; text: string; } export interface NoteTweetResult { result: NoteTweetResultData; } export interface NoteTweet { is_expandable?: boolean; note_tweet_results: NoteTweetResult; } export type TweetPostCtaDisplayLocationsItem = (typeof TweetPostCtaDisplayLocationsItem)[keyof typeof TweetPostCtaDisplayLocationsItem]; export const TweetPostCtaDisplayLocationsItem = { TweetDetails: "TweetDetails", ForYouTimeline: "ForYouTimeline", RepliesTimeline: "RepliesTimeline", } as const; export interface PostCtaUserResultsAvatar { image_url: string; } export interface PostCtaUserResultsResult { __typename: TypeName; avatar: PostCtaUserResultsAvatar; } export interface PostCtaUserResults { result: PostCtaUserResultsResult; } export interface PostCtaTitleTextEntityRef { __typename: TypeName; user_results?: PostCtaUserResults; } export interface PostCtaTitleTextEntity { fromIndex: number; ref: PostCtaTitleTextEntityRef; toIndex: number; } export interface PostCtaTitleText { entities: PostCtaTitleTextEntity[]; text: string; } export interface PostCta { action_url: string; background_color: string; show_chevron: boolean; stroke_color: string; title_text: PostCtaTitleText; } export interface TweetPostCta { display_locations: TweetPostCtaDisplayLocationsItem[]; post_cta: PostCta; scribe_id?: string; } export interface TweetPreviousCounts { bookmark_count: number; favorite_count: number; quote_count: number; reply_count: number; retweet_count: number; } export interface QuotedRefResult { result?: TweetUnion; } export interface SuperFollowsReplyUserResultCore { screen_name: string; } export interface SuperFollowsReplyUserResultData { __typename: TypeName; core?: SuperFollowsReplyUserResultCore; } export interface SuperFollowsReplyUserResult { result: SuperFollowsReplyUserResultData; } export interface TrendResults { /** @pattern ^[0-9]+$ */ rest_id: string; } export type UnifiedCardCardFetchState = (typeof UnifiedCardCardFetchState)[keyof typeof UnifiedCardCardFetchState]; export const UnifiedCardCardFetchState = { NoCard: "NoCard", } as const; export interface UnifiedCard { card_fetch_state: UnifiedCardCardFetchState; } export type TweetViewState = (typeof TweetViewState)[keyof typeof TweetViewState]; export const TweetViewState = { Enabled: "Enabled", EnabledWithCount: "EnabledWithCount", } as const; export interface TweetView { /** @pattern ^[0-9]+$ */ count?: string; state: TweetViewState; } export type TweetQuickPromoteEligibility = { [key: string]: unknown }; export type TweetUnmentionData = { [key: string]: unknown }; export interface Tweet { __typename?: TypeName; article?: Article; author_community_relationship?: AuthorCommunityRelationship; birdwatch_pivot?: BirdwatchPivot; card?: TweetCard; community_relationship?: CommunityRelationship; community_results?: CommunityResult; content_disclosure?: ContentDisclosure; core?: UserResultCore; edit_control?: TweetEditControl; edit_prespective?: TweetEditPrespective; grok_analysis_button?: boolean; grok_analysis_followups?: string[]; grok_annotations?: GrokAnnotation; grok_share_attachment?: GrokShareAttachment; grok_translated_post_with_availability?: GrokTranslatedPostWithAvailability; has_birdwatch_notes?: boolean; is_translatable?: boolean; legacy?: TweetLegacy; note_tweet?: NoteTweet; postCta?: TweetPostCta; post_image_description?: string; post_video_description?: string; previous_counts?: TweetPreviousCounts; quick_promote_eligibility?: TweetQuickPromoteEligibility; quotedRefResult?: QuotedRefResult; quoted_status_result?: ItemResult; /** @pattern ^[0-9]+$ */ rest_id: string; source?: string; superFollowsReplyUserResult?: SuperFollowsReplyUserResult; trend_results?: TrendResults; unified_card?: UnifiedCard; unmention_data?: TweetUnmentionData; views?: TweetView; } export type TweetInterstitialTextEntityRefType = (typeof TweetInterstitialTextEntityRefType)[keyof typeof TweetInterstitialTextEntityRefType]; export const TweetInterstitialTextEntityRefType = { TimelineUrl: "TimelineUrl", } as const; export type TweetInterstitialTextEntityRefUrlType = (typeof TweetInterstitialTextEntityRefUrlType)[keyof typeof TweetInterstitialTextEntityRefUrlType]; export const TweetInterstitialTextEntityRefUrlType = { ExternalUrl: "ExternalUrl", } as const; export interface TweetInterstitialTextEntityRef { type: TweetInterstitialTextEntityRefType; url: string; urlType: TweetInterstitialTextEntityRefUrlType; } export interface TweetInterstitialTextEntity { fromIndex: number; ref: TweetInterstitialTextEntityRef; toIndex: number; } export interface TweetInterstitialText { entities: TweetInterstitialTextEntity[]; rtl: boolean; text: string; } export interface MediaVisibilityResultsBlurredImageInterstitial { opacity: number; text: TweetInterstitialText; title: TweetInterstitialText; } export interface MediaVisibilityResults { blurred_image_interstitial: MediaVisibilityResultsBlurredImageInterstitial; } export type TweetInterstitialDisplayType = (typeof TweetInterstitialDisplayType)[keyof typeof TweetInterstitialDisplayType]; export const TweetInterstitialDisplayType = { NonCompliant: "NonCompliant", EntireTweet: "EntireTweet", } as const; export interface TweetInterstitialRevealText { entities: TweetInterstitialTextEntity[]; rtl: boolean; text: string; } export interface TweetInterstitial { __typename: TypeName; displayType: TweetInterstitialDisplayType; revealText: TweetInterstitialRevealText; text: TweetInterstitialText; } export type TweetWithVisibilityResultsLimitedActionResults = { [key: string]: unknown }; export interface TweetWithVisibilityResults { __typename: TypeName; limitedActionResults?: TweetWithVisibilityResultsLimitedActionResults; mediaVisibilityResults?: MediaVisibilityResults; tweet: Tweet; tweetInterstitial?: TweetInterstitial; } export interface TweetTombstone { __typename?: TypeName; [key: string]: unknown; } export interface TweetUnavailable { __typename?: TypeName; reason?: string; } export type TweetPreviewDisplayCtaUrlUrlType = (typeof TweetPreviewDisplayCtaUrlUrlType)[keyof typeof TweetPreviewDisplayCtaUrlUrlType]; export const TweetPreviewDisplayCtaUrlUrlType = { DeepLink: "DeepLink", UrtEndpoint: "UrtEndpoint", ExternalUrl: "ExternalUrl", } as const; export interface TweetPreviewDisplayCtaUrl { url: string; urlType: TweetPreviewDisplayCtaUrlUrlType; } export interface TweetPreviewDisplayCta { title: string; url: TweetPreviewDisplayCtaUrl; } export type LimitedActionResultsDataAction = (typeof LimitedActionResultsDataAction)[keyof typeof LimitedActionResultsDataAction]; export const LimitedActionResultsDataAction = { Reply: "Reply", Retweet: "Retweet", QuoteTweet: "QuoteTweet", Like: "Like", React: "React", AddToBookmarks: "AddToBookmarks", AddToMoment: "AddToMoment", PinToProfile: "PinToProfile", ViewHiddenReplies: "ViewHiddenReplies", VoteOnPoll: "VoteOnPoll", ShowRetweetActionMenu: "ShowRetweetActionMenu", ReplyDownVote: "ReplyDownVote", SendViaDm: "SendViaDm", ViewPostEngagements: "ViewPostEngagements", } as const; export interface LimitedActionResultsData { action: LimitedActionResultsDataAction; } export interface TweetLimitedActionResults { limited_actions: LimitedActionResultsData[]; } export interface ArticlePreview { article_id: number; cover_media?: ArticleCoverMedia; preview_text: string; title: string; } export interface TweetPreviewDisplayTweetViewCount { /** @pattern ^[0-9]+$ */ count: string; } export type TweetPreviewDisplayTweetEntities = { [key: string]: unknown }; export interface TweetPreviewDisplayTweet { article_preview?: ArticlePreview; bookmark_count: number; core: UserResultCore; created_at: TwitterTimeFormat; entities: TweetPreviewDisplayTweetEntities; favorite_count: number; quote_count: number; reply_count: number; /** @pattern ^[0-9]+$ */ rest_id: string; retweet_count: number; text: string; view_count: TweetPreviewDisplayTweetViewCount; } export interface TweetPreviewDisplay { __typename: TypeName; cta: TweetPreviewDisplayCta; limited_action_results: TweetLimitedActionResults; tweet: TweetPreviewDisplayTweet; } export type TweetUnion = | Tweet | TweetWithVisibilityResults | TweetTombstone | TweetUnavailable | TweetPreviewDisplay; export interface ItemResult { __typename?: TypeName; result?: TweetUnion; } export type TimelineTweetPromotedMetadata = { [key: string]: unknown }; export interface TimelineTweet { __typename: TypeName; hasModeratedReplies?: boolean; highlights?: Highlight; itemType: ContentItemType; promotedMetadata?: TimelineTweetPromotedMetadata; socialContext?: SocialContextUnion; tweetDisplayType: TimelineTweetTweetDisplayType; tweet_results: ItemResult; } export type CursorType = (typeof CursorType)[keyof typeof CursorType]; export const CursorType = { Top: "Top", Bottom: "Bottom", ShowMore: "ShowMore", ShowMoreThreads: "ShowMoreThreads", Gap: "Gap", ShowMoreThreadsPrompt: "ShowMoreThreadsPrompt", } as const; export interface DisplayTreatment { actionText: string; labelText?: string; } export interface TimelineTimelineCursor { __typename: TypeName; cursorType: CursorType; displayTreatment?: DisplayTreatment; entryType?: ContentEntryType; itemType?: ContentEntryType; stopOnEmptyResponse?: boolean; value: string; } export type TimelineUserUserDisplayType = (typeof TimelineUserUserDisplayType)[keyof typeof TimelineUserUserDisplayType]; export const TimelineUserUserDisplayType = { User: "User", UserDetailed: "UserDetailed", SubscribableUser: "SubscribableUser", UserConcise: "UserConcise", } as const; export interface TimelineUser { __typename: TypeName; itemType: ContentItemType; socialContext?: SocialContextUnion; userDisplayType: TimelineUserUserDisplayType; user_results: UserResults; } export interface TimelinePrompt { __typename?: TypeName; [key: string]: unknown; } export interface TimelineMessagePrompt { __typename?: TypeName; [key: string]: unknown; } export interface TimelineCommunity { __typename?: TypeName; [key: string]: unknown; } export type TimelineTombstoneTombstoneDisplayType = (typeof TimelineTombstoneTombstoneDisplayType)[keyof typeof TimelineTombstoneTombstoneDisplayType]; export const TimelineTombstoneTombstoneDisplayType = { Inline: "Inline", } as const; export type TombstoneRefType = (typeof TombstoneRefType)[keyof typeof TombstoneRefType]; export const TombstoneRefType = { TimelineUrl: "TimelineUrl", } as const; export type TombstoneRefUrlType = (typeof TombstoneRefUrlType)[keyof typeof TombstoneRefUrlType]; export const TombstoneRefUrlType = { ExternalUrl: "ExternalUrl", } as const; export interface TombstoneRef { type?: TombstoneRefType; url?: string; urlType?: TombstoneRefUrlType; } export interface TombstoneEntity { fromIndex?: number; ref?: TombstoneRef; toIndex?: number; } export interface TombstoneRichText { entities?: TombstoneEntity[]; rtl?: boolean; text?: string; } export interface TombstoneInfo { richText?: TombstoneRichText; text?: string; } export interface TimelineTombstone { __typename?: TypeName; itemType?: ContentItemType; tombstoneDisplayType?: TimelineTombstoneTombstoneDisplayType; tombstoneInfo?: TombstoneInfo; } export interface TrendImage { url?: string; } export interface ThumbnailImage { original_img_height?: number; original_img_url?: string; original_img_width?: number; } export interface TrendMetadata { url?: SocialContextLandingUrl; } export interface TimelineTrend { __typename: TypeName; images?: TrendImage[]; is_ai_trend?: boolean; itemType?: ContentItemType; name: string; social_context?: SocialContextUnion; thumbnail_image?: ThumbnailImage; trend_metadata: TrendMetadata; trend_url: SocialContextLandingUrl; } export interface RichMessage { rtl?: boolean; text?: string; } export type NotificationTemplateFromUsersItem = { [key: string]: unknown }; export type NotificationTemplateTargetObjectsItem = { [key: string]: unknown }; export interface NotificationTemplate { __typename?: TypeName; from_users?: NotificationTemplateFromUsersItem[]; target_objects?: NotificationTemplateTargetObjectsItem[]; } export interface TimelineNotification { __typename: TypeName; id: string; itemType: ContentItemType; notification_icon: string; notification_url: SocialContextLandingUrl; rich_message: RichMessage; template: NotificationTemplate; timestamp_ms: string; } export type ItemContentUnion = | TimelineTweet | TimelineTimelineCursor | TimelineUser | TimelinePrompt | TimelineMessagePrompt | TimelineCommunity | TimelineTombstone | TimelineTrend | TimelineNotification; export type TimelineTimelineItemFeedbackInfo = { [key: string]: unknown }; export interface TimelineTimelineItem { __typename: TypeName; clientEventInfo?: ClientEventInfo; entryType: ContentEntryType; feedbackInfo?: TimelineTimelineItemFeedbackInfo; itemContent: ItemContentUnion; } export type DisplayType = (typeof DisplayType)[keyof typeof DisplayType]; export const DisplayType = { Vertical: "Vertical", VerticalConversation: "VerticalConversation", VerticalGrid: "VerticalGrid", Carousel: "Carousel", } as const; export interface FeedbackInfo { clientEventInfo?: ClientEventInfo; feedbackKeys?: string[]; } export interface ModuleEntry { clientEventInfo?: ClientEventInfo; feedbackInfo?: FeedbackInfo; itemContent: ItemContentUnion; } export interface ModuleItem { dispensable?: boolean; /** @pattern ^(([a-zA-Z]+|[0-9]+|[0-9a-f]+)(-|$))+ */ entryId: string; item: ModuleEntry; } export type TimelineTimelineModuleFooter = { [key: string]: unknown }; export type TimelineTimelineModuleHeader = { [key: string]: unknown }; export type TimelineTimelineModuleMetadata = { [key: string]: unknown }; export interface TimelineTimelineModule { __typename: TypeName; clientEventInfo?: ClientEventInfo; displayType: DisplayType; entryType: ContentEntryType; feedbackInfo?: FeedbackInfo; footer?: TimelineTimelineModuleFooter; header?: TimelineTimelineModuleHeader; items?: ModuleItem[]; metadata?: TimelineTimelineModuleMetadata; } export type ContentUnion = TimelineTimelineItem | TimelineTimelineModule | TimelineTimelineCursor; export interface TimelineAddEntry { content: ContentUnion; /** @pattern ^(([a-zA-Z]+|[0-9]+|[0-9a-f]+)(-|$))+ */ entryId: string; /** @pattern [0-9]+$ */ sortIndex: string; } export type InstructionType = (typeof InstructionType)[keyof typeof InstructionType]; export const InstructionType = { TimelineAddEntries: "TimelineAddEntries", TimelineAddToModule: "TimelineAddToModule", TimelineClearCache: "TimelineClearCache", TimelinePinEntry: "TimelinePinEntry", TimelineReplaceEntry: "TimelineReplaceEntry", TimelineShowAlert: "TimelineShowAlert", TimelineTerminateTimeline: "TimelineTerminateTimeline", TimelineShowCover: "TimelineShowCover", TimelineClearEntriesUnreadState: "TimelineClearEntriesUnreadState", TimelineMarkEntriesUnreadGreaterThanSortIndex: "TimelineMarkEntriesUnreadGreaterThanSortIndex", } as const; export interface TimelineAddEntries { entries: TimelineAddEntry[]; type: InstructionType; } export interface TimelineAddToModule { moduleEntryId: string; moduleItems: ModuleItem[]; prepend?: boolean; type: InstructionType; } export interface TimelineClearCache { type: InstructionType; } export interface TimelinePinEntry { entry: TimelineAddEntry; type: InstructionType; } export interface TimelineReplaceEntry { entry: TimelineAddEntry; entry_id_to_replace: string; type: InstructionType; } export type TimelineShowAlertAlertType = (typeof TimelineShowAlertAlertType)[keyof typeof TimelineShowAlertAlertType]; export const TimelineShowAlertAlertType = { NewTweets: "NewTweets", } as const; export type TimelineShowAlertDisplayLocation = (typeof TimelineShowAlertDisplayLocation)[keyof typeof TimelineShowAlertDisplayLocation]; export const TimelineShowAlertDisplayLocation = { Top: "Top", } as const; export type TimelineShowAlertColorConfig = { [key: string]: unknown }; export type TimelineShowAlertIconDisplayInfo = { [key: string]: unknown }; export type TimelineShowAlertRichTextEntitiesItem = { [key: string]: unknown }; export type TimelineShowAlertRichText = { entities?: TimelineShowAlertRichTextEntitiesItem[]; text?: string; }; export interface TimelineShowAlert { alertType?: TimelineShowAlertAlertType; clientEventInfo?: ClientEventInfo; colorConfig?: TimelineShowAlertColorConfig; displayDurationMs?: number; displayLocation?: TimelineShowAlertDisplayLocation; iconDisplayInfo?: TimelineShowAlertIconDisplayInfo; richText: TimelineShowAlertRichText; triggerDelayMs?: number; type: InstructionType; usersResults: UserResults[]; } export type TimelineTerminateTimelineDirection = (typeof TimelineTerminateTimelineDirection)[keyof typeof TimelineTerminateTimelineDirection]; export const TimelineTerminateTimelineDirection = { Top: "Top", Bottom: "Bottom", TopAndBottom: "TopAndBottom", } as const; export interface TimelineTerminateTimeline { direction: TimelineTerminateTimelineDirection; type: InstructionType; } export type TimelineHalfCoverHalfCoverDisplayType = (typeof TimelineHalfCoverHalfCoverDisplayType)[keyof typeof TimelineHalfCoverHalfCoverDisplayType]; export const TimelineHalfCoverHalfCoverDisplayType = { Cover: "Cover", } as const; export interface Callback { endpoint: string; } export type CoverCtaButtonStyle = (typeof CoverCtaButtonStyle)[keyof typeof CoverCtaButtonStyle]; export const CoverCtaButtonStyle = { Primary: "Primary", } as const; export type CtaClientEventInfoAction = (typeof CtaClientEventInfoAction)[keyof typeof CtaClientEventInfoAction]; export const CtaClientEventInfoAction = { primary_cta: "primary_cta", } as const; export interface CtaClientEventInfo { action: CtaClientEventInfoAction; } export type TimelineCoverBehaviorType = (typeof TimelineCoverBehaviorType)[keyof typeof TimelineCoverBehaviorType]; export const TimelineCoverBehaviorType = { TimelineCoverBehaviorDismiss: "TimelineCoverBehaviorDismiss", TimelineCoverBehaviorNavigate: "TimelineCoverBehaviorNavigate", } as const; export type TimelineCoverBehaviorUrlUrlType = (typeof TimelineCoverBehaviorUrlUrlType)[keyof typeof TimelineCoverBehaviorUrlUrlType]; export const TimelineCoverBehaviorUrlUrlType = { ExternalUrl: "ExternalUrl", } as const; export interface TimelineCoverBehaviorUrl { url: string; url_type: TimelineCoverBehaviorUrlUrlType; } export interface TimelineCoverBehavior { type: TimelineCoverBehaviorType; url?: TimelineCoverBehaviorUrl; } export interface CoverCta { Text?: string; buttonStyle?: CoverCtaButtonStyle; callbacks: Callback[]; clientEventInfo: CtaClientEventInfo; ctaBehavior: TimelineCoverBehavior; } export type TextEntityRefType = (typeof TextEntityRefType)[keyof typeof TextEntityRefType]; export const TextEntityRefType = { TimelineUrl: "TimelineUrl", } as const; export type TextEntityRefUrlType = (typeof TextEntityRefUrlType)[keyof typeof TextEntityRefUrlType]; export const TextEntityRefUrlType = { ExternalUrl: "ExternalUrl", } as const; export interface TextEntityRef { type: TextEntityRefType; url: string; urlType: TextEntityRefUrlType; } export interface TextEntity { fromIndex: number; ref: TextEntityRef; toIndex: number; } export interface Text { entities: TextEntity[]; text: string; } export type TimelineHalfCoverType = (typeof TimelineHalfCoverType)[keyof typeof TimelineHalfCoverType]; export const TimelineHalfCoverType = { TimelineHalfCover: "TimelineHalfCover", } as const; export interface TimelineHalfCover { dismissible: boolean; halfCoverDisplayType: TimelineHalfCoverHalfCoverDisplayType; impressionCallbacks: Callback[]; primaryCoverCta: CoverCta; primaryText: Text; secondaryText: Text; type: TimelineHalfCoverType; } export interface TimelineShowCover { clientEventInfo: ClientEventInfo; cover: TimelineHalfCover; type: InstructionType; } export interface TimelineClearEntriesUnreadState { type: InstructionType; } export interface TimelineMarkEntriesUnreadGreaterThanSortIndex { /** @pattern [0-9]+$ */ sort_index?: string; type: InstructionType; } export type InstructionUnion = | TimelineAddEntries | TimelineAddToModule | TimelineClearCache | TimelinePinEntry | TimelineReplaceEntry | TimelineShowAlert | TimelineTerminateTimeline | TimelineShowCover | TimelineClearEntriesUnreadState | TimelineMarkEntriesUnreadGreaterThanSortIndex; export type TimelineMetadata = { [key: string]: unknown }; export type TimelineResponseObjects = { [key: string]: unknown }; export interface Timeline { instructions: InstructionUnion[]; metadata?: TimelineMetadata; responseObjects?: TimelineResponseObjects; } export interface TimelineResult { id?: string; timeline?: Timeline; } export interface ListTweetsTimelineList { tweets_timeline: TimelineResult; } export interface ListTweetsTimelineData { list: ListTweetsTimelineList; } export interface Tracing { /** @pattern ^[0-9a-f]{16}$ */ trace_id: string; } export interface ErrorExtensions { code: number; kind: string; name: string; retry_after?: number; source: string; tracing: Tracing; } export interface Location { column: number; line: number; } export interface ErrorResponse { code: number; extensions: ErrorExtensions; kind: string; locations: Location[]; message: string; name: string; path: (string | number)[]; retry_after?: number; source: string; tracing: Tracing; } export interface ListLatestTweetsTimelineResponse { data: ListTweetsTimelineData; errors?: ErrorResponse[]; } export interface SearchTimeline { timeline: Timeline; } export interface SearchByRawQuery { search_timeline: SearchTimeline; } export interface SearchTimelineData { search_by_raw_query: SearchByRawQuery; } export interface SearchTimelineResponse { data: SearchTimelineData; errors?: ErrorResponse[]; } export interface TweetDetailResponseData { threaded_conversation_with_injections_v2?: Timeline; } export interface TweetDetailResponse { data: TweetDetailResponseData; errors?: ErrorResponse[]; } export interface UserResponseData { user?: UserResults; } export interface UserResponse { data: UserResponseData; errors?: ErrorResponse[]; } export interface UserTweetsResultV1 { __typename: TypeName; timeline: TimelineResult; } export interface UserTweetsUser { result: UserTweetsResultV1; } export interface UserTweetsData { user?: UserTweetsUser; } export interface UserTweetsResponse { data: UserTweetsData; errors?: ErrorResponse[]; } export type GetListLatestTweetsTimelineParams = { variables: { count: number; listId: string; }; features: { articles_preview_enabled: boolean; c9s_tweet_anatomy_moderator_badge_enabled: boolean; communities_web_enable_tweet_community_results_fetch: boolean; creator_subscriptions_quote_tweet_preview_enabled: boolean; creator_subscriptions_tweet_preview_api_enabled: boolean; freedom_of_speech_not_reach_fetch_enabled: boolean; graphql_is_translatable_rweb_tweet_is_translatable_enabled: boolean; longform_notetweets_consumption_enabled: boolean; longform_notetweets_inline_media_enabled: boolean; longform_notetweets_rich_text_read_enabled: boolean; payments_enabled: boolean; premium_content_api_read_enabled: boolean; profile_label_improvements_pcf_label_in_post_enabled: boolean; responsive_web_edit_tweet_api_enabled: boolean; responsive_web_enhance_cards_enabled: boolean; responsive_web_graphql_skip_user_profile_image_extensions_enabled: boolean; responsive_web_graphql_timeline_navigation_enabled: boolean; responsive_web_grok_analysis_button_from_backend: boolean; responsive_web_grok_analyze_button_fetch_trends_enabled: boolean; responsive_web_grok_analyze_post_followups_enabled: boolean; responsive_web_grok_community_note_auto_translation_is_enabled: boolean; responsive_web_grok_image_annotation_enabled: boolean; responsive_web_grok_imagine_annotation_enabled: boolean; responsive_web_grok_share_attachment_enabled: boolean; responsive_web_grok_show_grok_translated_post: boolean; responsive_web_jetfuel_frame: boolean; responsive_web_profile_redirect_enabled: boolean; responsive_web_twitter_article_tweet_consumption_enabled: boolean; rweb_tipjar_consumption_enabled: boolean; rweb_video_screen_enabled: boolean; standardized_nudges_misinfo: boolean; tweet_awards_web_tipping_enabled: boolean; tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: boolean; verified_phone_label_enabled: boolean; view_counts_everywhere_api_enabled: boolean; }; }; export type GetSearchTimelineParams = { variables: { count: number; product: string; querySource: string; rawQuery: string; }; features: { articles_preview_enabled: boolean; c9s_tweet_anatomy_moderator_badge_enabled: boolean; communities_web_enable_tweet_community_results_fetch: boolean; content_disclosure_ai_generated_indicator_enabled: boolean; content_disclosure_indicator_enabled: boolean; creator_subscriptions_tweet_preview_api_enabled: boolean; freedom_of_speech_not_reach_fetch_enabled: boolean; graphql_is_translatable_rweb_tweet_is_translatable_enabled: boolean; longform_notetweets_consumption_enabled: boolean; longform_notetweets_inline_media_enabled: boolean; longform_notetweets_rich_text_read_enabled: boolean; post_ctas_fetch_enabled: boolean; premium_content_api_read_enabled: boolean; profile_label_improvements_pcf_label_in_post_enabled: boolean; responsive_web_edit_tweet_api_enabled: boolean; responsive_web_enhance_cards_enabled: boolean; responsive_web_graphql_skip_user_profile_image_extensions_enabled: boolean; responsive_web_graphql_timeline_navigation_enabled: boolean; responsive_web_grok_analysis_button_from_backend: boolean; responsive_web_grok_analyze_button_fetch_trends_enabled: boolean; responsive_web_grok_analyze_post_followups_enabled: boolean; responsive_web_grok_annotations_enabled: boolean; responsive_web_grok_community_note_auto_translation_is_enabled: boolean; responsive_web_grok_image_annotation_enabled: boolean; responsive_web_grok_imagine_annotation_enabled: boolean; responsive_web_grok_share_attachment_enabled: boolean; responsive_web_grok_show_grok_translated_post: boolean; responsive_web_jetfuel_frame: boolean; responsive_web_profile_redirect_enabled: boolean; responsive_web_twitter_article_tweet_consumption_enabled: boolean; rweb_cashtags_composer_attachment_enabled: boolean; rweb_cashtags_enabled: boolean; rweb_conversational_replies_downvote_enabled: boolean; rweb_tipjar_consumption_enabled: boolean; rweb_video_screen_enabled: boolean; standardized_nudges_misinfo: boolean; tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: boolean; verified_phone_label_enabled: boolean; view_counts_everywhere_api_enabled: boolean; }; }; export type GetTweetDetailParams = { variables: { focalTweetId: string; includePromotedContent: boolean; rankingMode: string; referrer: string; withBirdwatchNotes: boolean; withCommunity: boolean; withQuickPromoteEligibilityTweetFields: boolean; withVoice: boolean; with_rux_injections: boolean; }; features: { articles_preview_enabled: boolean; c9s_tweet_anatomy_moderator_badge_enabled: boolean; communities_web_enable_tweet_community_results_fetch: boolean; content_disclosure_ai_generated_indicator_enabled: boolean; content_disclosure_indicator_enabled: boolean; creator_subscriptions_tweet_preview_api_enabled: boolean; freedom_of_speech_not_reach_fetch_enabled: boolean; graphql_is_translatable_rweb_tweet_is_translatable_enabled: boolean; longform_notetweets_consumption_enabled: boolean; longform_notetweets_inline_media_enabled: boolean; longform_notetweets_rich_text_read_enabled: boolean; post_ctas_fetch_enabled: boolean; premium_content_api_read_enabled: boolean; profile_label_improvements_pcf_label_in_post_enabled: boolean; responsive_web_edit_tweet_api_enabled: boolean; responsive_web_enhance_cards_enabled: boolean; responsive_web_graphql_skip_user_profile_image_extensions_enabled: boolean; responsive_web_graphql_timeline_navigation_enabled: boolean; responsive_web_grok_analysis_button_from_backend: boolean; responsive_web_grok_analyze_button_fetch_trends_enabled: boolean; responsive_web_grok_analyze_post_followups_enabled: boolean; responsive_web_grok_annotations_enabled: boolean; responsive_web_grok_community_note_auto_translation_is_enabled: boolean; responsive_web_grok_image_annotation_enabled: boolean; responsive_web_grok_imagine_annotation_enabled: boolean; responsive_web_grok_share_attachment_enabled: boolean; responsive_web_grok_show_grok_translated_post: boolean; responsive_web_jetfuel_frame: boolean; responsive_web_profile_redirect_enabled: boolean; responsive_web_twitter_article_tweet_consumption_enabled: boolean; rweb_cashtags_composer_attachment_enabled: boolean; rweb_cashtags_enabled: boolean; rweb_conversational_replies_downvote_enabled: boolean; rweb_tipjar_consumption_enabled: boolean; rweb_video_screen_enabled: boolean; standardized_nudges_misinfo: boolean; tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: boolean; verified_phone_label_enabled: boolean; view_counts_everywhere_api_enabled: boolean; }; fieldToggles: { withArticlePlainText: boolean; withArticleRichContentState: boolean; withArticleSummaryText: boolean; withArticleVoiceOver: boolean; withDisallowedReplyControls: boolean; withGrokAnalyze: boolean; }; }; export type GetUserByScreenNameParams = { variables: { screen_name: string; }; features: { creator_subscriptions_tweet_preview_api_enabled: boolean; hidden_profile_subscriptions_enabled: boolean; highlights_tweets_tab_ui_enabled: boolean; profile_label_improvements_pcf_label_in_post_enabled: boolean; responsive_web_graphql_skip_user_profile_image_extensions_enabled: boolean; responsive_web_graphql_timeline_navigation_enabled: boolean; responsive_web_profile_redirect_enabled: boolean; responsive_web_twitter_article_notes_tab_enabled: boolean; rweb_tipjar_consumption_enabled: boolean; subscriptions_feature_can_gift_premium: boolean; subscriptions_verification_info_is_identity_verified_enabled: boolean; subscriptions_verification_info_verified_since_enabled: boolean; verified_phone_label_enabled: boolean; }; fieldToggles: { withAuxiliaryUserLabels: boolean; withPayments: boolean; }; }; export type GetUserTweetsParams = { variables: { count: number; includePromotedContent: boolean; userId: string; withQuickPromoteEligibilityTweetFields: boolean; withVoice: boolean; }; features: { articles_preview_enabled: boolean; c9s_tweet_anatomy_moderator_badge_enabled: boolean; communities_web_enable_tweet_community_results_fetch: boolean; content_disclosure_ai_generated_indicator_enabled: boolean; content_disclosure_indicator_enabled: boolean; creator_subscriptions_tweet_preview_api_enabled: boolean; freedom_of_speech_not_reach_fetch_enabled: boolean; graphql_is_translatable_rweb_tweet_is_translatable_enabled: boolean; longform_notetweets_consumption_enabled: boolean; longform_notetweets_inline_media_enabled: boolean; longform_notetweets_rich_text_read_enabled: boolean; post_ctas_fetch_enabled: boolean; premium_content_api_read_enabled: boolean; profile_label_improvements_pcf_label_in_post_enabled: boolean; responsive_web_edit_tweet_api_enabled: boolean; responsive_web_enhance_cards_enabled: boolean; responsive_web_graphql_skip_user_profile_image_extensions_enabled: boolean; responsive_web_graphql_timeline_navigation_enabled: boolean; responsive_web_grok_analysis_button_from_backend: boolean; responsive_web_grok_analyze_button_fetch_trends_enabled: boolean; responsive_web_grok_analyze_post_followups_enabled: boolean; responsive_web_grok_annotations_enabled: boolean; responsive_web_grok_community_note_auto_translation_is_enabled: boolean; responsive_web_grok_image_annotation_enabled: boolean; responsive_web_grok_imagine_annotation_enabled: boolean; responsive_web_grok_share_attachment_enabled: boolean; responsive_web_grok_show_grok_translated_post: boolean; responsive_web_jetfuel_frame: boolean; responsive_web_profile_redirect_enabled: boolean; responsive_web_twitter_article_tweet_consumption_enabled: boolean; rweb_cashtags_composer_attachment_enabled: boolean; rweb_cashtags_enabled: boolean; rweb_conversational_replies_downvote_enabled: boolean; rweb_tipjar_consumption_enabled: boolean; rweb_video_screen_enabled: boolean; standardized_nudges_misinfo: boolean; tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: boolean; verified_phone_label_enabled: boolean; view_counts_everywhere_api_enabled: boolean; }; fieldToggles: { withArticlePlainText: boolean; }; }; export type getListLatestTweetsTimelineResponse200 = { data: ListLatestTweetsTimelineResponse; status: 200; }; export type getListLatestTweetsTimelineResponseSuccess = getListLatestTweetsTimelineResponse200 & { headers: Headers; }; export type getListLatestTweetsTimelineResponse = getListLatestTweetsTimelineResponseSuccess; export const getGetListLatestTweetsTimelineUrl = ( params: GetListLatestTweetsTimelineParams, pathQueryId: string = "FVWmROVvhgjRPC-4jAUh8A", ) => { const normalizedParams = new URLSearchParams(); Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : String(value)); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `/graphql/${pathQueryId}/ListLatestTweetsTimeline?${stringifiedParams}` : `/graphql/${pathQueryId}/ListLatestTweetsTimeline`; }; /** * get tweet list of timeline */ export const getListLatestTweetsTimeline = async ( params: GetListLatestTweetsTimelineParams, pathQueryId: string = "FVWmROVvhgjRPC-4jAUh8A", options?: RequestInit, ): Promise => { const res = await fetch(getGetListLatestTweetsTimelineUrl(params, pathQueryId), { ...options, method: "GET", }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data: getListLatestTweetsTimelineResponse["data"] = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers } as getListLatestTweetsTimelineResponse; }; export type getSearchTimelineResponse200 = { data: SearchTimelineResponse; status: 200; }; export type getSearchTimelineResponseSuccess = getSearchTimelineResponse200 & { headers: Headers; }; export type getSearchTimelineResponse = getSearchTimelineResponseSuccess; export const getGetSearchTimelineUrl = ( params: GetSearchTimelineParams, pathQueryId: string = "Yw6L66Pw54NHKuq4Dp7b4Q", ) => { const normalizedParams = new URLSearchParams(); Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : String(value)); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `/graphql/${pathQueryId}/SearchTimeline?${stringifiedParams}` : `/graphql/${pathQueryId}/SearchTimeline`; }; /** * search tweet list. product:[Top, Latest, People, Photos, Videos] */ export const getSearchTimeline = async ( params: GetSearchTimelineParams, pathQueryId: string = "Yw6L66Pw54NHKuq4Dp7b4Q", options?: RequestInit, ): Promise => { const res = await fetch(getGetSearchTimelineUrl(params, pathQueryId), { ...options, method: "GET", }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data: getSearchTimelineResponse["data"] = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers } as getSearchTimelineResponse; }; export type getTweetDetailResponse200 = { data: TweetDetailResponse; status: 200; }; export type getTweetDetailResponseSuccess = getTweetDetailResponse200 & { headers: Headers; }; export type getTweetDetailResponse = getTweetDetailResponseSuccess; export const getGetTweetDetailUrl = ( params: GetTweetDetailParams, pathQueryId: string = "oCon7R-cgWRFy6EfZjaKfg", ) => { const normalizedParams = new URLSearchParams(); Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : String(value)); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `/graphql/${pathQueryId}/TweetDetail?${stringifiedParams}` : `/graphql/${pathQueryId}/TweetDetail`; }; /** * get TweetDetail */ export const getTweetDetail = async ( params: GetTweetDetailParams, pathQueryId: string = "oCon7R-cgWRFy6EfZjaKfg", options?: RequestInit, ): Promise => { const res = await fetch(getGetTweetDetailUrl(params, pathQueryId), { ...options, method: "GET", }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data: getTweetDetailResponse["data"] = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers } as getTweetDetailResponse; }; export type getUserByScreenNameResponse200 = { data: UserResponse; status: 200; }; export type getUserByScreenNameResponseSuccess = getUserByScreenNameResponse200 & { headers: Headers; }; export type getUserByScreenNameResponse = getUserByScreenNameResponseSuccess; export const getGetUserByScreenNameUrl = ( params: GetUserByScreenNameParams, pathQueryId: string = "IGgvgiOx4QZndDHuD3x9TQ", ) => { const normalizedParams = new URLSearchParams(); Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : String(value)); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `/graphql/${pathQueryId}/UserByScreenName?${stringifiedParams}` : `/graphql/${pathQueryId}/UserByScreenName`; }; /** * get user by screen name */ export const getUserByScreenName = async ( params: GetUserByScreenNameParams, pathQueryId: string = "IGgvgiOx4QZndDHuD3x9TQ", options?: RequestInit, ): Promise => { const res = await fetch(getGetUserByScreenNameUrl(params, pathQueryId), { ...options, method: "GET", }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data: getUserByScreenNameResponse["data"] = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers } as getUserByScreenNameResponse; }; export type getUserTweetsResponse200 = { data: UserTweetsResponse; status: 200; }; export type getUserTweetsResponseSuccess = getUserTweetsResponse200 & { headers: Headers; }; export type getUserTweetsResponse = getUserTweetsResponseSuccess; export const getGetUserTweetsUrl = ( params: GetUserTweetsParams, pathQueryId: string = "36rb3Xj3iJ64Q-9wKDjCcQ", ) => { const normalizedParams = new URLSearchParams(); Object.entries(params || {}).forEach(([key, value]) => { if (value !== undefined) { normalizedParams.append(key, value === null ? "null" : String(value)); } }); const stringifiedParams = normalizedParams.toString(); return stringifiedParams.length > 0 ? `/graphql/${pathQueryId}/UserTweets?${stringifiedParams}` : `/graphql/${pathQueryId}/UserTweets`; }; /** * get user tweets */ export const getUserTweets = async ( params: GetUserTweetsParams, pathQueryId: string = "36rb3Xj3iJ64Q-9wKDjCcQ", options?: RequestInit, ): Promise => { const res = await fetch(getGetUserTweetsUrl(params, pathQueryId), { ...options, method: "GET", }); const body = [204, 205, 304].includes(res.status) ? null : await res.text(); const data: getUserTweetsResponse["data"] = body ? JSON.parse(body) : {}; return { data, status: res.status, headers: res.headers } as getUserTweetsResponse; };