@glagan/rettiwt-api 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/.eslintrc.js +166 -0
  2. package/.gitattributes +3 -0
  3. package/.github/FUNDING.yml +4 -0
  4. package/.github/ISSUE_TEMPLATE/bug-report.yml +57 -0
  5. package/.github/ISSUE_TEMPLATE/feature-request.yml +20 -0
  6. package/.github/ISSUE_TEMPLATE/question.yml +15 -0
  7. package/.github/PULL_REQUEST_TEMPLATE.md +32 -0
  8. package/.github/workflows/ci.yml +32 -0
  9. package/.github/workflows/publish.yml +23 -0
  10. package/.nvmrc +1 -0
  11. package/.prettierignore +3 -0
  12. package/.prettierrc +13 -0
  13. package/LICENSE +21 -0
  14. package/README.md +566 -0
  15. package/dist/cli.js +43 -0
  16. package/eslint.config.mjs +17 -0
  17. package/package.json +50 -0
  18. package/src/Rettiwt.ts +97 -0
  19. package/src/cli.ts +48 -0
  20. package/src/collections/Extractors.ts +155 -0
  21. package/src/collections/Groups.ts +81 -0
  22. package/src/collections/Requests.ts +89 -0
  23. package/src/collections/Tweet.ts +17 -0
  24. package/src/commands/DirectMessage.ts +62 -0
  25. package/src/commands/List.ts +90 -0
  26. package/src/commands/Tweet.ts +437 -0
  27. package/src/commands/User.ts +367 -0
  28. package/src/enums/Api.ts +10 -0
  29. package/src/enums/Authentication.ts +10 -0
  30. package/src/enums/Data.ts +13 -0
  31. package/src/enums/Logging.ts +14 -0
  32. package/src/enums/Media.ts +10 -0
  33. package/src/enums/Notification.ts +12 -0
  34. package/src/enums/Resource.ts +69 -0
  35. package/src/enums/Tweet.ts +8 -0
  36. package/src/enums/raw/Analytics.ts +32 -0
  37. package/src/enums/raw/Media.ts +10 -0
  38. package/src/enums/raw/Notification.ts +11 -0
  39. package/src/enums/raw/Tweet.ts +20 -0
  40. package/src/helper/CliUtils.ts +17 -0
  41. package/src/helper/JsonUtils.ts +70 -0
  42. package/src/index.ts +128 -0
  43. package/src/models/RettiwtConfig.ts +101 -0
  44. package/src/models/args/FetchArgs.ts +169 -0
  45. package/src/models/args/PostArgs.ts +93 -0
  46. package/src/models/args/ProfileArgs.ts +68 -0
  47. package/src/models/auth/AuthCookie.ts +58 -0
  48. package/src/models/auth/AuthCredential.ts +83 -0
  49. package/src/models/data/Analytics.ts +97 -0
  50. package/src/models/data/BookmarkFolder.ts +73 -0
  51. package/src/models/data/Conversation.ts +344 -0
  52. package/src/models/data/CursoredData.ts +64 -0
  53. package/src/models/data/DirectMessage.ts +335 -0
  54. package/src/models/data/Inbox.ts +124 -0
  55. package/src/models/data/List.ts +113 -0
  56. package/src/models/data/Notification.ts +84 -0
  57. package/src/models/data/Tweet.ts +388 -0
  58. package/src/models/data/User.ts +187 -0
  59. package/src/models/errors/TwitterError.ts +65 -0
  60. package/src/models/params/Variables.ts +62 -0
  61. package/src/requests/DirectMessage.ts +229 -0
  62. package/src/requests/List.ts +203 -0
  63. package/src/requests/Media.ts +67 -0
  64. package/src/requests/Tweet.ts +607 -0
  65. package/src/requests/User.ts +1191 -0
  66. package/src/services/internal/AuthService.ts +115 -0
  67. package/src/services/internal/ErrorService.ts +41 -0
  68. package/src/services/internal/LogService.ts +34 -0
  69. package/src/services/public/DirectMessageService.ts +159 -0
  70. package/src/services/public/FetcherService.ts +366 -0
  71. package/src/services/public/ListService.ts +241 -0
  72. package/src/services/public/TweetService.ts +886 -0
  73. package/src/services/public/UserService.ts +1154 -0
  74. package/src/types/ErrorHandler.ts +13 -0
  75. package/src/types/Fetch.ts +3 -0
  76. package/src/types/RettiwtConfig.ts +48 -0
  77. package/src/types/args/FetchArgs.ts +233 -0
  78. package/src/types/args/PostArgs.ts +142 -0
  79. package/src/types/args/ProfileArgs.ts +33 -0
  80. package/src/types/auth/AuthCookie.ts +22 -0
  81. package/src/types/auth/AuthCredential.ts +28 -0
  82. package/src/types/auth/TransactionHeader.ts +8 -0
  83. package/src/types/data/Analytics.ts +58 -0
  84. package/src/types/data/BookmarkFolder.ts +12 -0
  85. package/src/types/data/Conversation.ts +44 -0
  86. package/src/types/data/CursoredData.ts +24 -0
  87. package/src/types/data/DirectMessage.ts +33 -0
  88. package/src/types/data/Inbox.ts +23 -0
  89. package/src/types/data/List.ts +33 -0
  90. package/src/types/data/Notification.ts +26 -0
  91. package/src/types/data/Tweet.ts +99 -0
  92. package/src/types/data/User.ts +54 -0
  93. package/src/types/errors/TwitterError.ts +37 -0
  94. package/src/types/params/Variables.ts +41 -0
  95. package/src/types/raw/base/Analytic.ts +32 -0
  96. package/src/types/raw/base/BookmarkFolder.ts +12 -0
  97. package/src/types/raw/base/Cursor.ts +13 -0
  98. package/src/types/raw/base/Error.ts +38 -0
  99. package/src/types/raw/base/LimitedVisibilityTweet.ts +40 -0
  100. package/src/types/raw/base/List.ts +50 -0
  101. package/src/types/raw/base/Media.ts +53 -0
  102. package/src/types/raw/base/Message.ts +22 -0
  103. package/src/types/raw/base/Notification.ts +66 -0
  104. package/src/types/raw/base/Space.ts +35 -0
  105. package/src/types/raw/base/Tweet.ts +139 -0
  106. package/src/types/raw/base/User.ts +182 -0
  107. package/src/types/raw/composite/DataResult.ts +8 -0
  108. package/src/types/raw/composite/TimelineList.ts +10 -0
  109. package/src/types/raw/composite/TimelineTweet.ts +14 -0
  110. package/src/types/raw/composite/TimelineUser.ts +13 -0
  111. package/src/types/raw/dm/Conversation.ts +59 -0
  112. package/src/types/raw/dm/InboxInitial.ts +155 -0
  113. package/src/types/raw/dm/InboxTimeline.ts +301 -0
  114. package/src/types/raw/dm/UserUpdates.ts +46 -0
  115. package/src/types/raw/generic/Response.ts +10 -0
  116. package/src/types/raw/list/AddMember.ts +175 -0
  117. package/src/types/raw/list/Details.ts +176 -0
  118. package/src/types/raw/list/Members.ts +154 -0
  119. package/src/types/raw/list/RemoveMember.ts +174 -0
  120. package/src/types/raw/list/Tweets.ts +2296 -0
  121. package/src/types/raw/media/FinalizeUpload.ts +20 -0
  122. package/src/types/raw/media/InitalizeUpload.ts +12 -0
  123. package/src/types/raw/media/LiveVideoStream.ts +21 -0
  124. package/src/types/raw/space/Details.ts +359 -0
  125. package/src/types/raw/tweet/Bookmark.ts +14 -0
  126. package/src/types/raw/tweet/Details.ts +210 -0
  127. package/src/types/raw/tweet/DetailsBulk.ts +338 -0
  128. package/src/types/raw/tweet/Like.ts +14 -0
  129. package/src/types/raw/tweet/Likers.ts +200 -0
  130. package/src/types/raw/tweet/Post.ts +150 -0
  131. package/src/types/raw/tweet/Replies.ts +539 -0
  132. package/src/types/raw/tweet/Retweet.ts +31 -0
  133. package/src/types/raw/tweet/Retweeters.ts +208 -0
  134. package/src/types/raw/tweet/Schedule.ts +18 -0
  135. package/src/types/raw/tweet/Search.ts +597 -0
  136. package/src/types/raw/tweet/Unbookmark.ts +14 -0
  137. package/src/types/raw/tweet/Unlike.ts +14 -0
  138. package/src/types/raw/tweet/Unpost.ts +20 -0
  139. package/src/types/raw/tweet/Unretweet.ts +31 -0
  140. package/src/types/raw/tweet/Unschedule.ts +14 -0
  141. package/src/types/raw/user/Affiliates.ts +179 -0
  142. package/src/types/raw/user/Analytics.ts +23 -0
  143. package/src/types/raw/user/BookmarkFolderTweets.ts +53 -0
  144. package/src/types/raw/user/BookmarkFolders.ts +41 -0
  145. package/src/types/raw/user/Bookmarks.ts +637 -0
  146. package/src/types/raw/user/Details.ts +185 -0
  147. package/src/types/raw/user/DetailsBulk.ts +104 -0
  148. package/src/types/raw/user/Follow.ts +280 -0
  149. package/src/types/raw/user/Followed.ts +1942 -0
  150. package/src/types/raw/user/Followers.ts +215 -0
  151. package/src/types/raw/user/Following.ts +215 -0
  152. package/src/types/raw/user/Highlights.ts +1287 -0
  153. package/src/types/raw/user/Likes.ts +1254 -0
  154. package/src/types/raw/user/Lists.ts +378 -0
  155. package/src/types/raw/user/Media.ts +1738 -0
  156. package/src/types/raw/user/Notifications.ts +499 -0
  157. package/src/types/raw/user/ProfileUpdate.ts +80 -0
  158. package/src/types/raw/user/Recommended.ts +2319 -0
  159. package/src/types/raw/user/Scheduled.ts +37 -0
  160. package/src/types/raw/user/Search.ts +230 -0
  161. package/src/types/raw/user/Subscriptions.ts +176 -0
  162. package/src/types/raw/user/Tweets.ts +1254 -0
  163. package/src/types/raw/user/TweetsAndReplies.ts +1254 -0
  164. package/src/types/raw/user/Unfollow.ts +280 -0
  165. package/tsconfig.json +97 -0
