x-twitter-scraper 0.19.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 (257) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +120 -120
  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/activity.d.mts +18 -2
  11. package/resources/activity.d.mts.map +1 -1
  12. package/resources/activity.d.ts +18 -2
  13. package/resources/activity.d.ts.map +1 -1
  14. package/resources/credits.d.mts +5 -0
  15. package/resources/credits.d.mts.map +1 -1
  16. package/resources/credits.d.ts +5 -0
  17. package/resources/credits.d.ts.map +1 -1
  18. package/resources/extractions.d.mts +153 -5
  19. package/resources/extractions.d.mts.map +1 -1
  20. package/resources/extractions.d.ts +153 -5
  21. package/resources/extractions.d.ts.map +1 -1
  22. package/resources/index.d.mts +1 -1
  23. package/resources/index.d.mts.map +1 -1
  24. package/resources/index.d.ts +1 -1
  25. package/resources/index.d.ts.map +1 -1
  26. package/resources/index.js.map +1 -1
  27. package/resources/index.mjs.map +1 -1
  28. package/resources/monitors/index.d.mts +1 -1
  29. package/resources/monitors/index.d.mts.map +1 -1
  30. package/resources/monitors/index.d.ts +1 -1
  31. package/resources/monitors/index.d.ts.map +1 -1
  32. package/resources/monitors/index.js.map +1 -1
  33. package/resources/monitors/index.mjs.map +1 -1
  34. package/resources/monitors/monitors.d.mts +38 -1
  35. package/resources/monitors/monitors.d.mts.map +1 -1
  36. package/resources/monitors/monitors.d.ts +38 -1
  37. package/resources/monitors/monitors.d.ts.map +1 -1
  38. package/resources/monitors/monitors.js +18 -0
  39. package/resources/monitors/monitors.js.map +1 -1
  40. package/resources/monitors/monitors.mjs +18 -0
  41. package/resources/monitors/monitors.mjs.map +1 -1
  42. package/resources/monitors/posts.d.mts +27 -0
  43. package/resources/monitors/posts.d.mts.map +1 -1
  44. package/resources/monitors/posts.d.ts +27 -0
  45. package/resources/monitors/posts.d.ts.map +1 -1
  46. package/resources/radar.d.mts +9 -0
  47. package/resources/radar.d.mts.map +1 -1
  48. package/resources/radar.d.ts +9 -0
  49. package/resources/radar.d.ts.map +1 -1
  50. package/resources/shared.d.mts +175 -5
  51. package/resources/shared.d.mts.map +1 -1
  52. package/resources/shared.d.ts +175 -5
  53. package/resources/shared.d.ts.map +1 -1
  54. package/resources/x/account-connection-attempts.d.mts +4 -0
  55. package/resources/x/account-connection-attempts.d.mts.map +1 -1
  56. package/resources/x/account-connection-attempts.d.ts +4 -0
  57. package/resources/x/account-connection-attempts.d.ts.map +1 -1
  58. package/resources/x/account-connection-links.d.mts +159 -0
  59. package/resources/x/account-connection-links.d.mts.map +1 -0
  60. package/resources/x/account-connection-links.d.ts +159 -0
  61. package/resources/x/account-connection-links.d.ts.map +1 -0
  62. package/resources/x/account-connection-links.js +82 -0
  63. package/resources/x/account-connection-links.js.map +1 -0
  64. package/resources/x/account-connection-links.mjs +78 -0
  65. package/resources/x/account-connection-links.mjs.map +1 -0
  66. package/resources/x/accounts.d.mts +13 -9
  67. package/resources/x/accounts.d.mts.map +1 -1
  68. package/resources/x/accounts.d.ts +13 -9
  69. package/resources/x/accounts.d.ts.map +1 -1
  70. package/resources/x/analysis.d.mts +540 -36
  71. package/resources/x/analysis.d.mts.map +1 -1
  72. package/resources/x/analysis.d.ts +540 -36
  73. package/resources/x/analysis.d.ts.map +1 -1
  74. package/resources/x/bookmarks.d.mts +5 -0
  75. package/resources/x/bookmarks.d.mts.map +1 -1
  76. package/resources/x/bookmarks.d.ts +5 -0
  77. package/resources/x/bookmarks.d.ts.map +1 -1
  78. package/resources/x/communities/communities.d.mts +19 -2
  79. package/resources/x/communities/communities.d.mts.map +1 -1
  80. package/resources/x/communities/communities.d.ts +19 -2
  81. package/resources/x/communities/communities.d.ts.map +1 -1
  82. package/resources/x/communities/communities.js +7 -4
  83. package/resources/x/communities/communities.js.map +1 -1
  84. package/resources/x/communities/communities.mjs +7 -4
  85. package/resources/x/communities/communities.mjs.map +1 -1
  86. package/resources/x/communities/join.d.mts +16 -2
  87. package/resources/x/communities/join.d.mts.map +1 -1
  88. package/resources/x/communities/join.d.ts +16 -2
  89. package/resources/x/communities/join.d.ts.map +1 -1
  90. package/resources/x/communities/join.js +4 -4
  91. package/resources/x/communities/join.js.map +1 -1
  92. package/resources/x/communities/join.mjs +4 -4
  93. package/resources/x/communities/join.mjs.map +1 -1
  94. package/resources/x/dm.d.mts +16 -2
  95. package/resources/x/dm.d.mts.map +1 -1
  96. package/resources/x/dm.d.ts +16 -2
  97. package/resources/x/dm.d.ts.map +1 -1
  98. package/resources/x/dm.js +4 -4
  99. package/resources/x/dm.js.map +1 -1
  100. package/resources/x/dm.mjs +4 -4
  101. package/resources/x/dm.mjs.map +1 -1
  102. package/resources/x/index.d.mts +2 -1
  103. package/resources/x/index.d.mts.map +1 -1
  104. package/resources/x/index.d.ts +2 -1
  105. package/resources/x/index.d.ts.map +1 -1
  106. package/resources/x/index.js +3 -1
  107. package/resources/x/index.js.map +1 -1
  108. package/resources/x/index.mjs +1 -0
  109. package/resources/x/index.mjs.map +1 -1
  110. package/resources/x/media.d.mts +55 -1
  111. package/resources/x/media.d.mts.map +1 -1
  112. package/resources/x/media.d.ts +55 -1
  113. package/resources/x/media.d.ts.map +1 -1
  114. package/resources/x/media.js +2 -2
  115. package/resources/x/media.js.map +1 -1
  116. package/resources/x/media.mjs +2 -2
  117. package/resources/x/media.mjs.map +1 -1
  118. package/resources/x/profile.d.mts +24 -3
  119. package/resources/x/profile.d.mts.map +1 -1
  120. package/resources/x/profile.d.ts +24 -3
  121. package/resources/x/profile.d.ts.map +1 -1
  122. package/resources/x/profile.js +6 -6
  123. package/resources/x/profile.js.map +1 -1
  124. package/resources/x/profile.mjs +6 -6
  125. package/resources/x/profile.mjs.map +1 -1
  126. package/resources/x/tweets/bookmark.d.mts +84 -0
  127. package/resources/x/tweets/bookmark.d.mts.map +1 -0
  128. package/resources/x/tweets/bookmark.d.ts +84 -0
  129. package/resources/x/tweets/bookmark.d.ts.map +1 -0
  130. package/resources/x/tweets/bookmark.js +55 -0
  131. package/resources/x/tweets/bookmark.js.map +1 -0
  132. package/resources/x/tweets/bookmark.mjs +51 -0
  133. package/resources/x/tweets/bookmark.mjs.map +1 -0
  134. package/resources/x/tweets/index.d.mts +1 -0
  135. package/resources/x/tweets/index.d.mts.map +1 -1
  136. package/resources/x/tweets/index.d.ts +1 -0
  137. package/resources/x/tweets/index.d.ts.map +1 -1
  138. package/resources/x/tweets/index.js +3 -1
  139. package/resources/x/tweets/index.js.map +1 -1
  140. package/resources/x/tweets/index.mjs +1 -0
  141. package/resources/x/tweets/index.mjs.map +1 -1
  142. package/resources/x/tweets/like.d.mts +16 -2
  143. package/resources/x/tweets/like.d.mts.map +1 -1
  144. package/resources/x/tweets/like.d.ts +16 -2
  145. package/resources/x/tweets/like.d.ts.map +1 -1
  146. package/resources/x/tweets/like.js +4 -4
  147. package/resources/x/tweets/like.js.map +1 -1
  148. package/resources/x/tweets/like.mjs +4 -4
  149. package/resources/x/tweets/like.mjs.map +1 -1
  150. package/resources/x/tweets/retweet.d.mts +16 -2
  151. package/resources/x/tweets/retweet.d.mts.map +1 -1
  152. package/resources/x/tweets/retweet.d.ts +16 -2
  153. package/resources/x/tweets/retweet.d.ts.map +1 -1
  154. package/resources/x/tweets/retweet.js +4 -4
  155. package/resources/x/tweets/retweet.js.map +1 -1
  156. package/resources/x/tweets/retweet.mjs +4 -4
  157. package/resources/x/tweets/retweet.mjs.map +1 -1
  158. package/resources/x/tweets/tweets.d.mts +68 -13
  159. package/resources/x/tweets/tweets.d.mts.map +1 -1
  160. package/resources/x/tweets/tweets.d.ts +68 -13
  161. package/resources/x/tweets/tweets.d.ts.map +1 -1
  162. package/resources/x/tweets/tweets.js +8 -4
  163. package/resources/x/tweets/tweets.js.map +1 -1
  164. package/resources/x/tweets/tweets.mjs +8 -4
  165. package/resources/x/tweets/tweets.mjs.map +1 -1
  166. package/resources/x/users/block.d.mts +84 -0
  167. package/resources/x/users/block.d.mts.map +1 -0
  168. package/resources/x/users/block.d.ts +84 -0
  169. package/resources/x/users/block.d.ts.map +1 -0
  170. package/resources/x/users/block.js +55 -0
  171. package/resources/x/users/block.js.map +1 -0
  172. package/resources/x/users/block.mjs +51 -0
  173. package/resources/x/users/block.mjs.map +1 -0
  174. package/resources/x/users/follow.d.mts +16 -2
  175. package/resources/x/users/follow.d.mts.map +1 -1
  176. package/resources/x/users/follow.d.ts +16 -2
  177. package/resources/x/users/follow.d.ts.map +1 -1
  178. package/resources/x/users/follow.js +4 -4
  179. package/resources/x/users/follow.js.map +1 -1
  180. package/resources/x/users/follow.mjs +4 -4
  181. package/resources/x/users/follow.mjs.map +1 -1
  182. package/resources/x/users/index.d.mts +3 -1
  183. package/resources/x/users/index.d.mts.map +1 -1
  184. package/resources/x/users/index.d.ts +3 -1
  185. package/resources/x/users/index.d.ts.map +1 -1
  186. package/resources/x/users/index.js +5 -1
  187. package/resources/x/users/index.js.map +1 -1
  188. package/resources/x/users/index.mjs +2 -0
  189. package/resources/x/users/index.mjs.map +1 -1
  190. package/resources/x/users/mute.d.mts +84 -0
  191. package/resources/x/users/mute.d.mts.map +1 -0
  192. package/resources/x/users/mute.d.ts +84 -0
  193. package/resources/x/users/mute.d.ts.map +1 -0
  194. package/resources/x/users/mute.js +55 -0
  195. package/resources/x/users/mute.js.map +1 -0
  196. package/resources/x/users/mute.mjs +51 -0
  197. package/resources/x/users/mute.mjs.map +1 -0
  198. package/resources/x/users/users.d.mts +783 -9
  199. package/resources/x/users/users.d.mts.map +1 -1
  200. package/resources/x/users/users.d.ts +783 -9
  201. package/resources/x/users/users.d.ts.map +1 -1
  202. package/resources/x/users/users.js +44 -3
  203. package/resources/x/users/users.js.map +1 -1
  204. package/resources/x/users/users.mjs +44 -3
  205. package/resources/x/users/users.mjs.map +1 -1
  206. package/resources/x/write-actions.d.mts +1 -1
  207. package/resources/x/write-actions.d.mts.map +1 -1
  208. package/resources/x/write-actions.d.ts +1 -1
  209. package/resources/x/write-actions.d.ts.map +1 -1
  210. package/resources/x/x.d.mts +15 -2
  211. package/resources/x/x.d.mts.map +1 -1
  212. package/resources/x/x.d.ts +15 -2
  213. package/resources/x/x.d.ts.map +1 -1
  214. package/resources/x/x.js +4 -0
  215. package/resources/x/x.js.map +1 -1
  216. package/resources/x/x.mjs +4 -0
  217. package/resources/x/x.mjs.map +1 -1
  218. package/src/client.ts +9 -0
  219. package/src/core/README.md +4 -0
  220. package/src/internal/README.md +6 -1
  221. package/src/resources/activity.ts +41 -2
  222. package/src/resources/credits.ts +6 -0
  223. package/src/resources/extractions.ts +183 -0
  224. package/src/resources/index.ts +2 -0
  225. package/src/resources/monitors/index.ts +2 -0
  226. package/src/resources/monitors/monitors.ts +49 -0
  227. package/src/resources/monitors/posts.ts +32 -0
  228. package/src/resources/radar.ts +10 -0
  229. package/src/resources/shared.ts +213 -4
  230. package/src/resources/x/account-connection-attempts.ts +5 -0
  231. package/src/resources/x/account-connection-links.ts +215 -0
  232. package/src/resources/x/accounts.ts +15 -14
  233. package/src/resources/x/analysis.ts +618 -36
  234. package/src/resources/x/bookmarks.ts +6 -0
  235. package/src/resources/x/communities/communities.ts +35 -4
  236. package/src/resources/x/communities/join.ts +32 -4
  237. package/src/resources/x/dm.ts +32 -4
  238. package/src/resources/x/index.ts +18 -0
  239. package/src/resources/x/media.ts +74 -2
  240. package/src/resources/x/profile.ts +48 -6
  241. package/src/resources/x/tweets/bookmark.ts +127 -0
  242. package/src/resources/x/tweets/index.ts +7 -0
  243. package/src/resources/x/tweets/like.ts +32 -4
  244. package/src/resources/x/tweets/retweet.ts +32 -4
  245. package/src/resources/x/tweets/tweets.ts +104 -14
  246. package/src/resources/x/users/block.ts +119 -0
  247. package/src/resources/x/users/follow.ts +32 -4
  248. package/src/resources/x/users/index.ts +23 -0
  249. package/src/resources/x/users/mute.ts +119 -0
  250. package/src/resources/x/users/users.ts +1063 -89
  251. package/src/resources/x/write-actions.ts +6 -0
  252. package/src/resources/x/x.ts +54 -0
  253. package/src/version.ts +1 -1
  254. package/version.d.mts +1 -1
  255. package/version.d.ts +1 -1
  256. package/version.js +1 -1
  257. package/version.mjs +1 -1
