x-twitter-scraper 0.20.0 → 0.21.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 (214) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +120 -121
  3. package/client.d.mts +7 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +7 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/extractions.d.mts +105 -5
  11. package/resources/extractions.d.mts.map +1 -1
  12. package/resources/extractions.d.ts +105 -5
  13. package/resources/extractions.d.ts.map +1 -1
  14. package/resources/index.d.mts +1 -1
  15. package/resources/index.d.mts.map +1 -1
  16. package/resources/index.d.ts +1 -1
  17. package/resources/index.d.ts.map +1 -1
  18. package/resources/index.js.map +1 -1
  19. package/resources/index.mjs.map +1 -1
  20. package/resources/monitors/index.d.mts +1 -1
  21. package/resources/monitors/index.d.mts.map +1 -1
  22. package/resources/monitors/index.d.ts +1 -1
  23. package/resources/monitors/index.d.ts.map +1 -1
  24. package/resources/monitors/index.js.map +1 -1
  25. package/resources/monitors/index.mjs.map +1 -1
  26. package/resources/monitors/monitors.d.mts +38 -1
  27. package/resources/monitors/monitors.d.mts.map +1 -1
  28. package/resources/monitors/monitors.d.ts +38 -1
  29. package/resources/monitors/monitors.d.ts.map +1 -1
  30. package/resources/monitors/monitors.js +18 -0
  31. package/resources/monitors/monitors.js.map +1 -1
  32. package/resources/monitors/monitors.mjs +18 -0
  33. package/resources/monitors/monitors.mjs.map +1 -1
  34. package/resources/monitors/posts.d.mts +27 -0
  35. package/resources/monitors/posts.d.mts.map +1 -1
  36. package/resources/monitors/posts.d.ts +27 -0
  37. package/resources/monitors/posts.d.ts.map +1 -1
  38. package/resources/shared.d.mts +175 -5
  39. package/resources/shared.d.mts.map +1 -1
  40. package/resources/shared.d.ts +175 -5
  41. package/resources/shared.d.ts.map +1 -1
  42. package/resources/x/account-connection-attempts.d.mts +4 -0
  43. package/resources/x/account-connection-attempts.d.mts.map +1 -1
  44. package/resources/x/account-connection-attempts.d.ts +4 -0
  45. package/resources/x/account-connection-attempts.d.ts.map +1 -1
  46. package/resources/x/account-connection-links.d.mts +159 -0
  47. package/resources/x/account-connection-links.d.mts.map +1 -0
  48. package/resources/x/account-connection-links.d.ts +159 -0
  49. package/resources/x/account-connection-links.d.ts.map +1 -0
  50. package/resources/x/account-connection-links.js +82 -0
  51. package/resources/x/account-connection-links.js.map +1 -0
  52. package/resources/x/account-connection-links.mjs +78 -0
  53. package/resources/x/account-connection-links.mjs.map +1 -0
  54. package/resources/x/accounts.d.mts +13 -9
  55. package/resources/x/accounts.d.mts.map +1 -1
  56. package/resources/x/accounts.d.ts +13 -9
  57. package/resources/x/accounts.d.ts.map +1 -1
  58. package/resources/x/analysis.d.mts +540 -36
  59. package/resources/x/analysis.d.mts.map +1 -1
  60. package/resources/x/analysis.d.ts +540 -36
  61. package/resources/x/analysis.d.ts.map +1 -1
  62. package/resources/x/bookmarks.d.mts +5 -0
  63. package/resources/x/bookmarks.d.mts.map +1 -1
  64. package/resources/x/bookmarks.d.ts +5 -0
  65. package/resources/x/bookmarks.d.ts.map +1 -1
  66. package/resources/x/communities/communities.d.mts +2 -2
  67. package/resources/x/communities/communities.d.mts.map +1 -1
  68. package/resources/x/communities/communities.d.ts +2 -2
  69. package/resources/x/communities/communities.d.ts.map +1 -1
  70. package/resources/x/communities/communities.js.map +1 -1
  71. package/resources/x/communities/communities.mjs.map +1 -1
  72. package/resources/x/communities/join.d.mts +2 -2
  73. package/resources/x/communities/join.d.mts.map +1 -1
  74. package/resources/x/communities/join.d.ts +2 -2
  75. package/resources/x/communities/join.d.ts.map +1 -1
  76. package/resources/x/dm.d.mts +2 -2
  77. package/resources/x/dm.d.mts.map +1 -1
  78. package/resources/x/dm.d.ts +2 -2
  79. package/resources/x/dm.d.ts.map +1 -1
  80. package/resources/x/index.d.mts +2 -1
  81. package/resources/x/index.d.mts.map +1 -1
  82. package/resources/x/index.d.ts +2 -1
  83. package/resources/x/index.d.ts.map +1 -1
  84. package/resources/x/index.js +3 -1
  85. package/resources/x/index.js.map +1 -1
  86. package/resources/x/index.mjs +1 -0
  87. package/resources/x/index.mjs.map +1 -1
  88. package/resources/x/media.d.mts +48 -1
  89. package/resources/x/media.d.mts.map +1 -1
  90. package/resources/x/media.d.ts +48 -1
  91. package/resources/x/media.d.ts.map +1 -1
  92. package/resources/x/media.js.map +1 -1
  93. package/resources/x/media.mjs.map +1 -1
  94. package/resources/x/profile.d.mts +3 -3
  95. package/resources/x/profile.d.mts.map +1 -1
  96. package/resources/x/profile.d.ts +3 -3
  97. package/resources/x/profile.d.ts.map +1 -1
  98. package/resources/x/tweets/bookmark.d.mts +84 -0
  99. package/resources/x/tweets/bookmark.d.mts.map +1 -0
  100. package/resources/x/tweets/bookmark.d.ts +84 -0
  101. package/resources/x/tweets/bookmark.d.ts.map +1 -0
  102. package/resources/x/tweets/bookmark.js +55 -0
  103. package/resources/x/tweets/bookmark.js.map +1 -0
  104. package/resources/x/tweets/bookmark.mjs +51 -0
  105. package/resources/x/tweets/bookmark.mjs.map +1 -0
  106. package/resources/x/tweets/index.d.mts +1 -0
  107. package/resources/x/tweets/index.d.mts.map +1 -1
  108. package/resources/x/tweets/index.d.ts +1 -0
  109. package/resources/x/tweets/index.d.ts.map +1 -1
  110. package/resources/x/tweets/index.js +3 -1
  111. package/resources/x/tweets/index.js.map +1 -1
  112. package/resources/x/tweets/index.mjs +1 -0
  113. package/resources/x/tweets/index.mjs.map +1 -1
  114. package/resources/x/tweets/like.d.mts +2 -2
  115. package/resources/x/tweets/like.d.mts.map +1 -1
  116. package/resources/x/tweets/like.d.ts +2 -2
  117. package/resources/x/tweets/like.d.ts.map +1 -1
  118. package/resources/x/tweets/retweet.d.mts +2 -2
  119. package/resources/x/tweets/retweet.d.mts.map +1 -1
  120. package/resources/x/tweets/retweet.d.ts +2 -2
  121. package/resources/x/tweets/retweet.d.ts.map +1 -1
  122. package/resources/x/tweets/tweets.d.mts +41 -13
  123. package/resources/x/tweets/tweets.d.mts.map +1 -1
  124. package/resources/x/tweets/tweets.d.ts +41 -13
  125. package/resources/x/tweets/tweets.d.ts.map +1 -1
  126. package/resources/x/tweets/tweets.js +4 -0
  127. package/resources/x/tweets/tweets.js.map +1 -1
  128. package/resources/x/tweets/tweets.mjs +4 -0
  129. package/resources/x/tweets/tweets.mjs.map +1 -1
  130. package/resources/x/users/block.d.mts +84 -0
  131. package/resources/x/users/block.d.mts.map +1 -0
  132. package/resources/x/users/block.d.ts +84 -0
  133. package/resources/x/users/block.d.ts.map +1 -0
  134. package/resources/x/users/block.js +55 -0
  135. package/resources/x/users/block.js.map +1 -0
  136. package/resources/x/users/block.mjs +51 -0
  137. package/resources/x/users/block.mjs.map +1 -0
  138. package/resources/x/users/follow.d.mts +2 -2
  139. package/resources/x/users/follow.d.mts.map +1 -1
  140. package/resources/x/users/follow.d.ts +2 -2
  141. package/resources/x/users/follow.d.ts.map +1 -1
  142. package/resources/x/users/index.d.mts +3 -1
  143. package/resources/x/users/index.d.mts.map +1 -1
  144. package/resources/x/users/index.d.ts +3 -1
  145. package/resources/x/users/index.d.ts.map +1 -1
  146. package/resources/x/users/index.js +5 -1
  147. package/resources/x/users/index.js.map +1 -1
  148. package/resources/x/users/index.mjs +2 -0
  149. package/resources/x/users/index.mjs.map +1 -1
  150. package/resources/x/users/mute.d.mts +84 -0
  151. package/resources/x/users/mute.d.mts.map +1 -0
  152. package/resources/x/users/mute.d.ts +84 -0
  153. package/resources/x/users/mute.d.ts.map +1 -0
  154. package/resources/x/users/mute.js +55 -0
  155. package/resources/x/users/mute.js.map +1 -0
  156. package/resources/x/users/mute.mjs +51 -0
  157. package/resources/x/users/mute.mjs.map +1 -0
  158. package/resources/x/users/users.d.mts +359 -9
  159. package/resources/x/users/users.d.mts.map +1 -1
  160. package/resources/x/users/users.d.ts +359 -9
  161. package/resources/x/users/users.d.ts.map +1 -1
  162. package/resources/x/users/users.js +27 -1
  163. package/resources/x/users/users.js.map +1 -1
  164. package/resources/x/users/users.mjs +27 -1
  165. package/resources/x/users/users.mjs.map +1 -1
  166. package/resources/x/write-actions.d.mts +1 -1
  167. package/resources/x/write-actions.d.mts.map +1 -1
  168. package/resources/x/write-actions.d.ts +1 -1
  169. package/resources/x/write-actions.d.ts.map +1 -1
  170. package/resources/x/x.d.mts +15 -2
  171. package/resources/x/x.d.mts.map +1 -1
  172. package/resources/x/x.d.ts +15 -2
  173. package/resources/x/x.d.ts.map +1 -1
  174. package/resources/x/x.js +4 -0
  175. package/resources/x/x.js.map +1 -1
  176. package/resources/x/x.mjs +4 -0
  177. package/resources/x/x.mjs.map +1 -1
  178. package/src/client.ts +9 -0
  179. package/src/core/README.md +4 -0
  180. package/src/internal/README.md +6 -1
  181. package/src/resources/extractions.ts +125 -0
  182. package/src/resources/index.ts +2 -0
  183. package/src/resources/monitors/index.ts +2 -0
  184. package/src/resources/monitors/monitors.ts +49 -0
  185. package/src/resources/monitors/posts.ts +32 -0
  186. package/src/resources/shared.ts +203 -4
  187. package/src/resources/x/account-connection-attempts.ts +5 -0
  188. package/src/resources/x/account-connection-links.ts +215 -0
  189. package/src/resources/x/accounts.ts +15 -14
  190. package/src/resources/x/analysis.ts +618 -36
  191. package/src/resources/x/bookmarks.ts +6 -0
  192. package/src/resources/x/communities/communities.ts +12 -0
  193. package/src/resources/x/communities/join.ts +12 -0
  194. package/src/resources/x/dm.ts +12 -0
  195. package/src/resources/x/index.ts +15 -0
  196. package/src/resources/x/media.ts +64 -0
  197. package/src/resources/x/profile.ts +18 -0
  198. package/src/resources/x/tweets/bookmark.ts +127 -0
  199. package/src/resources/x/tweets/index.ts +7 -0
  200. package/src/resources/x/tweets/like.ts +12 -0
  201. package/src/resources/x/tweets/retweet.ts +12 -0
  202. package/src/resources/x/tweets/tweets.ts +69 -10
  203. package/src/resources/x/users/block.ts +119 -0
  204. package/src/resources/x/users/follow.ts +12 -0
  205. package/src/resources/x/users/index.ts +20 -0
  206. package/src/resources/x/users/mute.ts +119 -0
  207. package/src/resources/x/users/users.ts +470 -7
  208. package/src/resources/x/write-actions.ts +6 -0
  209. package/src/resources/x/x.ts +48 -0
  210. package/src/version.ts +1 -1
  211. package/version.d.mts +1 -1
  212. package/version.d.ts +1 -1
  213. package/version.js +1 -1
  214. package/version.mjs +1 -1