@@ -0,0 +1,35 @@
1
+ /* eslint-disable */
2
+
3
+ import { IDataResult } from '../composite/DataResult';
4
+ import { IUser } from './User';
5
+ import { ITweet } from './Tweet';
6
+
7
+ /**
8
+ * Represents the raw data of a single Space.
9
+ *
10
+ * @public
11
+ */
12
+ export interface ISpace {
13
+ rest_id: string;
14
+ state: string;
15
+ title: string;
16
+ media_key: string;
17
+ created_at: number;
18
+ started_at: number;
19
+ ended_at: string;
20
+ replay_start_time: number;
21
+ updated_at: number;
22
+ creator_results: IDataResult<IUser>;
23
+ conversation_controls: number;
24
+ disallow_join: boolean;
25
+ is_employee_only: boolean;
26
+ is_locked: boolean;
27
+ is_muted: boolean;
28
+ is_space_available_for_clipping: boolean;
29
+ is_space_available_for_replay: boolean;
30
+ narrow_cast_space_type: number;
31
+ no_incognito: boolean;
32
+ total_replay_watched: number;
33
+ total_live_listeners: number;
34
+ tweet_results: IDataResult<ITweet>;
35
+ }
@@ -0,0 +1,139 @@
1
+ /* eslint-disable */
2
+
3
+ import { IDataResult } from '../composite/DataResult';
4
+ import { IUser } from './User';
5
+ import { IMedia, IExtendedMedia } from './Media';
6
+ import { ILimitedVisibilityTweet } from './LimitedVisibilityTweet';
7
+
8
+ /**
9
+ * Represents the raw data of a single Tweet.
10
+ *
11
+ * @public
12
+ */
13
+ export interface ITweet {
14
+ __typename: string;
15
+ rest_id: string;
16
+ core: ITweetCore;
17
+ edit_control: ITweetEditControl;
18
+ edit_perspective: ITweetEditPerspective;
19
+ is_translatable: boolean;
20
+ views?: ITweetViews;
21
+ source: string;
22
+ quoted_status_result: IDataResult<ITweet | ILimitedVisibilityTweet>;
23
+ note_tweet: ITweetNote;
24
+ legacy: ITweetLegacy;
25
+ quick_promote_eligibility: ITweetQuickPromoteEligibilityInfo;
26
+ }
27
+
28
+ export interface ITweetCore {
29
+ user_results: IDataResult<IUser>;
30
+ }
31
+
32
+ export interface ITweetEditControl {
33
+ edit_tweet_ids: string[];
34
+ editable_until_msecs: string;
35
+ is_edit_eligible: boolean;
36
+ edits_remaining: string;
37
+ }
38
+
39
+ export interface ITweetEditPerspective {
40
+ favorited: boolean;
41
+ retweeted: boolean;
42
+ }
43
+
44
+ export interface ITweetViews {
45
+ count: string;
46
+ state: string;
47
+ }
48
+
49
+ export interface ITweetNote {
50
+ is_expandable: boolean;
51
+ note_tweet_results: ITweetNoteResults;
52
+ }
53
+
54
+ export interface ITweetNoteResults {
55
+ result: ITweetNoteResult;
56
+ }
57
+
58
+ export interface ITweetNoteResult {
59
+ id: string;
60
+ text: string;
61
+ entity_set: IEntities;
62
+ richtext: IRichtext;
63
+ media: ITweetNoteMedia;
64
+ }
65
+
66
+ export interface IRichtext {
67
+ richtext_tags: IRichtextTag[];
68
+ }
69
+
70
+ export interface IRichtextTag {
71
+ from_index: number;
72
+ to_index: number;
73
+ richtext_types: string[];
74
+ }
75
+
76
+ export interface ITweetNoteMedia {
77
+ inline_media: any[];
78
+ }
79
+
80
+ export interface ITweetLegacy {
81
+ bookmark_count?: number;
82
+ bookmarked: boolean;
83
+ created_at: string;
84
+ conversation_id_str: string;
85
+ display_text_range: number[];
86
+ entities: IEntities;
87
+ extended_entities: IExtendedEntities;
88
+ favorite_count?: number;
89
+ favorited: boolean;
90
+ full_text: string;
91
+ in_reply_to_status_id_str: string;
92
+ is_quote_status: boolean;
93
+ lang: string;
94
+ possibly_sensitive: boolean;
95
+ possibly_sensitive_editable: boolean;
96
+ quote_count?: number;
97
+ quoted_status_id_str: string;
98
+ reply_count?: number;
99
+ retweet_count?: number;
100
+ retweeted: boolean;
101
+ user_id_str: string;
102
+ id_str: string;
103
+ retweeted_status_result: IDataResult<ITweet | ILimitedVisibilityTweet>;
104
+ }
105
+
106
+ export interface IEntities {
107
+ media: IMedia[];
108
+ user_mentions: IUserMention[];
109
+ urls: IUrl[];
110
+ hashtags: IHashtag[];
111
+ symbols: any[];
112
+ }
113
+
114
+ export interface IUserMention {
115
+ id_str: string;
116
+ name: string;
117
+ screen_name: string;
118
+ indices: number[];
119
+ }
120
+
121
+ export interface IUrl {
122
+ display_url: string;
123
+ expanded_url: string;
124
+ url: string;
125
+ indices: number[];
126
+ }
127
+
128
+ export interface IHashtag {
129
+ indices: number[];
130
+ text: string;
131
+ }
132
+
133
+ export interface IExtendedEntities {
134
+ media: IExtendedMedia[];
135
+ }
136
+
137
+ export interface ITweetQuickPromoteEligibilityInfo {
138
+ eligibility: string;
139
+ }
@@ -0,0 +1,182 @@
1
+ /* eslint-disable */
2
+
3
+ import { IUrl } from './Tweet';
4
+
5
+ /**
6
+ * Represents the raw data of a single User.
7
+ *
8
+ * @public
9
+ */
10
+ export interface IUser {
11
+ __typename: string;
12
+ id: string;
13
+ rest_id: string;
14
+ core?: IUserCore;
15
+ avatar?: IUserAvatar;
16
+ affiliates_highlighted_label: IAffiliatesHighlightedLabel;
17
+ has_graduated_access: boolean;
18
+ is_blue_verified: boolean;
19
+ profile_image_shape: string;
20
+ legacy: IUserLegacy;
21
+ location?: IUserLocation;
22
+ super_follow_eligible: boolean;
23
+ smart_blocked_by: boolean;
24
+ smart_blocking: boolean;
25
+ verified_phone_status: boolean;
26
+ legacy_extended_profile: ILegacyExtendedProfile;
27
+ is_profile_translatable: boolean;
28
+ verification_info: IVerificationInfo;
29
+ highlights_info: IHighlightsInfo;
30
+ business_account: IBusinessAccountInfo;
31
+ creator_subscriptions_count: number;
32
+ }
33
+
34
+ export interface IUserCore {
35
+ created_at: string;
36
+ name: string;
37
+ screen_name: string;
38
+ }
39
+
40
+ export interface IUserAvatar {
41
+ image_url: string;
42
+ }
43
+
44
+ export interface IAffiliatesHighlightedLabel {
45
+ label: IAffiliateLabel;
46
+ }
47
+
48
+ export interface IAffiliateLabel {
49
+ url: IAffiliateUrl;
50
+ badge: IAffiliateBadge;
51
+ description: string;
52
+ longDescription: IAffiliateDescription;
53
+ userLabelType: string;
54
+ userLabelDisplayType: string;
55
+ }
56
+
57
+ export interface IAffiliateUrl {
58
+ url: string;
59
+ urlType: string;
60
+ }
61
+
62
+ export interface IAffiliateBadge {
63
+ url: string;
64
+ }
65
+
66
+ export interface IAffiliateDescription {
67
+ text: string;
68
+ entities: IAffiliateDescriptionEntity[];
69
+ }
70
+
71
+ export interface IAffiliateDescriptionEntity {
72
+ fromIndex: number;
73
+ toIndex: number;
74
+ ref: IAffiliateHighlightedMention;
75
+ }
76
+
77
+ export interface IAffiliateHighlightedMention {
78
+ type: string;
79
+ screen_name: string;
80
+ mention_results: IAffiliateHighlightedMentionResults;
81
+ }
82
+
83
+ export interface IAffiliateHighlightedMentionResults {
84
+ result: IAffiliateHighlightedMentionResult;
85
+ }
86
+
87
+ export interface IAffiliateHighlightedMentionResult {
88
+ __typename: string;
89
+ legacy: IAffiliateHighlightedMentionResultLegacy;
90
+ rest_id: string;
91
+ }
92
+
93
+ export interface IAffiliateHighlightedMentionResultLegacy {
94
+ screen_name: string;
95
+ }
96
+
97
+ export interface IUserLegacy {
98
+ created_at?: string;
99
+ name?: string;
100
+ screen_name?: string;
101
+ location?: string;
102
+ followed_by?: boolean;
103
+ following?: boolean;
104
+ can_dm: boolean;
105
+ can_media_tag: boolean;
106
+ default_profile: boolean;
107
+ default_profile_image: boolean;
108
+ description: string;
109
+ entities: IProfileEntities;
110
+ fast_followers_count: number;
111
+ favourites_count: number;
112
+ followers_count: number;
113
+ friends_count: number;
114
+ has_custom_timelines: boolean;
115
+ is_translator: boolean;
116
+ listed_count: number;
117
+ media_count: number;
118
+ normal_followers_count: number;
119
+ pinned_tweet_ids_str: string[];
120
+ possibly_sensitive: boolean;
121
+ profile_banner_url: string;
122
+ profile_image_url_https?: string;
123
+ profile_interstitial_type: string;
124
+ statuses_count: number;
125
+ translator_type: string;
126
+ verified: boolean;
127
+ want_retweets: boolean;
128
+ withheld_in_countries: string[];
129
+ }
130
+
131
+ export interface IProfileEntities {
132
+ description: IProfileDescription;
133
+ url: IProfileUrl;
134
+ }
135
+
136
+ export interface IProfileDescription {
137
+ urls: IUrl[];
138
+ }
139
+
140
+ export interface IProfileUrl {
141
+ urls: IUrl[];
142
+ }
143
+
144
+ export interface IUserLocation {
145
+ location: string;
146
+ }
147
+
148
+ export interface ILegacyExtendedProfile {}
149
+
150
+ export interface IVerificationInfo {
151
+ reason: IVerificationReason;
152
+ }
153
+
154
+ export interface IVerificationReason {
155
+ description: IVerificationReasonDescription;
156
+ verified_since_msec: string;
157
+ }
158
+
159
+ export interface IVerificationReasonDescription {
160
+ text: string;
161
+ entities: IVerificationEntity[];
162
+ }
163
+
164
+ export interface IVerificationEntity {
165
+ from_index: number;
166
+ to_index: number;
167
+ ref: IVerificationRef;
168
+ }
169
+
170
+ export interface IVerificationRef {
171
+ url: string;
172
+ url_type: string;
173
+ }
174
+
175
+ export interface IHighlightsInfo {
176
+ can_highlight_tweets: boolean;
177
+ highlighted_tweets: string;
178
+ }
179
+
180
+ export interface IBusinessAccountInfo {
181
+ affiliates_count: number;
182
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Represents inner data result of either a Tweet or User.
3
+ *
4
+ * @public
5
+ */
6
+ export interface IDataResult<T> {
7
+ result: T;
8
+ }
@@ -0,0 +1,10 @@
1
+ import { IList } from '../base/List';
2
+
3
+ /**
4
+ * Represents the raw data of a single timeline tweet.
5
+ *
6
+ * @public
7
+ */
8
+ export interface ITimelineList {
9
+ list: IList;
10
+ }
@@ -0,0 +1,14 @@
1
+ /* eslint-disable */
2
+
3
+ import { IDataResult } from './DataResult';
4
+ import { ITweet } from '../base/Tweet';
5
+ import { ILimitedVisibilityTweet } from '../base/LimitedVisibilityTweet';
6
+
7
+ /**
8
+ * Represents the raw data of a single timeline tweet.
9
+ *
10
+ * @public
11
+ */
12
+ export interface ITimelineTweet {
13
+ tweet_results: IDataResult<ITweet | ILimitedVisibilityTweet>;
14
+ }
@@ -0,0 +1,13 @@
1
+ /* eslint-disable */
2
+
3
+ import { IDataResult } from './DataResult';
4
+ import { IUser } from '../base/User';
5
+
6
+ /**
7
+ * Represents the raw data of a single timeline user.
8
+ *
9
+ * @public
10
+ */
11
+ export interface ITimelineUser {
12
+ user_results: IDataResult<IUser>;
13
+ }
@@ -0,0 +1,59 @@
1
+ /* eslint-disable */
2
+
3
+ import { Users, Conversations } from './InboxInitial';
4
+
5
+ /**
6
+ * The raw data received when fetching a specific conversation timeline.
7
+ *
8
+ * @public
9
+ */
10
+ export interface IConversationTimelineResponse {
11
+ conversation_timeline: ConversationTimeline;
12
+ }
13
+
14
+ interface ConversationTimeline {
15
+ status: 'HAS_MORE' | 'AT_END';
16
+ min_entry_id: string;
17
+ max_entry_id: string;
18
+ entries: ConversationEntry[];
19
+ users: Users;
20
+ conversations: Conversations;
21
+ }
22
+
23
+ type ConversationEntry = { message: ConversationMessage } | { trust_conversation: TrustConversation };
24
+
25
+ export interface ConversationMessage {
26
+ id: string;
27
+ time: string;
28
+ request_id: string;
29
+ conversation_id: string;
30
+ message_data: ConversationMessageData;
31
+ }
32
+
33
+ interface ConversationMessageData {
34
+ id: string;
35
+ time: string;
36
+ recipient_id: string;
37
+ sender_id: string;
38
+ text: string;
39
+ edit_count?: number;
40
+ message_reactions?: MessageReaction[];
41
+ }
42
+
43
+ interface MessageReaction {
44
+ id: string;
45
+ time: string;
46
+ conversation_id: string;
47
+ message_id: string;
48
+ reaction_key: string;
49
+ emoji_reaction: string;
50
+ sender_id: string;
51
+ }
52
+
53
+ interface TrustConversation {
54
+ id: string;
55
+ time: string;
56
+ request_id: string;
57
+ conversation_id: string;
58
+ reason: string; // e.g., "accept"
59
+ }
@@ -0,0 +1,155 @@
1
+ /* eslint-disable */
2
+
3
+ /**
4
+ * The raw data received when fetching the initial state of the DM inbox.
5
+ *
6
+ * @public
7
+ */
8
+ export interface IInboxInitialResponse {
9
+ inbox_initial_state: InboxInitialState;
10
+ }
11
+
12
+ export interface InboxInitialState {
13
+ last_seen_event_id: string;
14
+ trusted_last_seen_event_id: string;
15
+ untrusted_last_seen_event_id: string;
16
+ cursor: string;
17
+ inbox_timelines: InboxTimelines;
18
+ entries: Entry[];
19
+ users: Users;
20
+ conversations: Conversations;
21
+ }
22
+
23
+ interface InboxTimelines {
24
+ trusted: TimelineStatus;
25
+ untrusted: TimelineStatus;
26
+ untrusted_low_quality: TimelineStatus;
27
+ }
28
+
29
+ interface TimelineStatus {
30
+ status: string; // "HAS_MORE" | "AT_END"
31
+ min_entry_id: string;
32
+ }
33
+
34
+ interface Entry {
35
+ message: Message;
36
+ }
37
+
38
+ export interface Message {
39
+ id: string;
40
+ time: string;
41
+ affects_sort: boolean;
42
+ request_id: string;
43
+ conversation_id: string;
44
+ message_data: MessageData;
45
+ }
46
+
47
+ interface MessageData {
48
+ id: string;
49
+ time: string;
50
+ recipient_id: string;
51
+ sender_id: string;
52
+ text: string;
53
+ edit_count: number;
54
+ }
55
+
56
+ export interface Users {
57
+ [userId: string]: User;
58
+ }
59
+
60
+ interface User {
61
+ id: number;
62
+ id_str: string;
63
+ name: string;
64
+ screen_name: string;
65
+ profile_image_url: string;
66
+ profile_image_url_https: string;
67
+ following: boolean;
68
+ follow_request_sent: boolean;
69
+ description: string;
70
+ entities: UserEntities;
71
+ verified: boolean;
72
+ is_blue_verified: boolean;
73
+ protected: boolean;
74
+ blocking: boolean;
75
+ subscribed_by: boolean;
76
+ can_media_tag: boolean;
77
+ dm_blocked_by: boolean;
78
+ dm_blocking: boolean;
79
+ created_at: string;
80
+ friends_count: number;
81
+ followers_count: number;
82
+ }
83
+
84
+ interface UserEntities {
85
+ url: UrlEntity;
86
+ description: DescriptionEntity;
87
+ }
88
+
89
+ interface UrlEntity {
90
+ urls: UrlInfo[];
91
+ }
92
+
93
+ interface DescriptionEntity {
94
+ urls: UrlInfo[];
95
+ }
96
+
97
+ interface UrlInfo {
98
+ url: string;
99
+ expanded_url: string;
100
+ display_url: string;
101
+ indices: [number, number];
102
+ }
103
+
104
+ export interface Conversations {
105
+ [conversationId: string]: Conversation;
106
+ }
107
+
108
+ export interface Conversation {
109
+ conversation_id: string;
110
+ type: 'GROUP_DM' | 'ONE_TO_ONE';
111
+ sort_event_id: string;
112
+ sort_timestamp: string;
113
+ participants: Participant[];
114
+ nsfw: boolean;
115
+ notifications_disabled: boolean;
116
+ mention_notifications_disabled: boolean;
117
+ last_read_event_id: string;
118
+ trusted: boolean;
119
+ low_quality: boolean;
120
+ muted: boolean;
121
+ status: 'HAS_MORE' | 'AT_END';
122
+ min_entry_id: string;
123
+ max_entry_id: string;
124
+ create_time?: string; // Only for GROUP_DM
125
+ created_by_user_id?: string; // Only for GROUP_DM
126
+ name?: string; // Only for GROUP_DM
127
+ avatar_image_https?: string; // Only for GROUP_DM
128
+ avatar?: ConversationAvatar; // Only for GROUP_DM
129
+ read_only?: boolean; // Only for ONE_TO_ONE
130
+ social_proof?: SocialProof[]; // Only for untrusted conversations
131
+ }
132
+
133
+ interface ConversationAvatar {
134
+ image: {
135
+ original_info: {
136
+ url: string;
137
+ width: number;
138
+ height: number;
139
+ };
140
+ };
141
+ }
142
+
143
+ interface Participant {
144
+ user_id: string;
145
+ join_time?: string; // Only for GROUP_DM
146
+ last_read_event_id?: string;
147
+ join_conversation_event_id?: string; // Only for GROUP_DM
148
+ is_admin?: boolean; // Only for GROUP_DM
149
+ }
150
+
151
+ export interface SocialProof {
152
+ proof_type: string; // e.g., "mutual_friends"
153
+ users: any[]; // Array of users (structure depends on proof_type)
154
+ total: number;
155
+ }