@@ -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,
@@ -24,11 +24,11 @@ export class Like extends APIResource {
24
24
  * ```
25
25
  */
26
26
  create(id: string, params: LikeCreateParams, options?: RequestOptions): APIPromise<LikeCreateResponse> {
27
- const { 'Idempotency-Key': idempotencyKey, ...body } = params;
27
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
28
28
  return this._client.post(path`/x/tweets/${id}/like`, {
29
29
  body,
30
30
  ...options,
31
- headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
31
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
32
32
  });
33
33
  }
34
34
 
@@ -44,11 +44,11 @@ export class Like extends APIResource {
44
44
  * ```
45
45
  */
46
46
  delete(id: string, params: LikeDeleteParams, options?: RequestOptions): APIPromise<LikeDeleteResponse> {
47
- const { 'Idempotency-Key': idempotencyKey, ...body } = params;
47
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
48
48
  return this._client.delete(path`/x/tweets/${id}/like`, {
49
49
  body,
50
50
  ...options,
51
- headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
51
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
52
52
  });
53
53
  }
54
54
  }
@@ -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'
@@ -570,6 +582,14 @@ export interface LikeCreateParams {
570
582
  * days.
571
583
  */
572
584
  'Idempotency-Key': string;
585
+
586
+ /**
587
+ * Header param: A long write answers 202 with a status link, then lands on X.
588
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
589
+ * the write is still running then, the API answers 202 with Location. Poll
590
+ * Location until `terminal` is true, and don't send the write again.
591
+ */
592
+ Prefer?: string;
573
593
  }