@@ -156,6 +156,12 @@ export interface BookmarkListParams {
156
156
  * Optional bookmark folder ID. Folders need X Premium.
157
157
  */
158
158
  folderId?: string;
159
+
160
+ /**
161
+ * Items per page, 1 to 100, default 20. Source, filters or credits can return
162
+ * fewer. Follow next_cursor for more pages.
163
+ */
164
+ pageSize?: number;
159
165
  }
160
166
 
161
167
  export interface BookmarkRetrieveFoldersParams {
@@ -353,8 +353,14 @@ export interface CommunityCreateResponse {
353
353
  | 'unlike'
354
354
  | 'retweet'
355
355
  | 'unretweet'
356
+ | 'bookmark'
357
+ | 'unbookmark'
356
358
  | 'follow'
357
359
  | 'unfollow'
360
+ | 'block'
361
+ | 'unblock'
362
+ | 'mute'
363
+ | 'unmute'
358
364
  | 'remove_follower'
359
365
  | 'send_dm'
360
366
  | 'delete_dm'
@@ -604,8 +610,14 @@ export interface CommunityDeleteResponse {
604
610
  | 'unlike'
605
611
  | 'retweet'
606
612
  | 'unretweet'
613
+ | 'bookmark'
614
+ | 'unbookmark'
607
615
  | 'follow'
608
616
  | 'unfollow'
617
+ | 'block'
618
+ | 'unblock'
619
+ | 'mute'
620
+ | 'unmute'
609
621
  | 'remove_follower'
610
622
  | 'send_dm'
611
623
  | 'delete_dm'
@@ -83,8 +83,14 @@ export interface JoinCreateResponse {
83
83
  | 'unlike'
84
84
  | 'retweet'
85
85
  | 'unretweet'
86
+ | 'bookmark'
87
+ | 'unbookmark'
86
88
  | 'follow'
87
89
  | 'unfollow'
90
+ | 'block'
91
+ | 'unblock'
92
+ | 'mute'
93
+ | 'unmute'
88
94
  | 'remove_follower'
89
95
  | 'send_dm'
90
96
  | 'delete_dm'
@@ -334,8 +340,14 @@ export interface JoinDeleteAllResponse {
334
340
  | 'unlike'
335
341
  | 'retweet'
336
342
  | 'unretweet'
343
+ | 'bookmark'
344
+ | 'unbookmark'
337
345
  | 'follow'
338
346
  | 'unfollow'
347
+ | 'block'
348
+ | 'unblock'
349
+ | 'mute'
350
+ | 'unmute'
339
351
  | 'remove_follower'
340
352
  | 'send_dm'
341
353
  | 'delete_dm'
@@ -103,8 +103,14 @@ export interface DmDeleteMessageResponse {
103
103
  | 'unlike'
104
104
  | 'retweet'
105
105
  | 'unretweet'
106
+ | 'bookmark'
107
+ | 'unbookmark'
106
108
  | 'follow'
107
109
  | 'unfollow'
110
+ | 'block'
111
+ | 'unblock'
112
+ | 'mute'
113
+ | 'unmute'
108
114
  | 'remove_follower'
109
115
  | 'send_dm'
110
116
  | 'delete_dm'
@@ -385,8 +391,14 @@ export interface DmSendResponse {
385
391
  | 'unlike'
386
392
  | 'retweet'
387
393
  | 'unretweet'
394
+ | 'bookmark'
395
+ | 'unbookmark'
388
396
  | 'follow'
389
397
  | 'unfollow'
398
+ | 'block'
399
+ | 'unblock'
400
+ | 'mute'
401
+ | 'unmute'
390
402
  | 'remove_follower'
391
403
  | 'send_dm'
392
404
  | 'delete_dm'
@@ -6,6 +6,15 @@ export {
6
6
  AccountConnectionAttempts,
7
7
  type AccountConnectionAttemptRetrieveResponse,
8
8
  } from './account-connection-attempts';
9
+ export {
10
+ AccountConnectionLinks,
11
+ type XAccountConnectionLink,
12
+ type AccountConnectionLinkCreateResponse,
13
+ type AccountConnectionLinkListResponse,
14
+ type AccountConnectionLinkDeleteResponse,
15
+ type AccountConnectionLinkCreateParams,
16
+ type AccountConnectionLinkListParams,
17
+ } from './account-connection-links';
9
18
  export {
10
19
  AccountConnectionChallenges,
11
20
  type AccountConnectionChallengeSubmitResponse,
@@ -182,6 +191,11 @@ export {
182
191
  type UserRemoveFollowerResponse,
183
192
  type UserRetrieveBatchResponse,
184
193
  type UserRetrieveBatchTweetsResponse,
194
+ type UserRetrieveFollowerAuditResponse,
195
+ type FollowerAudit,
196
+ type AuditedFollower,
197
+ type FollowerClass,
198
+ type FollowerValueCount,
185
199
  type UserRetrieveFollowerIDsResponse,
186
200
  type UserRetrieveFollowersResponse,
187
201
  type UserRetrieveFollowingResponse,
@@ -200,6 +214,7 @@ export {
200
214
  type UserRetrieveArticlesParams,
201
215
  type UserRetrieveBatchParams,
202
216
  type UserRetrieveBatchTweetsParams,
217
+ type UserRetrieveFollowerAuditParams,
203
218
  type UserRetrieveFollowerIDsParams,
204
219
  type UserRetrieveFollowersParams,
205
220
  type UserRetrieveFollowersYouKnowParams,
@@ -3,6 +3,7 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
 
5
5
  import { APIResource } from '../../core/resource';
6
+ import * as Shared from '../shared';
6
7
  import { APIPromise } from '../../core/api-promise';
7
8
  import { type Uploadable } from '../../core/uploads';
8
9
  import { buildHeaders } from '../../internal/headers';
@@ -55,18 +56,39 @@ export class Media extends APIResource {
55
56
  export interface MediaDownloadResponse {
56
57
  cacheHit?: boolean;
57
58
 
59
+ /**
60
+ * Posts Xquik couldn't read, at no charge. Send them again.
61
+ */
62
+ failedTweetIds?: Array<string>;
63
+
58
64
  galleryUrl?: string;
59
65
 
66
+ /**
67
+ * What the image filter asked & how many posts it kept. Present when the request
68
+ * sent imageShows.
69
+ */
70
+ imageFilter?: Shared.ImageFilterSummary;
71
+
60
72
  /**
61
73
  * The post's files saved to your gallery. Single downloads only.
62
74
  */
63
75
  items?: Array<MediaDownloadResponse.Item>;
64
76
 
77
+ /**
78
+ * Posts with no media to save, at no charge.
79
+ */
80
+ noMediaTweetIds?: Array<string>;
81
+
65
82
  totalMedia?: number;
66
83
 
67
84
  totalTweets?: number;
68
85
 
69
86
  tweetId?: string;
87
+
88
+ /**
89
+ * Posts Xquik had no time to read, at no charge. Send them again.
90
+ */
91
+ unprocessedTweetIds?: Array<string>;
70
92
  }
71
93
 
72
94
  export namespace MediaDownloadResponse {
@@ -88,6 +110,18 @@ export namespace MediaDownloadResponse {
88
110
  */
89
111
  mediaUrl: string;
90
112
 
113
+ /**
114
+ * Cover image of a video or GIF. Null for photos & files first saved to Xquik
115
+ * before 2026-11-03.
116
+ */
117
+ posterUrl: string | null;
118
+
119
+ /**
120
+ * The MP4 sizes X stores for a video, highest bitrate first. Empty for photos,
121
+ * GIFs & files first saved to Xquik before 2026-11-03.
122
+ */
123
+ qualities: Array<Item.Quality>;
124
+
91
125
  /**
92
126
  * File size in bytes, as a string.
93
127
  */
@@ -112,6 +146,21 @@ export namespace MediaDownloadResponse {
112
146
 
113
147
  views: number | null;
114
148
  }
149
+
150
+ export namespace Item {
151
+ /**
152
+ * 1 MP4 size of the video.
153
+ */
154
+ export interface Quality {
155
+ bitrate: number;
156
+
157
+ height: number;
158
+
159
+ url: string;
160
+
161
+ width: number;
162
+ }
163
+ }
115
164
  }
116
165
 
117
166
  /**
@@ -134,8 +183,14 @@ export interface MediaUploadResponse {
134
183
  | 'unlike'
135
184
  | 'retweet'
136
185
  | 'unretweet'
186
+ | 'bookmark'
187
+ | 'unbookmark'
137
188
  | 'follow'
138
189
  | 'unfollow'
190
+ | 'block'
191
+ | 'unblock'
192
+ | 'mute'
193
+ | 'unmute'
139
194
  | 'remove_follower'
140
195
  | 'send_dm'
141
196
  | 'delete_dm'
@@ -366,6 +421,15 @@ export namespace MediaUploadResponse {
366
421
  }
367
422
 
368
423
  export interface MediaDownloadParams {
424
+ /**
425
+ * Save only posts whose photos show this. Send charts, screenshots, product_photos,
426
+ * memes or people, or describe it in words, such as a rocket. AI-powered analysis
427
+ * checks posts with photos X doesn't mark sensitive & keeps scores of 0.5 or more.
428
+ * Each post saved costs 2 credits, the AI analysis price, on top of its save price,
429
+ * & a post the filter drops costs nothing. imageFilter states the cutoff & counts.
430
+ */
431
+ imageShows?: string;
432
+
369
433
  /**
370
434
  * Numeric tweet ID alias for tweetInput
371
435
  */
@@ -118,8 +118,14 @@ export interface ProfileUpdateResponse {
118
118
  | 'unlike'
119
119
  | 'retweet'
120
120
  | 'unretweet'
121
+ | 'bookmark'
122
+ | 'unbookmark'
121
123
  | 'follow'
122
124
  | 'unfollow'
125
+ | 'block'
126
+ | 'unblock'
127
+ | 'mute'
128
+ | 'unmute'
123
129
  | 'remove_follower'
124
130
  | 'send_dm'
125
131
  | 'delete_dm'
@@ -369,8 +375,14 @@ export interface ProfileUpdateAvatarResponse {
369
375
  | 'unlike'
370
376
  | 'retweet'
371
377
  | 'unretweet'
378
+ | 'bookmark'
379
+ | 'unbookmark'
372
380
  | 'follow'
373
381
  | 'unfollow'
382
+ | 'block'
383
+ | 'unblock'
384
+ | 'mute'
385
+ | 'unmute'
374
386
  | 'remove_follower'
375
387
  | 'send_dm'
376
388
  | 'delete_dm'
@@ -620,8 +632,14 @@ export interface ProfileUpdateBannerResponse {
620
632
  | 'unlike'
621
633
  | 'retweet'
622
634
  | 'unretweet'
635
+ | 'bookmark'
636
+ | 'unbookmark'
623
637
  | 'follow'
624
638
  | 'unfollow'
639
+ | 'block'
640
+ | 'unblock'
641
+ | 'mute'
642
+ | 'unmute'
625
643
  | 'remove_follower'
626
644
  | 'send_dm'
627
645
  | 'delete_dm'
@@ -0,0 +1,127 @@
1
+ // SPDX-FileCopyrightText: 2026 Xquik contributors
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+
5
+ import { APIResource } from '../../../core/resource';
6
+ import * as WriteActionsAPI from '../write-actions';
7
+ import { APIPromise } from '../../../core/api-promise';
8
+ import { buildHeaders } from '../../../internal/headers';
9
+ import { RequestOptions } from '../../../internal/request-options';
10
+ import { path } from '../../../internal/utils/path';
11
+
12
+ /**
13
+ * X write actions (tweets, likes, follows, DMs)
14
+ */
15
+ export class Bookmark extends APIResource {
16
+ /**
17
+ * Bookmarks a post through a connected X account. Only that account sees its
18
+ * bookmarks, and `client.x.bookmarks.list` lists them.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const bookmark = await client.x.tweets.bookmark.create('id', {
23
+ * account: '@elonmusk',
24
+ * 'Idempotency-Key': 'Idempotency-Key',
25
+ * });
26
+ * ```
27
+ */
28
+ create(
29
+ id: string,
30
+ params: BookmarkCreateParams,
31
+ options?: RequestOptions,
32
+ ): APIPromise<BookmarkCreateResponse> {
33
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
34
+ return this._client.post(path`/x/tweets/${id}/bookmark`, {
35
+ body,
36
+ ...options,
37
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
38
+ });
39
+ }
40
+
41
+ /**
42
+ * Removes a bookmark through a connected X account.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const response = await client.x.tweets.bookmark.delete('id', {
47
+ * account: '@elonmusk',
48
+ * 'Idempotency-Key': 'Idempotency-Key',
49
+ * });
50
+ * ```
51
+ */
52
+ delete(
53
+ id: string,
54
+ params: BookmarkDeleteParams,
55
+ options?: RequestOptions,
56
+ ): APIPromise<BookmarkDeleteResponse> {
57
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
58
+ return this._client.delete(path`/x/tweets/${id}/bookmark`, {
59
+ body,
60
+ ...options,
61
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
62
+ });
63
+ }
64
+ }
65
+
66
+ export type BookmarkCreateResponse = WriteActionsAPI.WriteActionRetrieveResponse;
67
+
68
+ export type BookmarkDeleteResponse = WriteActionsAPI.WriteActionRetrieveResponse;
69
+
70
+ export interface BookmarkCreateParams {
71
+ /**
72
+ * Body param: X account identifier (@username or account ID)
73
+ */
74
+ account: string;
75
+
76
+ /**
77
+ * Header param: Use one unique value per intended write. Reuse it only for an
78
+ * identical retry. A matching retry returns the first answer again, with
79
+ * idempotent: true added. It keeps the first status, body & Retry-After. It sends
80
+ * nothing to X & charges nothing. While the first request runs, a retry returns
81
+ * 202 & the action. Different input returns 409. Protection lasts at least 90
82
+ * days.
83
+ */
84
+ 'Idempotency-Key': string;
85
+
86
+ /**
87
+ * Header param: A long write answers 202 with a status link, then lands on X.
88
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
89
+ * the write is still running then, the API answers 202 with Location. Poll
90
+ * Location until `terminal` is true, and don't send the write again.
91
+ */
92
+ Prefer?: string;
93
+ }
94
+
95
+ export interface BookmarkDeleteParams {
96
+ /**
97
+ * Body param: X account identifier (@username or account ID)
98
+ */
99
+ account: string;
100
+
101
+ /**
102
+ * Header param: Use one unique value per intended write. Reuse it only for an
103
+ * identical retry. A matching retry returns the first answer again, with
104
+ * idempotent: true added. It keeps the first status, body & Retry-After. It sends
105
+ * nothing to X & charges nothing. While the first request runs, a retry returns
106
+ * 202 & the action. Different input returns 409. Protection lasts at least 90
107
+ * days.
108
+ */
109
+ 'Idempotency-Key': string;
110
+
111
+ /**
112
+ * Header param: A long write answers 202 with a status link, then lands on X.
113
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
114
+ * the write is still running then, the API answers 202 with Location. Poll
115
+ * Location until `terminal` is true, and don't send the write again.
116
+ */
117
+ Prefer?: string;
118
+ }
119
+
120
+ export declare namespace Bookmark {
121
+ export {
122
+ type BookmarkCreateResponse as BookmarkCreateResponse,
123
+ type BookmarkDeleteResponse as BookmarkDeleteResponse,
124
+ type BookmarkCreateParams as BookmarkCreateParams,
125
+ type BookmarkDeleteParams as BookmarkDeleteParams,
126
+ };
127
+ }
@@ -2,6 +2,13 @@
2
2
  //
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
 
5
+ export {
6
+ Bookmark,
7
+ type BookmarkCreateResponse,
8
+ type BookmarkDeleteResponse,
9
+ type BookmarkCreateParams,
10
+ type BookmarkDeleteParams,
11
+ } from './bookmark';
5
12
  export {
6
13
  Like,
7
14
  type LikeCreateResponse,
@@ -73,8 +73,14 @@ export interface LikeCreateResponse {
73
73
  | 'unlike'
74
74
  | 'retweet'
75
75
  | 'unretweet'
76
+ | 'bookmark'
77
+ | 'unbookmark'
76
78
  | 'follow'
77
79
  | 'unfollow'
80
+ | 'block'
81
+ | 'unblock'
82
+ | 'mute'
83
+ | 'unmute'
78
84
  | 'remove_follower'
79
85
  | 'send_dm'
80
86
  | 'delete_dm'
@@ -324,8 +330,14 @@ export interface LikeDeleteResponse {
324
330
  | 'unlike'
325
331
  | 'retweet'
326
332
  | 'unretweet'
333
+ | 'bookmark'
334
+ | 'unbookmark'
327
335
  | 'follow'
328
336
  | 'unfollow'
337
+ | 'block'
338
+ | 'unblock'
339
+ | 'mute'
340
+ | 'unmute'
329
341
  | 'remove_follower'
330
342
  | 'send_dm'
331
343
  | 'delete_dm'
@@ -81,8 +81,14 @@ export interface RetweetCreateResponse {
81
81
  | 'unlike'
82
82
  | 'retweet'
83
83
  | 'unretweet'
84
+ | 'bookmark'
85
+ | 'unbookmark'
84
86
  | 'follow'
85
87
  | 'unfollow'
88
+ | 'block'
89
+ | 'unblock'
90
+ | 'mute'
91
+ | 'unmute'
86
92
  | 'remove_follower'
87
93
  | 'send_dm'
88
94
  | 'delete_dm'
@@ -332,8 +338,14 @@ export interface RetweetDeleteResponse {
332
338
  | 'unlike'
333
339
  | 'retweet'
334
340
  | 'unretweet'
341
+ | 'bookmark'
342
+ | 'unbookmark'
335
343
  | 'follow'
336
344
  | 'unfollow'
345
+ | 'block'
346
+ | 'unblock'
347
+ | 'mute'
348
+ | 'unmute'
337
349
  | 'remove_follower'
338
350
  | 'send_dm'
339
351
  | 'delete_dm'
@@ -4,6 +4,14 @@
4
4
 
5
5
  import { APIResource } from '../../../core/resource';
6
6
  import * as Shared from '../../shared';
7
+ import * as BookmarkAPI from './bookmark';
8
+ import {
9
+ Bookmark,
10
+ BookmarkCreateParams,
11
+ BookmarkCreateResponse,
12
+ BookmarkDeleteParams,
13
+ BookmarkDeleteResponse,
14
+ } from './bookmark';
7
15
  import * as LikeAPI from './like';
8
16
  import { Like, LikeCreateParams, LikeCreateResponse, LikeDeleteParams, LikeDeleteResponse } from './like';
9
17
  import * as RetweetAPI from './retweet';
@@ -20,6 +28,7 @@ import { RequestOptions } from '../../../internal/request-options';
20
28
  import { path } from '../../../internal/utils/path';
21
29
 
22
30
  export class Tweets extends APIResource {
31
+ bookmark: BookmarkAPI.Bookmark = new BookmarkAPI.Bookmark(this._client);
23
32
  like: LikeAPI.Like = new LikeAPI.Like(this._client);
24
33
  retweet: RetweetAPI.Retweet = new RetweetAPI.Retweet(this._client);
25
34
 
@@ -1845,8 +1854,14 @@ export interface TweetCreateResponse {
1845
1854
  | 'unlike'
1846
1855
  | 'retweet'
1847
1856
  | 'unretweet'
1857
+ | 'bookmark'
1858
+ | 'unbookmark'
1848
1859
  | 'follow'
1849
1860
  | 'unfollow'
1861
+ | 'block'
1862
+ | 'unblock'
1863
+ | 'mute'
1864
+ | 'unmute'
1850
1865
  | 'remove_follower'
1851
1866
  | 'send_dm'
1852
1867
  | 'delete_dm'
@@ -2132,8 +2147,14 @@ export interface TweetDeleteResponse {
2132
2147
  | 'unlike'
2133
2148
  | 'retweet'
2134
2149
  | 'unretweet'
2150
+ | 'bookmark'
2151
+ | 'unbookmark'
2135
2152
  | 'follow'
2136
2153
  | 'unfollow'
2154
+ | 'block'
2155
+ | 'unblock'
2156
+ | 'mute'
2157
+ | 'unmute'
2137
2158
  | 'remove_follower'
2138
2159
  | 'send_dm'
2139
2160
  | 'delete_dm'
@@ -2830,6 +2851,7 @@ export namespace TweetGetRepliesResponse {
2830
2851
  | 'page_cap'
2831
2852
  | 'partial_view'
2832
2853
  | 'repeated_cursor'
2854
+ | 'reported_held'
2833
2855
  | 'window_covered'
2834
2856
  | 'window_passed';
2835
2857
 
@@ -2992,7 +3014,8 @@ export namespace TweetResolveLinksResponse {
2992
3014
  * Tweet & reply coverage keeps shape, filters, aliases & billing. Unprefixed
2993
3015
  * cursors are legacy.
2994
3016
  */
2995
- export type TweetSearchResponse = Shared.PaginatedTweets | TweetSearchResponse.TweetSearchCoverageResponse;
3017
+ export type TweetSearchResponse =
3018
+ Shared.FilterablePaginatedTweets | TweetSearchResponse.TweetSearchCoverageResponse;
2996
3019
 
2997
3020
  export namespace TweetSearchResponse {
2998
3021
  /**
@@ -3461,6 +3484,13 @@ export interface TweetCreateParams {
3461
3484
  */
3462
3485
  media?: Array<string>;
3463
3486
 
3487
+ /**
3488
+ * Body param: Media IDs from `client.x.media.upload`, uploaded with this account.
3489
+ * IDs last 24 hours. Send up to 4 image IDs or exactly 1 video ID. Send `media` or
3490
+ * `media_ids`, not both. Media adds 2 credits per started MB across all files.
3491
+ */
3492
+ media_ids?: Array<string>;
3493
+
3464
3494
  /**
3465
3495
  * Body param: The post to reply to. Any X post ID works, from 1 to 19 digits.
3466
3496
  */
@@ -5085,16 +5115,17 @@ export interface TweetResolveLinksParams {
5085
5115
 
5086
5116
  export interface TweetSearchParams {
5087
5117
  /**
5088
- * Query, Tweet ID, or URL. Alias query. Hyphens negate terms. Use exactPhrase for
5089
- * literals. Valid bounds apply per page. `since:` & `until:` dates are UTC days,
5090
- * written YYYY-MM-DD. 25/12/2026 & 12/25/2026 also work, since each has 1 reading.
5091
- * 04/01/2026 has 2 & answers 424 with the form to write. `since_time:` &
5092
- * `until_time:` take Unix seconds or an ISO 8601 time. `list:` takes a public
5093
- * List's ID. A private List answers 404 list_not_found. X searches up to 512
5094
- * characters. A longer query answers 424 before any read, unless a term of its
5095
- * first OR group fits alone.
5118
+ * Query, Tweet ID, or URL. Alias query. Optional when fromUser, keywords or another
5119
+ * field forms the search. Without either, it answers 400 missing_query. Hyphens
5120
+ * negate terms. Use exactPhrase for literals. Valid bounds apply per page. `since:`
5121
+ * & `until:` dates are UTC days, written YYYY-MM-DD. 25/12/2026 & 12/25/2026 also
5122
+ * work, since each has 1 reading. 04/01/2026 has 2 & answers 424 with the form to
5123
+ * write. `since_time:` & `until_time:` take Unix seconds or an ISO 8601 time.
5124
+ * `list:` takes a public List's ID. A private List answers 404 list_not_found. X
5125
+ * searches up to 512 characters. A longer query answers 424 before any read, unless
5126
+ * a term of its first OR group fits alone.
5096
5127
  */
5097
- q: string;
5128
+ q?: string;
5098
5129
 
5099
5130
  /**
5100
5131
  * Raw advanced search query appended as-is.
@@ -5182,6 +5213,16 @@ export interface TweetSearchParams {
5182
5213
  */
5183
5214
  hashtags?: string;
5184
5215
 
5216
+ /**
5217
+ * Keep only posts whose photos show this. Send charts, screenshots, product_photos,
5218
+ * memes or people, or describe it in words, such as a rocket. AI-powered analysis
5219
+ * checks posts with photos X doesn't mark sensitive & keeps scores of 0.5 or more.
5220
+ * Other posts stay out at no charge. Each kept post costs 2 credits, the AI analysis
5221
+ * price, instead of the read price, & a post the filter drops costs nothing.
5222
+ * imageFilter states the cutoff & counts.
5223
+ */
5224
+ imageShows?: string;
5225
+
5185
5226
  /**
5186
5227
  * Only replies to this tweet ID.
5187
5228
  */
@@ -5394,6 +5435,15 @@ export interface TweetSearchParams {
5394
5435
  */
5395
5436
  textOnlyTerms?: string;
5396
5437
 
5438
+ /**
5439
+ * Keep only posts about this topic. AI-powered analysis asks "Is this post about
5440
+ * <topic>?" of each post & keeps scores of 0.5 or more. It reads post text & safe
5441
+ * photos. Each kept post costs 2 credits, the AI analysis price, instead of the read
5442
+ * price, & a post the filter drops costs nothing. limit counts checked posts, & only
5443
+ * kept posts come back. topicFilter states the cutoff & counts.
5444
+ */
5445
+ topic?: string;
5446
+
5397
5447
  /**
5398
5448
  * Filter replies sent to a username.
5399
5449
  */
@@ -5458,6 +5508,7 @@ export interface TweetTranslateParams {
5458
5508
  omit?: string;
5459
5509
  }
5460
5510
 
5511
+ Tweets.Bookmark = Bookmark;
5461
5512
  Tweets.Like = Like;
5462
5513
  Tweets.Retweet = Retweet;
5463
5514
 
@@ -5499,6 +5550,14 @@ export declare namespace Tweets {
5499
5550
  type TweetTranslateParams as TweetTranslateParams,
5500
5551
  };
5501
5552
 
5553
+ export {
5554
+ Bookmark as Bookmark,
5555
+ type BookmarkCreateResponse as BookmarkCreateResponse,
5556
+ type BookmarkDeleteResponse as BookmarkDeleteResponse,
5557
+ type BookmarkCreateParams as BookmarkCreateParams,
5558
+ type BookmarkDeleteParams as BookmarkDeleteParams,
5559
+ };
5560
+
5502
5561
  export {
5503
5562
  Like as Like,
5504
5563
  type LikeCreateResponse as LikeCreateResponse,