574
594
 
575
595
  export interface LikeDeleteParams {
@@ -587,6 +607,14 @@ export interface LikeDeleteParams {
587
607
  * days.
588
608
  */
589
609
  'Idempotency-Key': string;
610
+
611
+ /**
612
+ * Header param: A long write answers 202 with a status link, then lands on X.
613
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
614
+ * the write is still running then, the API answers 202 with Location. Poll
615
+ * Location until `terminal` is true, and don't send the write again.
616
+ */
617
+ Prefer?: string;
590
618
  }
591
619
 
592
620
  export declare namespace Like {
@@ -28,11 +28,11 @@ export class Retweet extends APIResource {
28
28
  params: RetweetCreateParams,
29
29
  options?: RequestOptions,
30
30
  ): APIPromise<RetweetCreateResponse> {
31
- const { 'Idempotency-Key': idempotencyKey, ...body } = params;
31
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
32
32
  return this._client.post(path`/x/tweets/${id}/retweet`, {
33
33
  body,
34
34
  ...options,
35
- headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
35
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
36
36
  });
37
37
  }
38
38
 
@@ -52,11 +52,11 @@ export class Retweet extends APIResource {
52
52
  params: RetweetDeleteParams,
53
53
  options?: RequestOptions,
54
54
  ): APIPromise<RetweetDeleteResponse> {
55
- const { 'Idempotency-Key': idempotencyKey, ...body } = params;
55
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
56
56
  return this._client.delete(path`/x/tweets/${id}/retweet`, {
57
57
  body,
58
58
  ...options,
59
- headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
59
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
60
60
  });
61
61
  }
62
62
  }
@@ -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'
@@ -578,6 +590,14 @@ export interface RetweetCreateParams {
578
590
  * days.
579
591
  */
580
592
  'Idempotency-Key': string;
593
+
594
+ /**
595
+ * Header param: A long write answers 202 with a status link, then lands on X.
596
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
597
+ * the write is still running then, the API answers 202 with Location. Poll
598
+ * Location until `terminal` is true, and don't send the write again.
599
+ */
600
+ Prefer?: string;
581
601
  }
582
602
 
583
603
  export interface RetweetDeleteParams {
@@ -595,6 +615,14 @@ export interface RetweetDeleteParams {
595
615
  * days.
596
616
  */
597
617
  'Idempotency-Key': string;
618
+
619
+ /**
620
+ * Header param: A long write answers 202 with a status link, then lands on X.
621
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
622
+ * the write is still running then, the API answers 202 with Location. Poll
623
+ * Location until `terminal` is true, and don't send the write again.
624
+ */
625
+ Prefer?: string;
598
626
  }
599
627
 
600
628
  export declare namespace Retweet {
@@ -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
 
@@ -37,11 +46,11 @@ export class Tweets extends APIResource {
37
46
  * ```
38
47
  */
39
48
  create(params: TweetCreateParams, options?: RequestOptions): APIPromise<TweetCreateResponse> {
40
- const { 'Idempotency-Key': idempotencyKey, ...body } = params;
49
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
41
50
  return this._client.post('/x/tweets', {
42
51
  body,
43
52
  ...options,
44
- headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
53
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
45
54
  });
46
55
  }
47
56
 
@@ -85,11 +94,11 @@ export class Tweets extends APIResource {
85
94
  * ```
86
95
  */
87
96
  delete(id: string, params: TweetDeleteParams, options?: RequestOptions): APIPromise<TweetDeleteResponse> {
88
- const { 'Idempotency-Key': idempotencyKey, ...body } = params;
97
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
89
98
  return this._client.delete(path`/x/tweets/${id}`, {
90
99
  body,
91
100
  ...options,
92
- headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey }, options?.headers]),
101
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
93
102
  });
94
103
  }
95
104
 
@@ -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'
@@ -2606,6 +2627,14 @@ export interface TweetGetRepliesResponse extends Omit<Shared.PaginatedTweets, 't
2606
2627
  * the same replies.
2607
2628
  */
2608
2629
  partialBefore?: string;
2630
+
2631
+ /**
2632
+ * Present on automatic pages without filters while X counts replies the read
2633
+ * hasn't reached. If a reply that belongs in your rows is missing, it's among
2634
+ * them. The count drops as you read more pages. On the last page, it counts the
2635
+ * replies the read can't reach.
2636
+ */
2637
+ unreachedReplies?: number;
2609
2638
  }
2610
2639
 
2611
2640
  export namespace TweetGetRepliesResponse {
@@ -2822,6 +2851,7 @@ export namespace TweetGetRepliesResponse {
2822
2851
  | 'page_cap'
2823
2852
  | 'partial_view'
2824
2853
  | 'repeated_cursor'
2854
+ | 'reported_held'
2825
2855
  | 'window_covered'
2826
2856
  | 'window_passed';
2827
2857
 
@@ -2984,7 +3014,8 @@ export namespace TweetResolveLinksResponse {
2984
3014
  * Tweet & reply coverage keeps shape, filters, aliases & billing. Unprefixed
2985
3015
  * cursors are legacy.
2986
3016
  */
2987
- export type TweetSearchResponse = Shared.PaginatedTweets | TweetSearchResponse.TweetSearchCoverageResponse;
3017
+ export type TweetSearchResponse =
3018
+ Shared.FilterablePaginatedTweets | TweetSearchResponse.TweetSearchCoverageResponse;
2988
3019
 
2989
3020
  export namespace TweetSearchResponse {
2990
3021
  /**
@@ -3426,6 +3457,14 @@ export interface TweetCreateParams {
3426
3457
  */
3427
3458
  'Idempotency-Key': string;
3428
3459
 
3460
+ /**
3461
+ * Header param: A long write answers 202 with a status link, then lands on X.
3462
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
3463
+ * the write is still running then, the API answers 202 with Location. Poll
3464
+ * Location until `terminal` is true, and don't send the write again.
3465
+ */
3466
+ Prefer?: string;
3467
+
3429
3468
  /**
3430
3469
  * Body param: The Community to post into, from 1 to 19 digits. The account must be
3431
3470
  * a member. Xquik picks the Community in X's composer, checks the post request
@@ -3445,6 +3484,13 @@ export interface TweetCreateParams {
3445
3484
  */
3446
3485
  media?: Array<string>;
3447
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
+
3448
3494
  /**
3449
3495
  * Body param: The post to reply to. Any X post ID works, from 1 to 19 digits.
3450
3496
  */
@@ -3515,6 +3561,14 @@ export interface TweetDeleteParams {
3515
3561
  * days.
3516
3562
  */
3517
3563
  'Idempotency-Key': string;
3564
+
3565
+ /**
3566
+ * Header param: A long write answers 202 with a status link, then lands on X.
3567
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
3568
+ * the write is still running then, the API answers 202 with Location. Poll
3569
+ * Location until `terminal` is true, and don't send the write again.
3570
+ */
3571
+ Prefer?: string;
3518
3572
  }
3519
3573
 
3520
3574
  export interface TweetCheckRepostParams {
@@ -5061,16 +5115,17 @@ export interface TweetResolveLinksParams {
5061
5115
 
5062
5116
  export interface TweetSearchParams {
5063
5117
  /**
5064
- * Query, Tweet ID, or URL. Alias query. Hyphens negate terms. Use exactPhrase for
5065
- * literals. Valid bounds apply per page. `since:` & `until:` dates are UTC days,
5066
- * written YYYY-MM-DD. 25/12/2026 & 12/25/2026 also work, since each has 1 reading.
5067
- * 04/01/2026 has 2 & answers 424 with the form to write. `since_time:` &
5068
- * `until_time:` take Unix seconds or an ISO 8601 time. `list:` takes a public
5069
- * List's ID. A private List answers 404 list_not_found. X searches up to 512
5070
- * characters. A longer query answers 424 before any read, unless a term of its
5071
- * 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.
5072
5127
  */
5073
- q: string;
5128
+ q?: string;
5074
5129
 
5075
5130
  /**
5076
5131
  * Raw advanced search query appended as-is.
@@ -5158,6 +5213,16 @@ export interface TweetSearchParams {
5158
5213
  */
5159
5214
  hashtags?: string;
5160
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
+
5161
5226
  /**
5162
5227
  * Only replies to this tweet ID.
5163
5228
  */
@@ -5363,6 +5428,22 @@ export interface TweetSearchParams {
5363
5428
  */
5364
5429
  source?: string;
5365
5430
 
5431
+ /**
5432
+ * Keeps a post only when at least 1 of these words or quoted phrases appears
5433
+ * outside the author's name and username, such as in its text, a link, its card
5434
+ * or a quoted post.
5435
+ */
5436
+ textOnlyTerms?: string;
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
+
5366
5447
  /**
5367
5448
  * Filter replies sent to a username.
5368
5449
  */
@@ -5427,6 +5508,7 @@ export interface TweetTranslateParams {
5427
5508
  omit?: string;
5428
5509
  }
5429
5510
 
5511
+ Tweets.Bookmark = Bookmark;
5430
5512
  Tweets.Like = Like;
5431
5513
  Tweets.Retweet = Retweet;
5432
5514
 
@@ -5468,6 +5550,14 @@ export declare namespace Tweets {
5468
5550
  type TweetTranslateParams as TweetTranslateParams,
5469
5551
  };
5470
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
+
5471
5561
  export {
5472
5562
  Like as Like,
5473
5563
  type LikeCreateResponse as LikeCreateResponse,
@@ -0,0 +1,119 @@
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 Block extends APIResource {
16
+ /**
17
+ * Blocks a user through a connected X account. X removes follows both ways, and
18
+ * unblocking doesn't restore them.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const block = await client.x.users.block.create('id', {
23
+ * account: '@elonmusk',
24
+ * 'Idempotency-Key': 'Idempotency-Key',
25
+ * });
26
+ * ```
27
+ */
28
+ create(id: string, params: BlockCreateParams, options?: RequestOptions): APIPromise<BlockCreateResponse> {
29
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
30
+ return this._client.post(path`/x/users/${id}/block`, {
31
+ body,
32
+ ...options,
33
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
34
+ });
35
+ }
36
+
37
+ /**
38
+ * Unblocks a user through a connected X account.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const response = await client.x.users.block.delete('id', {
43
+ * account: '@elonmusk',
44
+ * 'Idempotency-Key': 'Idempotency-Key',
45
+ * });
46
+ * ```
47
+ */
48
+ delete(id: string, params: BlockDeleteParams, options?: RequestOptions): APIPromise<BlockDeleteResponse> {
49
+ const { 'Idempotency-Key': idempotencyKey, Prefer: prefer, ...body } = params;
50
+ return this._client.delete(path`/x/users/${id}/block`, {
51
+ body,
52
+ ...options,
53
+ headers: buildHeaders([{ 'Idempotency-Key': idempotencyKey, Prefer: prefer }, options?.headers]),
54
+ });
55
+ }
56
+ }
57
+
58
+ export type BlockCreateResponse = WriteActionsAPI.WriteActionRetrieveResponse;
59
+
60
+ export type BlockDeleteResponse = WriteActionsAPI.WriteActionRetrieveResponse;
61
+
62
+ export interface BlockCreateParams {
63
+ /**
64
+ * Body param: X account identifier (@username or account ID)
65
+ */
66
+ account: string;
67
+
68
+ /**
69
+ * Header param: Use one unique value per intended write. Reuse it only for an
70
+ * identical retry. A matching retry returns the first answer again, with
71
+ * idempotent: true added. It keeps the first status, body & Retry-After. It sends
72
+ * nothing to X & charges nothing. While the first request runs, a retry returns
73
+ * 202 & the action. Different input returns 409. Protection lasts at least 90
74
+ * days.
75
+ */
76
+ 'Idempotency-Key': string;
77
+
78
+ /**
79
+ * Header param: A long write answers 202 with a status link, then lands on X.
80
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
81
+ * the write is still running then, the API answers 202 with Location. Poll
82
+ * Location until `terminal` is true, and don't send the write again.
83
+ */
84
+ Prefer?: string;
85
+ }
86
+
87
+ export interface BlockDeleteParams {
88
+ /**
89
+ * Body param: X account identifier (@username or account ID)
90
+ */
91
+ account: string;
92
+
93
+ /**
94
+ * Header param: Use one unique value per intended write. Reuse it only for an
95
+ * identical retry. A matching retry returns the first answer again, with
96
+ * idempotent: true added. It keeps the first status, body & Retry-After. It sends
97
+ * nothing to X & charges nothing. While the first request runs, a retry returns
98
+ * 202 & the action. Different input returns 409. Protection lasts at least 90
99
+ * days.
100
+ */
101
+ 'Idempotency-Key': string;
102
+
103
+ /**
104
+ * Header param: A long write answers 202 with a status link, then lands on X.
105
+ * `wait=<seconds>` asks for the answer within that many seconds, up to 85. If
106
+ * the write is still running then, the API answers 202 with Location. Poll
107
+ * Location until `terminal` is true, and don't send the write again.
108
+ */
109
+ Prefer?: string;
110
+ }
111
+
112
+ export declare namespace Block {
113
+ export {
114
+ type BlockCreateResponse as BlockCreateResponse,
115
+ type BlockDeleteResponse as BlockDeleteResponse,
116
+ type BlockCreateParams as BlockCreateParams,
117
+ type BlockDeleteParams as BlockDeleteParams,
118
+ };
119
+ }